3.2.4 MUF Compiler Directives
Compiler directives additional instructions that the server
executes before or while compiling your code were introduced in
the MUF Overview. Below is a more complete
reference of the available compiler directives.
$define <definition name> <definition> $enddef
<definition name> such that all
instances of it will be replaced with
when the program is compiled.
<defname>, making it an undefined
value for the compiler. Its primary use is to allow compiler directives
to be included in the source code without their being invoked by the
compiler. For example, you might have a program that should be compiled
differently if running at Mucker Level 3 rather than Mucker Level 2. You
could include the following lines in your code...
$define MLev2 (* Undefine this if the program is set M3 *)
$undef MLev3 (* Define this if the program is set M2 *)
This way, the person compiling the program would have an example of
each valid form, even though only one is being invoked.
This outputs <string> to the person compiling the program, at
compile time. Example:
$echo Compiling multi-guest.muf...
$echo See header comment for configuration instructions.
This is a pre-defined macro that is replaced at compile time with the
current server version. It would be useful for tests to ensure that the
server version can support all the primitives used in your program. The
replacement string will be the same as that returned by the
These cause conditional compilation of blocks of code, based on
<Condition> can be a
$defined name, or a test that consists of a comparator such
as =, <, or > and a test value, all in one word, without
whitespace. The else clause is optional. Comiler directives are
$define envprop .envprop $enddef
$ifdef proplocs .proploc $else $endif $enddef
$defines based on the
<program>. For example, if object
#345 had the following properties...
/_defs/desc: "_/de" getpropstr
/_defs/setpropstr: dup if 0 addprop else pop remove_prop then
/_defs/setpropval: dup if "" swap addprop else pop remove_prop then
/_defs/setprop: dup int? if setpropval else setpropstr then
... then a program that contains the line
would be compiled such that all instances of
setprop would be preplaced with their respective
Escaped statements will be read literally, rather than interpreted and
expanded by the compiler, which allows primitives and macros to be
$define addprop over over or if \addprop else pop pop remove_prop
In this case,
ADDPROP will be expanded in the program
itself, but the compiler will not recursively expand it... it will call
the actual, in-server