DIRECTORY CHNameP2V0 USING [Name], IO USING [STREAM], Rope USING [ROPE], PrintingP4V3; XNSPrintRequestManager: CEDAR DEFINITIONS ~ { OPEN CHName: CHNameP2V0, Printing: PrintingP4V3; ROPE: TYPE ~ Rope.ROPE; GetPrinterProperties: PROC [printer: ROPE] RETURNS [service: CHName.Name, answer: Printing.PrinterProperties]; GetPrinterStatus: PROC [printer: ROPE] RETURNS [service: CHName.Name, answer: Printing.PrinterStatus]; Context: TYPE ~ REF ContextObject; ContextObject: TYPE ~ RECORD [ copyCount: INT, message: ROPE, mediumHint: ROPE, pageFirst: INT, pageLast: INT, printerName: ROPE, printObjectCreateDate: CARD, -- BasicTime.ToNSTime[GMT] printObjectName: ROPE, printObjectSize: INT, priorityHint: ROPE, recipientName: ROPE, releaseKey: INT, senderName: ROPE, stapled: BOOL, twoSided: BOOL ]; GetDefaults: PROC [context: Context _ NIL] RETURNS [newContext: Context]; InterpressMasterStatus: TYPE ~ Printing.InterpressMasterStatus; RequestStatus: TYPE ~ RECORD [ status: InterpressMasterStatus, statusMessage: ROPE ]; StatusChangedProc: TYPE ~ PROC [request: PrintRequest]; PrintFromFile: PROC [file: ROPE, context: Context, update: StatusChangedProc _ NIL] RETURNS [request: PrintRequest]; PrintFromStream: PROC [s: IO.STREAM, context: Context, update: StatusChangedProc _ NIL] RETURNS [request: PrintRequest]; GetPrintRequestStatus: PROC [request: PrintRequest] RETURNS [status: RequestStatus]; ListChanged: CONDITION; RegisterPrintRequest: PROC [request: PrintRequest, update: StatusChangedProc _ NIL]; UnRegisterPrintRequest: PROC [request: PrintRequest]; GetPrintRequestList: PROC RETURNS [list: PrintRequestList]; CreateAttributes: PROC [context: Context] RETURNS [attributes: Printing.PrintAttributes]; CreateOptions: PROC [context: Context] RETURNS [options: Printing.PrintOptions]; CreatePrintRequest: PROC [context: Context] RETURNS [request: PrintRequest]; PrintRequestList: TYPE ~ LIST OF PrintRequest; PrintRequest: TYPE ~ REF PrintRequestObject; PrintRequestObject: TYPE ~ RECORD [ context: Context, -- a copy of the ContextObject used to create this PrintRequestObject update: StatusChangedProc, distinguishedName: CHName.Name, requestID: Printing.RequestID, lastStatus: RequestStatus, attributes: Printing.PrintAttributes, options: Printing.PrintOptions, fileName: ROPE, ipMasterStream: IO.STREAM ]; }... ŠXNSPrintRequestManager.mesa Copyright Σ 1985, 1986, 1987 by Xerox Corporation. All rights reserved. Bloomenthal, October 29, 1986 10:04:01 pm PST Bill Jackson (bj) February 6, 1987 5:42:59 am PST Routines to discover printer state At some point, we should isolate the types PrinterProperties & PrinterStatus from Printing Routines to make and monitor print requests decorates ContextObject from current user's defaults, supplying NIL will cause a ContextObject to be created. ContextObjects belong to the creator, so this one is yours... The intent here is to use a sequence like: context _ GetDefaults[NIL]; context.printerName _ Quoth; -- a request to use a specal printer context _ GetDefaults[context]; -- return to the printerName in the user's profile. PrintRequestObjects have some internal constraints depending upon how this interface is implemented. Considering this, you should probably consider them immutable, unless of course you're sure that you own them. The intent is to capture all of the state required external to the implementation so that clients can examine the values, and to make debugging and/or exception handing easier. If update is non-NIL, then RegisterPrintRequest will be invoked. All of the commentary below on RegisterPrintRequest applies. There's no FS/IO error processing here, so anticipate some trickling up... Explicit request managment routines Notified whenever someone either registers or unregisters a request Add request to the data base of pending requests for possible use by other applications. If update is non-NIL, then status updates will be performed, and the StatusChangedProc will be invoked (asyncronously) when lastStatus changes. This requires that StatusChangedProc persist until the request is unregistered. Update may do the unregister (I promise not to monitor lock this way...). Remove request from the data base of pending requests. Atomically return the data base of pending requests. The intent is that it will be (almost) immediately traversed. Updates will happen behind the scenes, so this represents some state from the past. Safe Storage provides adequate guarantees for this. Private Stuff Κύ– "cedar" style˜codešœ™KšœH™HKšœ*Οk™-Kšœ1™1—K˜š ˜ Kšœ œ˜Kšœœœ˜Kšœœœ˜Kšœ ˜ —K˜šΟnœœ œ˜-Kšœžœžœ˜0Kšœœœ˜K˜—šœ"™"K™Kšœ[™[Kšžœœ œœ<˜nKšžœœ œœ8˜fK˜—šœ+™+K˜Kšœ œœ˜"šœœœ˜Kšœ œ˜Kšœ œ˜Kšœ œ˜Kšœ œ˜Kšœ œ˜Kšœ œ˜KšœœΟc˜7Kšœœ˜Kšœœ˜Kšœœ˜Kšœœ˜Kšœ œ˜Kšœ œ˜Kšœ œ˜Kšœ ˜Kšœ˜K˜—šž œœœœ˜IšœQŸ œŸ œŸœE™ΨKšœ™KšœA™AKšœS™S——K˜Kšœ‡™‡K™Kšœœ#˜?šœœœ˜Kšœ˜Kšœ˜K˜—Kšœœœ˜7K˜Kš ž œœœ0œœ˜tš žœœœœ0œœ˜xKšœΚ™Κ—K˜Kšžœœœ˜TK˜—™#J™šž œ œ˜K™C—K˜šžœœ5œ˜TKšœkœ—™…K™—šžœœ˜5K™6K˜—šžœœœ˜;K™ύ—K˜—™ K™Kšžœœœ(˜YKšž œœœ"˜PKšžœœœ˜LK˜Kšœœœœ˜.Kšœœœ˜,šœœœ˜#KšœŸE˜WKšœ˜Kšœ˜Kšœ˜Kšœ˜Kšœ%˜%Kšœ˜Kšœ œ˜Kšœœ˜Kšœ˜——K˜Kšœ˜K˜—…— $«