PPWIZARD Manual
[Bottom][Contents][Search][Prev]: Quoted Text - qRestq[Next]: Simplest Macros

Macros

Macros are collections of text and/or commands and would have to be one of the most important and most used features of this preprocessor.

Macros can be created using one of the following methods:

  1. #define[+]
  2. #evaluate[+]
  3. MacroSet()
  4. /define

The simplest types of macro simply allows you to define text which you will use over and over again. You will want to specify it in one place so that if it ever changes you won't need to hunt up all occurances. The following example shows an email address being defined (this would normally be done in a central place and be accessed with #include):

    #define MyEmailAddress           dbareis@labyrinth.net.au
    

Now that we have defined the email address (once as per example above), in all the html pages that required it we could refer to it as in:

    <P>If you have any questions or suggestions for improvements please feel free to
    <A HREF="mailto:<$MyEmailAddress>">email me</A>.
    

There are also a number of "Standard Macros" which always exist, including the following specialised forms:

  1. <?xXX>
  2. <??RexxVariable>

All normal macros are replaced before standard macros. The "<?xXX>" form is never replaced until just before the line is to be written to the output file.

The following sections provide more details about macros (please read in order):

  1. Simplest Macros
  2. Using Standard Definitions + Using REXX Logic
  3. Multi Line Macros
  4. Macros With Mandatory Parameters
  5. Macros With Optional Parameters
  6. Macro Parameters without values
  7. Positional Parameters (not named)
  8. Expand All Unused Parameters
  9. Special MACRO Replacement "$$" Commands
  10. Special MACRO PARAMETER Replacement "$$" Commands
  11. Multi Line Macros With Logic

A macro's name (or parameter) can be very long and can contain nearly any character (space and end of macro replacement character are the main exceptions). You will be told if a macro name is invalid when you try to define it. The maximum length of a macro will be approximately 100 characters in OS/2 rexx and unlimited with the regina interpreter.

The name of a macro (and it's parameters) are normally case insensitive, however you can make them case sensitive by using the CsReplacement option. When this option is not used all macros and parameters are converted to upper case.


[Top][Contents][Search][Prev]: Quoted Text - qRestq[Next]: Simplest Macros

PPWIZARD Manual
My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Wednesday October 04 2000 at 5:05pm