DEFINE MACRO

Create a macro.

Syntax

DEFINE MACRO [/OVERWRITE] [/BUTTON] name "text"

Parameters

/OVERWRITE

Redefining an existing macro causes an error message. It is possible to redefine a macro if the option /OVERWRITE is used. In this case, only a warning message appears.

/BUTTON

It is possible to define toolbar buttons for the macro by using the /BUTTON option. The macro is executed whenever the associated button is pressed. The button is allocated with the same name as the macro.

name

The macro name consisting of letters and digits. The first character has to be a letter.

text

The replacement text of the macro. It can contain more than one line.

Description

The DEFINE MACRO command defines a new macro. If the macro is defined inside a batch file, the ‘\' (backslash) must be inserted just before the newline if the macro body spans more than one line. The maximum number of macro parameters is 19. These parameters can be addressed by @number. The macro may contain any text. See also Escape Sequences.

Macros cannot be used recursively. The execution of the macro on the command level is done by:

@name (parameter1,…,parameter9)

Only the parameters actually used must be specified. The others are replaced by empty strings. The macro is replaced and the replacement text is interpreted like any other input. Macros can be nested and used as parameters to other macros. The parameters are expanded during the scanning of the parameter list. If no parameters are given, the parentheses may be omitted. Macros must not be recursive!

Macros and debugger variables use the same designations. In case of equal names, the macro definition is used.

If the macro contains more than one command, the commands must be separated by semicolons.

Example

DEFINE MACRO MAC0 "SET BREAK AT @1"

Invocation of macro MAC0:

@MAC0 (@LINE 29)
DEFINE MACRO CONTINUE "RUN"
DEFINE MACRO FILENAM "testset.@1"

Invocation of macro FILENAM:

SET LOGFILE @FILENAM(log)
DEFINE MACRO /OVERWRITE CONTINUE "STEP"
DEFINE MACRO BREAK "set @1 at @2"

Invocations of macro BREAK:

@BREAK (BREAKPOINT,main)
@BREAK (WATCHPOINT, @line 70)
DEFINE MACRO /BUTTON MAC "set @1 at @2"

This macro is called by clicking on the corresponding button MAC. A dialog box appears to enter the parameters @1 and @2. The parameters need to be separated by commas.

See Also

For more complete information about compiler optimizations, see our Optimization Notice.