Section 3: Assembler
273
TI
-
89 / TI
-
92 Plus Sierra C Assembler Reference Manual
Not for Distribution
Beta Version February 2, 2001
The following steps are then performed for each statement in the body of the
macro:
•
The statement is retrieved.
•
Any formal parameters are replaced with their corresponding actual
parameters; formal parameters that have no corresponding actual parameter
are assigned a null string.
•
The \@ designator is replaced with a unique number (refer to section
3.8.1.4 Local Labels).
•
The NARG symbol is replaced with its value (see section 3.8.1.5 NARG
Symbol).
•
The fully expanded statement is processed as any other statement would be
processed. If it is a nested macro invocation, these steps are performed
recursively.
Macros must be defined before they are invoked. A macro’s expanded code will
appear in the listing file only if the OPT MEX directive is specified (default:
OPT NOMEX).
3.8.1.3. Parameters
The formal parameters of a macro are the parameters that are referenced in the
macro’s definition. They are denoted by a backslash ( \ ) followed by a digit or
alphabetical character (either lowercase or uppercase). The formal parameter
designated by \0 corresponds to the optional size qualifier used when the macro
is invoked. The parameters designated by \1 – \9 and \A – \Z correspond to the
actual parameters that appear in the operand field of a macro invocation. If a
macro is defined with a non-consecutive set of formal parameters (e.g., \3 is
referenced, but \2 is not), a warning is issued.
The actual parameters of a macro are the parameters that are specified when a
macro is invoked. The actual parameters are substituted for their formal
counterparts in the body of the expanded macro. The default value for any
parameter in the operand field is a null string, and the default for the parameter in
the qualifier field is the size qualifier .W. If an actual parameter is omitted, its
value is the default.
If an actual parameter contains whitespace or commas, it must be enclosed in
angle brackets ( < > ). Angle brackets can be nested, but must always appear in
pairs.