PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
| A Macro Which Expands Another |
Sometimes you wish to delay the expansion of a macro. This might be so that you can display a symbols name as well as refer to its value.
The following is a very simple macro which expands a macro whose name is passed:
;--- Expands a macro (macros name is passed) ---
#define ExpandMacro <${$#1}>
The following macro makes use of the above macro to display the color name in a "C" style comment as well as expanding the color into the integer some fictional subroutine requires:
;--- Define a macro to change color ------------
#define RED 1
#define GREEN 2
#define BLUE 3
#define ChangeColor \
/*--- The color used was "{$#1}" ---*/ %\
ChangeColor(<$ExpandMacro "{$#1}">);
This:
<$ChangeColor "RED">
Expands to:
/*--- The color used was "RED" ---*/ ChangeColor(1);