TextLooksSupport.mesa
Copyright © 1985, 1986 by Xerox Corporation. All rights reserved.
written by Bill Paxton, February 1981
last edit by Bill Paxton, December 22, 1981 1:57 pm
last edit by Maxwell, January 5, 1983 12:48 pm
last edit by Russ Atkinson, July 22, 1983 10:03 am
Michael Plass, March 29, 1985 2:26:31 pm PST
Doug Wyatt, September 4, 1986 6:01:57 pm PDT
Internal support interface for TextLooks.
DIRECTORY
TextLooks USING [BaseRuns, FlatMax, Looks, MaxLen, noLooks, Runs];
TextLooksSupport: CEDAR DEFINITIONS
SHARES TextLooks
= BEGIN OPEN TextLooks;
BaseRun: PROC [x: BaseRuns, index: INT, lower: NAT ← 0, upper: NATLAST[NAT]]
RETURNS
[NAT];
ExtractRuns: PROC [base: BaseRuns, ref: Runs, start, len: INT, index: NAT ← 0]
RETURNS
[NAT]; -- value is next index
CountRunsAfterChanges: PROC [ref: Runs, start, len: INT, limit: INT ← MaxLen,
remove, add: Looks, merge: BOOLFALSE, firstLooks: Looks ← noLooks
] RETURNS [count: NAT, nonempty: BOOL, lastLooks: Looks];
ExtractRunsAfterChanges: PROC [base: BaseRuns, ref: Runs, remove, add: Looks,
start: INT, len: INT, index: NAT ← 0] RETURNS [NAT]; -- value is next index
CopyRuns: PROC [to, from: BaseRuns, toLoc, fromLoc, nRuns: NAT];
MakeRun: PROC [len: INT] RETURNS [new: Runs];
TryFlatSubstr: PROC [base: Runs, start, len: INT, limit: INT ← FlatMax] RETURNS [BaseRuns];
TryFlatConcat: PROC [base, rest: Runs, baseLen, restLen: INT] RETURNS [new: BaseRuns];
TryFlatConcatRest: PROC [base, rest: Runs, baseLen, restLen, numRuns: INT,
merge: BOOL, looks: Looks] RETURNS [BaseRuns];
TbaseSize: PROC [x: BaseRuns] RETURNS [INT];
InsertRun: PROC [base: BaseRuns, len: INT, looks: Looks, index: NAT] RETURNS [NAT];
NewBase: PROC [runs: NAT] RETURNS [BaseRuns];
FindBaseRuns: PROC [x: BaseRuns, start, len: INT] RETURNS [first, last: NAT];
BaseRunLengths: PROC [x: BaseRuns, start, len: INT, first, last: NAT]
RETURNS
[firstLen, lastLen: INT];
ModifyLooks: PROC [old, remove, add: Looks] RETURNS [Looks];
modified looks are == (old & ~remove) v add
MergeChanges: PROC [oldrem, oldadd, rem, add: Looks] RETURNS [newrem, newadd: Looks];
((lks & ~oldrem) v oldadd) & ~rem) v add ==
lks & ~(oldrem v rem)) v ((oldadd & ~rem) v add
thus, newrem ← oldrem v rem, newadd ← (oldadd & ~rem) v add
END.