82 of 172
ZBasic Language Reference 75 ZX Microcontroller Family 3.15 Include Directive You may use an include directive in a source file to cause another source file to be compiled as well. The form of the include directive is: #include "<filename>" The <filename> element is the name of the file that you want to have compiled. If the filename is not specified using an absolute path (i.e. beginning with the root directory and/or a drive letter), the path prefix (if any) of the current module will be appended to the front of the filename. Note, however, that if an include path is specified on the command line, a filename specified with a relative path will, instead, be sought in among the directories specified in the include path list. See Section 7.2 for more information on the include path option. Note that the effect of the include directive is no different than if you had instructed the compiler directly to compile the file. It is compiled as a separate module. BasicX Compatibility Note Include directives are not supported in BasicX compatibility mode. 3.16 Using Conditional Directives in Project and Argument Files The ZBasic compiler optionally supports the use of the conditional directives, as described in Section 3.12, in project and argument files. Because conditionals are introduced with a # character and that same character is recognized as a comment introduction character in project and argument files, support for conditionals in these files is not enabled by default. You may enable support for conditionals in project and argument files using the compiler option -- allow-conditionals. If this option appears as the first line in a project or argument file, conditionals will be enabled for that file and for all subsequently processed project and argument files. If the -- allow-conditionals option appears on a line other than the first line, conditionals will be enabled for subsequently processed files but not for the the file in which the option appeared. Alternately, conditionals may be enbled only for a specific project or argument file by placing the special comment #!allow-conditionals as the first line of the file. When creating conditionals in project and argument files, you may utilize symbols previously defined via command line options as well as the built-in constant symbols described in Section 3.9. 3.17 Preprocessor Symbols The ZBasic compiler supports several “preprocessor symbols” that can be used in your program code. These are special sequences of characters that the compiler recognizes very early in the compilation process. When they are recognized, they are replaced with a specific series of characters, different for each symbol. Conceptually, the replacement process is very much like a “global search and replace” operation in a text editor where context is not taken into account. The supported preprocessor symbols are shown in the table below. Symbol Description __DATE__ The month, day and year when compiled, e.g. Oct 21, 2005. __TIME__ The hour, minute and second when compiled, e.g. 14:16:04. __FILE__ The name of the file being compiled. __LINE__ The line number of the file on which the symbol occurs.