TextLooks.mesa
Copyright Ó 1985, 1986, 1988, 1991 by Xerox Corporation. All rights reserved.
written by Bill Paxton, February 1981
last edit by Bill Paxton, December 13, 1982 1:17 pm
Last Edited by: Maxwell, January 5, 1983 12:35 pm
Michael Plass, March 14, 1985 10:00:03 am PST
Doug Wyatt, October 17, 1991 5:27 pm PDT
This package provides Looks for text in Tioga
it allows a client to associate looks with characters in a rope
looks are represented as a vector of 32 bits
The implementation expects that long sequences will have the same looks
and thus uses a run encoding to save space.
As of Cedar10, we use a ROSARY.
The runs of looks are immutable just like the text in a rope.
i.e., you don't change runs;
instead you build new ones out of parts of old ones
DIRECTORY
Basics USING [BITAND, BITOR, BITNOT],
Rope USING [ROPE],
Tioga USING [Look, Looks, noLooks, allLooks, Runs];
TextLooks: CEDAR DEFINITIONS IMPORTS Basics ~ BEGIN
Look: TYPE = Tioga.Look;
Looks: TYPE = Tioga.Looks;
noLooks: Looks = Tioga.noLooks;
allLooks: Looks = Tioga.allLooks;
Runs: TYPE ~ Tioga.Runs;
LooksAND:
PROC [looks1, looks2: Looks]
RETURNS [Looks]
~ INLINE { RETURN[LOOPHOLE[Basics.BITAND[LOOPHOLE[looks1], LOOPHOLE[looks2]]]] };
LooksOR:
PROC [looks1, looks2: Looks]
RETURNS [Looks]
~ INLINE { RETURN[LOOPHOLE[Basics.BITOR[LOOPHOLE[looks1], LOOPHOLE[looks2]]]] };
LooksNOT:
PROC [looks: Looks]
RETURNS [Looks]
~ INLINE { RETURN[LOOPHOLE[Basics.BITNOT[LOOPHOLE[looks]]]] };
ModifyLooks:
PROC [old, remove, add: Looks]
RETURNS [Looks]
~ INLINE { RETURN[LooksOR[LooksAND[old, LooksNOT[remove]], add]] };
Size:
PROC [runs: Runs]
RETURNS [
INT];
FetchLooks:
PROC [runs: Runs, index:
INT]
RETURNS [Looks];
LooksToRope:
PROC [looks: Looks]
RETURNS [rope: Rope.
ROPE];
RopeToLooks:
PROC [rope: Rope.
ROPE]
RETURNS [looks: Looks];
END.