PrintingP4V3ServerImpl.Mesa
Copyright (C) 1986 by Xerox Corporation. All rights reserved.
Generated by Demers.pa at January 6, 1987 4:12:31 pm PST
using Sirocco [2.0] of January 6, 1987 4:07:33 pm PST
DIRECTORY
CrRPC,
TimeP15V2,
AuthenticationP14V2,
BulkDataP0V1,
PrintingP4V3;
PrintingP4V3ServerImpl: CEDAR PROGRAM
IMPORTS CrRPC, PrintingP4V3 ~ {
OPEN PrintingP4V3;
GetPrintRequestStatusCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
printRequestID: RequestID;
status: RequestStatus;
{
FOR i42: CARDINAL IN [0..5) DO
printRequestID[i42] ← CrRPC.GetCard16[s];
ENDLOOP;
};
[status] ← GetPrintRequestStatus[h, printRequestID];
beginReturn[h];
{
MProc43[h, s, status];
};
};
GetPrinterPropertiesCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
properties: PrinterProperties;
[properties] ← GetPrinterProperties[h];
beginReturn[h];
{
MProc44[h, s, properties];
};
};
GetPrinterStatusCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
status: PrinterStatus;
[status] ← GetPrinterStatus[h];
beginReturn[h];
{
MProc45[h, s, status];
};
};
PrintCaller: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, beginReturn: CrRPC.BeginReturnProc] ~ {
master: CrRPC.BulkDataSource;
printAttributes: PrintAttributes;
printOptions: PrintOptions;
printRequestID: RequestID;
TRUSTED {
master ← CrRPC.GetBulkDataSource[h, s];
};
{
printAttributes ← UProc46[h, s];
};
{
printOptions ← UProc47[h, s];
};
[printRequestID] ← Print[h, master, printAttributes, printOptions];
beginReturn[h];
{
FOR i48: CARDINAL IN [0..5) DO
CrRPC.PutCard16[s, printRequestID[i48]];
ENDLOOP;
};
};
Server: CrRPC.ServerProc ~ {
[h: Handle, s: STREAM, pgm: CARD32, pgmVersion: CARD16, proc: CARD16, beginReturn: BeginReturnProc, beginError: BeginErrorProc, beginReject: BeginRejectProc]
ENABLE {
PrintingP4V3.TransferError => { -- (12 )
beginError[h, 12 ];
CrRPC.PutCard16[s, ORD[problem]];
GOTO Finished;
};
PrintingP4V3.InsufficientSpoolSpace => { -- (1 )
beginError[h, 1 ];
GOTO Finished;
};
PrintingP4V3.Busy => { -- (0 )
beginError[h, 0 ];
GOTO Finished;
};
PrintingP4V3.SpoolingQueueFull => { -- (7 )
beginError[h, 7 ];
GOTO Finished;
};
PrintingP4V3.SpoolingDisabled => { -- (6 )
beginError[h, 6 ];
GOTO Finished;
};
PrintingP4V3.ConnectionError => { -- (11 )
beginError[h, 11 ];
CrRPC.PutCard16[s, ORD[problem]];
GOTO Finished;
};
PrintingP4V3.MediumUnavailable => { -- (5 )
beginError[h, 5 ];
GOTO Finished;
};
PrintingP4V3.InvalidPrintParameters => { -- (2 )
beginError[h, 2 ];
GOTO Finished;
};
PrintingP4V3.Undefined => { -- (10 )
beginError[h, 10 ];
CrRPC.PutCard16[s, problem];
GOTO Finished;
};
PrintingP4V3.SystemError => { -- (8 )
beginError[h, 8 ];
GOTO Finished;
};
PrintingP4V3.MasterTooLarge => { -- (3 )
beginError[h, 3 ];
GOTO Finished;
};
PrintingP4V3.ServiceUnavailable => { -- (4 )
beginError[h, 4 ];
GOTO Finished;
};
PrintingP4V3.TooManyClients => { -- (9 )
beginError[h, 9 ];
GOTO Finished;
};
};
IF (pgmVersion # 3) THEN {
beginReject[h, CrRPC.noSuchVersion];
CrRPC.PutCard16[s, 3]; --low
CrRPC.PutCard16[s, 3]; --high
RETURN
};
SELECT proc FROM
2 => GetPrintRequestStatusCaller[h, s, beginReturn];
1 => GetPrinterPropertiesCaller[h, s, beginReturn];
3 => GetPrinterStatusCaller[h, s, beginReturn];
0 => PrintCaller[h, s, beginReturn];
ENDCASE => {
beginReject[h, CrRPC.noSuchProcedure];
};
EXITS
Finished => { NULL };
};
Unmarshal / Marshal Procs --
UProc46: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: PrintAttributes] ~ {
{
length50: CARDINAL ~ CrRPC.GetCard16[s];
res ← NEW[PrintAttributesObject[length50]];
FOR i49: CARDINAL IN [0..length50) DO
res.body[i49] ← UProc51[h, s];
ENDLOOP;
};
};
UProc47: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: PrintOptions] ~ {
{
length53: CARDINAL ~ CrRPC.GetCard16[s];
res ← NEW[PrintOptionsObject[length53]];
FOR i52: CARDINAL IN [0..length53) DO
res.body[i52] ← UProc54[h, s];
ENDLOOP;
};
};
MProc43: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: RequestStatus] ~ {
CrRPC.PutCard16[s, val.length];
FOR i55: CARDINAL IN [0..val.length) DO
MProc56[h, s, val.body[i55]];
ENDLOOP;
};
UProc54: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: Option] ~ {
{
tag57: OptionKind ~ VAL[CrRPC.GetCard16[s]];
SELECT tag57 FROM
printObjectSize => {
temp58: CARD32;
temp58 ← CrRPC.GetCard32[s];
res ← NEW[OptionObject.printObjectSize ← [printObjectSize[temp58]]] };
recipientName => {
temp58: ROPE;
temp58 ← CrRPC.GetRope[s];
res ← NEW[OptionObject.recipientName ← [recipientName[temp58]]] };
message => {
temp58: ROPE;
temp58 ← CrRPC.GetRope[s];
res ← NEW[OptionObject.message ← [message[temp58]]] };
copyCount => {
temp58: CARD16;
temp58 ← CrRPC.GetCard16[s];
res ← NEW[OptionObject.copyCount ← [copyCount[temp58]]] };
pagesToPrint => {
temp58: DocumentSubrange;
temp58.beginningPageNumber ← CrRPC.GetCard16[s];
temp58.endingPageNumber ← CrRPC.GetCard16[s];
res ← NEW[OptionObject.pagesToPrint ← [pagesToPrint[temp58]]] };
mediumHint => {
temp58: Medium;
temp58 ← UProc59[h, s];
res ← NEW[OptionObject.mediumHint ← [mediumHint[temp58]]] };
priorityHint => {
temp58: Priority;
temp58 ← VAL[CrRPC.GetCard16[s]];
res ← NEW[OptionObject.priorityHint ← [priorityHint[temp58]]] };
releaseKey => {
temp58: CARD16;
temp58 ← CrRPC.GetCard16[s];
res ← NEW[OptionObject.releaseKey ← [releaseKey[temp58]]] };
staple => {
temp58: BOOLEAN;
temp58 ← CrRPC.GetBool[s];
res ← NEW[OptionObject.staple ← [staple[temp58]]] };
twoSided => {
temp58: BOOLEAN;
temp58 ← CrRPC.GetBool[s];
res ← NEW[OptionObject.twoSided ← [twoSided[temp58]]] };
ENDCASE => ERROR;
};
};
MProc45: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: PrinterStatus] ~ {
CrRPC.PutCard16[s, val.length];
FOR i60: CARDINAL IN [0..val.length) DO
MProc61[h, s, val.body[i60]];
ENDLOOP;
};
MProc56: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: JobStatus] ~ {
CrRPC.PutCard16[s, ORD[val.type]];
WITH val SELECT FROM
it: REF JobStatusObject.status => {
CrRPC.PutCard16[s, ORD[it^.status]];
};
it: REF JobStatusObject.statusMessage => {
CrRPC.PutRope[s, it^.statusMessage];
};
ENDCASE;
};
MProc44: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: PrinterProperties] ~ {
CrRPC.PutCard16[s, val.length];
FOR i63: CARDINAL IN [0..val.length) DO
MProc64[h, s, val.body[i63]];
ENDLOOP;
};
UProc51: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: Attribute] ~ {
{
tag65: AttributeKind ~ VAL[CrRPC.GetCard16[s]];
SELECT tag65 FROM
printObjectName => {
temp66: ROPE;
temp66 ← CrRPC.GetRope[s];
res ← NEW[AttributeObject.printObjectName ← [printObjectName[temp66]]] };
printObjectCreateDate => {
temp66: CARD32;
temp66 ← CrRPC.GetCard32[s];
res ← NEW[AttributeObject.printObjectCreateDate ← [printObjectCreateDate[temp66]]] };
senderName => {
temp66: ROPE;
temp66 ← CrRPC.GetRope[s];
res ← NEW[AttributeObject.senderName ← [senderName[temp66]]] };
ENDCASE => ERROR;
};
};
MProc61: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: ServiceStatus] ~ {
CrRPC.PutCard16[s, ORD[val.type]];
WITH val SELECT FROM
it: REF ServiceStatusObject.spooler => {
CrRPC.PutCard16[s, ORD[it^.spooler]];
};
it: REF ServiceStatusObject.formatter => {
CrRPC.PutCard16[s, ORD[it^.formatter]];
};
it: REF ServiceStatusObject.printer => {
CrRPC.PutCard16[s, ORD[it^.printer]];
};
it: REF ServiceStatusObject.media => {
MProc68[h, s, it^.media];
};
ENDCASE;
};
MProc64: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Property] ~ {
CrRPC.PutCard16[s, ORD[val.type]];
WITH val SELECT FROM
it: REF PropertyObject.ppmedia => {
MProc68[h, s, it^.ppmedia];
};
it: REF PropertyObject.ppstaple => {
CrRPC.PutBool[s, it^.ppstaple];
};
it: REF PropertyObject.pptwoSided => {
CrRPC.PutBool[s, it^.pptwoSided];
};
ENDCASE;
};
UProc59: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: Medium] ~ {
{
tag70: MediumKind ~ VAL[CrRPC.GetCard16[s]];
SELECT tag70 FROM
paper => {
temp71: Paper;
temp71 ← UProc72[h, s];
res ← NEW[MediumObject.paper ← [paper[temp71]]] };
ENDCASE => ERROR;
};
};
MProc68: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Media] ~ {
CrRPC.PutCard16[s, val.length];
FOR i73: CARDINAL IN [0..val.length) DO
MProc74[h, s, val.body[i73]];
ENDLOOP;
};
UProc72: PROC [h: CrRPC.Handle, s: CrRPC.STREAM] RETURNS [res: Paper] ~ {
{
tag75: PaperKind ~ VAL[CrRPC.GetCard16[s]];
SELECT tag75 FROM
unknown => {
temp76: EmptyRecord;
temp76.null ← 0;
res ← NEW[PaperObject.unknown ← [unknown[temp76]]] };
knownSize => {
temp76: KnownPaperSize;
temp76 ← VAL[CrRPC.GetCard16[s]];
res ← NEW[PaperObject.knownSize ← [knownSize[temp76]]] };
otherSize => {
temp76: PaperDimensions;
temp76.width ← CrRPC.GetCard16[s];
temp76.length ← CrRPC.GetCard16[s];
res ← NEW[PaperObject.otherSize ← [otherSize[temp76]]] };
ENDCASE => ERROR;
};
};
MProc74: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Medium] ~ {
CrRPC.PutCard16[s, ORD[val.type]];
WITH val SELECT FROM
it: REF MediumObject.paper => {
MProc78[h, s, it^.paper];
};
ENDCASE;
};
MProc78: PROC [h: CrRPC.Handle, s: CrRPC.STREAM, val: Paper] ~ {
CrRPC.PutCard16[s, ORD[val.type]];
WITH val SELECT FROM
it: REF PaperObject.unknown => {
NULL; -- RECORD [] --
};
it: REF PaperObject.knownSize => {
CrRPC.PutCard16[s, ORD[it^.knownSize]];
};
it: REF PaperObject.otherSize => {
CrRPC.PutCard16[s, it^.otherSize.width];
CrRPC.PutCard16[s, it^.otherSize.length];
};
ENDCASE;
};
CrRPC.RegisterServerProc[pgm~4, serverProc~Server, pgmVersion~3];
CrRPC.EnsureListener[class~$SPP];
}...