PPWIZARD is a free preprocessor for HTML, REXX, Visual Basic or any text files.
#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.
Syntax |
[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:
One example of why you might want to do this is my DLCNTR ppwizard add-on where it marks "new" downloads if they are recent, I need to check if recent every day.
One good example of how to use this is where your build depends on the value of an environment variable (although in this case a "*Exec" of the "set" command would also work in most operating systems).
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 |
#DependsOn INPUT "C:\CONFIG.SYS" "C:\STARTUP.CMD"
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>"$ #endif <$TmpFileSize $$AddComma> #) #define SizeOfFileInSmallFont <FONT SIZE=-1>{$Before=""}<$SizeOfFile File=*{$File}*> bytes{$After=""}</FONT> #define (SizeOfFileInSmallFont) <$SizeOfFileInSmallFont File=*{$File}* Before='(' After=')'>