| |||
| Home > Working with the CLI > Macro language > Macro definition | |||
A macro definition must contain:
the DEFINE command (see DEFINE on DEFINE)
the macro name
the macro body
a terminating full stop or period (.)
as the first and only character on the last line.
The syntax of a macro definition is as follows:
DEFINE [/R] [return_type] macro_name([parameter_list])
[param_definitions]
{
macro_body
}
.
where:
/RThe new macro can replace an existing symbol with the same name.
return_typeThe return type for the macro and is an optional component of the macro definition. The default type is int.
One use of a macro return value is to control what action RealView Debugger takes when a conditional breakpoint is triggered (for example, see BREAKINSTRUCTION).
parameter_listA parameter list for the macro and is an optional
component of the macro definition. You specify a parameter list
in the same way that you specify arguments for a C function. If parameter_list is defined
then the type must also be specified or else type int is assumed.
The following example illustrates the use of a parameter_list:
define int scpy(target, source)
char *target;
char *source;
The declaration defines arguments for the macro scpy().
The type of both the target and the source are declared to be pointers
to a char.
For full details on the DEFINE command, see DEFINE on DEFINE.