NodeReader.mesa
Copyright Ó 1991, 1992 by Xerox Corporation. All rights reserved.
Doug Wyatt, March 13, 1992 1:10 pm PST
NodeReader provides fast access to character information in a Tioga Node.
DIRECTORY
Char USING [CharCode, CharSet, XCHAR],
Rope USING [ROPE],
Rosary USING [ROSARY],
Tioga USING [Node, Looks, noLooks, PropList];
NodeReader: CEDAR DEFINITIONS ~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
ROSARY:
TYPE ~ Rosary.
ROSARY;
Ref: TYPE ~ REF Rep;
Rep:
TYPE ~
RECORD [
size: INT ¬ 0,
rope: ROPE ¬ NIL,
runs: ROSARY ¬ NIL,
charSets: ROSARY ¬ NIL,
charProps: ROSARY ¬ NIL,
text: REF TEXT ¬ NIL,
textStart, textEnd: INT ¬ 0,
looks: Tioga.Looks ¬ Tioga.noLooks,
looksStart, looksEnd: INT ¬ 0,
charSet: Char.CharSet ¬ 0,
charSetStart, charSetEnd: INT ¬ 0,
props: Tioga.PropList ¬ NIL,
propsStart, propsEnd: INT ¬ 0
];
New: PROC [node: Tioga.Node ¬ NIL, oldReader: Ref ¬ NIL] RETURNS [Ref];
Free:
PROC [reader: Ref];
Set:
PROC [reader: Ref, node: Tioga.Node ¬
NIL];
SetParts:
PROC [reader: Ref, rope:
ROPE ¬
NIL, runs, charSets, charProps:
ROSARY ¬
NIL];
Size:
PROC [reader: Ref]
RETURNS [
INT] ~
INLINE {
RETURN [reader.size] };
CharInfo:
TYPE ~
RECORD [char: Char.
XCHAR, looks: Tioga.Looks, props: Tioga.PropList];
Fetch:
PROC [reader: Ref, index:
INT]
RETURNS [CharInfo];
FetchChar:
PROC [reader: Ref, index:
INT]
RETURNS [Char.
XCHAR];
FetchCharSet:
PROC [reader: Ref, index:
INT]
RETURNS [Char.CharSet];
FetchCharCode:
PROC [reader: Ref, index:
INT]
RETURNS [Char.CharCode];
FetchLooks:
PROC [reader: Ref, index:
INT]
RETURNS [Tioga.Looks];
FetchProps:
PROC [reader: Ref, index:
INT]
RETURNS [Tioga.PropList];
Run:
PROC [r1: Ref, pos1:
INT, r2: Ref, pos2:
INT,
case:
BOOL ¬
TRUE, len:
INT ¬
INT.
LAST]
RETURNS [
INT];
END.