<> <> <> <> DIRECTORY NameSymbolTable USING [Name, nullName], Rope USING [ROPE], TiogaLooks USING [Offset, Runs]; TiogaNode: CEDAR DEFINITIONS = BEGIN <> < item* branch*>> <> <> <> <> <> <> <<>> <> Node: TYPE = MACHINE DEPENDENT RECORD [ -- 4 words plus variant data next: PRIVATE Ref, -- next node in sibling chain or node.parent if last << -- siblings are either all branches or all non-branches>> format: Name, -- name of the format last: BOOL _ FALSE, -- true if last sibling; next then points to parent hasPropList: BOOL _ FALSE, -- true if has a nonNIL property list in hash table comment: BOOL _ FALSE, -- value of Comment prop for node hasbranchclass: BOOL _ FALSE, -- true if node has BranchClass prop (accelerator) 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 has Postfix prop (accelerator) deleted: BOOL _ FALSE, -- true if deleted or if root pending delete changed: BOOL _ FALSE, -- true if edited new: BOOL _ FALSE, -- true if created this editing session internalRepCreated: BOOL _ TRUE, -- true if have created branch internal representation externalRepValid: BOOL _ FALSE, -- true if have valid branch external representation templateInfo: TemplateInfo _ normal, -- an application, a formal parameter, or normal variantData: SELECT kind:OfNode FROM branch => [ -- a branch is an item optionally followed by a series of sub branches <<4 additional words of variant data>> child: PRIVATE RefBranchNode, -- head of child chain contents: PRIVATE RefItemNode], -- contents item => [ -- these are found as contents of branches class: ItemClassID, -- item implementation specific operations itemData: SELECT kind:OfItemNode FROM text => [ -- optimizes the common case of characters with looks <<5 additional words of variant data (counting class & variant discrimination)>> count: [0..countMax] _ NULL, -- number of edits since last flattened rope: Rope.ROPE, -- the characters runs: TiogaLooks.Runs -- run encoded looks ], box => [ -- for rectangular things like frames that do not have internal line breaks <<5 additional words of variant data (counting class & variant discrimination)>> boxFiller: [0..32) _ NULL, -- unused space contents: PRIVATE Ref, -- node contents; can be any kind of node data: REF ANY -- for use by the box class operations ], list => [ -- for things like fields that can have internal line breaks <<5 additional words of variant data (counting class & variant discrimination)>> listFiller: [0..32) _ NULL, -- unused space contents: PRIVATE Ref, -- node contents; can be any kind of node data: REF ANY -- for use by the list class operations ] ENDCASE], basic => [ -- only for various things that go in boxes and lists <<3 additional words of variant data>> class: BasicClassID, -- basic implementation specific operations data: REF ANY -- for use by the operations ] ENDCASE]; <> Ref: TYPE = REF Node; RefBranchNode: TYPE = REF Node.branch; RefItemNode: TYPE = REF Node.item; RefTextNode: TYPE = REF Node.item.text; RefBoxNode: TYPE = REF Node.item.box; RefListNode: TYPE = REF Node.item.list; RefBasicNode: TYPE = REF Node.basic; TemplateInfo: TYPE = { normal, application, formal }; OfNode: TYPE = { branch, item, basic }; OfItemNode: TYPE = { text, box, list }; countMax: NAT=31; -- 5 bits for edit count ItemClassID: TYPE = [0..512); defaultTextClassID: ItemClassID = 0; -- for standard text item nodes invalidItemClassID: ItemClassID = LAST[ItemClassID]; BasicClassID: TYPE = INTEGER; invalidBasicClassID: BasicClassID = LAST[BasicClassID]; Offset: TYPE = TiogaLooks.Offset; MaxLen: Offset = LAST[Offset]; Name: TYPE = NameSymbolTable.Name; nullName: Name = NameSymbolTable.nullName; <<>> <> Path: TYPE = RECORD [ node: Ref, -- node at end of the path path: REF Path -- the rest of the path -- ]; nullPath: Path = [NIL, NIL]; Location: TYPE = RECORD [path: Path, where: Offset]; <= length of text means at end>> <> <> <> NodeItself: Offset = -1; nullLocation: Location = [nullPath, NodeItself]; Span: TYPE = RECORD [start, end: Location _ nullLocation]; <> <> <> <> <> <> nullSpan: Span = [nullLocation, nullLocation]; END.