DEFINITION MODULE Loader;
(***********************)

(* overlay loader for the  Modula system *)

(* Vers. 01.11. 1983  P. Fink, ETH    *)

FROM SYSTEM IMPORT ADDRESS;
EXPORT QUALIFIED  Call,
                  Load, Unload;

PROCEDURE Call
  (VAR OvName : ARRAY OF CHAR;
   VAR result : INTEGER);
(* load and execute overlay OvName, as a subroutine *)
(* OvName can be a module name (max 11 chars significant), or a file name
   (form dev:rep:rep:name.ext).
   Done if: loading, and possibly execution, are errorfree.
   default extension for the load file search will be .LOD
   default dev: will be <nothing>, and alternate dev: is MODLIB:
   result is zero, when everything was ok, otherwise an errornumber
   (system-dependent) *)


(* more sophisticated functions: (not yet implemented) *)
(* definitely not required for the compiler ! *)
(* INTENDED FOR:
   management of several independent loaded modules.
   useful in M3 for the O.S., on the SMAKY 8 for XS-1.
   consistency is important. it is an error to load when the
   base layer is not loaded, or to unload when overlays are
   still loaded.
   The identification of the base layer for an overlay is
   done at link time.
   specs written by me (PF) *)


PROCEDURE Load (VAR ovname : ARRAY OF CHAR;  VAR reference: ADDRESS;
                VAR error : INTEGER);
(* load overlay  ovname  into memory, and execute its initialization part.
   does not unload it. code and data remain in memory *)

PROCEDURE Unload (reference: ADDRESS; VAR error: INTEGER);
(* unload the referenced overlay *)

END Loader.

