Next: , Up: AutoGen Native Macros   [Contents][Index]


3.6.1 AutoGen Macro Syntax

The general syntax is:

[ { <native-macro-name> | <user-defined-name> } ] [ <arg> ... ]

The syntax for <arg> depends on the particular macro, but is generally a full expression (see Macro Expression Syntax). Here are the exceptions to that general rule:

  1. INVOKE macros, implicit or explicit, must be followed by a list of name/string value pairs. The string values are simple expressions, as described above.

    That is, the INVOKE syntax is one of these two:

    <user-macro-name> [ <name> [ = <expression> ] ... ]
    
    INVOKE <name-expression> [ <name> [ = <expression> ] ... ]
    
  2. AutoGen FOR macros must be in one of three forms:
    FOR <name> [ <separator-string> ]
    
    FOR <name> (...Scheme expression list)
    
    FOR <name> IN <string-entry> [ ... ]
    

    where:

    <name>

    must be a simple name.

    <separator-string>

    is inserted between copies of the enclosed block. Do not try to use “IN” as your separator string. It won’t work.

    <string-entry>

    is an entry in a list of strings. “<name>” is assigned each value from the “IN” list before expanding the FOR block.

    (...Scheme expression list)

    is expected to contain one or more of the for-from, for-to, for-by, and for-sep functions. (See FOR - Emit a template block multiple times, and AutoGen Scheme Functions)

    The first two forms iterate over the FOR block if <name> is found in the AutoGen values. The last form will create the AutoGen value named <name>.

  3. AutoGen DEFINE macros must be followed by a simple name. Anything after that is ignored. Consequently, that “comment space” may be used to document any named values the macro expects to have set up as arguments. See DEFINE - Define a user AutoGen macro.
  4. The AutoGen COMMENT, ELSE, ESAC and the END* macros take no arguments and ignore everything after the macro name (e.g. see COMMENT - A block of comment to be ignored)

Next: BREAK - Leave a FOR or WHILE macro, Up: AutoGen Native Macros   [Contents][Index]