Monarch 9460 Printer User Manual


 
5-58 Command Reference
MACRO
Purpose Defines or invokes a single command the software expands to multiple commands
during script translation.
Syntax To define the macro ...
MACRO
macro-name
BEGIN
macro-body
END
To invoke the macro ...
macro-name
arg1 , arg2 , ... , arg99
Process The MACRO command defines or invokes a macro. A macro is a single command
the software expands to multiple commands during script translation. Each time a
macro command appears, the software inserts the commands it generates into the
script.
NOTE: Do Not use IF, SWITCH, or WHILE inside a macro.
Defining the Macro ...
The
macro-name
is an identifier naming the macro. The
macro-body
contains the
commands defining what the macro does. The keywords BEGIN and END define
macro-body
's boundary and limit the scope of control transfer to within the
boundary.
Keep macros in a separate macro file you include in the source script using the
INCLUDE command.
Rule: You must define macros before invoking them.
Invoking the Macro ...
The macro matches arguments. The first argument replaces %1, the second
argument replaces %2, and so on, up to %99 arguments.
Labels are handled differently in macros. The label names inside the macro body
should use this form:
*macro-label-name$
where
macro-label-name
is a unique name for the macro. The label can be up to
eight characters. This restriction helps avoid duplicate labels if a macro appears
within a function more than once.
As the compiler expands each macro ...
it expands the labels.
it expands each dollar sign ($) into a unique three-digit number.