RunReaderExtrasImpl.Mesa
Spreitzer, February 26, 1985 1:02:19 pm PST
DIRECTORY RunReader, RunReaderExtras, TextLooks;
RunReaderExtrasImpl: CEDAR PROGRAM IMPORTS RunReader EXPORTS RunReaderExtras SHARES RunReader = {OPEN RunReader, TextLooks;
MergedBackwards: PUBLIC PROC [reader: Ref] RETURNS [count: Offset, looks: Looks] --RunReader.ReaderProc-- = {
[count,looks] ← Backwards[reader];
WHILE reader.current=reader.first OR reader.changeLooks DO
nxtCount: Offset;
nxtLooks: Looks;
[nxtCount,nxtLooks] ← PeekBackwards[reader ! NoMoreRuns => EXIT];
IF nxtLooks#looks THEN RETURN;
count ← count+nxtCount;
[,] ← Backwards[reader];
ENDLOOP };
}.