P4_STR_ARGS_BRACE(3)

NAME
p4_str_args_brace - $ARGS{ ( arg1'$ ... argN'$ "arg1 ... argN <}>" -- )

SYNOPSIS

#include <pfe/def-config.h>

FCode p4_str_args_brace(---);

DESCRIPTION

         compilation: ( -- $: arg1$ ... argN$ )

Immediate and compilation-only.

Copy the argument strings across lines to the string buffer, push them onto the string stack with "argN" the most accessible, and make them into the top compile-time string stack frame. Compile the run-time code to make an argument frame out of the N most accessible run-time string stack entries. Inform the system text interpreter that it should compile run-time code for any white-space delimited argument encountered in the text of the definition, that concatenates the corresponding string in the run-time frame. At the semicolon terminating the definition, drop the compile-time argument frame and compile code to drop the run-time argument frame.

The code between $ARGS{ ... } and the terminating semicolon is not allowed to make a net change in the string stack depth, because that would interfere with the automatic dropping of the string argument frame at the semicolon. "string-args-brace"

Syntax for defining a string macro GEORGE:

          : george  ($: a$ b$ c$ -- cat$ )
            $ARGS{ arg1 arg2 arg3 }
            cat" This is arg1:  " arg1 cat" ." ENDCAT $. ;

The blank following the last argument is required. For a macro with no arguments, $ARGS{ } does nothing but add useless overhead and should be omitted. Two of the arguments in this example are ignored and could have been left out. Note that ENDCAT would not be legal in this word without something like $. to remove the concatenated string from the string stack before the terminating semicolon. It is normal to use an $ARGS{ } word as a step in a concatenation that is terminated elsewhere.

Sample syntax using the string macro george:

          $" bill"  $" sue"  $" marie"  george $.

The resulting display is:

          This is arg1:  bill.

NOTE: Macro argument labels must be distinct from each other and from any local labels that appear in the same definition, and there is no check for that.

NOTE: At the moment the semantics of $ARGS{ is undefined before DOES>.

AUTHOR

    • David N.Williams (modified by $Author: guidod $)

COPYRIGHT

Copyright (C) 2001-2004, 2006, 2008 David N. Williams