<> <> <> <> <> <> <> <> DIRECTORY Rope USING [ROPE], TextLooks USING [Runs]; TextNode: CEDAR DEFINITIONS = BEGIN Offset: TYPE = INT _ 0; MaxLen: INT = LAST[INT]; ROPE: TYPE = Rope.ROPE; Ref: TYPE = REF Body; RefTextNode: TYPE = Ref; -- a synonym for backwards compatibility. Body: TYPE = RECORD [ next: Ref, -- points to next sibling, or if last=true, to parent child: Ref, -- points to first child, if any, of this node props: NodeProps, -- 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: TextLooks.Runs ]; Location: TYPE = RECORD [node: Ref, where: INT]; <= length of text means at end>> <> <> <> NodeItself: INT = -1; nullLocation: Location = [node: NIL, where: NodeItself]; MakeNodeLoc: PROC [n: Ref] RETURNS [Location]; Span: TYPE = RECORD [start, end: Location _ nullLocation]; <> <> <> <> <> <> nullSpan: Span = [nullLocation,nullLocation]; MakeNodeSpan: PROC [first, last: Ref] RETURNS [Span]; countMax: NAT = 31; -- 5 bits for count OfNode: TYPE = {text, other}; NodeList: TYPE = REF NodeListBody; NodeListBody: TYPE = RECORD [node: Ref, next: NodeList]; NodeProps: TYPE = REF NodePropsBody; NodePropsBody: TYPE; -- exported by NodePropsImpl NewTextNode: PROC RETURNS [txt: RefTextNode]; NarrowToTextNode: PROC [n: Ref] RETURNS [txt: RefTextNode]; <> Parent: PROC [n: Ref] RETURNS [Ref]; Root: PROC [n: Ref] RETURNS [Ref]; Next: PROC [n: Ref] RETURNS [Ref]; <> <> Previous: PROC [n: Ref, parent: Ref _ NIL] RETURNS [nx: Ref]; <> <> <> Forward: PROC [node: Ref] RETURNS [nx: Ref, levelDelta: INTEGER]; <> <> <> <> <> Backward: PROC [node: Ref, parent: Ref _ NIL] RETURNS [back, backparent: Ref, levelDelta: INTEGER]; <> <> <> StepForward: PROC [node: Ref] RETURNS [Ref]; <> StepBackward: PROC [node: Ref, parent: Ref _ NIL] RETURNS [Ref]; <> Level: PROC [node: Ref] RETURNS [level: INTEGER]; <> ForwardClipped: PROC [node: Ref, maxLevel: INTEGER, nodeLevel: INTEGER _ 0] RETURNS [nx: Ref, nxLevel: INTEGER]; <> <> <> BackwardClipped: PROC [node: Ref, maxLevel: INTEGER, parent: Ref _ NIL, nodeLevel: INTEGER _ 0] RETURNS [back, backparent: Ref, backLevel: INTEGER]; <> <> LocRelative: PROC [location: Location, count: INT, break: NAT _ 1, skipCommentNodes: BOOL _ FALSE] RETURNS [Location]; <> < location corresponding to count>> <> <> LocWithin: PROC [n: Ref, 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: Ref] RETURNS [Ref]; LastSibling: PROC [n: Ref] RETURNS [Ref]; LastWithin: PROC [n: Ref] RETURNS [Ref]; <> <> LastLocWithin: PROC [n: Ref] RETURNS [Location]; <> FirstChild: PROC [n: Ref] RETURNS [Ref]; LastChild: PROC [n: Ref] RETURNS [Ref]; NthChild: PROC [n: Ref, location: INT _ 0] RETURNS [child: Ref]; NthSibling: PROC [n: Ref, cnt: INT _ 0] RETURNS [Ref]; CountChildren: PROC [n: Ref] RETURNS [count: INT]; CountFollowing: PROC [n: Ref] RETURNS [count: INT]; CountToParent: PROC [n: Ref] RETURNS [count: INT, parent: Ref]; CountToChild: PROC [parent, child: Ref] RETURNS [count: INT]; NodeRope: PROC [n: RefTextNode] RETURNS [ROPE]; NodeRuns: PROC [n: RefTextNode] RETURNS [TextLooks.Runs]; Props: PROC [n: Ref] RETURNS [NodeProps]; NodeFormat: PROC [n: Ref] RETURNS [ATOM]; IsLastSibling: PROC [n: Ref] RETURNS [BOOL]; EndPos: PROC [n: Ref] RETURNS [INT]; END.