PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
[Bottom][Contents][Search][Prev]: #DefineRexx[+][Next]: #elseif
\ -> Commands -> #DependsOn


This command can be used to indicate a dependancy that is not obvious to PPWIZARD. All input and output files seen by PPWIZARD are automatically taken care of but there may be instances where you might need to indicate other files.

As an example of an INPUT dependancy, you might have a macro which reads parts of CONFIG.SYS (only you know why!) using the rexx linein() function, because your generated output is dependant on the contents of CONFIG.SYS you will wish to rebuild if the file changes.

As an example of an OUTPUT dependancy, you might not wish to use the #output command and therefore directly write to files using a rexx "lineout()" function.

A file input dependancy should be defined before the file is used as this ensures that ppwizard can detect changes to the input file even while it is executing. It does not matter when an output dependancy is defined as the timestamp is only read at completion.

If /DependsOn was not specified then the command is ignored.


[WhiteSpace]#DependsOn  ["]DepType["]  ["]StampWhat1["]  ...

The "DepType" parameter indicates should be one of:

A rebuild of your target files is required if there are any input files which have a later date/time than any of your output files (ppwizard actually only cares if file timestamps have changes, it does not matter whether a file becomes newer or older). A rebuild is also forced if an input or output file can't be located.

It is not an error (just time consuming) to specify the same item more than once.

The "StampWhat" parameter(s) are usually the names of individual files (not file masks) however for "INPUT" dependancies if an item starts with a "*" then it should be one of the following codes:

If you wish to specify a whole group of individual files matching a mask then I would suggest the use of "*files", however this only works for "input" dependencies, have a look at the "Adding Dependencies via a File Mask" section for an example of how to do this for other types.

Example 1 - Assorted TIME related Commands

The following could be used to force a compile at or after a particular date (this would be handy if your page includes information that is obsolete after a specific date):

#DependsOn INPUT ^*Rexx=date('Standard') >= '20030114'^
The rexx function "date()" (with the "Standard" option) returns a string of the form "YYYYMMDD", if you needed to be dependant on time as well then you would probably use the TimeStamp() routine instead.

The following could be used to force a compile at the start of each new year so that your pages can update any copyright messages etc:

#DependsOn INPUT ^*Rexx=left( date('Standard'), 4)^

The following uses "Expires" to ensure that a build occurs at least once per day:

#DependsOn INPUT ^*Expires=1d^

Other "tests":

#DependsOn INPUT '*TODAY'        ;;Rebuild tomorrow
#DependsOn INPUT '*EXPIRES=1w'   ;;Rebuild in another week
#DependsOn INPUT '*EXPIRES=3H'   ;;rebuild in 3 hours
#DependsOn INPUT '*EXPIRES=NOW'  ;;Must always rebuild

Of course as well as using the standard rexx date() and time() built in functions you could use BaseDate(), TimeStamp() or any routine built by anyone (rexx, therefore PPWIZARD can execute external functions).

Example 2 - Assorted Commands

#DependsOn INPUT "*CMDLINE"      ;;If command line switches change
#DependsOn INPUT "*PpWPGM"       ;;If ppwizard program changes in any way
#DependsOn INPUT ^*Rexx=getenv('ppwizard_include')^ ;;If the environment variable changes

Example 3 - Two files specified


Example 4 - Real life macro

   ;--- Outputs the size of a file (takes parameter "File") --------------------
   #( ''
       #define SizeOfFile
       #evaluate+  LocalFileName    ^ReplaceString("../{$File}", "/", "\")^
       #DependsOn  INPUT            "<$LocalFileName>"
       #evaluate+  TmpFileSize      ^FileQuerySize("<$LocalFileName>")^
       #if "<$TmpFileSize>" = ""
           #error $Failed getting size of "<$LocalFileName>"$
       <$TmpFileSize $$AddComma>
   #define SizeOfFileInSmallFont   <FONT SIZE=-1>{$Before=""}<$SizeOfFile File=*{$File}*> bytes{$After=""}</FONT>
   #define (SizeOfFileInSmallFont) <$SizeOfFileInSmallFont File=*{$File}* Before='(' After=')'>

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

[Top][Contents][Search][Prev]: #DefineRexx[+][Next]: #elseif

My whole website and this manual itself was developed using PPWIZARD (free preprocessor written by Dennis Bareis)
Saturday May 28 2022 at 2:55pm