![]() | ![]() | ![]() | ![]() | ![]() |
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.
Macros parameter where they were supplied on a reference without a value that and begin with '$$' have special meaning, they are commands to PPWIZARD. The command applies to the complete contents of a macro before and replacement of parameters has occurred.
As well as all '$$' commands shown earlier (except the $$PASS ones) these commands are also available:
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.
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.
A simple example where if the "$$SQX2" command were not used that ppwizard would fail (in this case with variable "A" unknown trap):
#define TheMacro The value 'A' is in quotes #evaluate "" "call Summary 'VALUE', '<$TheMacro $$SQx2>'"
Another example where we wish to add commas to a rexx variable:
Value = <??ARexxVariable $$ADDCOMMA>
Here is another example which may be useful if you were creating 'C' code and maybe other situations:
;--- Define directory (non 'C' format as used elsewhere) --- #define DIR_NAME C:\DB\PROJECTS\FRED ;--- Define a macro to transform a string into 'C' format --- #DefineRexx REXX_$$TO_C_STRING TheValue = ReplaceString(TheValue, '\', '\\'); TheValue = ReplaceString(TheValue, '"', '\"'); TheValue = ReplaceString(TheValue, d2c(10), '\n'); TheValue = ReplaceString(TheValue, d2c(13), '\r'); TheValue = ReplaceString(TheValue, d2c(7), '\b'); #DefineRexx ;--- Use our defined transformation --- StringC = "<$DIR_NAME $$TO_C_STRING>";
Note that most of the above '$$' commands work directly on the contents of the macro. If the contents contains macros then you may not get the desired affect.
![]() | ![]() | ![]() | ![]() | ![]() |