2.5 Include
Files
There
are five major classes of include files: system, VICAR main, VICAR system,
VICAR subroutine, and local.
Include
only those files needed. Some includes require that other files be included
first. Extra includes in your program don't gain you anything, but slow down
your compiles. They also make system maintenance difficult, since the source
code must occasionally be searched to see what programs use an include, and all
programs that use an include must be recompiled when it changes (even if it's
not really used).
System
include files are provided by the operating system. Many are OS-specific, but
there are a few that are standard across platforms. Make sure the ones you need
are available in both operating systems, or isolate them in machine-dependent
code. System include files should be enclosed in angle brackets and have the
“.h” extension. Some known portable includes are:
#include <varargs.h>
#include <math.h>
#include <ctype.h>
#include <stdio.h>
One known
non-portable
file is
<unistd.h>.
If you need symbolic constants for the lseek() arguments(which are often
contained in
unistd.h),
use the definitions provided in xvmaininc.h.
The
VICAR main include file, which all VICAR programs should start with, must be in
lower case, with double quotes. The name of the main include is
“vicmain_c”, with no directory specifiers and no “.h”
extension.
Any
modules other than the main program module that need VICAR definitions should
include
xvmaininc.h,
in lower case, with double quotes and the “.h” extension
xvmaininc.h is automatically included with vicmain_c.
#include “vicmain_c”
— or —
#include “xvmaininc.h”
VICAR
system includes are provided as part of the RTL. Their names should be in lower
case, with quotes and the “.h” extension. The valid ones are listed
below. Only a few of these should ever be used in application code, notably
zvproto.h, ftnbridge.h, errdefs.h, and applic.h. The rest should only be needed
in very unusual circumstances. They should generally be in the order listed
below.
Include
only
those
needed. Extraneous include files will only slow down your compile and make
system maintenance harder. TAE includes are handled as specified in the TAE
documentation. They should be in double quotes, with the ”.inc” or
“.inp” extensions as appropriate. The first four listed below are
TAE includes:
#include “taeconf.inp”
#include “symtab.inc”
#include “parblk.inc”
#include “pgminc.inc”
#include “zvproto.h”
#include “defines.h”
#include “declares.h”
#include “externs.h”
#include “applic.h”
#include ”errdefs.h”
#include “ftnbridge.h”
#include “xviodefs.h”
VICAR
subroutine include files (class 2 and 3 SUBLIB, VRDI, etc.) should be in double
quotes, with no path names, and should include the “.h” extension,
like VICAR system includes. For these includes, the directories containing the
includes must be available to the compiler. This is normally handled
transparently, but some libraries will require a LIB_* macro in the imakefile
to access the includes.
#include “vmachdep.h”
#include “gll_ssi_edr.h”
#include “xderrors.h”
Local
includes, which are delivered as part of the COM file and are used only by that
application, should be in double quotes, with no path names. Include the
“.h” extension, just as for VICAR system and subroutine includes.
Local includes must be listed in the INCLUDE_LIST macro in the imakefile so
they can be cleaned up properly.
#include “my_inc.h”