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

Macro Parameters without values (Keyword)

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.

A macro reference would normally specify values for all parameters it uses, however there are times when this is not required. PPWIZARD does not require you to set a value, if you don't supply one then the name of the parameter in upper case is used.

The definition of the macro would supply a default value in case the parameter (keyword) was not used and would normally do some conditional generation (using #if etc).

You may wish to have a look at the rules that apply to positional parameters as these are used as a way of telling Keyword and positional parameters apart!

The following example shows a simple macro with very little validation that simply assumes if the "keyword" "start" was not supplied that the "end" condition is required:

;--- Define the macro ---
#define StupidMacro                 \
        #if '{$START=""}' = 'START' \
            start stuff             \
        #elseif                     \
            end stuff               \
        #endif

;--- Use the macro ---
<$StupidMacro start>   ;;Start
   stuff
<$StupidMacro>         ;;End


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

[Top][Contents][Search][Prev]: Macros With Optional Parameters[Next]: Positional Parameters (not named)


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