File RavenCounterImpl.mesa
Copyright (C) Xerox Corporation 1982, 1983, 1984, 1985, 1986. All rights reserved.
Last edited by Strickberger 27-Nov-85 0:12:31
Tim Diebert: December 2, 1986 3:03:34 pm PST
DIRECTORY
BasicTime USING [Now, nullGMT],
EngineLog USING [ForceOut, Map],
Process USING [Detach, priorityForeground, SetPriority],
RavenControl USING [LogItem, WaitLogItem],
RavenCounter USING [Handle, Item, Object];
RavenCounterImpl: CEDAR PROGRAM
IMPORTS BasicTime, EngineLog, Process, RavenControl EXPORTS RavenCounter = BEGIN
Constants:
currentLogVersion: CARDINAL = 1;
Variables:
log: RavenCounter.Handle;
PUBLIC PROCEDUREs:
ForceOut: PUBLIC PROCEDURE = BEGIN EngineLog.ForceOut[]; END;
force out the current log
Get: PUBLIC PROCEDURE RETURNS [dataBase: RavenCounter.Handle] = BEGIN
ForceOut, then return a pointer to the RavenCounter.Object in the log file
ForceOut[];
RETURN[dataBase: log];
END; -- Get
Reset: PUBLIC PROCEDURE = BEGIN
writes a log record with all counters set to zero
log.resetTime ← BasicTime.Now[];
log.counter ← ALL[0];
ForceOut[];
END; -- Reset
PRIVATE PROCEDUREs:
Initialize: PROCEDURE = TRUSTED BEGIN
log: RavenCounter.Handle ← NEW[RavenCounter.Object];
log^ ← LOOPHOLE[EngineLog.Map[ engineType: raven, version: currentLogVersion], RavenCounter.Handle]^;
IF log.resetTime = BasicTime.nullGMT THEN Reset[];
Process.Detach[FORK WatchLogItem];
END; -- Initialize
WatchLogItem: PROCEDURE = BEGIN
forked in Initialize
maintain internal log for each event type recorded in the log(s)
itemIn: RavenControl.LogItem;
itemOut: RavenCounter.Item;
lastFeed: {bottom, top};
state: {on, asleep} ← on;
Process.SetPriority[Process.priorityForeground];
DO
TRUSTED {itemIn ← RavenControl.WaitLogItem[]}; -- returns item for logging
WITH item: itemIn SELECT FROM
command => BEGIN
itemOut ← SELECT item.command FROM
solicitStatus => IF state = on THEN solicitStatus ELSE wakeUp,
beepShort, beepLong => beep,
IN [displayF..displayBlank] => display,
feed => feedBottomAligned,
feedOffset => feedBottomOffset,
feedTop => feedTopAligned,
feedTopOffset => feedTopOffset,
solicitPaperSize => solicitPaperSize,
goToSleep => dozeOff,
ENDCASE => null; -- others not logged
SELECT item.command FROM
feed, feedOffset => lastFeed ← bottom;
feedTop, feedTopOffset => lastFeed ← top;
solicitStatus => state ← on;
goToSleep => state ← asleep;
ENDCASE;
END;
printerStatus => BEGIN
itemOut ← SELECT item.printerStatus FROM
noStatus => noStatus,
IN [key0..key9] => key0to9,
keyClear => keyClear,
keyTest => keyTest,
keyOnLine => keyOnLine,
keyOffLine => keyOffLine,
warming => warming,
standBy => standBy,
feederFault => IF lastFeed = bottom THEN feederFaultBottom ELSE feederFaultTop,
registrationJam => registrationJam,
fuserJam => fuserJam,
noExit => noExit,
interlockOpen => interlockOpen,
fuserCold => fuserCold,
feeding => feeding,
readyToFeed => readyToFeed,
displayAcknowledge => displayAcknowledge,
parityError => parityError,
unrecognizedCommand => illegalCharacter,
illegalSequence => illegalSequence,
feedTraysNotEngaged => feedTraysNotEngaged,
pageSync => pageSync,
pageAtOutputTray => pageAtOutputTray,
tonerLow => tonerLow,
goingOffLine => goingOffLine,
offLine => offLine,
LOOPHOLE[57H] => onLine, -- from early Raven models
outputTrayFull => outputTrayFull,
aboutToDozeOff => aboutToDozeOff,
paperSmallSmall => paperSmallSmall,
paperSmallLarge => paperSmallLarge,
paperLargeSmall => paperLargeSmall,
paperLargeLarge => paperLargeLarge,
statusError => statusError,
statusOverRun => statusOverRun,
ENDCASE => undefinedStatus;
SELECT item.printerStatus FROM
warming, standBy, feederFault, registrationJam, fuserJam, noExit, interlockOpen, readyToFeed => state ← on;
aboutToDozeOff => state ← asleep;
ENDCASE;
END;
softwareStatus => itemOut ← SELECT item.statusExtras FROM
communicationFault => communicationFault,
imageFault1 => imageFault1,
imageFault2 => imageFault2,
imageFault3 => imageFault3,
sequenceFault => sequenceFault,
ENDCASE => null;
plateStatus => itemOut ← SELECT item.plateStatus FROM
bandOverrun => bandOverrun,
pageSyncMiss => pageSyncMiss,
ENDCASE => null;
ENDCASE;
log.counter[itemOut] ← SUCC[log.counter[itemOut]];
ENDLOOP;
END; -- WatchLogItem
MAINLINE CODE:
Initialize[];
END.
LOG
When / Who / What
31-Mar-82/Claude Pany/Created.
27-Sep-82 8:03:55 - Alfvin - Converted to Pilot 9.0, Filing 5.0 and Services 5.0.
28-Sep-82 17:15:16 - Trowell - added documentation
20-Sep-83 1:03:57 - Strickberger - Update for Klamath
26-Jan-84 23:56:12 - Strickberger - ServicesFileTypes ← PSFileTypes
18-Apr-84 22:19:54 - Strickberger - Initialize dataBaseInternal to ALL[0] (Klamath space not initialized to 0) fixes AR 6908. Make WatchLogItem run at priorityForeground.
9-Apr-85 0:27:43 - Strickberger - Updated for Raven engine level redesign. 12-Aug-85 18:57:46 - Strickberger - Rewrite to use EngineLog. Update for Euclid interfaces and Item. Added copyright. FixArrows.
23-Aug-85 15:45:45 - Strickberger - Add wakeUp differentiation.
27-Nov-85 0:12:31 - Strickberger - Log beep, solicitPaperSize commands.