Include File Processing
The EQUEL/Ada include statement provides a means to include external packages and source files into your program's source code. The syntax of the statement is:
## include filename
where filename is a quoted string constant specifying a file name or a logical name that points to the file name. If the file is in the local directory, it can also be specified without the surrounding quotes.
Including and Processing EQUEL/Ada Package Specifications
The above variant of the include statement can be used only to include package specifications. The preprocessor reads the specified file, processing all variables declared in the package, and generates the Ada with and use clauses using the last component of the file name (excluding the file extension) as the package name. If the last component of the file name has a trailing underscore, as is the standard in VAX/VMS Ada package specification files, then that trailing underscore is removed in the generated context clauses. The preprocessor does not generate an output file because it is assumed that the package specification has already been compiled.
The following example demonstrates this variant of the include statement. Assume that the specification of package "employee" is in file "employee_.qa" and that a procedure "empentry" is in file "empentry.qa".
Contents of "employee_.qa":
## package employee is
## ename: String(1..20);
## eage: Integer;
## esalary: Float;
## end employee;
Contents of "empentry.qa":
## include "[joe.ada.empfiles]employee_.qa"
## procedure empentry is
## begin
-- Statements using variables in package "employee"
## end empentry;
The EQUEL/Ada preprocessor modifies the include line to the Ada with and use clauses by extracting the last component of the file name:
with employee;
use employee;
The above two clauses appear in the output file "empentry.ada." The preprocessor does not generate an output file for "employee_.qa," and the package "employee" must have already been compiled in order to compile the "empentry.ada" file.
Assuming that the files "employee_.qa" and "empentry.qa" appear as shown above, the following sequence of VMS commands should be executed in order to compile "empentry.ada":
$ eqa employee_.qa
$ eqa empentry.qa
$ ada employee_.ada
$ ada empentry.ada
You must still follow the Ada rules specifying the order of compilation. The EQUEL preprocessor does not affect these compilation rules.
Including EQUEL/Ada Source Code
In order to include source code into your EQUEL/Ada file, you should issue the EQUEL include statement with the inline option. Its syntax is as follows:
## include inline filename
where filename has the same rules as mentioned earlier.
With this variant of include, the included text is preprocessed into the parent output file. For example, if you have a file called "messages.qa" that contains the text:
## message buffervar
## sleep 2
and you are preprocessing the file called "retrieve.qa", then the following include statement is legal in "retrieve.qa":
## retrieve (buffervar = e.name)
##
## include inline "messages.qa";
##
The file "messages.qa" is preprocessed into the output file "retrieve.ada." For more information on the inline option see the QUEL Reference Guide.
Last modified date: 08/14/2024