📄 ch08_167.htm
字号:
<html><head><title>Opcode (Perl in a Nutshell, 2nd Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Stephen Spainhour" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="0596002416L" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="Perl in a Nutshell, 2nd Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Java and XSLT" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch08_166.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch08_168.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h2 class="sect1">8.167. Opcode</h2><p><a name="INDEX-1524" />Permitsdefining an <em class="emphasis">operator mask</em> (opmask) so that anycode containing a masked opcode will not compile or execute when Perlnext compiles any code. Not usually used directly; for examples ofOpcode's use, see the <tt class="literal">ops</tt> pragmaand the Safe module.</p><p>Valid opcodes are listed in the array <tt class="literal">op_name</tt> inthe file <em class="emphasis">opcode.h</em>. Many Opcode functions andmethods take lists of operators, which are composed of elements. Eachelement can be a:</p><dl><dt><i><em class="replaceable"><tt>name</em> (<em class="replaceable">opname</em>) or <em class="replaceable">negated name</tt></em></i></dt><dd>Name of operator, usually lowercase. Prefixing the name with anexclamation mark (<tt class="literal">!</tt>) removes it from theaccumulated set of operations.</p></dd><dt><i><em class="replaceable"><tt>set</em> (<em class="replaceable">opset</tt></em>)</i></dt><dd>Operator set. Binary string holding a set of zero or more operators.</p></dd><dt><i><em class="replaceable"><tt>tag name</em> (<em class="replaceable">optag</em>) or <em class="replaceable">negated tag</tt></em></i></dt><dd>Operator tag name; refers to groups (or sets) of operators. Beginswith a colon (<tt class="literal">:</tt>). Negated by prefixing with anexclamation mark (<tt class="literal">!</tt>). Several<em class="replaceable"><tt>optag</tt></em>s are predefined, including thefollowing. See the Opcode module's manpage for theopcodes included in each tag.</p><blockquote><pre class="code">:base_core :base_io :base_loop:base_math :base_mem :base_orig:browse :dangerous :default:filesys_open :filesys_read :filesys_write:others :ownprocess :still_to_be_decided:subprocess :sys_db</pre></blockquote></dd></dl><a name="perlnut2-CHP-8-SECT-167.1" /><div class="sect2"><h3 class="sect2">8.167.1. Functions</h3><p>All the following functions can be exported.</p><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>define_optag</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>define_optag (<em class="replaceable">optag</em>, <em class="replaceable">opset</em>)</pre><p>Defines <em class="replaceable">optag</em> as symbolic name for the set<em class="replaceable"><tt>opset</tt></em>.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>empty_opset</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>empty_opset</pre><p>Returns an empty opset.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>full_opset</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>full_opset</pre><p>Returns an opset that includes all operators.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>invert_opset</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>invert_opset (<em class="replaceable">opset</em>)</pre><p>Returns an opset that is the inverse of<em class="replaceable"><tt>opset</tt></em>.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opcodes</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opcodes</pre><p>In scalar context, returns the number of opcodes in this version ofPerl.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opdesc</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opdesc (<em class="replaceable">op</em>, ...)</pre><p>Takes list of operator names and returns the corresponding listdescriptions.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opdump</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opdump ([<em class="replaceable">pat</em>])</pre><p>Writes two-column list of operator names and descriptions to STDOUT.If <em class="replaceable"><tt>pat</tt></em> is specified, only lines matchingthe (case-insensitive) pattern are output.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opmask</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opmask</pre><p>Returns an opset corresponding to the current opmask.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opmask_add</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opmask_add (<em class="replaceable">opset</em>)</pre><p>Adds <em class="replaceable">opset</em> to the current opmask.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opset</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opset (<em class="replaceable">op</em>, ...)</pre><p>Returns an opset containing the listed operators.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opset_to_hex</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opset_to_hex (<em class="replaceable">opset</em>)</pre><p>Returns string representation of <em class="replaceable">opset</em>.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>opset_to_ops</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>opset_to_ops (<em class="replaceable">opset</em>)</pre><p>Returns list of operator names corresponding to the operators in theset <em class="replaceable"><tt>opset</tt></em>.</p></div><div class="refentry"><table width="515" border="0" cellpadding="5"><tr><td align="left"><font size="+1"><b>verify_opset</b></font></td><td align="right"><i></i></td></tr></table><hr width="515" size="3" noshade="true" align="left" color="black" /><pre>verify_opset (<em class="replaceable">opset</em>[, ...])</pre><p>Returns true if <em class="replaceable">opset</em> appears to be avalid opset, else returns false. <tt class="literal">croak</tt> s instead ofreturning false if optional second parameter is true.</p></div></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch08_166.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch08_168.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">8.166. ODBM_File</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">8.168. ops</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2002</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,85,94" href="../index.htm"><area shape="rect" coords="86,1,178,103" href="../lwp/index.htm"><area shape="rect" coords="180,0,265,103" href="../lperl/index.htm"><area shape="rect" coords="267,0,353,105" href="../perlnut/index.htm"><area shape="rect" coords="354,1,446,115" href="../prog/index.htm"><area shape="rect" coords="448,0,526,132" href="../tk/index.htm"><area shape="rect" coords="528,1,615,119" href="../cookbook/index.htm"><area shape="rect" coords="617,0,690,135" href="../pxml/index.htm"></map></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -