DIRECTORY IO USING [STREAM], Rope USING [ROPE] ; PDQueue: DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; Request: TYPE = RECORD [ fileName: ROPE, -- i.e., "[Indigo]foo.pd!33". requestTime: ROPE, requestor: ROPE, requestorPassword: ROPE, separator: ROPE, -- To be printed between jobs, if possible. copies: CARDINAL ]; Reset: PROC; QueueRequest: PROC [request: Request] RETURNS [requestNumber: INT]; Reprint: PROC [copies: CARDINAL]; CancelReprint: PROC; ReprintCancelled: PROC RETURNS [BOOLEAN]; DoRequest: PROC [action: PROC [request: Request, requestNumber: CARDINAL, abort: REF BOOLEAN]]; CheckRequest: PROC [requestNumber: CARDINAL, action: PROC [request: Request, status: RequestStatus]]; RequestStatus: TYPE = {notFound, canceled, waiting, printing}; CancelRequest: PROC [requestNumber: CARDINAL] RETURNS [ok: BOOLEAN]; CountRequests: PROC RETURNS [requestCount: NAT]; EnumerateRequests: PROC [action: PROC [requestNumber: CARDINAL, request: Request, status: RequestStatus] RETURNS [continue: BOOLEAN]]; RegisterDisk: PROC [file: ROPE _ NIL]; RegisterTTY: PROC [stream: IO.STREAM]; GetSuspended: PROC RETURNS [BOOLEAN]; SetSuspended: PROC [suspended: BOOLEAN] RETURNS [old: BOOLEAN]; LogMessage: PROC [message: ROPE, requestNumber: INT _ -1, userName: ROPE _ NIL, printCR: BOOL _ TRUE]; SetLogState: PROC [logging: BOOLEAN] RETURNS [old: BOOLEAN]; EnumerateMessages: PROC [PROC[message: ROPE] RETURNS [continue: BOOLEAN]]; DeferSaving: PROC; DoDeferredSave: PROC; END. ζPDQueue.mesa Copyright (C) 1984, 1985, Xerox Corporation. All rights reserved. Michael Plass, October 31, 1984 10:19:10 am PST Tim Diebert: September 19, 1985 2:46:42 pm PDT This module manages the queue for the peach printer. If a disk is available, a simple mechanism is provided here for periodically saving the state of the queue on the disk, so booting the server will not lose it all. In any case, the queue lives in main memory, and consists mostly of full path names of the files, together with a little bit of information about who requested the print, etc. There is also some stuff here for logging what has been going on, and for accessing the log. Resets the queue. Returns -1 if the queue is full. Waits if queue is empty; action should return or raise ABORTED if abort^ becomes true. If the strings in the Request are NIL, the request is to reprint as much as the previous request as is possible without a lot of recomputation. Looks for a matching request (fileName and requestor), and removes it from the queue. Number of outstanding requests. Determins the disk file name of the queue. If NIL, no queue is kept on disk. Registers a proc for displaying messages. Setting suspended to TRUE will stop printing after the current job finishes. Adds time stamp. Message is also output to the printer's TTY, if present and enabled. Setting logging to FALSE prevents messages from being logged on the TTY, to prevent interference with typein. Unprinted messages will be printed when logging is re-enabled. Replays history for as far back as we can remember. Prevents operations that normally checkpoint the queue on disk from doing so, for example to prevent contention for the disk while actually printing. Does any deferred checkpoints; ΚS˜code™ K™BK™/K™.K™—šΟk ˜ Kšœœœ˜Kšœœœ˜Kšœ˜—K˜šΠlnœ œ˜™θK˜—Kšœœœ˜K˜šœ œœ˜Kšœ œΟc)˜;Kšœ œ˜Kšœ œ˜Kšœœ˜Kšœ œŸ+˜=Kšœ˜Kšœ˜K˜—šΟnœœ˜ K™K˜—š  œœœœ˜CK™ K˜—š œœ œ˜!K˜—š  œœ˜K˜—š œœœœ˜)K˜—š   œœ œ#œ œœ˜_Kšœ7œ™VKšœ"œj™K˜—š  œœœ œ,˜eKšœœ+˜>K˜—š   œœœœœ˜DKšœU™UK˜—š  œœœœ˜0K™K˜—š  œœ œœ+œ œ˜†K˜—š  œœœœ˜&Kšœ/œ™MK˜—š  œœ œœ˜&K™)K˜—Kš  œœœœ˜%K˜š   œœ œœœ˜?Kšœœ3™LK˜—š  œœ œœœœ œœ˜fKšœ:œ™VK˜—š   œœ œœœ˜