PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: Macro Parameters without values (Keyword)[Next]: Using Standard Definitions + Using REXX Logic
\ -> Macros -> Positional Parameters (not named)

Positional Parameters (not named)

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.

In some cases (especially with simple one parameter macros) you may simply wish to supply a value without bothering to name it. For example one way to implement a HTML comment might be:

   ;--- Define a macro (takes a parameter called "Text") ----
   #define COMMENT <!-- {$Text} -->

   ;--- Use the above macro ---
   <$COMMENT Text="This will become a html comment">

As you can see from the above we had to use "Text=" even though that is all the parameter could be (at least correctly), lets do this again but this time using a positional parameter:

   ;--- Define a macro (takes a single positional parameter) ----
   #define COMMENT <!-- {$#1} -->

   ;--- Use the above macro ---
   <$COMMENT "This will become a html comment">

The fact that PPWIZARD supports keyword parameters complicates things as a parameter without a value can easily be mistaken for a keyword so the rules are:

  1. Starts with a 'QUOTE'
    Something that starts with a "quote" is a positional parameter, the quote chars include single and double quotes .

  2. Starts with a '=
    If you can't quote the value with one of the above listed "quotes", then you can begin with an equal. The value following is a normal quoted value.

The macro contents refers to the parameters as a '#' followed by a decimal number which indicates its position (there can be any number of positional parameters).


   ;--- Use the above macro ---
   <$COMMENT  "Using double quotes">
   <$COMMENT  'Using single quotes'>
   <$COMMENT =@If all normal "quote" chars were (or could be) in this string@>

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

[Top][Contents][Search][Prev]: Macro Parameters without values (Keyword)[Next]: Using Standard Definitions + Using REXX Logic

My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Sunday November 05 2017 at 10:00am