A program module is the single simplest compilation unit containing all
declarations and program statements with perhaps an importation from one
or more modules. Assuming you have a source file hello.mod, the simplest
command line is
gpm hello.mod
The output would be an object file,
hello.o
and a reference file,
hello.rfx
.
A definition module (
.def
) is a separate compilation unit defining the interface
between a module and its environment. Its contains all the information that
the compiler needs to verify that another module is correctly using the
facilities provided by this module.
The command
gpm myfile.def
will produce a symbol file, with extension
.syx
.
A definition module must be compiled before the corresponding implementation
module. The definition module should also be compiled before any program or
module that imports objects from that module.
An implementation module ( .mod ) contains the procedure bodies and initialization statements together with any other hidden procedure or data declarations.
The command
gpm myfile.mod
will produce an object file, with extension .o , and a reference file, with extension .rfx .
Since an implementation module depends on its own definition module and those other definition modules from which it imports some facility, an implementation module cannot be compiled until all such definition modules have been compiled. During compilation, symbol files for imported modules are accessed, looking first in the current directory and then on the directories of the path $M2SYM . All module names will be moved to lower case before any extension is appended.
gpm accepts multiple filename arguments from the command line. It will repeatedly invoke the compiler to compile each file named. The same options are passed to each invocation of the compiler. It is possible to use the normal shell expansions of filename metacharacters to compile multiple files. For example
gpm `grep -l Terminal *.mod`
would recompile all files in the current directory with filename extension .mod, and which mention the library Terminal .
gpm provides many options to control the operation of the compiler and the format of messages produced during compilation. The syntax for options flags follows closely the style used by UNIX commands.
If any options are to be passed, they must be in option strings which appear between the command and the filename(s). gpm Option strings must start with a minus sign - and all options may appear in arbitrary order in arbitrary groups. The order of the options is never important, so that gpm -IirOfS foo.mod and gpm -S -Of -irI foo.mod have precisely the same effect.
-a
assertion-off - assertion tests in the source code, invoked by the system
procedure
ProgArgs.Assert
are ignored by the compiler and generate no code
-d
dangerous - warning messages to the screen and list file (if selected)
are suppressed. However, if a program has both errors
and
warnings both will go to the screen and listings in spite of the
-d
option
-f
filename - force the compiler to name reference and object files based
on the source filename rather than the module
name. This option is illegal when applied to program
modules. This option allows several implementations of the same
module to exist in the same directory, and to be selectively
linked using the query option
-q
of
build
-g
intermediate code is compiled with markers for the debuggers
adb dbx xdb
. This option is not required for simply obtaining a post-mortem
procedure call-chain listing
-I
Interactive - the compiler
halts on errors, displays the verbose version of the diagnostic,
and prompts the user to continue, quit, or jump into the
vi
editor
-i
array index tests are turned off (same as
(*$I-*)
in the source file)
-l
a list file
name.lst
is generated from input file
name.def
or
name.mod
-n
no-code - the compiler
performs syntactic and semantic checking, but
no object code is produced. This allows a speedy check of modified
code, before a complete recompilation is attempted
-Oc
Optimise so as to produce compact code, even at the price
of small speed loss (same as
(*$C+*)
in the source file).
-Of
Optimise so as to produce fast code, even at the price of
larger memory size. This flag has a similar effect to the
(*$F+*)
in the source file, but affects code generation strategy
as well as front-end program transformations. Use of this flag is
thus preferred to the use of the program switch statement
-p
compile with profiling code so that
bldprf
and
prof
can produce procedure call-counts as well as time
statistics. If any modules of a program are compiled
with this option, the program must be built with
bldprf.
See the relevant chapter of the technical reference
manual for more on the profiling facilities
-r
range checking of assigned values and actual value parameters is suppressed
(same as
(*$R-*)
in the source file)
-S
aSsembler - the
C
language intermediate code is persistent in the file
name.c
, no object code is produced. This flag is only of use for debugging mixed
language programs
-v
verbose screen messages are produced, and verbose listings also, if
-l
is also specified
-V
super-Verbose - the Version date and time of the compiler are displayed,
the key-values of all directly and indirectly imported symbol
modules are traced, and verbose messages and listings are produced.
Also, the absolute pathnames of imported symbol files are displayed.