Next: , Previous: , Up: Built-in functions   [Contents][Index]


7.2.3.12 $DEFINE: Deferred macro definition

$DEFINE’ behaves like the FWEB macro command @m, but it is intended to appear in the code part, not the definition part (so it is processed during output, not input). Thus, the code fragment

a = A;
$DEFINE(A 1)@%
a = A;

tangles to

a= A;
a= 1;

(Notice how the ‘@%’ command was used to kill an unwanted newline, analogous to the ‘dnl’ macro in m4.)

In the above example, one could also say ‘$DEFINE(A=1)’. To define a macro with arguments, say something like ‘$DEFINE(A(x)x*x)’. Do not say ‘$DEFINE(A(x)=x*x)’, as in this case the equals sign will be included in the macro expansion. One must use the equals sign as a means of preventing parentheses from being interpreted as an argument in examples like

$DEFINE(A=(x))

This expands to ‘(x)’.

A completely equivalent shorthand notation for $DEFINE is $M.