Tioga.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Doug Wyatt, February 26, 1992 12:07 pm PST
DIRECTORY
Prop USING [PropList],
Rope USING [ROPE],
Rosary USING [ROSARY],
Char USING [CharSet, XCHAR];
Tioga: CEDAR DEFINITIONS ~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
ROSARY: TYPE ~ Rosary.ROSARY;
XCHAR: TYPE ~ Char.XCHAR;
CharSet: TYPE ~ Char.CharSet;
PropList: TYPE ~ Prop.PropList;
Node: TYPE ~ REF NodeRep;
NodeRep: TYPE ~ PACKED RECORD [
parent: Node ¬ NIL, -- points to parent, if any
next: Node ¬ NIL, -- points to next sibling, if any
child: Node ¬ NIL, -- points to first child, if any
rope: ROPE ¬ NIL,
runs: ROSARY--OF CharLooksItem-- ¬ NIL,
charSets: ROSARY--OF CharSetsItem-- ¬ NIL,
charProps: ROSARY--OF CharPropsItem-- ¬ NIL,
nodeProps: PropList, -- node properties (except $Format and $Comment)
format: ATOM ¬ NIL, -- value of $Format property
comment: BOOL ¬ FALSE, -- value of $Comment property
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)
hasArtwork: BOOL ¬ FALSE, -- true if node has $Artwork prop (accelerator)
hasActive: BOOL ¬ FALSE, -- true if node has $Active 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)
];
Among the invariants that must be satisfied by a node n are:
n.child=NIL OR n.child.parent=n
n.next=NIL OR n.next.parent=n.parent
n.runs=NIL OR Rosary.Size[n.runs]=Rope.Size[n.rope]
n.charSets=NIL OR Rosary.Size[n.charSets]=Rope.Size[n.rope]
n.charProps=NIL OR Rosary.Size[n.charProps]=Rope.Size[n.rope]
n.hasStyleDef=(Prop.Get[n.nodeProps, $StyleDef]#NIL)
n.hasPrefix=(Prop.Get[n.nodeProps, $Prefix]#NIL)
n.hasPostfix=(Prop.Get[n.nodeProps, $Postfix]#NIL)
n.hasArtwork=(Prop.Get[n.nodeProps, $Artwork]#NIL)
n.hasActive=(Prop.Get[n.nodeProps, $Active]#NIL)
Look: TYPE ~ CHAR['a..'a+31]; -- 32 bits; indexed from "a"
Bit: TYPE ~ BOOL ¬ FALSE;
Looks: TYPE ~ PACKED ARRAY Look OF Bit;
noLooks: Looks ~ ALL[FALSE];
allLooks: Looks ~ ALL[TRUE];
Runs: TYPE ~ ROSARY;
CharSetsItem: TYPE ~ REF CharSet;
CharLooksItem: TYPE ~ REF Looks;
CharPropsItem: TYPE ~ PropList;
Location: TYPE ~ RECORD [node: Node, where: INT];
where >= length of text means at end
where = loc in [0..length) means before that character; where = 0 means at start of text
where = NodeItself means location is the node itself rather than in its contents
NodeItself: INT ~ -1;
nullLocation: Location ~ [node: NIL, where: NodeItself];
Span: TYPE ~ RECORD [start, end: Location ¬ nullLocation];
start.node can equal end.node
in which case either both start.where and end.where = NodeItself, or
neither does 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
nullSpan: Span ~ [nullLocation, nullLocation];
CapChange: TYPE ~ {allCaps, allLower, initCaps, firstCap};
Place: TYPE ~ {before, after, sibling, child};
Order: TYPE ~ {before, same, after, disjoint};
Event: TYPE ~ REF EventRep;
EventRep: TYPE;
END.