HP Pascal/iX Programmer's Guide (31502-90023)
2-: 7
.
:
MODULE Mod3; {The program defines this Mod3}
.
:
END; {Mod3}
$SEARCH 'Mod1.o'$
IMPORT
Mod2, {Mod2 comes from the library Mod1.o}
Mod3; {Mod3 is the one that the program defined}
BEGIN
.
:
END.
Global, Subprogram, and External Compilation Units
A
global compilation unit
defines global constants, data types, and
variables within a Pascal program. It also contains the body of the main
program. Syntactically, it is a program that begins with the GLOBAL
compiler option. For more information on the GLOBAL compiler option,
refer to the
HP Pascal/iX Reference Manual
or the
HP Pascal/HP-UX
Reference Manual
, depending on your implementation.
A
subprogram compilation unit
defines subprogram constants, data types,
and variables within a Pascal program. Syntactically, it is a program
that begins with the SUBPROGRAM compiler option. For more information on
the SUBPROGRAM compiler option, refer to the
HP Pascal/iX Reference
Manual
or the
HP Pascal/HP-UX Reference Manual
, depending on your
implementation.
An
external compilation unit
declares the global variables that it needs
and defines routines that the
global compilation
unit and other
external compilation units can access using the EXTERNAL directive.
Syntactically, it is a program that begins with the EXTERNAL compiler
option and has an empty outer block.
NOTE The EXTERNAL directive and the EXTERNAL compiler option are not the
same. For more information, see Chapter 9 in this manual and
the
HP Pascal/iX Reference Manual
or the
HP Pascal/HP-UX Reference
Manual
, depending on your implementation.
You must compile global and external compilation units separately. For
more information on program preparation see Appendix A and Appendix B
.
For more information on the EXTERNAL compiler option, refer to the
HP
Pascal/iX Reference Manual
or the
HP Pascal/HP-UX Reference Manual
,
depending on your implementation.
Separate Compilation
Separate compilation
is the process of separating the source for a large
program into pieces that can be compiled independently of other pieces.
There are several reasons why compiling pieces of a program separately is
practical:
* When the program is too long to compile.
* When the program is too complex to manage.
* When the program is being worked on by more than one programmer or
by a team of programmers.