Technical data

Compiler Directives
2-37
Macro Definition
To simplify complicated references, target files can define macros that are
expanded when they appear in subsequent expressions.
%define identifier opt-argument-list replacement-list
To undefine a previously defined macro, use:
%undef identifier
identifier
is the name of the macro being defined or undefined;
opt-argument-list is either a C macro argument list or is omitted;
replacement-list is an expansion list similar to a C language macro.
Note: This facility works, but it is not recommended. Rather, use %assign
and
%function, which provide the same capabilities in a more open way. RTW
does not make use of macros.
Identifier Definition
To define or change identifiers (TLC variables), use the directive:
%assign [::]expression = constant-expression
This directive introduces new identifiers (variables) or changes the values of
existing ones. The left-hand side can be a qualified reference to a variable using
the
. and [] operators, or it can be a single element of a vector or matrix. In the
case of the matrix, only the single element is changed by the assignment.
The
%assign directive inserts new identifiers into the local function scope (if
any), or into the global scope. Identifiers introduced into the function scope are
not available within functions being called, and are removed upon return from
the function. Identifiers inserted into the global scope are persistent. Existing
identifiers can be changed by completely respecifying them. The constant
expressions can include any legal identifiers from the
.rtw files. You can use
%undef to delete identifiers in the same way that you use it to remove macros.