|
Other manuals for this model:
manual abstract
MODULE
A module provides a mechanism for separate compilation of program
segments. It is a program fragment with a completely defined interface
that can be compiled independently and later used to construct programs.
A module usually defines some data types, constants, variables, and some
procedures and functions that operate on this data. Such definitions are
made accessible to users of the module by its export declarations.
Modules can only access data or procedures in other modules and then only
by importing them.
Any module used by a program, whether appearing in the program's globals
or compiled separately, must be named in an import declaration. The
objects that modules export always belong to the global scope of the
importer.
The source text input to a compiler that is the complete unit of
compilation may be a program or a list of modules separated by semicolons
(; ). An implementation may allow only a single module to be compiled at
a time, thus requiring multiple invocations of the compiler to process
several modules. The input text is terminated by a period.
A module cannot be imported before it has been compiled, either as part
of the importing program or by a previous invocation of the compiler.
This prevents construction of mutually-referring modules. Access to
separately compiled modules is discussed below.
Although a module declaration defines data and procedures that become
globals of any program importing the module, not everything declared in
the module becomes known to the importer. A module specifies exactly
what is exported to the "outside world" and lists any other modules on
which it is itself dependent.
The export declaration defines constants and types, declares variables,
and gives the headings of procedures and functions whose complete
specifications appear in the implement part of the module. It is only
the items in the export declaration that become accessible to any other
code that subsequently imports the module.
There need not be any procedures or functions in a module if its purpose
is solely to declare types and variables for other modules.
Any constants, types, and variables declared in the implement part are
not made known to importers of the module; they are only known inside the
module, and outside it they are hidden. Variables of the implement part
of a module have the same life time as global program variables, even
though they are hidden.
Any procedures or functions whose headings are exported by the module
must subsequently be completely specified in its implement part. In this
respect, the headings in the export declaration are like FORWARD
directives, and in fact the parameter list of such procedures need not
be, but may be, repeated in the implement part. Procedures and functions
that are not exported may be declared in the implement part; they are
known only within the module and are hidden from the rest of the program.
Separately compiled modules are called library modules. To use library
modules, a program imports them just as if they had appeared in the
program block. Refer to the HP Pascal/iX Programmer's Guide or the HP
Pascal/HP-UX Programmer's Guide, depending on your implementation, for
further information.
When an import declaration is seen, a module must be found matching each
name in the import declaration. If a module of the required name appears
in the compilation unit before the import declaration, the reference is
to that module. Otherwise, external module libraries must be searched.
See "SEARCH" , and the HP Pascal/iX Programmer's Guide or the HP
Pascal/HP-UX Programmer's Guide, depending on your implementation, for
7- 6
...Other models in this manual:
Software - MPE/iX 6.5 Operating System (775.76 kb)
Software - MPE/iX 7.0 Operating System (775.76 kb)
Software - MPE/iX 7.5 Operating System (775.76 kb)