<> <> <> <> <> <> <> <> DIRECTORY Rope USING [MaxLen, ROPE], TextLooks USING [Runs]; TextNode: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; MaxLen: INT ~ Rope.MaxLen; Runs: TYPE ~ TextLooks.Runs; Node: TYPE = REF NodeBody; NodeBody: TYPE = RECORD [ next: Node, -- points to next sibling, or if last=true, to parent child: Node, -- points to first child, if any, of this node props: Props, -- points to node property list formatName: ATOM _ NIL, -- name of format for the node last: BOOL _ FALSE, -- true if this is last sibling hasstyledef: BOOL _ FALSE, -- true if node has StyleDef prop (accelerator) hasprefix: BOOL _ FALSE, -- true if node has Prefix prop (accelerator) haspostfix: BOOL _ FALSE, -- true if node has Postfix prop (accelerator) hascharprops: BOOL _ FALSE, -- true if node has CharProps prop (accelerator) hascharsets: BOOL _ FALSE, -- true if node has CharSets prop (accelerator) hasartwork: BOOL _ FALSE, -- true if node has Artwork prop (accelerator) deleted: BOOL _ FALSE, -- true if has been deleted or is root pending delete dirty: BOOL _ FALSE, -- true if has been edited (contents, or children moved, inserted, ...) new: BOOL _ FALSE, -- true if created during this editing session (i.e., not from file) comment: BOOL _ FALSE, -- true if node is a comment count: [0..countMax] _ 0, -- incremented by text edit routines rope: ROPE, runs: Runs ]; Props: TYPE = REF PropsBody; PropsBody: TYPE = RECORD [name: ATOM, value: REF, next: Props]; countMax: NAT = 31; -- 5 bits for count Location: TYPE = RECORD [node: Node, where: INT _ 0]; <= length of text means at end>> <> <> <> nodeItself: INT = -1; nullLocation: Location = [node: NIL, where: nodeItself]; MakeNodeLoc: PROC [n: Node] RETURNS [Location]; NewTextNode: PROC RETURNS [Node]; Parent: PROC [n: Node] RETURNS [Node]; Root: PROC [n: Node] RETURNS [Node]; Next: PROC [n: Node] RETURNS [Node]; <> <> Previous: PROC [n: Node, parent: Node _ NIL] RETURNS [Node]; <> <> <> Forward: PROC [node: Node] RETURNS [nx: Node, levelDelta: INTEGER]; <> <> <> <> <> Backward: PROC [node: Node, parent: Node _ NIL] RETURNS [back, backparent: Node, levelDelta: INTEGER]; <> <> <> StepForward: PROC [node: Node] RETURNS [Node]; <> StepBackward: PROC [node: Node, parent: Node _ NIL] RETURNS [Node]; <> Level: PROC [node: Node] RETURNS [level: INTEGER]; <> ForwardClipped: PROC [node: Node, maxLevel: INTEGER, nodeLevel: INTEGER _ 0] RETURNS [nx: Node, nxLevel: INTEGER]; <> <> <> BackwardClipped: PROC [node: Node, maxLevel: INTEGER, parent: Node _ NIL, nodeLevel: INTEGER _ 0] RETURNS [back, backparent: Node, backLevel: INTEGER]; <> <> LocRelative: PROC [location: Location, count: INT, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [Location]; <> < location corresponding to count>> <> <> LocWithin: PROC [n: Node, count: INT, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [Location]; LocOffset: PROC [loc1, loc2: Location, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [count: INT]; <> <> <> <> BadArgs: ERROR; LocNumber: PROC [at: Location, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [count: INT]; <> FirstSibling: PROC [n: Node] RETURNS [Node]; LastSibling: PROC [n: Node] RETURNS [Node]; LastWithin: PROC [n: Node] RETURNS [Node]; <> <> LastLocWithin: PROC [n: Node] RETURNS [Location]; <> FirstChild: PROC [n: Node] RETURNS [Node]; LastChild: PROC [n: Node] RETURNS [Node]; NthChild: PROC [n: Node, location: INT _ 0] RETURNS [child: Node]; NthSibling: PROC [n: Node, cnt: INT _ 0] RETURNS [Node]; CountChildren: PROC [n: Node] RETURNS [count: INT]; CountFollowing: PROC [n: Node] RETURNS [count: INT]; CountToParent: PROC [n: Node] RETURNS [count: INT, parent: Node]; CountToChild: PROC [parent, child: Node] RETURNS [count: INT]; NodeRope: PROC [n: Node] RETURNS [ROPE]; NodeRuns: PROC [n: Node] RETURNS [Runs]; NodeProps: PROC [n: Node] RETURNS [Props]; NodeFormat: PROC [n: Node] RETURNS [ATOM]; IsLastSibling: PROC [n: Node] RETURNS [BOOL]; EndPos: PROC [n: Node] RETURNS [INT]; END.