| The ZKM PreprocessorThe ZKM preprocessor processes a ZKM Script before it is parsed and executed. The preprocessor
            System variables are replaced before include directives are actioned so an include directive may make use of a system variable.
         Also, an included file may itself contain include directives.
		 An Apache Ant example of the use of system variables in the Apache Ant environment are shown at the bottom of this page. 
         
         Note that if you start Zelix KlassMaster using theactions system variables by replacing them with their equivalent value.actions include directives by replacing them with the contents of the file specified by the directive. "-v"(ie. verbose) parameter then
            will be written to the Zelix KlassMaster log file which is namedthe contents of the properties as delivered to Zelix KlassMaster andthe expanded ZKM Script ZKM_log.txtby default. This can be very handy for debugging purposes.
         
            A system variable has the form%<variable_name>%The preprocessor looks
               for a key equal to the variable name.  If the key
            exists then the preprocessor replaces the variable with the corresponding value retrieved from the properties.
            
            For example, if there is a keyfirstly in the extra properties (if they were passed in via the build tool API) and then,the System properties my_homein the System properties associated with the value/projects/homethen the preprocessor takes the script fragmentopen "%my_home%/*";and converts it toopen "/projects/home/*";System variables can refer to the standard contents of System properties likejava.homeas%java.home%. 
            You can add your own variables to the System properties by using thejava -D<variable_name>=<variable_value>syntax
            when you start Zelix KlassMaster.  For example:java -Dmy_home=/projects/home -jar ZKM.jarNote that the command line processor of your operating system may require to use slightly different syntax.  For example, in the Windows environment,
            if you are executing Zelix KlassMaster through a batch or command file, then you will need to enclose the name value pair in double quotes as follows.java -D"my_home=/projects/home" -jar ZKM.jarIf for some reason you cannot use the command line to set System properties then there are two alternative approaches. 
			One is to set the property as an environmental variable and also set theZKM_LOAD_ENV_VARIABLES=trueenvironmental variable to tell Zelix KlassMaster 
			to load all environmental variables into System properties.
			The second alternative approach is to place the property into a file named "ZKM_System.properties" in the working directory (i.e."user.dir").  
			If Zelix KlassMaster finds such a property file then it will load its contents into System properties. The command line approach takes precedence over the environmental variable approach and the "ZKM_System.properties" approach takes precedence over the command line approach.
            To refer to an environment variables such asPATHuse the following syntax to put the value into System properties.
               An include directive has the form
                  | In Windows | java -D"PATH=%PATH%" |  
                  | In Unix | java -DPATH=$PATH |  <% include "<file_name>" %>where<file_name>is the name of the file to be included. 
            The file name can be relative (to the current directory) or absolute. For example, the include directive<% include "fragment.txt" %>Will be replaced by the contents of the file "fragment.txt". As mentioned above, include directives can make use of 
            system variables as in the following example:<% include "%my_home%/fragment.txt" %>Below is an example ZKM Script.  %MY_CLASSPATH%, %OPEN_CLASSES% and %SAVE_PATH% are system variables. 
			In the Apache Ant environment, the Zelix KlassMaster Ant task ZKMTask passes the Ant project properties through to Zelix KlassMaster (as the "extra properties" in the Zelix KlassMaster build tool API).
			So, when the ZKM Script is executed, the ZKM Preprocessor will replace the system variables in the script with the value stored under the corresponding key 
			in either the System Properties or the Apache Ant project properties.
            
            <%include "ZKMExclude.txt"%> is an include directive.
			When the ZKM Script is executed, the ZKM Preprocessor will replace the directive with the contents of the specified file "ZKMExclude.txt".Below are the contents of the file "ZKMExclude.txt".  The include directive in the ZKM Script above says that "ZKMExclude.txt" should be 
			included in the script.| 
///// Start ZKM Script TestScript.txt /////
classpath "%MY_CLASSPATH%";
open        "%OPEN_CLASSES%";
<%include "ZKMExclude.txt"%>
obfuscate   changeLogFileOut="ChangeLog.txt"
            obfuscateFlow=aggressive
            encryptStringLiterals=flowObfuscate
            lineNumbers=delete;
saveAll     "%SAVE_PATH%";
///// End ZKM Script TestScript.txt /////
 | 
 Below are the contents of the Apache Ant build file "build.xml". 
			The places where the three system variables are given values (by the addition of key/value pairs to either the Ant project properties or the system properties) appear in bold.| 
///// Start Include file ZKMExclude.txt /////
exclude     *.* public static main{java.lang.String[]);
///// End Include file ZKMExclude.txt /////
 | 
 The ZKM Preprocessor expands the ZKM Script to what appears below. The places where the three system variables were give values appear in bold. 
			The included file contents are shown in italics.| 
///// Start build.xml /////
<?xml version="1.0"?>
<project name="ZKMTask" default="main" basedir=".">
  <!-- Add a project property -->
  <property name="OPEN_CLASSES" value="\Projects\MyJar.jar"/>
  <path id="ZKM_classpath">
	<fileset dir="\JDK\j2sdkee1.4\lib" includes="j2ee.jar"/>
	<fileset dir="\JDK\WTK21\wtklib\" includes="kenv.zip"/>
  </path>
  <!-- Add a project property -->
  <property name="MY_CLASSPATH" refid="ZKM_classpath"/>
  <taskdef name="ZKM" classname="ZKMTask"/>
  <target name="main">
    <ZKM scriptFileName="\Projects\TestScript.txt" 
          logFileName="ZKM_log1.txt" 
          trimLogFileName="ZKM_TrimLog1.txt" 
          defaultExcludeFileName="defaultExclude0.txt" 
          defaultTrimExcludeFileName="\Projects\defaultTrimExclude0.txt" 
          isParseOnly="false"
          isVerbose="true" 
     >
        <!-- Add a System property -->
        <sysproperty key="SAVE_PATH" value="\Projects\save" />
     </ZKM>
  </target>
</project>
///// End build.xml /////
 | 
 | 
///// Start ZKM Script TestScript.txt /////
classpath "C:\JDK\j2sdkee1.4\lib\j2ee.jar;C:\JDK\WTK21\wtklib\kenv.zip";
open        "\Projects\MyJar.jar";
///// Start Include file ZKMExclude.txt /////
exclude     *.* public static main{java.lang.String[]);
///// End Include file ZKMExclude.txt /////
obfuscate   changeLogFileOut="ChangeLog.txt"
            obfuscateFlow=aggressive
            encryptStringLiterals=flowObfuscate
            lineNumbers=delete;
saveAll     "\Projects\save";
///// End ZKM Script TestScript.txt /////
 | 
 |