TreeOps.mesa
Copyright Ó 1985, 1986, 1988, 1991 by Xerox Corporation. All rights reserved.
Satterthwaite, June 6, 1986 1:18:22 pm PDT
Russ Atkinson (RRA) March 1, 1988 6:36:13 pm PST
DIRECTORY
Alloc USING [Handle],
Literals USING [LTIndex, STIndex],
SourceMap USING [Loc],
Symbols USING [HTIndex, ISEIndex],
Tree USING [AttrId, Finger, Id, Index, Info, Link, LinkRep, LinkTag, Map, NodeName, Scan, SubInfo, Test];
TreeOps: DEFINITIONS = {
tree construction interface
Initialize: PROC [Alloc.Handle];
Reset: PROC;
Finalize: PROC;
PushTree: PROC [v: Tree.Link];
PopTree: PROC RETURNS [Tree.Link];
InsertTree: PROC [Tree.Link, CARDINAL];
ExtractTree: PROC [CARDINAL] RETURNS [Tree.Link];
MakeNode: PROC [name: Tree.NodeName, count: INTEGER] RETURNS [Tree.Link];
MakeList: PROC [size: INTEGER] RETURNS [Tree.Link];
PushNode: PROC [name: Tree.NodeName, count: INTEGER];
PushList: PROC [size: INTEGER];
PushProperList: PROC [size: INTEGER];
PushHash: PROC [hti: Symbols.HTIndex];
PushSe: PROC [sei: Symbols.ISEIndex];
PushLit: PROC [lti: Literals.LTIndex];
PushString: PROC [lti: Literals.STIndex];
SetAttr: PROC [attr: Tree.AttrId, value: BOOL];
SetAttrs: PROC [attr1, attr2, attr3: BOOL];
SetInfo: PROC [info: Tree.Info];
SetSubInfo: PROC [subInfo: Tree.SubInfo];
tree deallocation
FreeNode: PROC [node: Tree.Index];
FreeTree: PROC [t: Tree.Link] RETURNS [Tree.Link];
tree attributes
GetTag: PROC [t: Tree.Link] RETURNS [Tree.LinkTag] = INLINE {
RETURN [LOOPHOLE[t, Tree.LinkRep].tag];
};
GetHash: PROC [t: Tree.Link] RETURNS [Symbols.HTIndex];
GetNode: PROC [t: Tree.Link] RETURNS [Tree.Index];
GetSe: PROC [t: Tree.Link] RETURNS [Symbols.ISEIndex];
GetLit: PROC [t: Tree.Link] RETURNS [Literals.LTIndex];
GetStr: PROC [t: Tree.Link] RETURNS [Literals.STIndex];
NthSon: PROC [t: Tree.Link, n: CARDINAL] RETURNS [Tree.Link];
OpName: PROC [t: Tree.Link] RETURNS [Tree.NodeName];
GetAttr: PROC [t: Tree.Link, attr: Tree.AttrId] RETURNS [BOOL];
GetAttrs: PROC [t: Tree.Link] RETURNS [attr1, attr2, attr3: BOOL];
PutAttr: PROC [t: Tree.Link, attr: Tree.AttrId, value: BOOL];
PutAttrs: PROC [t: Tree.Link, attr1, attr2, attr3: BOOL];
GetInfo: PROC [t: Tree.Link] RETURNS [Tree.Info];
PutInfo: PROC [t: Tree.Link, value: Tree.Info];
GetSubInfo: PROC [t: Tree.Link] RETURNS [Tree.SubInfo];
PutSubInfo: PROC [t: Tree.Link, subInfo: Tree.SubInfo];
ToCard: PROC [card: Tree.Info] RETURNS [CARD] = INLINE {
RETURN [LOOPHOLE[card, CARD]];
};
ToLoc: PROC [loc: Tree.Info] RETURNS [SourceMap.Loc] = INLINE {
RETURN [LOOPHOLE[loc, SourceMap.Loc]];
};
FromCard: PROC [card: CARD] RETURNS [Tree.Info] = INLINE {
RETURN [LOOPHOLE[card, Tree.Info]];
};
FromLoc: PROC [loc: SourceMap.Loc] RETURNS [Tree.Info] = INLINE {
RETURN [LOOPHOLE[loc, Tree.Info]];
};
Shared: PROC [t: Tree.Link] RETURNS [BOOL];
MarkShared: PROC [t: Tree.Link, shared: BOOL];
tree manipulation
ScanSons: PROC [root: Tree.Link, action: Tree.Scan];
UpdateLeaves: PROC [root: Tree.Link, map: Tree.Map] RETURNS [v: Tree.Link];
list testing
ListLength: PROC [t: Tree.Link] RETURNS [CARDINAL];
ListHead: PROC [t: Tree.Link] RETURNS [Tree.Link];
ListTail: PROC [t: Tree.Link] RETURNS [Tree.Link];
list manipulation
ScanList: PROC [root: Tree.Link, action: Tree.Scan];
SearchList: PROC [root: Tree.Link, test: Tree.Test];
ReverseScanList: PROC [root: Tree.Link, action: Tree.Scan];
UpdateList: PROC [root: Tree.Link, map: Tree.Map] RETURNS [Tree.Link];
ReverseUpdateList: PROC [root: Tree.Link, map: Tree.Map] RETURNS [Tree.Link];
cross-table tree copying
CopyTree: PROC [root: Tree.Id, map: Tree.Map] RETURNS [v: Tree.Link];
IdentityMap: Tree.Map;
NodeSize: PROC [baseP: Tree.Finger, node: Tree.Index] RETURNS [CARDINAL];
}.