Macro

Use

Defines a macro.

Command Syntax

MACRO macro-name = [action-list]

where:

action-list
Specifies a set of one or more CodeWatch commands separated by semicolons

Description

The MACRO command is used to define a macro as shorthand for an action-list. Sixty-four macros can be defined at any one time.

Note: Do not choose a macro name that is the same as a debugger command name, because the macro name will override the debugger command.

The action-list is specified in the usual way.

Once a macro has been defined, its name may be used just like any other debugger command name. The macro in the command line is replaced by the debugger commands specified in the action-list. Those commands are then executed normally.

If the last (or only) command in the action-list does not end with a semicolon, any additional arguments to that command can appear on a command line after the macro name. For example, suppose the following macro has been defined:

FOO = [ LET A = A + ]

The command FOO 3 can then be entered to add 3 to A.

Example

In this example, the macro info is defined that lists all breakpoints, the current evaluation environment, all macros, and the current execution point.

CodeWatch> MACRO info = [LB /ALL; LENV; LMACRO /ALL; WHERE] 
CodeWatch> info
Break set at PRIME\118 (count = 2)
Break set at PRIMES.READ_INPUT\%ENTRY
Break set at PRIME.ISPRIME\%ENTRY (COUNT = 1)
Evaluation environment is PRIMES.ISPRIME
   info = [LB /ALL; LENV; LMA /ALL; WHERE]
Current execution point is PRIMES.ISPRIME\%EXIT

In the following example, the macro fig is defined to perform a case-insensitive search for the string you wish to specify as an argument.

CodeWatch> MACRO fig = [FIND /IGNORE] 
CodeWatch> fig MAIN
  /* Main program */