INFO
preprocessor - about the NannyMUD preprocessor
DESCRIPTION
Preprocessing is done as the first pass of the compilation.
The directives start with a # as the first character on a
line. White space (SPACE or TAB characters) can appear after
the initial # for proper indentation.
#pragma strict_types
Turns on typechecking for the whole file and the types
of functions and variables must be declared.
#pragma save_types
Saves type information which then can be used in inherited
objects.
#define name token-string
Replace subsequent instances of name with token-string.
#define name(argument [, argument] ... ) token-string
There can be no space between name and the `('.
Replace subsequent instances of name, followed by a
parenthesized list of arguments, with token-string,
where each occurrence of an argument in the token-
string is replaced by the corresponding token in the
comma-separated list. When a macro with arguments is
expanded, the arguments are placed into the expanded
token-string unchanged. After the entire token-string
has been expanded, preprocessor re-starts its scan for
names to expand at the beginning of the newly created
token-string.
#undef name
Remove any definition for the symbol name. No additional
tokens are permitted on the directive line after name.
#include "filename"
#include
Read in the contents of filename at this location.
This data is processed as if it were part of the
current file. When the notation is used,
filename is only searched for in the /include.
#line integer-constant "filename"
Generate line control information for the next pass of
the compiler. integer-constant is interpreted as the line
number of the next line and filename is interpreted as
the file from where it comes. If "filename" is not given,
the current filename is unchanged. No additional tokens
are permitted on the directive line after the optional
filename.
#if constant-expression
Subsequent lines up to the matching #else, #elif, or #endif
directive, appear in the output only if constant-expression
yields a nonzero value. All binary non-assignment LPC
operators, including `&&', `||', and `,', are legal in
constant-expression. The `?:' operator, and the unary `-',
`!', and `~' operators, are also legal in constant-expression.
The precedence of these operators is the same as that for
LPC. In addition, the unary operator defined, can be used
in constant-expression in these two forms: `defined ( name )'
or `defined name'. This allows the effect of #ifdef and
#ifndef directives (described below) in the #if directive.
Only these operators, integer constants, and names that are
known by the preprocessor should be used within
constant-expression. In particular, the size of operator is
not available.
#ifdef name
Subsequent lines up to the matching #else, #elif, or #endif
appear in the output only if name has been defined with a
#define directive, and in the absence of an intervening #undef
directive. Additional tokens after name on the directive line
will be silently ignored.
#ifndef name
Subsequent lines up to the matching #else, #elif, or #endif
appear in the output only if name has not been defined, or
if its definition has been removed with an #undef directive.
No additional tokens are permitted on the directive line after
name.
#elif constant-expression
Any number of #elif directives may appear between an
#if, #ifdef, or #ifndef directive and a matching #else
or #endif directive. The lines following the #elif
directive appear in the output only if all of the
following conditions hold:
o The constant-expression in the preceding #if
directive evaluated to zero, the name in the
preceding #ifdef is not defined, or the name in
the preceding #ifndef directive was defined.
o The constant-expression in all intervening
#elif directives evaluated to zero.
o The current constant-expression evaluates to
non-zero.
If the constant-expression evaluates to non-zero, sub-
sequent #elif and #else directives are ignored up to
the matching #endif. Any constant-expression allowed
in an #if directive is allowed in an #elif directive.
#else
This inverts the sense of the conditional directive
otherwise in effect. If the preceding conditional
would indicate that lines are to be included, then
lines between the #else and the matching #endif are
ignored. If the preceding conditional indicates that
lines would be ignored, subsequent lines are included
in the output. Conditional directives and correspond-
ing #else directives can be nested.
#endif
End a section of lines begun by one of the conditional
directives #if, #ifdef, or #ifndef. Each such direc-
tive must have a matching #endif.
Help topics available:
You are guest number 185 since November 2019.
This file was last modified: June 2000.