Preprocessing changes the source code before it is compiled. With this mechanism any
device optimization can be done easily. An example is the inclusion of the J2ME Polish GUI,
which is "weaved" into the application by the build-process without any intervention of the developer.
Most preprocessing is triggered by directives, which use either symbols or variables.
A symbol is like a boolean value - either it is defined or the symbol is not defined.
A variable, however, always contains a value, which can be used or compared during the
Symbols and variables are defined in several files:
- build.xml: with the "symbols"-attribute of the <build> element and with the <variables> element
- vendors.xml, groups.xml, devices.xml: symbols are defined by the <features> element, whereas variables are defined by the capabilities. Most capabilities also define symbols.
Preprocessing directives always start
"//#" and often have one or more
arguments. All directives must not span several rows.
J2ME Polish supports all directives (and more) of the antenna preprocessor (antenna.sourceforge.net),
by the way. So if you migrate from antenna, you can keep your preprocessing directives.