Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

226 lines
10 KiB

  1. Name
  2. m4 - Invokes a macro processor.
  3. Syntax
  4. m4 [ option... ] [ file... ]
  5. Description
  6. M4 is a macro processor intended as a front end for Ratfor,
  7. C, and other languages. Each of the argument files is
  8. processed in order; if there are no files, or if a filename
  9. is -, the standard input is read. The processed text is
  10. written on the standard output.
  11. The options and their effects are:
  12. -e Operates interactively. Interrupts are ignored and the
  13. output is unbuffered.
  14. -s Enables line sync output for the C preprocessor (#line
  15. ...)
  16. -Bint
  17. Changes the size of the push-back and argument
  18. collection buffers from the default of 4,096.
  19. -Hint
  20. Changes the size of the symbol table hash array from
  21. the default of 199. The size should be prime.
  22. -Sint
  23. Changes the size of the call stack from the default of
  24. 100 slots. Macros take three slots, and nonmacro
  25. arguments take one.
  26. -Tint
  27. Changes the size of the token buffer from the default
  28. of 512 bytes.
  29. To be effective, these flags must appear before any
  30. filenames and before any -D or -U flags:
  31. -Dname[=val]
  32. Defines name to val or to null in val's absence.
  33. -Uname
  34. Undefines name.
  35. Macro Calls
  36. Macro calls have the form:
  37. name(arg1,arg2, ..., argn)
  38. The left parenthesis (() must immediately follow the name of
  39. the macro. If a defined macro name is not followed by a
  40. left parenthesis ((), it is deemed to have no arguments.
  41. Leading unquoted blanks, tabs, and newlines are ignored
  42. while collecting arguments. Potential macro names consist
  43. of alphabetic letters, digits, and underscore _, where the
  44. first character is not a digit.
  45. Left and right single quotation marks are used to quote
  46. strings. The value of a quoted string is the string
  47. stripped of the quotation marks.
  48. When a macro name is recognized, its arguments are collected
  49. by searching for a matching right parenthesis. Macro
  50. evaluation proceeds normally during the collection of the
  51. arguments, and any commas or right parentheses which happen
  52. to turn up within the value of a nested call are as
  53. effective as those in the original input text. After
  54. argument collection, the value of the macro is pushed back
  55. onto the input stream and rescanned.
  56. M4 makes available the following built-in macros. They may
  57. be redefined, but once this is done the original meaning is
  58. lost. Their values are null unless otherwise stated:
  59. define The second argument is installed as the value of
  60. the macro whose name is the first argument.
  61. Each occurrence of $n in the replacement text,
  62. where n is a digit, is replaced by the n-th
  63. argument. Argument 0 is the name of the macro;
  64. missing arguments are replaced by the null
  65. string; $# is replaced by the number of
  66. arguments; $* is replaced by a list of all the
  67. arguments separated by commas; @ $@ is like $*,
  68. but each argument is quoted (with the current
  69. quotation marks).
  70. undefine Removes the definition of the macro named in its
  71. argument.
  72. defn Returns the quoted definition of its
  73. argument(s). It is useful for renaming macros,
  74. especially built-ins.
  75. pushdef Like define, but saves any previous definition.
  76. popdef Removes current definition of its argument(s),
  77. exposing the previous one if any.
  78. ifdef If the first argument is defined, the value is
  79. the second argument, otherwise the third. If
  80. there is no third argument, the value is null.
  81. shift Returns all but its first argument. The other
  82. arguments are quoted and pushed back with commas
  83. in between. The quoting nullifies the effect of
  84. the extra scan that will subsequently be
  85. performed.
  86. changequote Changes quotation marks to the first and second
  87. arguments. The symbols may be up to five
  88. characters long. Changequote without arguments
  89. restores the original values.
  90. changecom Changes left and right comment markers from the
  91. default # and newline. With no arguments, the
  92. comment mechanism is effectively disabled. With
  93. one argument, the left marker becomes the
  94. argument and the right marker becomes newline.
  95. With two arguments, both markers are affected.
  96. Comment markers may be up to five characters
  97. long.
  98. divert M4 maintains 10 output streams, numbered 0-9.
  99. The final output is the concatenation of the
  100. streams in numerical order; initially stream 0
  101. is the current stream. The divert macro changes
  102. the current output stream to its (digit-string)
  103. argument. Output diverted to a stream other
  104. than 0 through 9 is discarded.
  105. undivert Causes immediate output of text from diversions
  106. named as arguments, or all diversions if no
  107. argument. Text may be undiverted into another
  108. diversion. Undiverting discards the diverted
  109. text.
  110. divnum Returns the value of the current output stream.
  111. dnl Reads and discards characters up to and
  112. including the next newline.
  113. ifelse Has three or more arguments. If the first
  114. argument is the same string as the second, then
  115. the value is the third argument. If not, and if
  116. there are more than four arguments, the process
  117. is repeated with arguments 4, 5, 6 and 7.
  118. Otherwise, the value is either the fourth
  119. string, or if it is not present, null.
  120. incr Returns the value of its argument incremented by
  121. 1. The value of the argument is calculated by
  122. interpreting an initial digit-string as a
  123. decimal number.
  124. decr Returns the value of its argument decremented by
  125. 1.
  126. eval Evaluates its argument as an arithmetic
  127. expression, using 32-bit arithmetic. Operators
  128. include +, -, *, /, %, ^ (exponentiation),
  129. bitwise &, |, ^, and ~; relationals;
  130. parentheses. Octal and hex numbers may be
  131. specified as in C. The second argument
  132. specifies the radix for the result; the default
  133. is 10. The third argument may be used to
  134. specify the minimum number of digits in the
  135. result.
  136. len Returns the number of characters in its
  137. argument.
  138. index Returns the position in its first argument where
  139. the second argument begins (zero origin), or -1
  140. if the second argument does not occur.
  141. substr Returns a substring of its first argument. The
  142. second argument is a zero origin number
  143. selecting the first character; the third
  144. argument indicates the length of the substring.
  145. A missing third argument is taken to be large
  146. enough to extend to the end of the first string.
  147. translit Transliterates the characters in its first
  148. argument from the set given by the second
  149. argument to the set given by the third. No
  150. abbreviations are permitted.
  151. include Returns the contents of the file named in the
  152. argument.
  153. sinclude Identical to include, except that it says
  154. nothing if the file is inaccessible.
  155. syscmd Executes the XENIX command given in the first
  156. argument. No value is returned.
  157. sysval Is the return code from the last call to syscmd.
  158. maketemp Fills in a string of XXXXX in its argument with
  159. the current process ID.
  160. m4exit Causes immediate exit from m4. Argument 1, if
  161. given, is the exit code; the default is 0.
  162. m4wrap Argument 1 will be pushed back at final end-of-
  163. file; for example, m4wrap(`cleanup()').
  164. errprint Prints its argument on the diagnostic output
  165. file.
  166. dumpdef Prints current names and definitions, for the
  167. named items, or for all if no arguments are
  168. given.
  169. traceon With no arguments, turns on tracing for all
  170. macros (including built-ins). Otherwise, turns
  171. on tracing for named macros.
  172. traceoff Turns off trace globally and for any macros
  173. specified. Macros specifically traced by
  174. traceon can be untraced only by specific calls
  175. to traceoff.