⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 m4.html

📁 posix标准英文,html格式
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2004 IEEE and The Open Group, All Rights Reserved --><title>m4</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="m4"></a> <a name="tag_04_82"></a><!-- m4 --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2004 Edition<br>Copyright &copy; 2001-2004 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_04_82_01"></a>NAME</h4><blockquote>m4 - macro processor (<b>DEVELOPMENT</b>)</blockquote><h4><a name="tag_04_82_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><code><tt><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> m4</tt> <b>[</b><tt>-s</tt><b>][</b><tt>-D</tt><i>name</i><b>[</b><tt>=</tt><i>val</i><b>]]</b><tt>...</tt><b>[</b><tt>-U</tt> <i>name</i><b>]</b><tt>...</tt> <i>file</i><tt>...<img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></code></div></blockquote><h4><a name="tag_04_82_03"></a>DESCRIPTION</h4><blockquote><p>The <i>m4</i> utility is a macro processor that shall read one or more text files, process them according to their includedmacro statements, and write the results to standard output.</p></blockquote><h4><a name="tag_04_82_04"></a>OPTIONS</h4><blockquote><p>The <i>m4</i> utility shall conform to the Base Definitions volume of IEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap12.html#tag_12_02">Section 12.2, Utility Syntax Guidelines</a>, except that the order of the <b>-D</b> and<b>-U</b> options shall be significant.</p><p>The following options shall be supported:</p><dl compact><dt><b>-s</b></dt><dd>Enable line synchronization output for the <a href="../utilities/c99.html"><i>c99</i></a> preprocessor phase (that is,<b>#line</b> directives).</dd><dt><b>-D&nbsp;</b> <i>name</i><b>[</b>=<i>val</i><b>]</b></dt><dd>Define <i>name</i> to <i>val</i> or to null if = <i>val</i> is omitted.</dd><dt><b>-U&nbsp;</b> <i>name</i></dt><dd>Undefine <i>name</i>.</dd></dl></blockquote><h4><a name="tag_04_82_05"></a>OPERANDS</h4><blockquote><p>The following operand shall be supported:</p><dl compact><dt><i>file</i></dt><dd>A pathname of a text file to be processed. If no <i>file</i> is given, or if it is <tt>'-'</tt>, the standard input shall beread.</dd></dl></blockquote><h4><a name="tag_04_82_06"></a>STDIN</h4><blockquote><p>The standard input shall be a text file that is used if no <i>file</i> operand is given, or if it is <tt>'-'</tt>.</p></blockquote><h4><a name="tag_04_82_07"></a>INPUT FILES</h4><blockquote><p>The input file named by the <i>file</i> operand shall be a text file.</p></blockquote><h4><a name="tag_04_82_08"></a>ENVIRONMENT VARIABLES</h4><blockquote><p>The following environment variables shall affect the execution of <i>m4</i>:</p><dl compact><dt><i>LANG</i></dt><dd>Provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume ofIEEE&nbsp;Std&nbsp;1003.1-2001, <a href="../basedefs/xbd_chap08.html#tag_08_02">Section 8.2, Internationalization Variables</a> forthe precedence of internationalization variables used to determine the values of locale categories.)</dd><dt><i>LC_ALL</i></dt><dd>If set to a non-empty string value, override the values of all the other internationalization variables.</dd><dt><i>LC_CTYPE</i></dt><dd>Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte asopposed to multi-byte characters in arguments and input files).</dd><dt><i>LC_MESSAGES</i></dt><dd>Determine the locale that should be used to affect the format and contents of diagnostic messages written to standarderror.</dd><dt><i>NLSPATH</i></dt><dd>Determine the location of message catalogs for the processing of <i>LC_MESSAGES .</i></dd></dl></blockquote><h4><a name="tag_04_82_09"></a>ASYNCHRONOUS EVENTS</h4><blockquote><p>Default.</p></blockquote><h4><a name="tag_04_82_10"></a>STDOUT</h4><blockquote><p>The standard output shall be the same as the input files, after being processed for macro expansion.</p></blockquote><h4><a name="tag_04_82_11"></a>STDERR</h4><blockquote><p>The standard error shall be used to display strings with the <b>errprint</b> macro, macro tracing enabled by the <b>traceon</b>macro, the defined text for macros written by the <b>dumpdef</b> macro, or for diagnostic messages.</p></blockquote><h4><a name="tag_04_82_12"></a>OUTPUT FILES</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_04_82_13"></a>EXTENDED DESCRIPTION</h4><blockquote><p>The <i>m4</i> utility shall compare each token from the input against the set of built-in and user-defined macros. If the tokenmatches the name of a macro, then the token shall be replaced by the macro's defining text, if any, and rescanned for matchingmacro names. Once no portion of the token matches the name of a macro, it shall be written to standard output. Macros may havearguments, in which case the arguments shall be substituted into the defining text before it is rescanned.</p><p>Macro calls have the form:</p><pre><i>name</i><tt>(</tt><i>arg1</i><tt>,</tt> <i>arg2</i><tt>, ...,</tt> <i>argn</i><tt>)</tt></pre><p>Macro names shall consist of letters, digits, and underscores, where the first character is not a digit. Tokens not of this formshall not be treated as macros.</p><p>The application shall ensure that the left parenthesis immediately follows the name of the macro. If a token matching the nameof a macro is not followed by a left parenthesis, it is handled as a use of that macro without arguments.</p><p>If a macro name is followed by a left parenthesis, its arguments are the comma-separated tokens between the left parenthesis andthe matching right parenthesis. Unquoted &lt;blank&gt;s and &lt;newline&gt;s preceding each argument shall be ignored. All othercharacters, including trailing &lt;blank&gt;s and &lt;newline&gt;s, are retained. Commas enclosed between left and rightparenthesis characters do not delimit arguments.</p><p>Arguments are positionally defined and referenced. The string <tt>"$1"</tt> in the defining text shall be replaced by the firstargument. Systems shall support at least nine arguments; only the first nine can be referenced, using the strings <tt>"$1"</tt> to<tt>"$9"</tt>, inclusive. The string <tt>"$0"</tt> is replaced with the name of the macro. The string <tt>"$#"</tt> is replaced bythe number of arguments as a string. The string <tt>"$*"</tt> is replaced by a list of all of the arguments, separated by commas.The string <tt>"$@"</tt> is replaced by a list of all of the arguments separated by commas, and each argument is quoted using thecurrent left and right quoting strings.</p><p>If fewer arguments are supplied than are in the macro definition, the omitted arguments are taken to be null. It is not an errorif more arguments are supplied than are in the macro definition.</p><p>No special meaning is given to any characters enclosed between matching left and right quoting strings, but the quoting stringsare themselves discarded. By default, the left quoting string consists of a grave accent ( <tt>'`'</tt> ) and the right quotingstring consists of an acute accent ( <tt>'&quot;</tt> ); see also the <b>changequote</b> macro.</p><p>Comments are written but not scanned for matching macro names; by default, the begin-comment string consists of the number signcharacter and the end-comment string consists of a &lt;newline&gt;. See also the <b>changecom</b> and <b>dnl</b> macros.</p><p>The <i>m4</i> utility shall make available the following built-in macros. They can be redefined, but once this is done theoriginal meaning is lost. Their values shall be null unless otherwise stated. In the descriptions below, the term <i>definingtext</i> refers to the value of the macro: the second argument to the <b>define</b> macro, among other things. Except for the firstargument to the <b>eval</b> macro, all numeric arguments to built-in macros shall be interpreted as decimal values. The stringvalues produced as the defining text of the <b>decr</b>, <b>divnum</b>, <b>incr</b>, <b>index</b>, <b>len</b>, and <b>sysval</b>built-in macros shall be in the form of a decimal-constant as defined in the C language.</p><dl compact><dt><b>changecom</b></dt><dd>The <b>changecom</b> macro shall set the begin-comment and end-comment strings. With no arguments, the comment mechanism shallbe disabled. With a single argument, that argument shall become the begin-comment string and the &lt;newline&gt; shall become theend-comment string. With two arguments, the first argument shall become the begin-comment string and the second argument shallbecome the end-comment string. Systems shall support comment strings of at least five characters.</dd><dt><b>changequote</b></dt><dd>The <b>changequote</b> macro shall set the begin-quote and end-quote strings. With no arguments, the quote strings shall be setto the default values (that is, <tt>`'</tt>). With a single argument, that argument shall become the begin-quote string and the&lt;newline&gt; shall become the end-quote string. With two arguments, the first argument shall become the begin-quote string andthe second argument shall become the end-quote string. Systems shall support quote strings of at least five characters.</dd><dt><b>decr</b></dt><dd>The defining text of the <b>decr</b> macro shall be its first argument decremented by 1. It shall be an error to specify anargument containing any non-numeric characters.</dd><dt><b>define</b></dt><dd>The second argument shall become the defining text of the macro whose name is the first argument.</dd><dt><b>defn</b></dt><dd>The defining text of the <b>defn</b> macro shall be the quoted definition (using the current quoting strings) of itsarguments.</dd><dt><b>divert</b></dt><dd>The <i>m4</i> utility maintains nine temporary buffers, numbered 1 to 9, inclusive. When the last of the input has beenprocessed, any output that has been placed in these buffers shall be written to standard output in buffer-numerical order. The<b>divert</b> macro shall divert future output to the buffer specified by its argument. Specifying no argument or an argument of 0shall resume the normal output process. Output diverted to a stream other than 0 to 9 shall be discarded. It shall be an error tospecify an argument containing any non-numeric characters.</dd><dt><b>divnum</b></dt><dd>The defining text of the <b>divnum</b> macro shall be the number of the current output stream as a string.</dd><dt><b>dnl</b></dt><dd>The <b>dnl</b> macro shall cause <i>m4</i> to discard all input characters up to and including the next &lt;newline&gt;.</dd><dt><b>dumpdef</b></dt><dd>The <b>dumpdef</b> macro shall write the defined text to standard error for each of the macros specified as arguments, or, ifno arguments are specified, for all macros.</dd><dt><b>errprint</b></dt><dd>The <b>errprint</b> macro shall write its arguments to standard error.</dd><dt><b>eval</b></dt><dd>The <b>eval</b> macro shall evaluate its first argument as an arithmetic expression, using 32-bit signed integer arithmetic.All of the C-language operators shall be supported, except for: <pre><tt>[]-&gt;++--(</tt><i>type</i><tt>)unary *</tt><i>sizeof</i><tt>,.?:unary &amp;</tt></pre><p>and all assignment operators. It shall be an error to specify any of these operators. Precedence and associativity shall be asin the ISO&nbsp;C standard. Systems shall support octal and hexadecimal numbers as in the ISO&nbsp;C standard. The second argument,if specified, shall set the radix for the result; the default is 10. The third argument, if specified, sets the minimum number ofdigits in the result. It shall be an error to specify the second or third argument containing any non-numeric characters.</p></dd><dt><b>ifdef</b></dt><dd>If the first argument to the <b>ifdef</b> macro is defined, the defining text shall be the second argument. Otherwise, thedefining text shall be the third argument, if specified, or the null string, if not.</dd><dt><b>ifelse</b></dt><dd>The <b>ifelse</b> macro takes three or more arguments. If the first two arguments compare as equal strings (after macroexpansion of both arguments), the defining text shall be the third argument. If the first two arguments do not compare as equalstrings and there are three arguments, the defining text shall be null. If the first two arguments do not compare as equal stringsand there are four or five arguments, the defining text shall be the fourth argument. If the first two arguments do not compare as

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -