
It may be necessary to define a large number of global variables, that are shared by a number of macro definitions. It may also be necessary to replicate other text in each macro. Explicit replication of text in each macro makes that body of text next to impossible to change. The include feature of the macro processor can be used to circumvent this problem. The following example illustrates the use of this feature.
exam: 'macro
'include global_defs
...
'endmacro
This include statement causes the file "global_defs" from the macro library to be included in the text of the macro "exam". The file name may not be an expression. It must be a string either with or without quotes. If the name is not found in any macro library, it will be treated as an ordinary file name. If the file can be found using the ordinary rules for locating files, (i.e. full path name, relative to current directory) that file will be included in the text, otherwise a "nonexistent file" message will be issued.
The 'include statement may be nested arbitrarily, but beware of circular references. Circular references always cause a non-terminating expansion of the text. This is because the 'include statement is executed as the text is read from the source files, not when the code is interpreted. Every 'include statement is executed unconditionally regardless of where in appears in the text. Thus the following example will cause two include statements to be executed.
exam: 'macro
'if 'run'=='abc'
'include abc
'else
'include xyz
'endif
'endmacro
For convenience, all include files may be gathered into an include directory which will be treated as a macro library by the preprocessor. It is important that the names of include files and macros be distinct. See section 18 for more information.