PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: {$?PARMS} - Query: How many parameters were passed?[Next]: $$ADDCOMMA
\ -> Macros -> Macro Transformations

Macro Transformations

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.

PPWIZARD provides a mechanism to hold macro data in one format but transform this data when used, this removes the need to hold the same data in multiple formats.

Transformation commands all start with $$ and apply to both macro replacement and parameter replacement within a macro. Multiple transforms may be coded, and are applied from left to right.

Transformations can apply to:


Note that most of the '$$' commands work directly on the contents of the macro (after parameter substitution). If the contents (or parameters) contained macros then you may not get the desired affect. This is generally not an issue with standard definitions.

The "$$RxVar" transformation overcomes this restriction for rexx code evaluated within PPWIZARD.

EXAMPLE - $$ Macro Replacement

If you haven't a clue what this is about, cut and paste the following and try it:

;--- Need to have access to mixed, lower and upper case values ---
#define  MixedCase  Dennis Was Here
;#define LowerCase  dennis was here
;#define UpperCase  DENNIS WAS HERE

;--- Output the 3 formats ---
Mixed case = <$MixedCase>
Lower case = <$MixedCase $$lower>
Upper case = <$MixedCase $$upper>

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>

EXAMPLE - Passing Info to REXX code

#NextId LOCK 'MyTest'
#DefineRexx 'Example'
   ;--- Examples of how parameters (literals) can be passed to rexx code ----
   @@Ok   = '{$Parm1}';         ;;OK if you know it will never contain quotes
;  @@Dies = '{$Parm2}';         ;;Will fail (unmatched quotes) because parm contains single quotes
   @@Ok   = '{$Parm2 $$SQx2}';  ;;OK if string is shortish (less than 200 or so bytes)
   @@Ok   = 'B{$Parm2 $$Rx'}A'; ;;OK if string is not too long (handles longer strings than $$SQx2).

   ;--- Probably the best way where length and contents of info unpredictable ---
   {$Parm1 $$RxVar:@@OK1}
   {$Parm2 $$RxVar:@@OK2}

#evaluate ^^ ^<$Example Parm1='asdf' Parm2=!Contains single' and double" quotes!>^
OK1: <??@@OK1>
OK2: <??@@OK2>
#NextId UNLOCK 'MyTest'

email me  any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Search][Prev]: {$?PARMS} - Query: How many parameters were passed?[Next]: $$ADDCOMMA

My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Saturday May 28 2022 at 2:55pm