www.delorie.com/gnu/docs/gcal/gcal_31.html   search  
Buy GNU books!

Gcal 3.01

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1.7 Include directives

You may add #include directives in a resource file for searching and loading further resource files(55). An #include directive tells Gcal to suspend reading the current resource file and read one other resource file before continuing. The directive is a line in the resource file that looks like this template:

#include whitespace argument [whitespace] newline

The argument can either be

"file name"


<file name>

One whitespace character minimum is required between #include and the argument. The argument may be trailed by extra whitespace characters and the line must always end with a `\n' (newline) character, except it is the last line of a resource file.

Let us inspect a example which is a bit more concrete:

  1. #include "foo/bar"

  2. #include <bar>

The first #include directive tells Gcal to load the file `bar' in the file directory `foo' from the actual file directory. If this fails, Gcal tries to load this file by using steps 1...4 of the previously explained mechanism used for searching files (see section File searching mechanism).

The second #include directive tells Gcal to load the file `bar' from the user respectively system data file directory by using steps 3...4 of the previously explained mechanism used for searching files. It is not allowed to include files which have a fixed access path starting from the root file directory by such an #include directive like `#include </file>' or `#include </foo/bar/file>'; just as the specification of a single or an extended file name containing a disk/drive specifier(57), because the resulting path name(58) would not be a valid file name any longer.

Included files may include other files again. But the nesting level of included files is limited on the one hand by the amount of usable working storage of the computer, and on the other hand by the value which is given by the operating system respectively the compiler for the number of files which can be opened simultaneously. Recursive includes(59) or cyclic includes(60) are not permitted, because such backward references would produce an infinite loop in the program internally! Gcal recognizes such situations and terminates immediately with a fatal error. See section Error Code 119, for more information.

If an included resource file cannot be found and no `--debug=abort' option is given, processing of the resource file containing the #include continues.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003