System Debug Reference Manual (32650-90888)

210 Chapter6
System Debug Command Specifications M-X
MAC[RO]
$nmdat >
This macro has two optional parameters: num that defaults to the value 123, and loud that
defaults to TRUE.
The macro is written in a manner that allows it to be invoked as a function to return a
value that is the double of the input parameter. The second parameter controls the display
of an output line, and therefore this macro might also be used as a command to calculate a
value and display the result. When invoked as a command, the returned value is simply
ignored.
The following examples illustrate the rules governing the specification of macro
parameters for macros invoked as functions and for macros invoked as commands.
Macro Functions
For macros invoked as a function, parameters
must
be specified within parentheses as a
parameter list. The same convention applies to parameters passed to any of the System
Debug standard functions. Optional parameters can be implicitly omitted if a comma is
used as a parameter place holder. When all parameters are optional and are to be omitted,
the parentheses around the empty parameter list can be omitted.
$nmdat > wl double(1,false)
$2
$nmdat > wl double(,false)
$246
$nmdat > wl double ()
the double of $123 = $246
$246
$nmdat > wl double
the double of $123 = $246
$246
Macro Commands
For macros invoked as commands, parameter(s) can be specified without parentheses, in
the same manner that System Debug commands are normally used.
Unlike normal System Debug commands, however, parentheses can be used to surround a
parameter list for a macro command. If the first parameter to a macro command requires a
parenthesized expression, an ambiguity arises. In this case, parentheses should be used
around the entire parameter list.
Just as with macro functions, optional parameters can be implicitly omitted if a comma is
used as a parameter place holder.
$nmdat > double 1
the double of $1 = $2
$nmdat > double (2)
the double of $2 = $4