-- file P5.mesa
-- last edited by Sweet, September 17, 1980  12:21 PM
-- last edited by Satterthwaite, June 14, 1982 11:21 am

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 = 
  BEGIN
  OPEN Symbols, CodeDefs;

 -- from FOpTable.mesa
  MinimalStack: PROC [b: [0..256)] RETURNS [BOOLEAN];
  NumberOfParams: PROC [b: [0..256)] RETURNS [[0..3]];
  PopEffect: PROC [b: [0..256)] RETURNS [[0..7]];
  PushEffect: PROC [b: [0..256)] RETURNS [[0..3]];

 --from Calls.mesa
  BuildArgRecord: PROC [
      t: Tree.Link, rsei: RecordSEIndex, sigerr, isResume, refSafe: BOOLEAN]
    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 [BOOLEAN, se Lexeme];
  PRetLex: PROC [nrets: CARDINAL, node: Tree.Index,
    sig: BOOLEAN ← FALSE] RETURNS [Lexeme];
  PushArgRecord: PROC [
      t: Tree.Link, rsei: RecordSEIndex, sigerr, isResume, refSafe: BOOLEAN]
    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: BOOLEAN];

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

 --from Flow.mesa
  CompareFn: PROC [class: CompareClass, code: BOOLEAN, length: [1..2]] RETURNS [Byte];
  FlowTree: PROC [t: Tree.Link, tf: BOOLEAN, 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: se Lexeme];
  FreeHeapLex: PROC [l: se Lexeme];
  FreeTempList:  PROC;
  FreeTempSei: PROC [sei: ISEIndex];
  GenAnonLex:  PROC [nwords: CARDINAL] RETURNS [l: se Lexeme];
  GenStringBodyLex:  PROC [nchars: CARDINAL] RETURNS [l: se Lexeme];
  GenHeapLex: PROC RETURNS[l: se Lexeme];
  GenTempLex:  PROC [nwords: CARDINAL] RETURNS [l: se Lexeme];
  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: se Lexeme];
  TempInit: PROC;

 -- from Constructor.mesa
  All: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions];
  AllExp: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions] RETURNS [Lexeme];
  Construct: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions];
  ConstructExp: PROC [
    t: Tree.Link, node: Tree.Index, options: StoreOptions] RETURNS [vl: Lexeme];
  New: PROC [node: Tree.Index] RETURNS [Lexeme];
  RowCons: PROC [t: Tree.Link, node: Tree.Index, options: StoreOptions];
  RowConsExp: PROC [
    t: Tree.Link, node: Tree.Index, options: StoreOptions] RETURNS [Lexeme];
  TransferConstruct: PROC [
    nparms: CARDINAL, resident: BOOLEAN, 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: BOOLEAN];
  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 [BOOLEAN];
  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: BOOLEAN] RETURNS [Lexeme];
  CaseStmtExp: PROC [rootNode: Tree.Index, isExp: BOOLEAN] 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: BOOLEAN, label: LabelCCIndex];

  END.