PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: /FILESR[Next]: /FilterOutput
\ -> PPWIZARD Command Line -> Switches -> /FilterInput

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:

  1. The literal 'I' indicates that input is being filtered.

  2. The line as read by rexx (still has comments and all whitespace).

  3. The name of the file where the line came from.

  4. The line number of the source file being processed (first line is 1).

  5. The overall input line number (counter).

  6. The newline character you should use if returning more than one line.

The following environment variables are also available for use:

    This variable contains the version number of the interface used by this program. This version number will only change when PPWIZARD has been modified in such a way that existing input filters could break. It is recommended that you validate the interface in your filter.

    This variable tells you the current debug state ('Y' means on). This can be modified by the #debug command or the "/debug" command line switch.

  3. Your Own Variables
    You can create your own state variables in the environment.

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.


  1. You may modify the passed line in any way you wish and return the result.

  2. You may pass back more than one line by separating the lines with the passed newline character. This allows you to insert macros or #include instructions.

  3. You may drop a line altogether by returning the string value "d2c(0)".

  4. You may indicate an error by returning "d2c(0)" followed the error message, processing will stop.


/* 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
   /*--- 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 || ')' );

/*--- 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
   /*--- We wish to drop the 1st line ---------------------------------------*/
   if  DebugOn = 'Y' then
       say '          We are dropping this line';
   /*--- 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!');

/*                                                                           */
/* arg(1) : Name of environment variable.                                    */
   return( value(arg(1),,'OS2ENVIRONMENT') );

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

[Top][Contents][Search][Prev]: /FILESR[Next]: /FilterOutput

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