-- file P5.mesa
-- last edited by Sweet, 30-Nov-81 12:13:44
-- last edited by Satterthwaite, December 16, 1982 8:47 am

DIRECTORY
  CodeDefs: TYPE USING [
    BYTE, CCIndex, CCInfoType, 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..7]];

 --from Calls.mesa
  BuildArgRecord: PROC [t: Tree.Link, rsei: RecordSEIndex, sigerr, 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, 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
  FlowTree: PROC [t: Tree.Link, tf: BOOL, label: LabelCCIndex];
  GetLabelMark: PROC RETURNS [LabelInfoIndex];
  LabelCreate: PROC [t: Tree.Link];
  LabelList: PROC [t: Tree.Link, elabel: LabelCCIndex, mark: LabelInfoIndex];
  MakeExitLabel: PROC RETURNS [exit, loop: LabelCCIndex];

 --from Temp.mesa
  CreateTempLex: PROC [wdoffset, nwords: INTEGER] RETURNS [l: Lexeme.se];
  FreeHeapLex: PROC [l: Lexeme.se];
  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];
  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: CCIndex, ownEntry: CARDINAL];
  ccInfo: VAR 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: CCIndex];
  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, catch: BOOL←FALSE];
  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];

  }.