76
Pascal 4.0 User’s Guide
5
Using Program Units
The program unit is the source program with the program header. It has the
following syntax:
<
program unit
> ::= <
program heading
> <
declaration list
> <
program body
>
Each program you write can have only one program unit. The program body
is the first code that Pascal executes.
Using Module Units
A module unit is a source program that does not have a program header. It
has the following syntax:
<
module unit
>
::= [
<
module heading
>
]
<
declaration list
>
The module heading contains the reserved word
module
followed by an
identifier:
<
module heading
>
::= [
'module' <
identifier
> ';' ]
For example:
This is a legal module heading. The module heading is optional.
Sharing Variables and Routines Across Multiple Units
Pascal supports three methods of sharing variables and routines between units:
•
include
files
•
Multiple variable declarations
•
extern/define
variable declarations
These methods are not mutually exclusive; for example, you can declare a
variable as either
extern
or
define
in an
include
file.
The following sections describe these methods.
module sum;
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......