PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
A #if command (like #ifdef and #ifndef) can be used to conditionally include lines of text, this can be any other type of line or command except #elseif or #endif. As an example of its use, #if allows you to examine the machine it is running on (for example its environment variables) and generate the appropriate code.
#if commands can be nested to any level and there need not be any lines between a #if and a #endif or #elseif command.
There are two forms of this command. The second exists only to speed up the performance, it supplies a small subset of the full functionality but is very much faster.
|Syntax #1 - Full Functionality (but slower)|
The "ValidRexxCondition" specifies a valid rexx conditional test which results in a TRUE or FALSE answer. The condition may be as complex as you wish and may include the special GetEnv() function (or many others) to obtain information from the environment. For complex logic an external rexx script could be called, these can return numeric or text return codes.
|Syntax #2 - Partial Functionality (but fast)|
It is recommended that this form be used where possible if you have many tests in your code, if you only have a few you probably don't need to bother. This form does a single compare between two simple values. The square brackets surrounding the compare are used to indicate that this form is supplied by the user.
[WhiteSpace]#if [Value1 Operator Value2]
The "Operator" parameter should have whitespace to either side and be one of the following:
The Value1 & Value2 parameters can be one of the following:
|Example #1 - File Exists?|
;--- One possibility --- #if FileQueryExists('licence.txt') <> '' <P>The file "licence.txt" exists (in current directory). #endif ;--- Another possibility --- #if FindFile('licence.txt') <> '' <P>The file "licence.txt" found. #endif
|Example #2 - Check environment variable|
;--- Don't not display following graphics on works INTRANET! --- #if translate(GetEnv("PRJSRCDIR")) = "E:\DB\PROJECTS\HOMEPAGE" <CENTER><IMG SRC="graphics/fatguy.gif" BORDER=0 WIDTH=182 HEIGHT=181></CENTER> #endif ;--- A better way to do the above --- #if ["<?*PRJSRCDIR $$upper>" = "E:\DB\PROJECTS\HOMEPAGE"] blah blah #endif
#define StupidExampleMacro \ <P>Hi, my name is Dennis Bareis and I have been using OS/2 and developing for \ #if ['<$AtWork>' = 'Y'] \ BNZ \ #elseif \ *WRONG INC* \ #endif \ on and off since the original 1.0 version.