DEFINITION MODULE MLinkBase;
(*$ LargeVars:=FALSE NameChk:=FALSE *)
FROM SYSTEM IMPORT ADDRESS;
IMPORT m2:M2Amiga;

TYPE
  SymName = ARRAY[0..255] OF CHAR;
  NameRecPtr = POINTER TO RECORD
    CASE :INTEGER OF
    | 0: c: ARRAY[0..64] OF LONGINT; (* len,chars. Wir brauchen keine CHARs! *)
    | 1: lws: LONGINT;
         name: SymName;
    | END;
  END;

  FileErrors = (noError, notFound, readError, writeError, seekError);
  LongPtr = POINTER TO LONGINT;

(*$ LongAlign:=FALSE *)
VAR
  eof: BOOLEAN;
  MemPtr: LongPtr;
  MemEnd: LONGINT;


PROCEDURE ALLOCATE(VAR adr:ADDRESS; size:LONGINT);
PROCEDURE ForgetMem; (* alles mem wieder freigeben *)

PROCEDURE GetFile(Name:ARRAY OF CHAR; VAR Addr:ADDRESS;
		  VAR Len:LONGINT; VAR o:m2.ObjFilePtr):FileErrors;
PROCEDURE InitSer(a:ADDRESS; len:LONGINT);
PROCEDURE GetLong(VAR lc:LONGINT);
PROCEDURE SkipBlock(cnt:LONGINT); (* skip cnt LANGWORTE! *)

PROCEDURE Diff(a{8},b{9}:NameRecPtr):INTEGER;
PROCEDURE ExtractModuleName(n:NameRecPtr; VAR mod:SymName):BOOLEAN;
(* name der Form mmm_ooo: mod wird bis zum 1. "_", also 'mmm' *)

PROCEDURE OpenSeqOut(VAR filename: ARRAY OF CHAR):BOOLEAN;
VAR
  SeqOutOk: BOOLEAN;
PROCEDURE CloseSeqOut;
PROCEDURE OutL(l{4}:LONGINT);
PROCEDURE OutCount(from{3+8}:ADDRESS; count{7}:CARDINAL);
END MLinkBase.def
