Previous  |  Next ]     [ Up  |  First  |  Last ]     (Article 6 of 8)
 
 
To invoke the preprocessor use:
 
((w)perl) preprocessor.pl CommentCharacter JobFile
Eg: wperl preprocessor.pl %% Path\to\preprocessor.pp
 
 

 
 
The JobFile can contain anything, only the lines will be processed that correspond the syntax: <newline><comment character><hashmark><keyword><semicolon> etc. described below:
The order of the entries is arbitrary, they will be processed in the following order anyway: UPDATEON, UPDATE, WRITEPP
Italics mean optional parameters. In the examples below % will be the comment character.
 
JobFile entry:  %#UPDATEON: COMPUTERNAME "Path\to\file" >>> post-preprocess command to the system
After backing up to Path\to\filename.ext.ppbckp, this will rewrite the original file on the given computer, but only if it differs from the one identified by COMPUTERNAME. The COMPUTERNAME record will be also overwritten in the JobFile with the name of the current computer. This ensures that the file will be updated only once every time it is being processed on an other computer. The file to be processed can contain the following entries:
 
%#VAR_1 = ""This can be a long-long multiline expression with environmental variables, etc., see below...""
%#DEFON137 = ""s⁄replace this⁄for this⁄imsxoge""  See Perl Quick Reference on the usage of the s⁄⁄⁄ and tr⁄⁄⁄ operators.
 
All the substitutions defined with the DEFON statements will be applied to the document. In these statements, you can use all the variables defined within the same file, all the environmental variables and also $SPC_PATH. It is a good practice to use markers with the same label, like %#M137 to make matching easier and clearer!
 
 
JobFile entry:  %#UPDATE: "Path\to\file" >>> post-preprocess command to the system
UPDATE works the same way as UPDATEON, with a few differences: this carries out the replacements every time regardless of the COMPUTERNAME, and overwrites the document if and only if the replacements eventually change the content of the file. It compiles every DEF*** commands except those which begin with DEFON***.
 
 
JobFile entry:  %#WRITEPP: "Path\to\file"
Where file contains definition of variables at the beginning of new lines, like:
 
%#VAR_eXamPle1 = "" some stuff, where you need to put \\ backslash before any \' apostrophe, and \\ backslash, like: \\\' ""
 
... and references to these variables anywhere in the file: $VAR_eXamPle1. On each and every call, the preprocessor will replace $VAR_eXamPle1 to its value, and write the resulting file into a new file: Path\to\filename_pp.ext, which has to be included in any further compilation, etc... The original file won't be affected.
 
 

 
 
On VARiables:
%but than you need to begin them with the <comment character, eg. %>. Don\'t forget to use backslash, when: \\ or \'! This was written on $ENV_COMPUTERNAME to a file on the path $SPC_PATH.""
 
 
On DEFinitions:
 
 
Beware of the following: