|
Previous Next . Contents |
About . Documentation . License . Download |
Here is the XML DTD specifying the configuration file syntax:
<!ELEMENT p18cfg (input* define* undef* macro* option*)>
<!ELEMENT input (define* undef* macro* option* files*)>
<!ATTLIST input
name CDATA #IMPLIED
path CDATA #REQUIRED
>
<!ELEMENT define EMPTY>
<!ATTLIST define
name CDATA #REQUIRED
value CDATA #REQUIRED
>
<!ELEMENT undef EMPTY>
<!ATTLIST undef
name CDATA #REQUIRED
var-only (yes|no) "no"
>
<!ELEMENT macro (parameter)* (#PCDATA)>
<!ATTLIST macro
name CDATA #REQUIRED
>
<!ELEMENT parameter EMPTY>
<!ATTLIST parameter
name CDATA #REQUIRED
default CDATA #IMPLIED
vararg (yes|no) "no"
>
<!ELEMENT option EMPTY>
<!ATTLIST option
name CDATA #REQUIRED
value CDATA #IMPLIED
>
<!ELEMENT files (#PCDATA)>
|
| name | |
| The symbolic name associated with the input object. If this parameter is omitted, it defaults to the last component of the path parameter. | |
| path | |
| The path to the base directory of the input object. All input filenames and filename patterns are interpreted relative to this directory. | |
In an <input> element, the files (and file patterns) for all files represented by the input object are specified through one or more <files> elements. The contents of all <files> elements are interpreted as whitespace-separated lists of input file patterns. These patterns are glob-style patterns (i.e. the patterns may include the wildcard characters known from the UNIX command shell).
The <option> element takes the following parameters:
| name | |
| The name of the option. | |
| value | |
| The value bound to the option name. | |
| name | |
| The name of the variable/macro. | |
| value | |
| The value bound to the named variable/macro. | |
The <macro> elements takes the following parameters:
| name | |
| The name of the macro/variable. | |
The <parameter> element may appear inside the <macro> element, to specify the parameters taken by the macro. The <parameters> element takes the following parameters:
| name | |
| The name of the parameter. When the macro is expanded, the argument passed for that parameter is available through a variable with the specified name. | |
| default | |
| The default value for the parameter. If the macro is invoked with less arguments than defined parameters, the omitted arguments are replaced by the specified default values. | |
| vararg | |
| Valid values for this parameter are "yes" and "no" (the default is "no"). The value "yes" indicates that extra arguments passed to the macro should be combined to a single argument. Only the last parameter specified may be a vararg-parameter. | |
The <undef> element takes the following parameters:
| name | |
| The name of the variable/macro to be undefined. | |
| var-only | |
| Valid values for this parameter are "yes" and "no" (the default is "no"). The value "yes" indicates that only the variable with the specified name should be undefined. The default is to undefine all associated variables (i.e. macro definitions and default parameters). | |
| output-path | |
| The base path for the output files. When the preprocessor is run, the output files are generated relative to this directory, using the filenames derived from the <files> element in the input object. Note that this may actually mean that files are created in a subdirectory of the specified output path. | |
| create-directories | |
| If this option is set to a string representing TRUE, the directory hierarchy for the output files is created if it does not exit. The default is to issue an error message if an output directory does not exit. | |
| language | |
| The output language. The default value is "*", which means that the messages will not be translated. Note that if this option is specified, the value takes precedence over an output language specified on the command line (which is equivalent to a global option). It is probably better not to specify this option in a configuration file. | |
| config-status | |
| Specify the location of the projects "config.status" file (assuming the project uses GNU autoconf). All variables defined in the specified "config.status" file are defined as preprocessor variables. | |
| database | |
| Specify the translation database file. This
option is recognized only as a global option. Note: The translation database file is read on startup, i.e. this option has no effect if the configuration file is read through a config command. The option only works if the configuration file is specified on the invocation command line. | |
Note: When specifying options, be careful to double-check that the option names are correct. P18 will silently ignore options it does not know. This may change for the 1.0 release.
<p18cfg> <option name="create-directories" value="true"/> <option name="config-status" value="../config.status"/> <input name="doc" path="./html.in"> <option name="output-path" value="./html"/> <files>*.html</files> </input> </p18cfg> |
Although it is possible to define variables and macros in the configuration file, it is probably better to define macros and variables through an include file (i.e. a file that is read by the source files using an ##include directive). However, here's a more complex example of a configuration file defining some variables and macros:
<p18cfg>
<option name="create-directories" value="true"/>
<define name="PACKAGE" value="FOO-Wizard"/>
<define name="VERSION" value="1.0"/>
<input name="webapp" path="./php.in">
<option name="output-path" value="./php"/>
<files>
*.php
*.inc
*.html
</files>
<define name="ENABLE_FEATURE_A" value="1"/>
<define name="ENABLE_FEATURE_B" value="1"/>
<undef name="ENABLE_FEATURE_C"/>
</input>
<macro name="FEATURE">
<parameter name="feature"/>
## if ENABLE_@feature@
</macro>
<macro name="FEATURE_END">
## endif
</macro>
</p18cfg>
|
|
Previous Next . Contents |
About . Documentation . License . Download |