-- file TreeOps.Mesa
-- last modified by Satterthwaite, November 15, 1978  11:38 AM

DIRECTORY
  Literals: FROM "literals" USING [LTIndex, STIndex],
  Symbols: FROM "symbols" USING [HTIndex, ISEIndex],
  Table: FROM "table" USING [Finger],
  Tree: FROM "tree";

TreeOps: DEFINITIONS =
  BEGIN

 -- tree construction interface

  Initialize, Finalize: PROCEDURE;

  PushTree: PROCEDURE [v: Tree.Link];
  PopTree: PROCEDURE RETURNS [Tree.Link];

  InsertTree: PROCEDURE [Tree.Link, CARDINAL];
  ExtractTree: PROCEDURE [CARDINAL] RETURNS [Tree.Link];

  MakeNode: PROCEDURE [name: Tree.NodeName, count: INTEGER] RETURNS [Tree.Link];
  MakeList: PROCEDURE [size: INTEGER] RETURNS [Tree.Link];

  PushNode: PROCEDURE [name: Tree.NodeName, count: INTEGER];
  PushList, PushProperList: PROCEDURE [size: INTEGER];
  PushHash: PROCEDURE [hti: Symbols.HTIndex];
  PushSe: PROCEDURE [sei: Symbols.ISEIndex];
  PushLit: PROCEDURE [lti: Literals.LTIndex];
  PushStringLit: PROCEDURE [sti: Literals.STIndex];

  SetInfo: PROCEDURE [info: UNSPECIFIED];
  SetAttr: PROCEDURE [attr: [1..3], value: BOOLEAN];

 -- tree deallocation

  FreeNode: PROCEDURE [node: Tree.Index];
  FreeTree: PROCEDURE [t: Tree.Link] RETURNS [Tree.Link];

 -- tree attributes

  GetNode: PROCEDURE [t: Tree.Link] RETURNS [Tree.Index];
  Shared: PROCEDURE [t: Tree.Link] RETURNS [BOOLEAN];
  SetShared: PROCEDURE [t: Tree.Link, shared: BOOLEAN];
  TestTree: PROCEDURE [t: Tree.Link, name: Tree.NodeName] RETURNS [BOOLEAN];

 -- tree manipulation

  UpdateTree: PROCEDURE [root: Tree.Link, map: Tree.Map] RETURNS [v: Tree.Link];

 -- list testing

  ListLength: PROCEDURE [t: Tree.Link] RETURNS [CARDINAL];
  ListHead: PROCEDURE [t: Tree.Link] RETURNS [Tree.Link];
  ListTail: PROCEDURE [t: Tree.Link] RETURNS [Tree.Link];

 -- list manipulation

  ScanList: PROCEDURE [root: Tree.Link, action: Tree.Scan];
  SearchList: PROCEDURE [root: Tree.Link, test: Tree.Test];
  ReverseScanList: PROCEDURE [root: Tree.Link, action: Tree.Scan];
  UpdateList: PROCEDURE [root: Tree.Link, map: Tree.Map] RETURNS [Tree.Link];
  ReverseUpdateList: PROCEDURE [root: Tree.Link, map: Tree.Map] RETURNS [Tree.Link];


 -- cross-table tree copying

  CopyTree: PROCEDURE [root: Tree.Id, map: Tree.Map] RETURNS [v: Tree.Link];
  IdentityMap: Tree.Map;
  NodeSize: PROCEDURE [baseP: Table.Finger, node: Tree.Index] RETURNS [CARDINAL];

  END.