twoPre(n) manual page

Back to the Index
Table of Contents

Name

twoPre - TCL emulation the TCL precompiler twopre.pl(1)

Synopsis

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

Description

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 package require 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.

Commands

The 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.

Author

Frank J. Leitner
frank@fjl.de

See Also

twopre.pl(1) .


Table of Contents


Back to the Index