## ALP Programming Guide and Reference

[prev][next][parent][TOC]

### Macro Definition

A macro definition consists of three essential parts:

The MACRO directive, defining the Name and the Parameter-List
The body of the macro, containing the prototypes of statements to produce when you invoke the macro for expansion.
The ENDM directive, ending the definition of the macro.

Syntax

    Name   MACRO   [ Parameter   [ ,   Parameter   . . . ] ]
       .
       .
       .
    ENDM

Remarks

The Name field must be a valid preprocessor identifier and specifies the symbolic name that the user will refer to when invoking the macro for expansion. If Name is already defined, it must be that of a previous macro definition, otherwise an error message is issued. Macros may be redefined to have a different Parameter-Lists or macro body text; doing so causes the previous definition to be lost.

The optional Parameter-List is the complete comma-separated list of all Parameter valuess given in the macro definition statement. A parameter must be a valid symbol name according to the rules for naming preprocessor and assembler identifiers. Each parameter becomes a symbol that is local to the macro being defined and is recognized during macro expansion prior to searching the global name space. Thus, macro parameters need not have names unique from identifiers defined elsewhere in the program.