-- Loader.mesa
-- Last Modified By Paul Rovner On May 11, 1982 2:15 pm

DIRECTORY
  File USING [Capability, PageCount],
  PrincOps USING [ControlModule];

Loader: DEFINITIONS =

BEGIN

  Instantiate: PROC[file: File.Capability,
                       offset: File.PageCount,
		                 -- offset within the file of the first page of the BCD.
		                 -- Normally 1 (page 0 is the leader page)
	                   codeLinks: BOOLEAN ← TRUE]
    RETURNS[cm: PrincOps.ControlModule, unboundImports: BOOLEAN];
      -- raises Error

  Start: PROC[cm: PrincOps.ControlModule];

  Error: ERROR[type: ErrorType, message: LONG POINTER TO TEXT ← NIL];
    -- BEWARE that the storage for a non-NIL message is allocated in the local
    -- frame of the guy who raised Error. You must copy the message body before
    -- unwinding if you want the text available after the unwind. 

  ErrorType: TYPE = {invalidBcd, fileNotFound, versionMismatch,
                          loadStateFull, insufficientVM};

END.