HP Pascal/iX Reference Manual (31502-90022)

7- 11
IMPLEMENT
END.
PROGRAM show_import_export_prog (output);
$SEARCH 'mod1.o, mod2.o'$ {Object files that contain bit_types}
{and show_import_export. }
IMPORT
show_import_export;
VAR
little_bit : bits8; { bits8 is defined in module bit_types }
little_byte : byte_rec; {byte_rec is defined in module show_import_export}
BEGIN
little_bit := 9;
little_byte := little_bit;
END.
IMPLEMENT
This reserved word indicates the beginning of the internal part of a
MODULE. The IMPLEMENT section may be empty or it may contain declarations
of the
constants, types, variables, procedures
, and
functions
that are
only used within the module. In addition, it contains the bodies of the
procedures and functions whose headings appeared in the EXPORT section.
A module does not have to
export
procedures or functions. It may be used
simply to
create
data or data types. In such a case, there will be
nothing between the words IMPLEMENT and END. That is, every module must
have an IMPLEMENT section, but it may be empty.
Example
MODULE A_module;
EXPORT { Exported Type }
TYPE
byte = 0..255;
FUNCTION check (i:byte):Boolean; { Exported Function }
IMPLEMENT { Start of implement section }
IMPORT stdoutput;
FUNCTION check (i: byte;): Boolean;
BEGIN
IF i > 127 THEN
BEGIN
check := false;
IF flag THEN
writeln (error);
END
ELSE
check := true;
END;
FUNCTION control (i: byte; flag: Boolean):Boolean; {Exported function}
BEGIN
control := check (i,flage) AND (i < 32);
END;
END.