package require TwoPre
?1.0? two_define
macro two_undef
macro two_ifdef
macro script ?two_else
script? two_endif
two_ifndef
macro script ?two_else
script? two_endif
two_pre
is
used to emulate the twopre.pl(1)
program, which in turn emulates the C
preprocessor. The TCL package TwoPre implements all commands used by the
twopre.pl filter. The source
and packagerequire
commands are removed by
the twopre.pl filter, so you can use the same file directly as input to
the interpreter and as input for the twopre.pl filter.
The command line
options -DEFINE and -UNDEFINE are parsed as well. They override the settings
of two_define
and two_undef
in the code.
Please note that while this TCL
implementation automatically respects all of the TCL syntax, the preprocessor
is different in some ways. There is no way for the preprocessor to really
know what is code and what not, as this is often only decided at runtime
(e.g. the eval command). So it doesn't even try to parse the tcl syntax, and
only accepts one two_{define|undef|ifdef|ifndef|else|endif}
command or option
per line.
TwoPre
package contains the following commands:
two_define
macro- Define macro. Doesn't take any value! This is not really a macro, but more a flag which is set.
two_undef
macro- Unset macro.
two_ifdef
macro script1 ?two_else
script2?two_endif
- Evaluate script1 only if the macro has been set previously. Otherwise, if present, evaluate script2. Don't forget to add the
two_endif
at the end of this command.two_ifndef
macro script1 ?two_else
script2?two_endif
- Evaluate script1 only if the macro has not been set previously. Otherwise, if present, evaluate script2. Don't forget to add the
two_endif
at the end of this command.