-- DIActions.mesa  last edit, Bruce  October 11, 1980  4:06 PM

DIRECTORY
  DI USING [CSEIndex, Foo, HTIndex, ISEIndex, NumberType, SEIndex],
  Symbols USING [CSEIndex, HTIndex, SEIndex, TransferMode, typeANY],
  Tree USING [Index, Link, NodeName];
  
DIActions: DEFINITIONS =
  BEGIN OPEN DI;
  
  -- actions
  Abs: PROCEDURE [t: Tree.Link, target: SEIndex];
  Assign: PROCEDURE [lhs: Foo];
  Assignable: PROCEDURE [Foo, Symbols.CSEIndex];
  Base: PROC [Foo, SEIndex];
  DoApply: PROC [t: Tree.Link, target: Foo];
  First: PROCEDURE [t: Tree.Link, target: SEIndex];
  Interval: PROC [
    t: Tree.Link, type: Symbols.SEIndex,
    openLow, openHigh, cntOnly: BOOLEAN ← FALSE];
  Last: PROCEDURE [t: Tree.Link, target: SEIndex];
  Length: PROC [f: Foo, sei: SEIndex];
  LengthenFob: PROCEDURE [f: Foo];
  LoopHole: PROC [f: Foo, type: Symbols.SEIndex, lengthen: BOOLEAN ← FALSE];
  Deref: PROC [f: Foo] RETURNS [success: BOOLEAN];
  DumpArray: PROC [Foo];
  DumpMemory: PROCEDURE [fcnt: Foo];
  Memory: PROC [Tree.Link, Symbols.SEIndex];
  Max: PROCEDURE [size: NumberType, cnt: CARDINAL, signed: BOOLEAN];
  Min: PROCEDURE [size: NumberType, cnt: CARDINAL, signed: BOOLEAN];
  ProcedureCall: PROCEDURE [args: Tree.Link, proc: Foo];
  PushNil: PROC [Foo];
  PutReps: PROCEDURE [UNSPECIFIED];
  PutLongReps: PROCEDURE [LONG UNSPECIFIED];
  Qualify: PROC [f: Foo, hti: Symbols.HTIndex];
  Size: PROC [Foo];
  FoldExpr: PUBLIC PROC [op: Tree.NodeName];
  
  -- utilities
  
  NumberLength: PROC [f: Foo] RETURNS [NumberType];
  MinimalRep: PROC [t: Tree.Link, type: Symbols.SEIndex]
      RETURNS [f: Foo, size: NumberType, signed: BOOLEAN];
  GetRep: PROC [t: Tree.Link, type: Symbols.SEIndex]
      RETURNS [f: Foo, size: NumberType, signed: BOOLEAN];
  GetSize: PROC [index: Tree.Index, type: Symbols.SEIndex]
      RETURNS [size: NumberType, cnt: CARDINAL, signed: BOOLEAN];
  Long: PROC [f: Foo, signed: BOOLEAN];
  Inc: PROC [f: Foo, size: NumberType, signed: BOOLEAN];
  Dec: PROCEDURE [f: Foo, size: NumberType, signed: BOOLEAN];
  TotalWords: PROC [Foo] RETURNS [CARDINAL];
  MakeCnt: PROCEDURE [top, sub: Foo, size: NumberType, signed: BOOLEAN];
  
  CheckLength: PROC [f: Foo, size: CARDINAL] RETURNS [BOOLEAN];
  ResetLongs: PROCEDURE;  -- forget about constructed LONGs
  VariantUnionType: PROC [type: SEIndex] RETURNS [vType: CSEIndex];
  SelectVariantType: PROC [type: SEIndex, tag: HTIndex]
    RETURNS [sei: ISEIndex];
    
  TreeType: TYPE = {subtree, hash, symbol, literal};
  CheckNode: PROC [t: Tree.Link, name: Tree.NodeName]
    RETURNS [son1: Tree.Link];
  CheckLink: PROC [t: Tree.Link, type: TreeType] RETURNS [UNSPECIFIED];
  FirstSon: PROC [index: Tree.Index, type: SEIndex ← Symbols.typeANY]
      RETURNS [f: Foo];
  Son: PROC [t: Tree.Link, target: SEIndex] RETURNS [Foo];
  LoopHoleWork: PROC [t: Tree.Link, type: Symbols.SEIndex];
  TargetTypeWork: PROC [t: Tree.Link, type: Symbols.SEIndex];
  Work: PROC [t: Tree.Link, type: Symbols.SEIndex ← Symbols.typeANY];
  
  -- Stacks
  
  PushVal: PROC [UNSPECIFIED, SEIndex];
  PushLongVal: PROC [LONG UNSPECIFIED, SEIndex];
  Pop: PROCEDURE RETURNS [f: Foo];
  Push: PROCEDURE [Foo];
  Tos: PROCEDURE RETURNS [Foo];
  
  -- constructed types
  
  nullProc, nullSig, nullError: Symbols.CSEIndex;
  
  MakeXferType: PROC [mode: Symbols.TransferMode]
    RETURNS [csei: Symbols.CSEIndex];
  MakePointerType: PROC [cType: Symbols.SEIndex]
      RETURNS [type: Symbols.CSEIndex];
  
  med: CARDINAL;
  hot: CARDINAL;
  
  CheckForStackEmpty: PROCEDURE;
  
  DIAbort: ERROR;
  Underflow: ERROR;
  StackNotEmptyAtStatement: ERROR;
  
  exp: Tree.NodeName = exit;
  memoryInt: Tree.NodeName = open;
  arrayInt: Tree.NodeName = unit;
  reps: Tree.NodeName = label;
  conditionalBreak: Tree.NodeName = internal;
  eol: Tree.NodeName = rowcons;
  frameDollar: Tree.NodeName = index;
  fileDollar: Tree.NodeName = cdot;
  typeDollar: Tree.NodeName = dollar;
  card: Tree.NodeName = stringinit;
  lcard: Tree.NodeName = textinit;
  int: Tree.NodeName = signalinit;
  lint: Tree.NodeName = procinit;
  bang: Tree.NodeName = cast;
  memory: Tree.NodeName = openx;

  END.