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

📄 m4.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>m4</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_001_014_1308">&nbsp;</a>NAME</h4><blockquote>m4 - macro processor (<b>DEVELOPMENT</b>)</blockquote><h4><a name = "tag_001_014_1309">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>m4 <b>[</b>-s<b>][</b> -D <i>name</i><b>[</b>=<i>val</i><b>]]</b>...<b>[</b>-U <i>name</i><b>]</b>... <i>file</i>...</code></pre></blockquote><h4><a name = "tag_001_014_1310">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>m4</i>utility is a macro processorthat reads one or more text files,processes them according to their included macro statements,and writes the results to standard output.</blockquote><h4><a name = "tag_001_014_1311">&nbsp;</a>OPTIONS</h4><blockquote>The<i>m4</i>utility supports the <b>XBD</b> specification, <a href="../xbd/utilconv.html#usg"><b>Utility Syntax Guidelines</b>&nbsp;</a> ,except that the order of the<b>-D</b>and<b>-U</b>options is significant.The following options are supported:<dl compact><dt><b>-s</b><dd>Enable line synchronisation output for the<i><a href="c89.html">c89</a></i>preprocessor phase(that is,<b>#line</b>directives).<dt><b>-D</b> <i>name</i><b>[</b>=<i>val</i><b>]</b><dd>Define<i>name</i>to<i>val</i>or to null if<i>=val</i>is omitted.<dt><b>-U&nbsp;</b><i>name</i><dd>Undefine<i>name</i>.</dl></blockquote><h4><a name = "tag_001_014_1312">&nbsp;</a>OPERANDS</h4><blockquote>The following operand is supported:<dl compact><dt><i>file</i><dd>A pathname of a text file to be processed.If no<i>file</i>is given, or if it is "-", the standard input is read.</dl></blockquote><h4><a name = "tag_001_014_1313">&nbsp;</a>STDIN</h4><blockquote>The standard input is a text file that is used if no<i>file</i>operand is given, or if it is "-".</blockquote><h4><a name = "tag_001_014_1314">&nbsp;</a>INPUT FILES</h4><blockquote>The input file named by the<i>file</i>operand is a text file.</blockquote><h4><a name = "tag_001_014_1315">&nbsp;</a>ENVIRONMENT VARIABLES</h4><blockquote>The following environment variables affect the execution of<i>m4</i>:<dl compact><dt><i>LANG</i><dd>Provide a default value for the internationalisation variablesthat are unset or null.If<i>LANG</i>is unset or null, the corresponding value from theimplementation-dependent default locale will be used.If any of the internationalisation variables contains an invalid setting, theutility will behave as if none of the variables had been defined.<dt><i>LC_ALL</i><dd>If set to a non-empty string value,override the values of all the other internationalisation variables.<dt><i>LC_CTYPE</i><dd>Determine thelocale for the interpretation of sequences of bytes of text data ascharacters (for example, single- as opposed to multi-byte charactersin arguments and input files).<dt><i>LC_MESSAGES</i><dd>Determine the locale that should be used to affectthe format and contents of diagnosticmessages written to standard error.<dt><i>NLSPATH</i><dd>Determine the location of message cataloguesfor the processing of<i>LC_MESSAGES .</i></dl></blockquote><h4><a name = "tag_001_014_1316">&nbsp;</a>ASYNCHRONOUS EVENTS</h4><blockquote>Default.</blockquote><h4><a name = "tag_001_014_1317">&nbsp;</a>STDOUT</h4><blockquote>The standard output is the same as the input files,after being processed for macro expansion.</blockquote><h4><a name = "tag_001_014_1318">&nbsp;</a>STDERR</h4><blockquote>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 dumpdef macro,or for diagnostic messages.</blockquote><h4><a name = "tag_001_014_1319">&nbsp;</a>OUTPUT FILES</h4><blockquote>None.</blockquote><h4><a name = "tag_001_014_1320">&nbsp;</a>EXTENDED DESCRIPTION</h4><blockquote>The<i>m4</i>utility compares each token from the input against the set ofbuilt-in and user-defined macros.If the token matches the nameof a macro, then the token is replaced by the macros definingtext, if any, and rescanned for matching macro names.Once no portion of the token matches the name of a macro, it is writtento standard output.Macros may have arguments, in which casethe arguments will be substituted into the defining text beforeit is rescanned.<p>Macro calls have the form:<pre><code><i>name</i>(<i>arg1</i>, <i>arg2</i>, ..., <i>argn</i>)</code></pre><p>Macro names consist of letters, digits and underscores, wherethe first character is not a digit.Tokens not of this formare not treated as macro names.<p>The left parenthesis must immediately follow the name of the macro.If a token matching the name of a macro is not followed by a leftparenthesis, it will be handled as a use of that macro without arguments.<p>If a macro name is followed by a left parenthesis, its argumentsare the comma-separated tokens between the left parenthesisand the matching right parenthesis.Unquoted blank and newline characters preceding each argument are ignored.All other characters, including trailingblank and newline characters, are retained.Commas enclosed between left and right parenthesischaracters do not delimit arguments.<p>Arguments are positionally defined and referenced.The string$1in the defining text will be replaced by the first argument.Systems support at least nine arguments;only the first ninecan be referenced, using the strings$1to$9,inclusive.The string$0will be replaced with the name of the macro.The string$#will be replaced by the number ofarguments as a string.The string$*will be replaced by alist of all of the arguments, separated by commas.The string$@will be replaced by a list of all of the argumentsseparated by commas, and each argument will be quoted using thecurrent left and right quoting strings.<p>If fewer arguments are supplied than are in the macro definition,the omitted arguments are taken to be null.It is not anerror if more arguments are supplied than are in the macrodefinition.<p>No special meaning is given to any characters enclosed betweenmatching left and right quoting strings, but the quoting stringsare themselves discarded.By default, the left quoting stringconsists of a grave accent (`)and the right quoting string consists of an acute accent (')see also the<b>changequote</b>macro.<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 newline character.See also the<b>changecom</b>and<b>dnl</b>macros.<p>The<i>m4</i>utilitymakes available the following built-in macros.They can be redefined, but once this is done the original meaning is lost.Their values are null unless otherwise stated.<dl compact><dt><b>changecom</b><dd>The<b>changecom</b>macro sets the begin- and end-comment strings.With no arguments, the comment mechanism is disabled.With a single argument, that argumentbecomes the begin-comment string and thenewline characterbecomes the end-comment string.With two arguments, the first argumentbecomes the begin-comment string and the second argumentbecomes the end-comment string.Systems support comment strings of at least five characters.<dt><b>changequote</b><dd>The<b>changequote</b>macro sets the begin- and end-quote strings.With no arguments, the quote strings are setto the default values(that is,&nbsp;).With a single argument, that argumentbecomes the begin-quote string and thenewline characterbecomes the end-quote string.With two arguments, the first argumentbecomes the begin-quote string and the second argumentbecomes the end-quote string.Systems support quote strings of at least five characters.<dt><b>decr</b><dd>The defining text of the<b>decr</b>macro is its firstargument decremented by 1.It is an error to specifyan argument containing any non-numeric characters.<dt><b>define</b><dd>The second argument is specified as the defining text of themacro whose name is the first argument.<dt><b>defn</b><dd>The defining text of the<b>defn</b>macro is the quoteddefinition (using the current quoting strings) of its arguments.<dt><b>divert</b><dd>The<i>m4</i>utility maintains ten temporary buffers, numbered 0 to 9, inclusive.When the last of the input has been processed,any output that has been placed in these buffers willbe written to standard output in buffer-numerical order.The<b>divert</b>macro diverts future output to the buffer specifiedby its argument.Specifying no argument or an argument of0 resumes the normal output process.Output diverted to astream other than 0 to 9 is discarded.It is anerror to specify an argument containing any non-numericcharacters.<dt><b>divnum</b><dd>The defining text of the<b>divnum</b>macro is the numberof the current output stream as a string.<dt><b>dnl</b><dd>The<b>dnl</b>macro causes<i>m4</i>to discard all input characters up

⌨️ 快捷键说明

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