Compiler
Operation
-
Preprocessor
Description
DOS:
VMS:
UNIX:
MPW:
Pathname
for
alto
c
Invocation
Command
c:\gsp\files\alt.c
gspcpp
-ic:\gsp\files
source.c
[gsp.
files]
al
t.
c
gspcpp
-i[gsp.files]
source.c
/gsp/files/alt.c
gspcpp
-i/gsp/files
source.c
:gsp
:files
:alt
.c
gspcpp
-i
:gsp
:files
source.c
Note that the include filename
is
enclosed in
double
quotes. The preprocessor
first searches for
alt.
c in the current directory, because
source.
c
is
in the
current directory. Then, the preprocessor searches the directory named
with
the -i option.
3.1.3.2
Environment
Variable
DOS:
VMS:
UNIX:
MPW:
An environment variable
is
a system symbol that you define and assign a string
to. The preprocessor uses
an
environment variable named
C-DIR
to
name
alternate directories that contain include files. The commands
for
assigning
the environment variable
are:
set
C-DIR=pathname;another
pathname
...
assign
"pathname;another pathname
...
"
C-DIR
UNIX:
setenv
C-DIR
"pathname;another pathname
'"
"
MPW:
set
C-DIR
":pathname;another:
pathname
...
"
export
C-DIR
The pathnames
are
directories that contain include files. You
can
separate
pathnames
with
a semicolon or
with
blanks. In C source, you can use the
#include directive
without
specifying any path information; instead, you can
specify the path information
with
C-D
I
R.
For example, assume that a file called
source.
c contains these statements:
#include
<altl.c>
#include
<alt2.c>
The table
below
lists the complete pathnames for these files and shows
how
to
invoke the preprocessor; select the
row
for
your
operating system.
Pathnames
for
altl.
c
and
alt2.c
Invocation
Command
c:\gsp\files\altl.c
c:\gsys\alt2.c
set
C-DIR=c:\gsys
c:\exec\files
gspcpp
-ic:\gsp\files
source.c
[gsp.files]altl.c
assign
C-DIR
"
[gsys]
[exec.files]"
[gsys]alt2.c
gspcpp
-i[gsp.files]
source.c
/gsp/files/altl.c
setenv
C_DIR
"/gsys
/exec/files
/gsys/alt2.c
gspcpp
-i\gsp\files
source.
c I
:gsp
:files
:altl
.c
set
C-DIR
"
:gsys
:files
"
:gsys
:alt2
.c
export
C_DIR
gspcpp
-i:gsp
:files
source.c
Note that the include filenames
are
enclosed in angle brackets. The pre-
processor first searches
for
these files in the directories named
with
C-DIR
and finds
al
t2.
c.
Then, the preprocessor searches in the directories named
with
the
-i
option and finds
altl.
c.
3-5