PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
#Unknown Commands |
Normally ppwizard dies if you specify an invalid command. PPWIZARD allows you to extend the range of available commands if you wish.
One good reason why you might wish to do this is to create your own set of commands to integrate better with ppwizard, you don't wish to rely on a user specifying macros etc or you just feel the syntax is cleaner.
The first time ppwizard finds an unknown command it will look for a macro with the name UNKNOWN_HASH_COMMANDS. This macro should contain the rexx code to be executed.
The following rexx variables are significant:
If you wish to generate a newline which appears in the output file then you should use "<?NewLine>" otherwise you should use a newline character (ascii 10), to do this you can use d2c(10) or '0A'x (the second form is faster as no function called).
Example |
;--- Define Handler for new #commands --------------------------------------- #DefineRexx 'UNKNOWN_HASH_COMMANDS' select /*++++++++++++++++++++++++++++++++++++++++++++++*/ when HashCmd = HashPrefix || 'SET' then /*++++++++++++++++++++++++++++++++++++++++++++++*/ CmdGenerates = HashParms || '<' || '?NewLine>' || HashParms; /*++++++++++++++++++++++++++++++++++++++++++++++*/ when HashCmd = HashPrefix || 'EXECPPW' then /*++++++++++++++++++++++++++++++++++++++++++++++*/ CmdGenerates = HashParms || d2c(10) || HashParms; /*++++++++++++++++++++++++++++++++++++++++++++++*/ otherwise /*++++++++++++++++++++++++++++++++++++++++++++++*/ Error('Unknown command of "' || HashCmd || '"'); end; #DefineRexx ;--- Create macro to test use of unknown commands in a macro ---------------- #define XXXX \ (START) -\ #SET 222222_ -\ #SET 333333_ -\ (END) ;--- Do some tests (in and out of macro) ------------------------------------ 1111111 <$XXXX> 4444444 #SET 555555_ #SET 666666_ ;--- Test generation of ppwizard commands ----------------------------------- #ExecPpw #define A B ;--- Next line does and should fail (unknown command) ----------------------- #XXX .....