Keil Logo

Literal and Normal Modes

The MPL macro processor has two modes of operation: normal mode and literal mode.

  • In Normal Mode, the meta character precedes MPL macro functions and macro parameters. The MPL macro processor scans for this character in macro definitions and, if found, substitutes parameters and expands macros. This is the default mode of operation.
  • In Literal Mode, the MPL macro processor expands macro definitions without processing potential macro functions or substituting parameters.

To define a macro for literal mode, the asterisk character ('*') is prefixed to the DEFINE function. For example:

%*DEFINE (macro-name) <[>parameter-list<]> (macro-body)

The effect of a literal mode function is similar to surrounding a normal function call with the bracket function. Parameters to the literalized call are expanded; the escape, comment, and bracket functions are expanded; but no further processing is performed. If calls to other macros exist, they are not expanded.

If no parameters exist in the literal mode macro definition, the DEFINE function may be called without a literal character. If the macro uses parameters, the macro processor attempts to evaluate the formal parameters in the macro body as parameterless macro calls.

The following example illustrates the difference between defining a macro in literal mode and in normal mode:

%SET (TOM, 1)

%*DEFINE (AB) (%EVAL (%TOM))
%DEFINE (CD) (%EVAL (%TOM))

When AB and CD are defined, TOM is equal to 1. The macro body of AB is not evaluated because the macro is a literal mode macro. However, the macro body of CD is evaluated because it is a normal mode macro. Changing the value of TOM has no effect on CD, but it changes the value of AB, as follows:

%SET (TOM,2)   -> null string
%AB            -> 2
%CD            -> 1

%*CD           -> 1
%*AB           -> %EVAL (%TOM)
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.