PPWIZARD Manual
Special MACRO PARAMETER Replacement "$$" Commands
The subject of macros is reasonably complex (but well worth learning) please ensure you have at least
read the macro introduction before reading this section.
Within a macro's data, when referring to a parameter you can specify
certain special commands (all begin with '$$').
These commands (there can be more than one) occur immediately preceeding
the '}' character, available commands are:
- $$PASSDSQ
The parameter will be quoted as per the $$DSQ command and the parameter name followed by the equal sign will be added to the start.
This is handy when one macro uses another and a parameter needs to be passed to the inner macro (parameter has same name in both macros). - $$PASSAQ
The parameter will be quoted as per the $$AQ command and the parameter name followed by the equal sign will be added to the start.
This is handy when one macro uses another and a parameter needs to be passed to the inner macro (parameter has same name in both macros). - $$IGNORE
The parameter will be "dropped" (a empty string will be substituted). The main reason you might want to do this is to prevent a '"{$?}"' type parameter from including this parameter.
- $$DSQ
You use this command to surround your parameters data with quotes. The quotes used are double or single quotes, if neither can be used ppwizard will terminate. - $$SDQ
You use this command to surround your parameters data with quotes. The quotes used are single or double quotes, if neither can be used ppwizard will terminate. - $$AQ
You use this command to surround your parameters data with quotes.
The quotes used are double or single quotes, if neither can be used ppwizard will go through a whole list of alternative 'quote' characters,
if none of these can be used then ppwizard will terminate. - $$HTMLQ
The parameter is all or part of a string surrounded by double quotes, any double quotes that exist in the data should be converted to ""e;". - $$RX'
This can be very useful if you wish to use the value in a rexx string which is surrounded by single quotes. It makes sure that the value will not break any rexx rules.
Note that there is also a '$$RX"' variant for use in double quoted rexx literals.
- $$SPCPLUS
A space is added before the start of the value if it is non-empty. - $$SQX2
The value is modified such that all single quote characters are doubled up.
This can be very useful if you wish to use the value in a rexx string which is surrounded by single quotes as rexx will
in this situation treat the two single quotes as a single single quote that does not terminate the string.
It should be noted that under regina there is a limitation that a long string could break so I now recommend the use of "$$RX'" instead.
- $$UPPER
The parameter will be converted to upper case. - $$LOWER
The parameter will be converted to lower case. - $$ADDCOMMA
The parameter will be formatted using AddCommasToDecimalNumber(). - $$?
If the '$$' command is otherwise unknown you can create your own formatting (ie you can not redefine an existing format).
To define a format you need to define a macro which contains the rexx formatting code. The macro must have the name of "REXX_$$" followed by the name of your command, for
example to use the command "$$TO_C_STRING" you would create "REXX_$$TO_C_STRING". The value to be formatted is in the "TheValue" variable.
If required you can also determine the source of the value (macro or parameter name) as it is stored in "TheName" (for case insensitive items it is in upper case).
For macro parameters only the name of the macro being expanded is in the "TheMacro" variable.
Note that the quoting routines above do more than just make your code
"prettier", without using these commands you have to decide on a quote
character yourself and then a parameters value must never contain this
character. These special commands won't solve all quoting issues
(remember parameter processed left to right - imbedded parameters are
not processed first) however they will make life much easier.
Lets make sure that parameters 2 and 3 in the following macro get
translated to upper case:
;--- Define macro ---------
#define SimpleTest P1={$parm1}, P2={$parm2="parm1_default" $$upper}, P3={$parm3 $$upper $$DSQ}
;--- Expand macro ---------
<$SimpleTest Parm1='value1' Parm2='value2' Parm3='value3'>
PPWIZARD Manual

Tuesday January 02 2001 at 7:37am