PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
Switch /FilterInput:RexxCmdFile |
This is a PPWIZARD command line switch.
This will probably be a rarely used option. This switch allows you to translate file input a line at a time. The mechanism provides the filter enough information to perform complex processing (in case required). Your filter routine will return the possibly changed line or lines.
In most cases it would probably be easier to write a translation procedure as a separate step before PPWIZARD is invoked (however sometimes this may not be practical).
The rexx filter code you identify will be passed the following arguments:
The following environment variables are also available for use:
I have a need where each input line is encrypted to prevent tampering by users, the source is divided over many header files. For a number of reasons I do not wish to perform a separate step to get the files in the clear. This switch is my generic solution.
WHAT YOU RETURN |
EXAMPLE OF INPUT FILTER |
/************************************************/ /* Stupid non-useful example of an input filter */ /************************************************/ /*--- Get ALL parameters ----------------------------------------------------*/ FilterType = arg(1); TheLine = arg(2); FromFile = arg(3); FromFileLine = arg(4); TotalLine = arg(5); NewLine = arg(6); /*--- Check ONCE if on correct interface ------------------------------------*/ if TotalLine = 1 then do /*--- Filter written to interface version "98.131" --------------------------*/ WrittenToFilterVer = "98.131"; CallersVer = GetEnv("PPWIZARD_VER_II"); if CallersVer <> WrittenToFilterVer then return(d2c(0) || 'FILTERIN: Interface written to version ' || WrittenToFilterVer || ' (found ' || CallersVer || ')' ); end; /*--- Get current debug state (output input line if debug is on) ------------*/ DebugOn = GetEnv("PPWIZARD_DEBUG"); if DebugOn = 'Y' then say 'FILTERIN: #' || TotalLine || ' -> ' || TheLine; /*--- Process the input -----------------------------------------------------*/ if TotalLine = 1 then do /*--- We wish to drop the 1st line ---------------------------------------*/ if DebugOn = 'Y' then say ' We are dropping this line'; return(d2c(0)); end; else do /*--- Now either insert a line (if 4th) or return line unchanged ---------*/ if TotalLine = 4 then return(TheLine || NewLine || 'This line was inserted after the 4th line input line!'); else return(TheLine); end; /*===========================================================================*/ GetEnv: /* */ /* arg(1) : Name of environment variable. */ /*===========================================================================*/ return( value(arg(1),,'OS2ENVIRONMENT') );