DIRECTORY Rope USING [ROPE], TiogaLooks USING [Looks, Runs], TiogaNode, TiogaItemClass, TiogaBasicClass; TiogaNodeOps: CEDAR DEFINITIONS = BEGIN OPEN Rope, TiogaNode, TiogaItemClass, TiogaBasicClass; RegisterItemClass: PROC [classRec: ItemClassRec] RETURNS [ItemClassID]; LookupItemID: PROC [flavor: ItemFlavor] RETURNS [ItemClassID]; FetchItemClass: PROC [id: ItemClassID] RETURNS [ItemClass]; RegisterBasicClass: PROC [classRec: BasicClassRec] RETURNS [BasicClassID]; LookupBasicID: PROC [flavor: BasicFlavor] RETURNS [BasicClassID]; FetchBasicClass: PROC [id: BasicClassID] RETURNS [BasicClass]; NewBranchNode: PROC RETURNS [br: RefBranchNode]; NewTextNode: PROC [class: ItemClassID] RETURNS [tx: RefTextNode]; NewListNode: PROC [class: ItemClassID] RETURNS [ls: RefListNode]; NewBoxNode: PROC [class: ItemClassID] RETURNS [bx: RefBoxNode]; NewBasicNode: PROC [class: BasicClassID] RETURNS [bs: RefBasicNode]; FetchChar: PROC [text: RefTextNode, index: Offset] RETURNS [CHAR]; FetchLooks: PROC [text: RefTextNode, index: Offset] RETURNS [TiogaLooks.Looks]; Fetch: PROC [text: RefTextNode, index: Offset] RETURNS [CHAR, TiogaLooks.Looks]; GetRope, NodeRope: PROC [text: RefTextNode] RETURNS [ROPE]; GetRuns, NodeRuns: PROC [text: RefTextNode] RETURNS [TiogaLooks.Runs]; Size: PROC [text: RefTextNode] RETURNS [Offset]; FromRope: PROC [rope: ROPE] RETURNS [RefTextNode]; FromString: PROC [string: REF READONLY TEXT] RETURNS [RefTextNode]; DocFromNode: PROC [child: RefItemNode] RETURNS [root: RefBranchNode]; FreeTree: PROC [root: RefBranchNode]; IsBranch: PROC [n: Ref] RETURNS [BOOL] = INLINE {RETURN[n#NIL AND ISTYPE[n, RefBranchNode]]}; IsItem: PROC [n: Ref] RETURNS [BOOL] = INLINE {RETURN[n#NIL AND ISTYPE[n, RefItemNode]]}; IsText: PROC [n: Ref] RETURNS [BOOL] = INLINE {RETURN[n#NIL AND ISTYPE[n, RefTextNode]]}; IsList: PROC [n: Ref] RETURNS [BOOL] = INLINE {RETURN[n#NIL AND ISTYPE[n, RefListNode]]}; IsBox: PROC [n: Ref] RETURNS [BOOL] = INLINE {RETURN[n#NIL AND ISTYPE[n, RefBoxNode]]}; IsBasic: PROC [n: Ref] RETURNS [BOOL] = INLINE {RETURN[n#NIL AND ISTYPE[n, RefBasicNode]]}; NarrowToBranchNode: PROC [n: Ref] RETURNS [RefBranchNode] = INLINE {RETURN [WITH n SELECT FROM br: RefBranchNode => br, ENDCASE => NIL] }; NarrowToItemNode: PROC [n: Ref] RETURNS [RefItemNode] = INLINE {RETURN [WITH n SELECT FROM it: RefItemNode => it, ENDCASE => NIL] }; NarrowToTextNode: PROC [n: Ref] RETURNS [RefTextNode] = INLINE {RETURN [WITH n SELECT FROM tx: RefTextNode => tx, ENDCASE => NIL] }; NarrowToListNode: PROC [n: Ref] RETURNS [ls: RefListNode] = INLINE {RETURN [WITH n SELECT FROM ls: RefListNode => ls, ENDCASE => NIL] }; NarrowToBoxNode: PROC [n: Ref] RETURNS [RefBoxNode] = INLINE {RETURN [WITH n SELECT FROM bx: RefBoxNode => bx, ENDCASE => NIL] }; NarrowToBasicNode: PROC [n: Ref] RETURNS [RefBasicNode] = INLINE {RETURN [WITH n SELECT FROM bs: RefBasicNode => bs, ENDCASE => NIL] }; MakeNodeLoc: PROC [n: Ref] RETURNS [Location]; MakeNodeSpan: PROC [first, last: Ref] RETURNS [Span]; NodeSpan: PROC [span: Span] RETURNS [Span] = INLINE { RETURN [[[span.start.path,NodeItself],[span.end.path,NodeItself]]] }; NodeLoc: PROC [loc: Location] RETURNS [Location] = INLINE { RETURN [[loc.path,NodeItself]] }; EndPos: PROC [n: RefTextNode] RETURNS [Offset]; -- gives offset at end of text node END. ¨TiogaNodeOps.mesa; Written by McGregor, February 1983 edited by McGregor, May 11, 1983 3:55 pm edited by Paxton, August 10, 1983 4:26 pm Item Node Class registration and operations Register a new item class implementation. Given the name for a item node class, fetch the class ID. Will return invalidItemID if the given class is not registered. Given the unique class ID for a item node class, fetch the class information. Will return NIL if the given class is not registered. Basic Node Class registration and operations Register a new item class implementation. Given the name for a basic node class, fetch the class ID. Will return invalidBasicID if the given class is not registered. Given the unique class ID for a basic node class, fetch the class information. Will return NIL if the given class is not registered. Creating new nodes Text node operations fetches the indexed information returns the looks for the character at the given location use reader's if getting looks for sequence of locations fetches the indexed information Operations to create a text node from a rope or a string create a text node with looks from a normal rope copies the contents of the string Operation to create a document from an item node child typically created by FromRope or FromString Operation to free a tree by clearing all REF's Node predicates Node narrowing Return the requested type of node if possible, else return NIL Miscellaneous Κ(˜Jšœ5™5Jšœ(™(Jšœ)™)J˜šΟk ˜ Jšœœœ˜Jšœ œ˜Jšœ ˜ Jšœ˜Jšœ˜J˜—Jšœœ œ˜'Jšœ2˜6J˜™+J˜procšΟnœœœ˜GKšœ)™)K˜—šž œœœ˜>Kšœ6œB™zK™—šžœœœ ˜;Kšœ[œ&™„—J˜—™,J˜šžœœœ˜JKšœ)™)K˜—šž œœœ˜AKšœ7œC™|K™—šžœœœ˜>Kšœ\œ&™…—J˜—™J˜šž œœœ˜0J˜—šž œœœ˜AJ˜—šž œœœ˜AJ˜—šž œœœ˜?J˜—Jšž œœœ˜DJ˜—™J˜šž œœ$œœ˜BJšΟc™J˜—šž œœ$œ˜OJšŸ9™9JšŸ7™7J˜—šžœœ$œœ˜PJšŸ™J˜—Jšžœœœœ˜;J˜Jšžœœœ˜FJ˜Jšžœœœ ˜0J˜—šŸ8™8J˜šžœœœœ˜2JšŸ0™0J˜—š ž œœ œœœœ˜CJšŸ!™!J˜——šŸ0™0J™šž œœœ˜EJšŸ1™1J˜——šŸ.™.J™šžœœ˜%J˜——™J˜š žœœ œœ˜/Jš œœœœœ˜-J˜—š žœœ œœ˜-Jš œœœœœ˜+J˜—š žœœ œœ˜-Jš œœœœœ˜+J˜—š žœœ œœ˜-Jš œœœœœ˜+J˜—š žœœ œœ˜,Jš œœœœœ˜*J˜—š žœœ œœ˜.Jš œœœœœ˜,J˜—J˜—™J˜™>J˜—šžœœ œ˜BJš œœœœœœœ˜GJ˜—šžœœ œ˜>Jš œœœœœœœ˜EJ˜—šžœœ œ˜>Jš œœœœœœœ˜EJ˜—šžœœ œ˜BJš œœœœœœœ˜EJ˜—šžœœ œ˜J˜—šžœœœ˜9Jšœœ˜#J˜—Jšžœœœ Ÿ#˜SJ˜J˜—Jšœ˜J˜J˜—…— π