3.3. Procedure Notes

Version I.5, September 1978

page165 Declarations of SEGMENT procedures and functions are identical to standard Pascal procedures and functions except they are preceded by the reserved word “SEGMENT”, for example:

SEGMENT PROCEDURE INITIALIZE;
BEGIN
  (* PASCAL code *)
END;

Program behavior differs, however, as code and data for a SEGMENT procedure (function) are in memory only while there is an active invocation of that procedure.

Advantages and benefits:

The user may now put large pieces of one-time code, e.g. initialization code, into a SEGMENT procedure. After performing the initialization, for example, the now-useless code is taken out of memory thus increasing the available memory space.

Furthermore the user may now compile his/her program in chunks, specifically in SEGMENTS. The LIBRARIAN program (described in Section 4.8) can be used to link together the separate segments to produce one large code file.

Requirements and limitations:

The disk which holds the code file for the program must be on- line (and in the same drive as when the program was started) whenever one of SEGMENT procedures is to be called. Otherwise the system will attempt to retrieve and execute whatever information now occupies that particular location on the disk, usually with very displeasing and certainly unexpected results.

page166 A maximum of seven (7) SEGMENT procedures are ordinarily available to the user, including the main body segment.

SEGMENT procedures must be the first procedure declarations containing code-generating statements.

For further details and examples see Section 3.5, Introduction to the Pascal Pseudo Machine.


This page last regenerated Sun Jul 25 01:09:11 2010.