DIRECTORY NameSymbolTable USING [Name, nullName], Rope USING [ROPE], TiogaLooks USING [Offset, Runs]; TiogaNode: CEDAR DEFINITIONS = BEGIN Node: TYPE = MACHINE DEPENDENT RECORD [ -- 4 words plus variant data next: PRIVATE Ref, -- next node in sibling chain or node.parent if last 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 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 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 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 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 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]; NodeItself: Offset = -1; nullLocation: Location = [nullPath, NodeItself]; Span: TYPE = RECORD [start, end: Location _ nullLocation]; nullSpan: Span = [nullLocation, nullLocation]; END. ^TiogaNode.mesa; Written by Bill Paxton. December 1982 edited by Paxton on August 25, 1983 3:05 pm edited by McGregor on May 12, 1983 4:10 pm edited by Plass on February 9, 1983 10:43 am Tioga2 document model branch => item* branch* A branch contains a list of item contents and a list of children branches. Branches represent the hierarchical structure of a document and can be likened to a paragraph, illustration, table, etc. A document is a branch. item = text | list | box An item is either a text node, a list node, or a box node. Text nodes hold characters and looks. List nodes are used for fields, equations, footnotes, etc., and are not required to be rectangular; i.e., can have line breaks when formatted. Box nodes are used for graphics frames, parts of equations, etc., and are required to be rectangular; i.e. they cannot be broken across line boundaries. Basic nodes are for special kinds of contents for list or boxes (e.g., splines), and may only appear as children of box or list nodes. Sites of extensibility for Tioga2 documents are list, box, and basic nodes. All nodes have property lists and formats so styles extend down into structured objects such as equations and pictures. Node Declarations -- siblings are either all branches or all non-branches 4 additional words of variant data 5 additional words of variant data (counting class & variant discrimination) 5 additional words of variant data (counting class & variant discrimination) 5 additional words of variant data (counting class & variant discrimination) 3 additional words of variant data Various kinds of REF's for nodes Paths, Locations, and Spans where >= length of text means at end where = loc in [0..length) means before that character e.g., where = 0 means at start of text where = NodeItself means location is the node itself rather than in its contents start.node can equal end.node in which case either both start.where and end.where = NodeItself, or neither do and start.where <= end.where otherwise, end.node should follow start.node in the tree nodes need not be siblings no restrictions on start.where or end.where Κ˜Jšœ5™5Jšœ+™+Jšœ*™*Jšœ,™,J˜šΟk ˜ Jšœœ˜'Jšœœœ˜Jšœ œ˜ J˜—Jšœ œ œ˜$J˜™bodyšœ™K™έ—™K™‹—K™†K™KK™w—J™™J˜š œœœ œœΟc˜DJšœœ ž4˜LJšœ žœ4™BJšœž˜)Jšœœœž3˜LJšœ œœž3˜PJšœ œœž!˜;Jšœœœž2˜QJšœ œœž/˜LJšœ œœž-˜IJšœ œœž)˜FJšœ œœž,˜GJšœ œœž˜+Jšœœœž'˜>Jšœœœž6˜WJšœœœž4˜UJšœ%ž0˜Ušœ œ ˜$šœ žF˜RJšœ"™"Jšœœž˜5Jšœ œž ˜,—šœ ž+˜5Jšœž*˜Bšœ œ˜%šœ ž5˜?JšœL™LJšœœž'˜DJšœ ž˜&Jšœž˜,Jšœ˜—šœ žK˜TJšœL™LJšœœž˜+Jšœ œž)˜BJšœœœž&˜8Jšœ˜—šœ ž<˜FJšœL™LJšœœž˜,Jšœ œž)˜BJšœœœž'˜9Jšœ˜—Jšœ˜ ——šœ ž5˜@Jšœ"™"Jšœž+˜@Jšœœœž˜+Jšœ˜—Jšœ˜ J˜——™ Jšœœœ˜Jšœœœ ˜&Jšœ œœ ˜"Jšœ œœ˜'Jšœ œœ˜%Jšœ œœ˜'Jšœœœ ˜$—J˜Jšœœ#˜5Jšœœ˜'Jšœ œ˜'Jšœ œž˜*J˜Iprocšœ œ ˜Lšœ%ž˜DLšœ"œ˜4L˜Lšœœ˜Lšœ$œ˜7L˜Lšœœ˜!Jšœœ ˜J˜Jšœœ˜"J˜*—J™™J˜šœœœ˜Jšœ ž˜%Jšœœžœ˜,J˜—Jšœœœ˜J˜šœ œœ˜4Jšœ$™$šœ6™6Jšœ&™&—JšœP™PJ˜—J˜J˜Jšœ0˜0J˜šœœœ'˜:šœ™JšœD™DJšœ'™'—šœ8™8Jšœ™Jšœ+™+J˜——J˜.J˜—Jšœ˜J˜—…—Ζ%