DIRECTORY TiogaNode; TiogaTreeOps: CEDAR DEFINITIONS = BEGIN Ref: TYPE = TiogaNode.Ref; RefBranchNode: TYPE = TiogaNode.RefBranchNode; TreeLoc: TYPE = RECORD [node: Ref, where: TiogaNode.Offset]; nullLoc: TreeLoc = [NIL, TiogaNode.NodeItself]; TreeSpan: TYPE = RECORD [start, end: TreeLoc _ nullLoc]; nullSpan: TreeSpan = [nullLoc, nullLoc]; BranchLoc: TYPE = RECORD [node: RefBranchNode, where: TiogaNode.Offset]; nullBranchLoc: BranchLoc = [NIL, TiogaNode.NodeItself]; BranchSpan: TYPE = RECORD [start, end: BranchLoc _ nullBranchLoc]; nullBranchSpan: BranchSpan = [nullBranchLoc, nullBranchLoc]; Parent: PROC [n: Ref] RETURNS [Ref]; -- do you really want TiogaPathOps instead? Root: PROC [n: Ref] RETURNS [RefBranchNode]; -- do you really want TiogaPathOps instead? Next: PROC [n: Ref] RETURNS [Ref]; -- do you really want TiogaPathOps instead? Contents: PROC [n: Ref] RETURNS [Ref] ; -- do you really want TiogaPathOps instead? BranchChild: PROC [n: RefBranchNode] RETURNS [RefBranchNode] ; -- do you really want TiogaPathOps instead? FirstSibling: PROC [n: Ref, parent: Ref _ NIL] RETURNS [sib: Ref]; LastSibling: PROC [n: Ref] RETURNS [sib: Ref]; Previous: PROC [n: Ref, parent: Ref _ NIL] RETURNS [sib: Ref]; LastWithin: PROC [n: Ref] RETURNS [Ref]; ContainingStatement: PROC [n: Ref] RETURNS [RefBranchNode]; StepForwardNode: PROC [node: Ref] RETURNS [nxt: Ref]; Forward: PROC [node: RefBranchNode] RETURNS [nx: RefBranchNode, levelDelta: INTEGER]; StepBackwardNode: PROC [node: Ref, parent: Ref _ NIL] RETURNS [back, backparent: Ref]; Backward: PROC [node: RefBranchNode, parent: Ref _ NIL] RETURNS [back: RefBranchNode, backparent: Ref, levelDelta: INTEGER]; LastBranchWithin: PROC [n: RefBranchNode] RETURNS [RefBranchNode]; Level: PROC [n: Ref] RETURNS [INTEGER]; MakeTreeLoc: PROC [n: Ref] RETURNS [TreeLoc]; MakeTreeSpan: PROC [first, last: Ref] RETURNS [TreeSpan]; MakeBranchLoc: PROC [n: RefBranchNode] RETURNS [BranchLoc]; MakeBranchSpan: PROC [first, last: RefBranchNode] RETURNS [BranchSpan]; BackLoc: PROC [loc: TreeLoc] RETURNS [new: TreeLoc]; ForwardLoc: PROC [loc: TreeLoc] RETURNS [new: TreeLoc]; END. TiogaTreeOps.mesa; Written by McGregor, February 1983 edited by McGregor, May 11, 1983 3:55 pm edited by Paxton, July 26, 1983 11:08 am Tree traversal You probably want to use the routines in TiogaPathOps instead of these. These routines ignore template applications -- they are used by the tree editing routines that work within a single tree. Forward and Backward in Tree Miscellaneous ʘJšœ5™5Jšœ(™(Jšœ(™(J˜šÏk ˜ Jšœ ˜ J˜—Jšœœ œ˜'J˜Jšœœ˜Jšœœ˜.J˜Jšœ œœ&˜J˜šž œœ œ˜(J˜—šžœœ œ˜;J˜——™J™šžœœ œ ˜5J˜—šžœœœ!œ˜UJ˜—šžœœœœ˜VJ˜—šžœœ%œ˜7Jšœ4œ˜D—J™—™ J™šžœœœ˜BJ˜—Jšžœœ œœ˜'J˜šž œœ œ ˜-J˜—šž œœœ ˜9J˜—šž œœœ ˜;J˜—šžœœœ˜GJ˜—Jšžœœœ˜4J˜Jšž œœœ˜7J˜—Jšœ˜J˜J˜—…—p