-- file P5.mesa
-- last edited by Sweet, September 17, 1980  12:21 PM
-- last edited by Satterthwaite, November 23, 1982 5:06 pm

DIRECTORY
  CodeDefs: TYPE USING [
    Byte, CCIndex, CCInfoType, CompareClass, LabelCCIndex, LabelInfoIndex,
    Lexeme, StatementStateRecord, TempStateRecord, StoreOptions, VarIndex],
  Literals: TYPE USING [STIndex],
  Symbols: TYPE USING [
    BTIndex, CBTIndex, CSEIndex, ISEIndex, RecordSEIndex, WordLength],
  Tree: TYPE USING [Index, Link];

P5: DEFINITIONS = { 
  OPEN Symbols, CodeDefs;

 -- from FOpTable.mesa
  NumberOfParams: PROC [b: Byte] RETURNS [[0..3]];
  PopEffect: PROC [b: Byte] RETURNS [[0..7]];
  PushEffect: PROC [b: Byte] RETURNS [[0..3]];

 --from Calls.mesa
  BuildArgRecord: PROC [t: Tree.Link, rsei: RecordSEIndex, sigerr, isResume, refSafe: BOOL]
    RETURNS [nparms: CARDINAL];
  CallCatch: PROC [t: Tree.Link];
  ConstructOnStack: PROC [maint: Tree.Link, rcsei: RecordSEIndex];
  IndirectReturnRecord: PROC [node: Tree.Index, nrets: CARDINAL]
    RETURNS [Lexeme];
  LogHeapFree: SIGNAL [calltree: Tree.Link] RETURNS [BOOL, Lexeme.se];
  PRetLex: PROC [nrets: CARDINAL, node: Tree.Index, sig: BOOL ← FALSE]
    RETURNS [Lexeme];
  PushArgRecord: PROC [t: Tree.Link, rsei: RecordSEIndex, sigerr, isResume, refSafe: BOOL]
    RETURNS [nparms: CARDINAL];
  SysCall: PROC [alpha: Byte];
  SysCallN: PROC [alpha: Byte, n: CARDINAL];
  SysError: PROC;
  ZoneOp: PROC [
    zone: Tree.Link, index: CARDINAL, pushArg: PROC, catch: Tree.Link, long: BOOL];

 --from Driver.mesa
  Module: PROC;
  P5Error: PROC [n: CARDINAL];
  PopInVals: PROC [irecord: RecordSEIndex, isenable: BOOL];
  ReleaseLock: PROC;

 --from Flow.mesa
  CompareFn: PROC [class: CompareClass, code: BOOL, length: [1..2]] RETURNS [Byte];
  FlowTree: PROC [t: Tree.Link, tf: BOOL, label: LabelCCIndex];
  GetLabelMark: PROC RETURNS [LabelInfoIndex];
  LabelList: PROC [t: Tree.Link, elabel: LabelCCIndex, mark: LabelInfoIndex];
  LabelCreate: PROC [t: Tree.Link];
  MakeExitLabel: PROC RETURNS [exit, loop: LabelCCIndex];

 --from Temp.mesa
  CreateTempLex: PROC [wdoffset, nwords: INTEGER] RETURNS [l: Lexeme.se];
  FreeHeapLex: PROC [l: Lexeme.se];
  FreeTempList:  PROC;
  FreeTempSei: PROC [sei: ISEIndex];
  GenAnonLex:  PROC [nwords: CARDINAL] RETURNS [l: Lexeme.se];
  GenStringBodyLex:  PROC [nchars: CARDINAL] RETURNS [l: Lexeme.se];
  GenHeapLex: PROC RETURNS [l: Lexeme.se];
  GenTempLex:  PROC [nwords: CARDINAL] RETURNS [l: Lexeme.se];
  PopStatementState:  PROC [p: POINTER TO StatementStateRecord];
  PopTempState:  PROC [p: POINTER TO TempStateRecord];
  PurgeHeapList: PROC [oldheaplist: ISEIndex];
  PurgePendTempList:  PROC;
  PushHeapList: PROC RETURNS[oldheaplist: ISEIndex];
  PushStatementState: PROC [p: POINTER TO StatementStateRecord];
  PushTempState: PROC [p: POINTER TO TempStateRecord, newfs: CARDINAL];
  ReleaseTempLex: PROC [l: Lexeme.se];
  TempInit: PROC;

 -- from Constructor.mesa
  All: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions] RETURNS [Lexeme];
  Construct: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions] RETURNS [Lexeme];
  New: PROC [node: Tree.Index] RETURNS [Lexeme];
  RowCons: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions] RETURNS [Lexeme];
  TransferConstruct: PROC [nparms: CARDINAL, resident: BOOL, t: Tree.Link, tsei: CSEIndex];
  VariantConstruct: PROC [t1, t2: Tree.Link, options: StoreOptions];

 -- from Store.mesa
  ExtractFrom: PROC [
    t1: Tree.Link, tsei: RecordSEIndex, r: VarIndex, transferrec: BOOL];
  SAssign: PROC [sei: ISEIndex];
  TTAssign: PROC [t1, t2: Tree.Link];

 -- from Expression
  AdjustNilCheck: PROC [t: Tree.Link, wordOffset: CARDINAL];
  Exp: PROC [t: Tree.Link] RETURNS [l: Lexeme];
  LPushLex: PROC [l: Lexeme] RETURNS [Lexeme];
  MultiZero: PROC [t: Tree.Link, minWords: CARDINAL←3] RETURNS [BOOL];
  PushConst: PROC [t: Tree.Link];
  PushLex: PROC [l: Lexeme];
  PushLProcDesc: PROC [bti: CBTIndex];
  PushNestedProcDesc: PROC [bti: CBTIndex];
  PushNonnestedProcDesc: PROC [n: CARDINAL];
  PushRhs: PROC [t: Tree.Link];
  Reloc: PROC [node: Tree.Index] RETURNS [Lexeme];
  StoreMod: PROC [t: Tree.Link, bSize: [0..WordLength)] RETURNS [Tree.Link];

 -- from Final
  Fixup: PROC [start: LabelCCIndex, ownEntry: CARDINAL];
  ccInfo: CCInfoType;
  CCInfoMeaning: PROC RETURNS [CCInfoType];

 -- from FlowExpression
  FlowExp: PROC [node: Tree.Index] RETURNS [l: Lexeme];

 -- from OutCode
  EndCodeFile: PROC RETURNS [nbytes: CARDINAL];
  MoveToCodeWord: PROC RETURNS [CARDINAL];
  OutBinary: PROC [bti: CBTIndex, start: LabelCCIndex];
  ProcessGlobalStrings: PROC [framestart: CARDINAL] RETURNS [nextnewframe: CARDINAL];
  ProcessLocalStrings: PROC [
    framestart: CARDINAL, first: Literals.STIndex] RETURNS [nextnewframe: CARDINAL];
  StartCodeFile: PROC;
  WriteCodeWord: PROC [w: WORD];

 -- from Peephole
  C0: PROC [i: Byte];
  C1: PROC [i: Byte, p1: WORD];
  C1W: PROC [i: Byte, p1: WORD];
  C2: PROC [i: Byte, p1, p2: WORD];
  C3: PROC [i: Byte, p1, p2, p3: WORD];
  LoadConstant: PROC [c: UNSPECIFIED];
  PeepHole: PROC [start: CCIndex];

 -- from Statement
  CatchPhrase: PROC [node: Tree.Index];
  EnterBlock: PROC [bti: BTIndex];
  ExitBlock: PROC [bti: BTIndex];
  StatementTree: PROC [t: Tree.Link] RETURNS [Tree.Link];
  SCatchPhrase: PROC [node: Tree.Index];

 -- from Selection
  BindStmtExp: PROC [rootNode: Tree.Index, isExp: BOOL] RETURNS [Lexeme];
  CaseStmtExp: PROC [rootNode: Tree.Index, isExp: BOOL] RETURNS [Lexeme];
  CaseTest: PROC [t: Tree.Link, failLabel: LabelCCIndex];
  NarrowExp: PROC [node: Tree.Index] RETURNS [Lexeme];
  GetCanonicalType: PROC [node: Tree.Index] RETURNS [Lexeme];
  TypeRel: PROC [node: Tree.Index, tf: BOOL, label: LabelCCIndex];

  }.