[ivy]<Satterthwaite>SML>SMTreeOps.mesa!6

SMTreeOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
last edit by Satterthwaite, October 21, 1985 3:25:16 pm PDT
DIRECTORY
Tree: TYPE USING [
AttrId, Ext, Leaf, Link, Handle, Id, Info, Name, NodeName, Number, SonId, Text, null];
TreeOps: CEDAR DEFINITIONS = {
tree manager (with state)
TreeManager: TYPE;
TM: TYPE~REF TreeManager;
Create: PROC[zone: ZONE] RETURNS[TM];
Initialize: PROC[tm: TM];
Reset, Finalize: PROC[tm: TM];
tree construction interface (requires state from tree manager)
Zone: PROC [tm: TM] RETURNS[ZONE];
PushTree: PROC[tm: TM, v: Tree.Link];
PopTree: PROC[tm: TM] RETURNS[Tree.Link];
InsertTree: PROC[TM, Tree.Link, NAT];
ExtractTree: PROC[TM, NAT] RETURNS[Tree.Link];
MakeNode: PROC[tm: TM, name: Tree.NodeName, count: INTEGER] RETURNS[Tree.Link];
PushNode: PROC[tm: TM, name: Tree.NodeName, count: INTEGER];
PushName: PROC[tm: TM, name: Tree.Leaf] ~ INLINE {-- Name
tm.PushTree[name]};
PushId: PROC[tm: TM, id: Tree.Id] ~ INLINE {-- Id
tm.PushTree[id]};
PushNumber: PROC[tm: TM, number: Tree.Number] ~ INLINE {-- LTIndex
tm.PushTree[number]};
PushText: PROC[tm: TM, text: Tree.Text] ~ INLINE {-- STIndex
tm.PushTree[text]};
SetAttr: PROC[tm: TM, attr: Tree.AttrId, value: BOOL];
SetExt: PROC[tm: TM, ext: Tree.Ext];
SetInfo: PROC[tm: TM, info: Tree.Info];
FreeTree: PROC[tm: TM, t: Tree.Link] RETURNS[Tree.Link]~INLINE {RETURN [Tree.null]};
tree attributes (no state required)
GetName: PROC[t: Tree.Link] RETURNS[Tree.Name];
GetNode: PROC[t: Tree.Link] RETURNS[Tree.Handle];
GetId: PROC[t: Tree.Link] RETURNS[Tree.Id];
NSons: PROC[t: Tree.Link] RETURNS[NAT];
NthSon: PROC[t: Tree.Link, n: Tree.SonId] RETURNS[Tree.Link];
PutNthSon: PROC[t: Tree.Link, n: Tree.SonId, v: Tree.Link];
OpName: PROC[t: Tree.Link] RETURNS[Tree.NodeName];
GetAttr: PROC[t: Tree.Link, attr: Tree.AttrId] RETURNS[BOOL];
PutAttr: PROC[t: Tree.Link, attr: Tree.AttrId, value: BOOL];
GetExt: PROC[t: Tree.Link] RETURNS[Tree.Ext];
PutExt: PROC[t: Tree.Link, ext: Tree.Ext];
GetInfo: PROC[t: Tree.Link] RETURNS[Tree.Info];
PutInfo: PROC[t: Tree.Link, value: Tree.Info];
tree scanning
Scan: TYPE ~ PROC[t: Tree.Link];
Test: TYPE ~ PROC[t: Tree.Link] RETURNS[BOOL];
StartVisit: PROC[tm: TM] RETURNS[BOOL];
EndVisit: PROC[tm: TM];
ScanSons: PROC[root: Tree.Link, action: TreeOps.Scan];
SearchSons: PROC[root: Tree.Link, test: TreeOps.Test] RETURNS[BOOL];
tree mapping (requires tree manager)
Map: TYPE ~ PROC[tm: TM, t: Tree.Link] RETURNS[v: Tree.Link];
UpdateSons: PROC[tm: TM, root: Tree.Link, map: TreeOps.Map];
UpdateLeaves: PROC[tm: TM, root: Tree.Link, map: TreeOps.Map] RETURNS[v: Tree.Link];
tree copying
CopyTree: PROC[tm: TM, root: Tree.Link, map: TreeOps.Map] RETURNS[v: Tree.Link];
IdentityMap: TreeOps.Map;
}.