MarkerControlImpl.mesa
Copyright (C) Xerox Corporation 1984, 1985, 1986. All rights reserved.
Last edited by Jacks: 3-Oct-85 9:56:09
Tim Diebert: December 2, 1986 3:51:10 pm PST
<<This is the root module of a multi-module monitor which includes: BansheeMarkerControlImpl, D1MarkerControlImpl, FaxMarkerControlImpl, FX3500MarkerControlImpl and RavenMarkerControlImpl.>>
DIRECTORY
BansheeEngine USING [Initialize],
BansheeMarkerControl USING [Startup, Status],
BasicTime USING [GMT, nullGMT],
D1Console USING [BlankDisplay],
D1Engine USING [Initialize],
D1MarkerControl USING [Startup, Status],
FaxEngine USING [Initialize],
FaxMarkerControl USING [Startup, Status],
FX3500Console USING [BlankDisplay],
FX3500Engine USING [Initialize],
FX3500MarkerControl USING [Startup, Status],
MarkerControl USING [CancelProc, ClientProcsHandle, EngineFailureProc, FinishedMarkingProc, MarkerStatus, ReadyToMarkProc, TraceLevel, WaitChoice],
MarkerControlInternal,
MarkerInit USING [MarkerInitParams],
PaperHandling USING [PrintOrder],
PrintingTypes USING [Option],
PrintQueue USING [nilQueueObjectHandle, ObjectStatus, QueueObjectHandle, QueueWatcher],
Process USING [Priority, priorityForeground, SecondsToTicks, SetTimeout],
PSActivity USING [Marker],
PSAsyncMsg USING [Proc, PutString],
RavenConsole USING [BlankDisplay],
RavenEngine USING [Initialize],
RavenMarkerControl USING [Startup, Status];
MarkerControlImpl: CEDAR MONITOR
IMPORTS
BansheeEngine, BansheeMarkerControl, --D1Console, D1Engine, D1MarkerControl, FaxEngine, FaxMarkerControl, FX3500Console, FX3500Engine, FX3500MarkerControl, -- PrintQueue, Process, PSAsyncMsg, RavenConsole, RavenEngine, RavenMarkerControl
EXPORTS MarkerInit, MarkerControlInternal =
BEGIN
Control: TYPE = RECORD [
start, stop: BOOLEANFALSE,
pause, resume, pausing, resuming: BOOLEANFALSE,
resumeWhenAppropriate: BOOLEANFALSE, -- for delayed resumption
jobQueueEntry: BOOLEANFALSE,
tpQueueEntry: BOOLEANFALSE,
faxRetry: BOOLEANFALSE
];
State: TYPE = RECORD [
stopped: BOOLEANTRUE,
idle: BOOLEANTRUE,
engineProblem: BOOLEANFALSE,
activity: PSActivity.Marker ← available,
tpJob: BOOLEANFALSE, --current doc is a test pattern
clientPause: CARDINAL ← 0, --number of times clients have called to pause marking
qOH: PrintQueue.QueueObjectHandle ← PrintQueue.nilQueueObjectHandle,
trace: MarkerControl.TraceLevel ← none,
printOrder: PaperHandling.PrintOrder ← lastPageOutFirst,
printErrorRetry: CARDINAL ← 0,
stopStatus: PrintQueue.ObjectStatus ← canceledInMarker, --specified in Stop call
starting: MarkerControl.ReadyToMarkProc ← NIL,
finished: MarkerControl.FinishedMarkingProc ← NIL,
waitBetweenJobs: BOOLEANFALSE,
betweenJobWaitTime: CARDINAL ← 0,
engineFailure: MarkerControl.EngineFailureProc ← NIL,
canceledWhileMarking: MarkerControl.CancelProc ← NIL,
putAsyncMsgFromKey: PSAsyncMsg.Proc ← NIL,
startMarkDate: BasicTime.GMT ← BasicTime.nullGMT -- time started marking
];
printErrorRetryLimit: CARDINAL = 2;
event: CONDITION;
stopped: CONDITION;
paused: CONDITION;
control: Control;
state: REF State ← NIL;
procsHandle: MarkerControl.ClientProcsHandle ← NIL;
engineType: PrintingTypes.Option ← unknown;
========= ******** ==========
Init: PUBLIC ENTRY PROCEDURE [priority: Process.Priority ← Process.priorityForeground,
putAsyncMsgFromKey: PSAsyncMsg.Proc,
deviceParams: MarkerInit.MarkerInitParams]
RETURNS
[MarkerControl.ClientProcsHandle] = -- exported thru MarkerInit
BEGIN ENABLE UNWIND => NULL;
TRUSTED {Process.SetTimeout[@event, Process.SecondsToTicks[1]]};
state ← NEW[State ← [
starting: deviceParams.readyToMark,
finished: deviceParams.finishedMarking,
waitBetweenJobs: deviceParams.waitBetweenJobs,
betweenJobWaitTime: deviceParams.betweenJobWaitTime,
engineFailure: deviceParams.engineFailure,
putAsyncMsgFromKey: putAsyncMsgFromKey]];
WITH dP: deviceParams SELECT FROM
bansheeDl => BEGIN
engineType ← bansheeDl;
BansheeEngine.Initialize[dP.bufferSize, dP.enableUnlimitedPrinting];
procsHandle ← BansheeMarkerControl.Startup[priority];
END;
d1 => BEGIN
engineType ← d1;
D1Engine.Initialize[dP.bufferSize, dP.reenteringRepairMode];
procsHandle ← D1MarkerControl.Startup[priority];
END;
fax295 => BEGIN
engineType ← fax295;
FaxEngine.Initialize[];
procsHandle ← FaxMarkerControl.Startup[priority];
END;
fax495 => BEGIN
engineType ← fax495;
FaxEngine.Initialize[];
procsHandle ← FaxMarkerControl.Startup[priority];
END;
fx3500 => BEGIN
engineType ← fx3500;
FX3500Engine.Initialize[dP.bufferSize, dP.reenteringRepairMode];
procsHandle ← FX3500MarkerControl.Startup[priority];
END;
raven => BEGIN
engineType ← raven;
RavenEngine.Initialize[dP.bufferSize, dP.enableUnlimitedPrinting];
procsHandle ← RavenMarkerControl.Startup[priority];
END;
ENDCASE;
PrintQueue.QueueWatcher[proc: JobQueueEntry, queueStage: decomposed];
PrintQueue.QueueWatcher[proc: TPQueueEntry, queueStage: tpDecomposed];
RETURN[procsHandle];
END; --Init
JobQueueEntry: ENTRY PROCEDURE = -- called by PrintQueue
BEGIN ENABLE UNWIND => NULL;
control.jobQueueEntry ← TRUE;
BROADCAST event;
IF state.trace = verbose THEN PSAsyncMsg.PutString["Marker JobQueueEntry"];
END; --JobQueueEntry
TPQueueEntry: ENTRY PROCEDURE = -- called by PrintQueue for TestPatterns
BEGIN ENABLE UNWIND => NULL;
control.tpQueueEntry ← TRUE;
BROADCAST event;
IF state.trace = verbose THEN PSAsyncMsg.PutString["Marker TPQueueEntry"];
END; --TPQueueEntry
**************************************
Exported by MarkerControlInternal:
**************************************
Start: PUBLIC ENTRY PROCEDURE = BEGIN ENABLE UNWIND => NULL;
control.stop ← FALSE;
control.start ← TRUE;
BROADCAST event;
IF state.printErrorRetry # 0 THEN BEGIN
SELECT engineType FROM
d1 => D1Console.BlankDisplay[]; --to remove F2 or F4
fx3500 => FX3500Console.BlankDisplay[]; --to remove F2 or F4
raven => RavenConsole.BlankDisplay[]; --to remove L2 or L4
ENDCASE;
state.printErrorRetry ← 0
END;
END; --Start
Stop: PUBLIC ENTRY PROCEDURE [status: PrintQueue.ObjectStatus,
canceledWhileMarking: MarkerControl.CancelProc ← NIL] = BEGIN
ENABLE UNWIND => NULL;
state.stopStatus ← status;
state.canceledWhileMarking ← canceledWhileMarking;
control.stop ← TRUE;
BROADCAST event;
END; --Stop
Stopped: PUBLIC PROCEDURE [wither: MarkerControl.WaitChoice ← dontWait]
RETURNS
[BOOLEAN] = BEGIN
WaitTillStopped: ENTRY PROC = BEGIN ENABLE UNWIND => NULL;
UNTIL state.stopped DO WAIT stopped; ENDLOOP;
END; --WaitTillStopped
IF wither = wait THEN WaitTillStopped[];
RETURN[state.stopped];
END; --Stopped
Pause: PUBLIC PROCEDURE RETURNS [MarkerControl.MarkerStatus] = BEGIN
WaitTillPaused: ENTRY PROC = BEGIN ENABLE UNWIND => NULL;
IF state.activity = paused AND NOT control.resume THEN BEGIN
control.resumeWhenAppropriate ← FALSE;
state.clientPause ← state.clientPause + 1;
IF state.trace = verbose THEN PSAsyncMsg.PutString["Marker Already Paused"];
RETURN;
END;
control.pause ← TRUE;
IF state.trace = verbose THEN PSAsyncMsg.PutString["Marker.Pause by Client"];
BROADCAST event;
UNTIL state.activity = paused OR state.activity = available DO WAIT paused; ENDLOOP;
IF state.activity = paused THEN state.clientPause ← state.clientPause + 1;
END; --WaitTillPaused
IF state.activity = markingButInterruptable OR state.activity = paused THEN WaitTillPaused[];
RETURN[SELECT engineType FROM
bansheeDl => BansheeMarkerControl.Status[],
d1 => D1MarkerControl.Status[],
fax295 => FaxMarkerControl.Status[],
fax495 => FaxMarkerControl.Status[],
fx3500 => FX3500MarkerControl.Status[],
ENDCASE => RavenMarkerControl.Status[] --raven
];
END; --Pause
Resume: PUBLIC ENTRY PROCEDURE = BEGIN
IF state.clientPause > 0 THEN state.clientPause ← state.clientPause - 1; --clientPause should always be greater than zero at this point if the client calls Resume only once for every time he calls Pause.
IF state.activity = paused
THEN BEGIN
control.resume ← TRUE;
IF state.trace = verbose THEN PSAsyncMsg.PutString["Marker.Resume by Client"];
BROADCAST event;
END
ELSE IF state.trace # none THEN --Unfortunately this error msg does get displayed sometimes.
PSAsyncMsg.PutString["Marker Implementation Error: Resume called and state.activity # paused."];
END; --Resume
SetPrintOrder: PUBLIC ENTRY PROCEDURE [printOrder: PaperHandling.PrintOrder] = BEGIN
ENABLE UNWIND => NULL;
state.printOrder ← printOrder;
END; --SetPrintOrder
ModifyTraceLevel: PUBLIC ENTRY PROCEDURE [trace: MarkerControl.TraceLevel] = BEGIN
ENABLE UNWIND => NULL;
state.trace ← trace;
END; --ModifyTraceLevel
SetActivity: PUBLIC ENTRY PROCEDURE [activity: PSActivity.Marker] = BEGIN
ENABLE UNWIND => NULL;
state.activity ← activity;
IF activity = available THEN state.idle ← TRUE
ELSE state.idle ← FALSE;
END; --SetActivity
END. -- MarkerControlImpl
LOG
****EARLIER LOG ENTRIES DELETED. See archived version from 8.0.
17-Aug-84 13:58:40 - Jacks - Removed all aps phototypesetter stuff.
20-Sep-84 10:09:27 - Jacks - Updated to new MarkerControl interface for 9.0; added code for banshee and fax295.
4-Oct-84 14:39:02 - Jacks - Reduced timeout on event from 5 minutes to 45 seconds to try and help problem of delayed resumes.
16-Oct-84 14:50:17 - Jacks - Reduced timeout on event from 45 to 1 sec.
8-Nov-84 16:22:27 - Jacks - Made use to StatusTypes interface.
17-Jun-85 15:52:08 - Jacks - Added copyright notice; updated to PS Euclid interfaces.
19-Jun-85 15:56:31 - Jacks - Activity renamed to PSActivity.
27-Jun-85 10:11:29 - Jacks - Added code for the D1.
17-Jul-85 10:18:24 - Jacks - New PSAsyncMsg interface.
31-Jul-85 15:43:30 - Jacks - Removed reenteringRepairMode parm from RavenEngine.Init.
23-Sep-85 15:14:52 - Jacks - enableUnlimitedPrinting added to BansheeEngine and RavenEngine init parms; waitBetweenJobs and betweenJobWaitTime added to state.
3-Oct-85 9:55:41 - Jacks - Implementation error msg in Resume now only displays if tracing is set.