--file P5.mesa  edited by Sweet January 15, 1980  1:37 PM

DIRECTORY
  AltoDefs: FROM "altodefs" USING [BYTE],
  CodeDefs: FROM "codedefs",
  Literals: FROM "literals" USING [STIndex],
  Symbols: FROM "symbols" USING [CBTIndex, CSEIndex, ISEIndex, RecordSEIndex],
  Tree: FROM "tree" USING [Index, Link];

P5: DEFINITIONS = 
  BEGIN OPEN AltoDefs, Symbols, Literals, CodeDefs;

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

--from calls.mesa
  ConstructOnStack: PROCEDURE [maint: Tree.Link, rcsei: RecordSEIndex];
  SysCall: PROCEDURE [alpha: BYTE];
  SysCallN: PROCEDURE [alpha: BYTE, n: CARDINAL];
  SysError: PROCEDURE;
  LogHeapFree: SIGNAL [calltree: Tree.Link] RETURNS [BOOLEAN, se Lexeme];
  BuildArgRecord: PROCEDURE [
    t: Tree.Link, rsei: RecordSEIndex, sigerr, isResume: BOOLEAN ← FALSE]
      RETURNS [nparms: CARDINAL];
  IndirectReturnRecord: PROCEDURE [node: Tree.Index, nrets: CARDINAL]
	RETURNS[Lexeme];
  PRetLex: PROCEDURE [nrets: CARDINAL, node: Tree.Index,
    sig: BOOLEAN ← FALSE] RETURNS [Lexeme];

--from code.mesa
  P5Error: PROCEDURE [n: CARDINAL];

--from driver.mesa
  Module: PROCEDURE;
  PopInVals: PROCEDURE [irecord: RecordSEIndex, isenable: BOOLEAN];
  ReleaseLock: PROCEDURE;

--from flow.mesa
  FlowIn: PROCEDURE [t: Tree.Link, tf: BOOLEAN, label: LabelCCIndex];
  FlowTree: PROCEDURE [t: Tree.Link, tf: BOOLEAN, label: LabelCCIndex];
  CompareFn: PROCEDURE [class: CompareClass, code: BOOLEAN, length: [1..2]] RETURNS [BYTE];
  LabelCreate: PROCEDURE [t: Tree.Link];
  LabelList: PROCEDURE [t: Tree.Link, elabel: LabelCCIndex];
  GetLabelMark: PROCEDURE RETURNS [EXLRIndex];
  MakeExitLabel: PROCEDURE RETURNS [exit, loop: LabelCCIndex];
  PopLabels: PROCEDURE [labelmark: EXLRIndex];

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

-- from constructor.mesa
  AddrToStack: PROCEDURE [r: VarIndex];
  RowCons: PUBLIC PROCEDURE [t: Tree.Link, node: Tree.Index];
  RowConsExp: PUBLIC PROCEDURE [t: Tree.Link, node: Tree.Index] RETURNS [Lexeme];
  Construct: PROCEDURE [t: Tree.Link, node: Tree.Index];
  ConstructExp: PUBLIC PROCEDURE [t: Tree.Link, node: Tree.Index] RETURNS [vl: Lexeme];
  TransferConstruct: PROCEDURE [lex: Lexeme, t: Tree.Link, tsei: CSEIndex];
  VariantConstruct: PROCEDURE [node: Tree.Index];
  All: PROCEDURE [t: Tree.Link, node: Tree.Index];
  AllExp: PROCEDURE [t: Tree.Link, node: Tree.Index] RETURNS [Lexeme];

-- from store.mesa
  ExtractFrom: PROCEDURE [
    t1: Tree.Link, tsei: RecordSEIndex, r: VarIndex, transferrec: BOOLEAN];
  SAssign: PROCEDURE [sei: ISEIndex];
  SLAssign: PROCEDURE [sei: ISEIndex, l: Lexeme, exp: BOOLEAN, nwords: CARDINAL];
  TLLAssign: PROCEDURE [leftson: Tree.Link, leftlex, l: Lexeme, exp: BOOLEAN, nbits: CARDINAL];
  TTAssign: PROCEDURE [t1, t2: Tree.Link];

  -- from Expression
  Exp: PROCEDURE [t: Tree.Link] RETURNS [l: Lexeme];
  Reloc: PUBLIC PROCEDURE [node: Tree.Index]
    RETURNS [Lexeme];
  PushConst: PROCEDURE [t: Tree.Link];
  PushLex: PROCEDURE [l: Lexeme];
  LPushLex: PROCEDURE [l: Lexeme] RETURNS [Lexeme];
  PushNestedProcDesc: PROCEDURE [bti: CBTIndex];
  PushNonnestedProcDesc: PROCEDURE [n: CARDINAL];
  PushLProcDesc: PROCEDURE [bti: CBTIndex];
  PushRhs: PROCEDURE [t: Tree.Link];
  MWConstant: SIGNAL [cOffset: CARDINAL] RETURNS [Lexeme];
  DoubleZero: PROCEDURE [t: Tree.Link] RETURNS [BOOLEAN];

  -- from Final
  Fixup: PROCEDURE [start: CCIndex];
  CCInfoMeaning: PROCEDURE RETURNS [CCInfoType];

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

  -- from Jumps
  BindJump: PROCEDURE [min, max: INTEGER, c: JumpCCIndex] RETURNS [bindable: BOOLEAN];
  BindJumpDStar: PROCEDURE [min, max: INTEGER, c: JumpCCIndex] RETURNS [bindable: BOOLEAN];
  CodeJump: PROCEDURE [nbytes: INTEGER, c: JumpCCIndex];
  CodeJumpDStar: PROCEDURE [nbytes: INTEGER, c: JumpCCIndex];

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

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

  -- from Statement
  CaseStmtExp: PROCEDURE [node: Tree.Index, iscasexp: BOOLEAN]
    RETURNS [Lexeme];
  CatchPhrase: PROCEDURE [node: Tree.Index];
  StatementTree: PROCEDURE [t: Tree.Link] RETURNS [Tree.Link];
  SCatchPhrase: PROCEDURE [node: Tree.Index];

END.