User guide
2.1. LANGUAGE OVERVIEW 13
2.1.2 The GET Directive
A directives of the form GET "filename" is replaced by the contents of the named
file. Ear l y versions of the compiler only inserted the file up to the first occurring
dot but now the entire file is inserted. By convention, GET directives n o r m al ly
appear on separate lines. If the filename does not end in .h or .b the extension
.h is added.
The name is looked up by first s ear ching the current directory and t hen
the directori es specified by the environment variabl e whose nam e is held in the
rtn hdrsvar of the rootnode, b u t this can be overridden using the hdrs com-
piler option. The default environment variable for BCPL headers is BCPLHDRS
under Cintsys and POSHDRS under Cintpos. Header files are normally in the g/
directory in the root direct o r y of the curr ent syste m . To check whether the envi-
ronment variables are set cor r ect l y, enter cintsys or cintpos with the -f option
as suggested in Section 3.6.
2.1.3 Conditional Compilation
A simple mechanism, whose implementation takes fewer than 20 lines of code
in the lexical a n al ys er allows conditional skipping of lexical symbols. It uses
directives of the following form:
$$tag
$<tag
$~tag
$>tag
where tag is conditional compilatio n tag com posed of letters, digits, d ot s and
underlines. All tags are initially unset, but may be complemented usin g the $$tag
directive. All the lexical tokens between $<tag and $>tag are skipped (treated as
comments) unless the specified tag is set. All the lexical tokens between $~tag
and $>tag are skipped unless the specified tag is not set.
The following example shows how this conditional compilation feature can be
used.
$$Linux // Set the Linux conditional compilation tag
$<Linux // Include if the Linux tag is set
$<WinXP $$WinXP $>WinXP // Unset the WinXP tag if set
writef("This was compiled for Linux")
$>Linux
$<WinXP // Include if the WinXP tag is set
writef("This was compiled for Windows XP")
$>WinXP