Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
74
Добавлен:
14.04.2015
Размер:
2.03 Mб
Скачать

192

Chapter 6. Macro Processing Language

 

 

Literal and Normal Mode

In normal mode, the MPL processor scans for the metacharacter. If it is found, parameters are substituted and macros are expanded. This is the usual operation of the MPL processor.

When the literal character (*) is placed in a DEFINE function, the MPL processor shifts to literal mode while expanding the macro. The effect is similar to surrounding the entire call with the bracket function. Parameters to the literalized call are expanded, the escape, comment, and bracket functions are also expanded, but no further processing is performed. If there are any calls to other macros, they are not expanded.

If there are no parameters in the macro being defined, the DEFINE function can be called without literal character. If the macro uses parameters, the MPL processor will attempt 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 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 has not been evaluated due to the literal character, but the macro body of CD has been completely evaluated, since the literal character is not used in the

6 definition. Changing the value of TOM has no effect on CD, but it changes the value of AB:

%SET (TOM,2)

null string

%AB

2

%CD

1

%*CD

1

%*AB

%EVAL (%TOM)

Соседние файлы в папке HLP