The CollageSystem expects its input in a single plain text file that can be
created using any standard ASCII editor.
The notation of the syntax below uses some kind of Backus-Naur-Form where most Nonterminals have hypertext links to their definitions. Terminals represent the text that has actually to be typed into the file.
Before the input file is presented to the parser of the CollageSystem,
it is preprocessed by the program
cpp, the text preprocessor
of the C and C++ languages. The function of the preprocessor is documented in detail under the cpp or cc manpages. Here's a short summary of what it does:
#(number sign) is expected to be followed by a preprocessor command, such as
#definecan be used to define all kinds of makros, i.e. for constant definitions or even simple functions. Some examples:
#define pi 3.1415269
piis replaced by
#define quad(x) ((x)*(x))
quad(4)is replaced by
((4)*(4))and this, in turn, is evaluated by the CollageSystem's parser in the way you would expect.
#iffollowed by a constant expression can be used to conditionally activate or deactivate portions of the text (conditional compilation). If the expression evaluates to a zero value then the following text upto the next
#endifis ignored so that the parser of the CollageSystem does not see it. For example:
#define TRI 1If the macro
#define mypart polygon 0,0 1,0 .5,.7
#define mypart polygon 0,0 1,0 1,1 0,1
TRIis defined as 1 then
mypartwill be defined as a triangle. Otherwise,
mypartwill be a square.
#includefollowed by a filename enclosed in quotation marks includes the file into the text. This can be used to split definitions over several files and to build reusable libraries. For example: