X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=doc%2Fflow-control.texi;fp=doc%2Fflow-control.texi;h=c68923f8c052f35fe39cb3255daa2375e554a75b;hb=440613afbc2b901f51020c36afd59255a4988aa6;hp=2a4bd0afae53537c3b402c39615c8526fbc8b3d8;hpb=f626663385d57d16eff7e1d06e07b558cf669385;p=pspp diff --git a/doc/flow-control.texi b/doc/flow-control.texi index 2a4bd0afae..c68923f8c0 100644 --- a/doc/flow-control.texi +++ b/doc/flow-control.texi @@ -398,8 +398,9 @@ To expand macros in these cases, use the @code{!EVAL} macro function, e.g.@: @code{!LENGTH(!EVAL(!vars))} or @code{!LENGTH(!EVAL(!1))}. @xref{Macro Functions}, for details. -These rules apply to macro calls, not to uses of macro functions and -macro arguments within a macro body, which are always expanded. +These rules apply to macro calls, not to uses within a macro body of +macro functions, macro arguments, and macro variables created by +@code{!DO} or @code{!LET}, which are always expanded. @node Macro Functions @subsection Macro Functions @@ -797,6 +798,24 @@ SET MEXPAND, etc. doesn't work inside macro bodies. @node Macro Notes @subsection Additional Notes +@subsubsection Calling Macros from Macros + +If the body of macro A includes a call to macro B, the call can use +macro arguments (including @code{!*}) and macro variables as part of +arguments to B. For @code{!TOKENS} arguments, the argument or +variable name counts as one token regardless of the number that +expands into, for @code{!CHAREND} and @code{!ENCLOSE} arguments the +delimiters come only from the call, not the expansions, and +@code{!CMDEND} ends at the calling command, not any end of command +within an argument or variable. + +Macro functions are not supported as part of the arguments in a macro +call. To get the same effect, use @code{!LET} to define a macro +variable, then pass the macro variable to the macro. + +When macro A calls macro B, the order of their @code{DEFINE} commands +doesn't matter, as long as macro B has been defined when A is called. + @subsubsection Command Terminators Macros and command terminators require care. Macros honor the syntax