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


Predefined Macros

Predefined macros must start at the beginning of a line (or only be preceeded by whitespace on the line). There must be nothing else on the line other than any arguments to the predefined macro. Predefined macros are not case sensitive (all upper case or all lower case or mixed case will be treated as the same macro name). This is an exception to the rule that upper and lower case characters are unique, for example %%Sorton is identical to %%SORTON but variable names such as blah and Blah are unique. Predefined macros cannot be used within a text body. They can occur in any order (there are no dependencies during parsing) with the exception that user defined macros must be defined before they are used (otherwise they will not be expanded).

All predefined macros start with a %% sequence, followed by the rest of the macro name. The %%gpp and %%tex start sequences are deprecated and should not be used.

Some predefined macros have arguments. These have the following forms. A numeric argument is any decimal number. A string argument is enclosed in double quotes and can include any character except a double quote. A string argument cannot extend over a newline. A field argument is the name of a database field. As in text bodies the name must be in capitals and should be preceeded by the % character. A macro argument is a macro name followed by a space or a newline. If followed by a space then anything else up to a newline is taken to be the macros definition. A macro name must start with an alphabetic or underscore character, but can be followed by any upper or lower case alphabetic character, numeric character, or underscore character. Note that unlike predefined macros the macro name is case sensitive.

Other predefined macros start a text body on the following line. A text body can include almost any characters whatsoever. A text body is terminated by any line starting with a %% sequence and followed by a valid predefined macro. A line starting with %% followed by whitespace will be treated as a comment and discarded from the text body. Apart from at the start of a line a %% sequence is treated as the start of a user defined macro or equate the name of which should immediately follow. In the former case the user defined macro is expanded and the definition replaces the %% and user defined macro name sequence. Similarly an equate is processed and the result expanded in place (an equate need not return a result in which case the result will be blank and the %% plus equate name sequence is removed). The # sequence can also be used to refer to an equate to process and expand (but not a user defined macro). This could be used where an equate name and a user defined macro name share the same name, since if a macro of the same name exists this will always be favoured over the equate, but by using a hash character instead it makes it explicit that an equate is being called and not a user defined macro.

The name of an equate can be immediately followed by (...) which contains a comma separated list of arguments to the equate, each argument can be any expression (or expressions) that results in a value. The equate name and the entire contents of the brackets is replaced by the evaluation of the equate and argument expressions. Note that the argument expressions should be given in unreversed order if the equate was defined unreversed and reversed order otherwise.

If the result of an equate that is called from within a text body is a string which is itself an equate (or includes an equate) then this will get reprocessed and so on. This is similar to the way user defined macros will continually get expanded.

A \<newline> sequence at the end of a line in a text body will escape the newline. This is useful if a text body is a one line equate call that may not print anything, without adding this to the end you will always get at least one blank line.

A % sequence followed by a field name in a text body will be expanded with the contents of that field from the current record of the master database file.


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