is a general-purpose macro processor.
It copies text from each of the input
in order (or standard input by default), and writes the processed text to the standard output.
have the form
- name(arg1, arg2, ..., argn)
The `(' must immediately follow the name of the macro.
If a defined macro name is not followed by a `(',
it is deemed to have no arguments.
Leading unquoted blanks, tabs, and newlines are ignored while collecting arguments.
A comma within a nested parenthesis is part of an argument value, not an argument separator.
Potential macro names consist of alphabetic letters, Unicode characters,
digits, and underscore `_', where the first character is not a digit.
Comments begin with the
character and extend to the end of that line; the characters in a comment are copied to the current
output stream unchanged.
The comment start and end sequences may be changed using the
call described below.
The left and right single quotes (ie, grave and acute accents `' ) are used to quote strings.
Because the left and right quotes are distinct, quoted strings may nest.
The value of a quoted string is the string stripped of the outermost quotes.
The left and right quote characters may be changed using the
call described below.
recognises a macro name, followed by a `(', it collects arguments up to a matching right parenthesis.
Macro evaluation proceeds normally during this collection, and the text produced by those macro calls
is interpreted exactly as if it had been in the original input stream (in place of the corresponding macro call).
Thus, any commas or right parentheses within the value of a nested
call are as effective as those in the original input text.
(Remember however that commas within
parentheses are not argument separators.)
After argument collection,
the value of the macro is pushed back onto the input stream
makes available the following built-in macros.
They may be redefined, but once this is done the original meaning is lost.
Their values are null unless otherwise stated.
- Change the starting and ending delimiters for subsequent comments to the first and second arguments.
If the second argument is missing or an empty string, comments will be ended by newline.
If there are no arguments, there are no comments.
- Change quote characters to the first and second arguments.
without arguments restores the original values of
- The second argument is installed with the value of the macro
named by the first argument,
which may be a built-in macro.
Typically both arguments are quoted to prevent too early expansion.
A macro can be renamed using
- The second argument is installed as the value of the macro
named by the first argument.
When the macro is later called (expanded),
each occurrence in the replacement text of
is a digit,
is replaced by the
argument of that macro call.
Argument 0 is the name of the macro;
missing arguments are replaced by the null string.
If the macro value is the same as its name, or the value is
the result is the macro name.
To prevent expansion of a name when redefining a macro, quote the first argument.
maintains 10 output streams,
The final output is the concatenation of the streams
in numerical order;
initially stream 0 is the current stream.
macro changes the current output stream to its (digit-string)
Output diverted to a stream other than 0 through 9
- Returns the value of the current output stream.
- Reads and discards characters up to and including the next newline.
- Prints current names and definitions,
for the named items, or for all if no arguments are given.
- Prints its argument
on the diagnostic output file.
- Evaluates its argument as an arithmetic expression, using 32-bit arithmetic,
and returns the result as a signed decimal integer.
The only literals are decimal integers.
Operators are those of Limbo: the binary operators
< > >= <=,
* / %,
the unary operators
Operator precedence is the same as in Limbo.
Right shifts are signed.
- If the first argument is defined, the value is the second argument, otherwise the third.
If there is no third argument, the value is null.
is predefined with
as its replacement text.
- Has three or more arguments.
If the first argument is the same string as the second,
then the value is the third argument.
If not, the process is repeated with arguments 4, 5, 6 and so on, in groups of three.
If no match is found, the result is the remaining argument (not part of a group of three),
or null if none is present.
- Returns the contents of the file named in the argument.
- Returns the value of its argument incremented by 1.
The value of the argument is calculated
by interpreting an initial digit-string as a decimal number.
- Returns the position in its first argument where the second argument begins (zero origin),
or -1 if the second argument does not occur.
- Returns the number of characters in its argument.
- Returns its first argument after replacing any trailing XXXs by the current host name, process ID, and a unique letter.
Normally used to create unique temporary file names.
- The same as
except that it
says nothing if the file is inaccessible.
- Returns a substring of its first argument.
The second argument is a zero origin
number selecting the first character;
the third argument indicates the length of the substring.
A missing third argument is taken to be large enough to extend to
the end of the first string.
- Runs the first argument as an
No value is returned.
Note that the output of a command can be redirected to a temporary file named by
included, and then removed.
- Transliterates the characters in its first argument
from the set given by the second argument to the set given by the third.
No abbreviations are permitted.
- Removes the definition of the macro named in its argument.
- Causes immediate output of text from diversions named as
arguments, or all diversions if no argument.
Text may be undiverted into another diversion.
Undiverting discards the diverted text.
interprets its command line options after installing the predefined macro set.
as a macro with the given
as a macro with the given
that is regarded as always quoted (ie, is never rescanned).
may change a predefined macro.
the given macro
which may be one of the predefined macros.
in Inferno is more closely related to the original
in Seventh Edition UNIX than its more elaborate relatives in System V and POSIX.