Go to the first, previous, next, last section, table of contents.


Macro Expression Syntax

The syntax of a full AutoGen expression is:

[[ <apply-code> ] <value-name> ] [ <simple-expr-1> [ <simple-expr-2> ]]

Where

`<apply-code>'
is any of -, ?, % or ?% (see below).
`<value-name>'
is a (possibly unknown) AutoGen value name (See section Naming a value, and see section EXPR - Evaluate and emit an Expression). In this context, the name may not contain any white space.
`<simple-expr-1>'
is either a Scheme expression starting with ; or (; a shell expression surrounded with `; or a string, quoted or unquoted.
`<simple-expr-2>'
is as above, but only if the ? or ?% apply-code has been specified.

There are some places where only a simple expression (i.e. just the <simple-expr-1> clause) is allowed. I hope I have clearly marked which macros have those requirements. Otherwise, in the macro descriptions that follow, a full expression refers to what we are describing here.

The result of the expression evaluation will depend on what apply code has been provided, whether or not there is an associated value for the value name, and whether or not expressions are specified.

The syntax rules are:

  1. The expression may not be empty.
  2. If no value name is provided, then the rest of the macro is presumed to be an expression and is evaluated. It usually must start with one of the expression processing characters. See below.
  3. If no expression is provided, then there must be a value name and there may not be an apply code. The result will either be the empty string, or the AutoGen value associated with value name.
  4. If the apply code is either ? or ?%, then two expressions must be provided, otherwise only one expression may be provided.

The apply codes used are as follows:

`-'
The expression that follows the value name will be processed only if the named value is not found.
`?'
There must be two space separated expressions following the value name. The first is selected if the value name is found, otherwise the second expression is selected.
`%'
The first expression that follows the name will be used as a format string to sprintf. The data argument will be the value named after the % character.
`?%'
This combines the functions of ?and %, but for obvious reasons, only the first expression will be used as a format argument.
`not-supplied'
The macro will be skipped if there is no AutoGen value associated with the <value-name>. If there is an associated value, then the expression result is the result of evaluating <expression-1> (if present), otherwise it is the value associated with <value-name>.

The simple expression clauses are interpreted differently, depending on the first character:

`; (semi-colon)'
This is a Scheme comment character and must preceed Scheme code. AutoGen will strip it and pass the result to the Guile Scheme interpreter.
`( (open parenthesis)'
This is a Scheme expression. Guile will interpret it. The expression must end before the end macro marker.
`' (single quote)'
This is a fairly raw text string. It is not completely raw because backslash escapes are processed before 3 special characters: single quote ('), the hash character (#) and backslash (\).
`" (double quote)'
This is a cooked text string. The string is processed as in a K and R quoted string. That is to say, adjacent strings are not concatenated together.
`` (back quote)'
This is a shell expression. The AutoGen server shell will interpret it. The result of the expression will be the output of the shell script. The string is processed as in the cooked string before being passed to the shell.
`anything else'
Is presumed to be a literal string. It becomes the result of the expression.


Go to the first, previous, next, last section, table of contents.