(****************************************
*                                       *
*     MODULA-2 Multi-Pass Compiler      *
*     ****************************      *
*                                       *
*       VAX/VMS Implementation          *
*                                       *
*                                       *
*     MVCLi4:                           *
*                                       *
*     Linker interface in Pass 4        *
*                                       * 
*     Version 3.1 of  1-FEB-1983        *
*                                       *
*                                       *
*     D-2000 HAMBURG 13                 *
*                                       *
*     Based on PDP11 Implementation     *
*     Version M22 of 22.01.81           *
*                                       *
*     Institut fuer Informatik          *
*     ETH-Zentrum                       *
*     CH-8092 Zuerich                   *
*                                       *
****************************************)

(****************************************
* Updates: see implementation module    *
****************************************)

DEFINITION MODULE MVCLi4; (* PDP-11            : A. Gorrengourt *)
                          (* VAX-11            : M. Mall        *)
                          (* VAX-11 object code: E. Kisicki     *)

  IMPORT MVCompiler, MVCMnemonicsAndTraps;

  FROM SYSTEM IMPORT BYTE;
  FROM MVCompiler IMPORT Idptr, Spellix;
  FROM MVCMnemonicsAndTraps IMPORT Traps;

  EXPORT QUALIFIED LinkerDirective,LinkerTableEntry,
         EnterVariable, EnterConstant, EnterSystemData, EnterExternal,
         EnterProcedure, EnterModule, EnterRuntimeSupport,
         EnterLabel, EnterLine, CorrectLine,
         NextRelocationPoint, GetLabel, GetLine,
         UpdateLinkerTable, 
         StartProcedure,
         TerminateObjectFile, StartObjectFile, 
         PutControlledString, SearchSpellTable, PutObjectCode;


  TYPE
    LinkerDirective = (RefLocVariable, RefLocConstant, RefExtVariable,
                       RefLocProc,     RefExtProc,     RefExtMod,
                       RefSystemData,  RefRuntimeSupport);
    LinkerTableEntry = RECORD
                         linkpoint: CARDINAL;
                         CASE dir: LinkerDirective OF
                           RefLocConstant, RefSystemData: |
                           RefLocVariable, RefExtVariable : nptr: Idptr; |
                           RefExtProc, RefLocProc : procix: Idptr; |
                           RefExtMod : modix: Idptr; |
                           RefRuntimeSupport: trap: Traps;
                         END;
                       END;

  PROCEDURE EnterVariable(flp: CARDINAL; fnptr: Idptr);

  PROCEDURE EnterConstant(flp: CARDINAL);

  PROCEDURE EnterSystemData(flp: CARDINAL);

  PROCEDURE EnterExternal(flp: CARDINAL; fnptr: Idptr);

  PROCEDURE EnterRuntimeSupport(flp: CARDINAL; ftrap: Traps);

  PROCEDURE EnterProcedure(flp: CARDINAL; fprocix: Idptr);

  PROCEDURE EnterModule(flp: CARDINAL; fmodix: Idptr);

  PROCEDURE EnterLabel(flp: CARDINAL);

  PROCEDURE EnterLine;

  PROCEDURE CorrectLine;

  PROCEDURE NextRelocationPoint(VAR linkrec: LinkerTableEntry): BOOLEAN;

  PROCEDURE GetLabel(flp: CARDINAL; VAR labnum: CARDINAL): BOOLEAN;

  PROCEDURE GetLine(VAR flp: CARDINAL; VAR line: CARDINAL): BOOLEAN;

  PROCEDURE UpdateLinkerTable(initlc, delta: CARDINAL);

  PROCEDURE StartProcedure(fidptr: Idptr);

  PROCEDURE PutControlledString(fstring: ARRAY OF CHAR;
                                flength: CARDINAL;
                                fsymbol: BOOLEAN);

  PROCEDURE SearchSpellTable(fname: Spellix; VAR fstring: ARRAY OF CHAR);

  PROCEDURE PutObjectCode(VAR fctab: ARRAY OF BYTE;
                              flc: CARDINAL;
                              fpfmp: Idptr);

  PROCEDURE TerminateObjectFile;

  PROCEDURE StartObjectFile;

END MVCLi4.
