The INCLUDE @ statement inserts a file into the source program.
Parameter |
Description |
file |
Name of the file to be inserted |
INCLUDE "file"
The contents of the named file replace the INCLUDE statement.
If the name referred to by the INCLUDE statement begins with the character /, then it is taken by f77 to mean the absolute path name of the INCLUDE file. Otherwise, f77 looks for the file in the following directories, in this order:
The directory that contains the source file with the INCLUDE statement
The directories that are named in the -Iloc options
The current directory in which the f77 command was issued
The directories in the default list. For a standard install, the default list is:
/opt/SUNWspro/SC5.0/include/f77 /usr/include
For a non-standard install to a directory /mydir/, the default list is:
/mydir/SUNWspro/SC5.0/include/f77 /usr/include
The release number, SC5.0, varies with the release of the set of compilers.
These INCLUDE statements can be nested ten deep.
The paths and order searched for the INCLUDE statement are not the same as those searched for the preprocessor #include directive, described under -I in the Fortran User's Guide. Files included by the preprocessor #include directive can contain #defines and the like; files included with the compiler INCLUDE statement must contain only FORTRAN statements.
f77 interprets VMS logical file names on the INCLUDE statement if:
The -xl[d] or -vax=spec compiler options are set.
The environment variable LOGICALNAMEMAPPING is there to define the mapping between the logical names and the UNIX path name.
f77 uses the following rules for the interpretation:
The environment variable should be set to a string with the syntax:
"lname1=path1; lname2=path2; " |
where each lname is a logical name and each path1, path2, and so forth is the path name of a directory (without a trailing /).
All blanks are ignored when parsing this string. It strips any trailing /[no]list from the file name in the INCLUDE statement.
Logical names in a file name are delimited by the first : in the VMS file name, so f77 converts file names of the lname1:file form to the path1/file form.
For logical names, uppercase and lowercase are significant. If a logical name is encountered on the INCLUDE statement which is not specified in the LOGICALNAMEMAPPING, the file name is used, unchanged.
Example 1: INCLUDE, simple case:
INCLUDE 'stuff'
The above line is replaced by the contents of the file stuff.
Example 2: INCLUDE, search paths:
For the following conditions:
Your source file has the line:
INCLUDE 'ver1/const.h'
Your current working directory is /usr/ftn.
Your source file is /usr/ftn/projA/myprg.f.
In this example, f77 seeks const.h in these directories, in the order shown.
For a standard install, f77 searches these directories:
/usr/ftn/projA/ver1
/usr/ftn/ver1
/opt/SUNWspro/SC5.0/include/f77/ver1
/usr/include
For a non-standard install to a directory /mydir, it searches these directories:
/usr/ftn/projA/ver1
/usr/ftn/ver1
/mydir/SUNWspro/SC5.0/include/f77/ver1
usr/include