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=056ffb31310753dddafabbebf29ad12fe165f4f0;hb=52d7c80a1a54c4946c4962399667c40200236bc3;hp=f0bf4fe10b77400ed999dd56672f9c1b84f93460;hpb=286a3ec5b3fde58021342c1f1897eb2c41a2d14c;p=pspp diff --git a/doc/flow-control.texi b/doc/flow-control.texi index f0bf4fe10b..056ffb3131 100644 --- a/doc/flow-control.texi +++ b/doc/flow-control.texi @@ -165,7 +165,8 @@ positional argument. References to a positional argument in a macro body are numbered: @code{!1} is the first positional argument, @code{!2} the second, and -so on. +so on. In addition, @code{!*} expands to all of the positional +argument values, separated by a space. The following example uses a positional argument: @@ -205,15 +206,6 @@ FREQUENCIES /VARIABLES=!vars. @end example @end itemize -@example -DEFINE !analyze_kw(vars=!CMDEND) -DESCRIPTIVES !vars. -FREQUENCIES /VARIABLES=!vars. -!ENDDEFINE. - -!analyze_kw vars=v1 v2 v3. -@end example - If a macro has both positional and keyword arguments, then the positional arguments must come first in the DEFINE command, and their values also come first in macro calls. @@ -243,6 +235,18 @@ Any number of tokens up to @var{token}, which should be an operator or punctuator token such as @samp{/} or @samp{+}. The @var{token} does not become part of the value. +With the following variant of @code{!analyze_kw}, the variables must +be following by @samp{/}: + +@example +DEFINE !analyze_parens(vars=!CHARNED('/')) +DESCRIPTIVES !vars. +FREQUENCIES /VARIABLES=!vars. +!ENDDEFINE. + +!analyze_parens vars=v1 v2 v3/. +@end example + @item !ENCLOSE('@var{start}','@var{end}') Any number of tokens enclosed between @var{start} and @var{end}, which should each be operator or punctuator tokens. For example, use @@ -267,12 +271,24 @@ FREQUENCIES /VARIABLES=!vars. Any number of tokens up to the end of the command. This should be used only for the last positional parameter, since it consumes all of the tokens in the command calling the macro. + +The following variant of @code{!analyze_kw} takes all the variable +names up to the end of the command as its argument: + +@example +DEFINE !analyze_kw(vars=!CMDEND) +DESCRIPTIVES !vars. +FREQUENCIES /VARIABLES=!vars. +!ENDDEFINE. + +!analyze_kw vars=v1 v2 v3. +@end example @end table By default, when an argument's value contains a macro call, the call is expanded each time the argument appears in the macro's body. The @code{!NOEXPAND} keyword in an argument declaration suppresses this -expansion. +expansion. @xref{Controlling Macro Expansion}, for details. @node Controlling Macro Expansion @subsection Controlling Macro Expansion