CedarNSPrint.mesa
Copyright (C) Xerox Corporation 1982. All rights reserved.
Bill Jackson, June 22, 1985 9:31:11 pm PDT
  Cedar/Mesa interface to Printing protocol.
CedarNSPrint: DEFINITIONS =
BEGIN
ErrorCode: TYPE = -- Courier.ErrorCode;
{transmissionMediumHardwareProblem, transmissionMediumUnavailable, transmissionMediumNotReady, noAnswerOrBusy, noRouteToSystemElement, transportTimeout, remoteSystemElementNotResponding, noCourierAtRemoteSite, tooManyConnections, invalidMessage, noSuchProcedureNumber, returnTimedOut, callerAborted, unknownErrorInRemoteProcedure, streamNotYours, truncatedTransfer, parameterInconsistency, invalidArguments, noSuchProgramNumber, protocolMismatch, duplicateProgramExport, noSuchProgramExport, invalidHandle, noError};
Source: TYPE = -- NSDataStream.Source;
LONG STRING; -- This will be the name of the file to transfer to XDE!
String: TYPE = -- NSString.String;
RECORD [bytes: LONG POINTER TO PACKED ARRAY CARDINAL OF INTEGER[0..255], length: CARDINAL ← 0, maxlength: CARDINAL ← 0];
UniversalID: TYPE [5]; -- System.UniversalID;
-- This will have to be translated by Clearinghouse (XDE)
SystemNetworkAddress: TYPE = MACHINE DEPENDENT RECORD [
net: NetworkNumber,
host: HostNumber,
socket: SocketNumber];
NetworkNumber: TYPE [2];
HostNumber: TYPE [3];
SocketNumber: TYPE [1];
TYPES
Time: TYPE = LONG CARDINAL;
RequestID: TYPE = UniversalID;
SystemElement: TYPE = SystemNetworkAddress;
Media: TYPE = LONG DESCRIPTOR FOR ARRAY OF Medium;
Medium: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): MediumType FROM
paper => [paper(1): Paper],
ENDCASE];
MediumType: TYPE = MACHINE DEPENDENT {paper(0)};
MediumIndex: TYPE = CARDINAL[0..1);
Paper: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): PaperType FROM
unknown => [], --illegal argument, possible result
knownSize => [knownSize(1): PaperSize],
otherSize => [otherSize(1): PaperDimensions],
ENDCASE];
PaperType: TYPE = MACHINE DEPENDENT {unknown(0), knownSize, otherSize(2)};
PaperIndex: TYPE = CARDINAL[0..3);
PaperSize: TYPE = MACHINE DEPENDENT {
dontUse(0) -- the protocol defines this enumeration as starting at 1! --,
usLetter, usLegal, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9,
isoB0, isoB1, isoB2, isoB3, isoB4, isoB5, isoB6, isoB7, isoB8, isoB9, isoB10,
jisB0, jisB1, jisB2, jisB3, jisB4, jisB5, jisB6, jisB7, jisB8, jisB9,
jisB10(34)};
PaperDimensions: TYPE = MACHINE DEPENDENT RECORD [
length(0), width(1): CARDINAL]; --units are millimeters
PrintAttributes: TYPE = LONG DESCRIPTOR FOR ARRAY OF PrintAttribute;
PrintAttribute: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): PrintAttributeType FROM
printObjectName => [printObjectName(1): String ← [NIL, 0, 0]],
printObjectCreateDate => [printObjectCreateDate(1): Time ← 0],
senderName => [senderName(1): String ← [NIL, 0, 0]],
ENDCASE];
PrintAttributeType: TYPE = MACHINE DEPENDENT {
printObjectName(0), printObjectCreateDate, senderName(2)};
PrintAttributesIndex: TYPE = CARDINAL[0..3);
PrintOptions: TYPE = LONG DESCRIPTOR FOR ARRAY OF PrintOption;
PrintOption: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): PrintOptionType FROM
printObjectSize => [printObjectSize(1): LONG CARDINAL ← 0],
recipientName => [recipientName(1): String ← [NIL, 0, 0]],
message => [message(1): String ← [NIL, 0, 0]],
copyCount => [copyCount(1): CARDINAL ← 1],
pagesToPrint => [pagesToPrint(1): PagesToPrint ← [1, LAST[CARDINAL]]],
mediumHint => [mediumHint(1): Medium ← [paper[[knownSize[usLetter]]]]],
priorityHint => [priorityHint(1): PriorityHint ← normal],
releaseKey => [releaseKey(1): CARDINALLAST[CARDINAL]],
staple => [staple(1): BOOLEANFALSE],
twoSided => [twoSided(1): BOOLEANFALSE],
ENDCASE];
PrintOptionType: TYPE = MACHINE DEPENDENT {
printObjectSize(0), recipientName, message, copyCount, pagesToPrint,
mediumHint, priorityHint, releaseKey, staple, twoSided(9)};
PrintOptionsIndex: TYPE = CARDINAL[0..10);
PagesToPrint: TYPE = MACHINE DEPENDENT RECORD [
beginningPageNumber(0), endingPageNumber(1): CARDINAL];
PriorityHint: TYPE = MACHINE DEPENDENT {low(0), normal, high(2)};
PrinterProperties: TYPE = LONG DESCRIPTOR FOR ARRAY OF PrinterProperty;
PrinterProperty: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): PrinterPropertyType FROM
media => [media(1): Media],
staple => [staple(1): BOOLEAN],
twoSided => [twoSided(1): BOOLEAN],
ENDCASE];
PrinterPropertyType: TYPE = MACHINE DEPENDENT {
media(0), staple, twoSided(2)};
PrinterPropertiesIndex: TYPE = CARDINAL[0..3);
PrinterStatus: TYPE = LONG DESCRIPTOR FOR ARRAY OF PrinterStatusComponent;
PrinterStatusComponent: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): PrinterStatusType FROM
spooler => [spooler(1): Spooler],
formatter => [formatter(1): Formatter],
printer => [printer(1): Printer],
media => [media(1): Media],
ENDCASE];
PrinterStatusType: TYPE = MACHINE DEPENDENT {
spooler(0), formatter, printer, media(3)};
PrinterStatusIndex: TYPE = CARDINAL[0..4);
Spooler: TYPE = MACHINE DEPENDENT {available(0), busy, disabled, full(3)};
Formatter: TYPE = MACHINE DEPENDENT {available(0), busy, disabled(2)};
Printer: TYPE = MACHINE DEPENDENT {
available(0), busy, disabled, needsAttention, needsKeyOperator(4)};
RequestStatus: TYPE = LONG DESCRIPTOR FOR ARRAY OF RequestStatusComponent;
RequestStatusComponent: TYPE = MACHINE DEPENDENT RECORD [
var(0): SELECT type(0): RequestStatusType FROM
status => [status(1): Status],
statusMessage => [statusMessage(1): String],
ENDCASE];
RequestStatusType: TYPE = MACHINE DEPENDENT {status(0), statusMessage(1)};
RequestStatusIndex: TYPE = CARDINAL[0..2);
Status: TYPE = MACHINE DEPENDENT {
pending(0), inProgress, completed, completedWithWarnings, unknown, rejected,
aborted, canceled, held(8)};
ConnectionProblem: TYPE = MACHINE DEPENDENT {
noRoute(0), noResponse, transmissionHardware, transportTimeout,
tooManyLocalConnections, tooManyRemoteConnections,
missingCourier, missingProgram, missingProcedure, protocolMismatch,
parameterInconsistency, invalidMessage, returnTimedOut(12)
--otherCallProblem(LAST[CARDINAL])--};
ErrorType: TYPE = MACHINE DEPENDENT {
busy(0), insufficientSpoolSpace, invalidPrintParameters, masterTooLarge,
mediumUnavailable, serviceUnavailable, spoolingDisabled, spoolingQueueFull,
systemError, tooManyClients, undefinedError, connectionError, transferError(12), courier};
TransferProblem: TYPE = MACHINE DEPENDENT {
aborted(0), formatIncorrect(2), noRendezvous, wrongDirection(4)};
UndefinedProblem: TYPE = CARDINAL;
ERRORS
Error: ERROR [why: ErrorRecord];
ErrorRecord: TYPE = RECORD [
SELECT errorType: ErrorType FROM
busy, insufficientSpoolSpace, invalidPrintParameters, masterTooLarge,
mediumUnavailable, serviceUnavailable, spoolingDisabled, spoolingQueueFull,
systemError, tooManyClients => [],
undefinedError => [undefined: UndefinedProblem],
transferError => [transfer: TransferProblem],
connectionError => [connection: ConnectionProblem],
courier => [courier: ErrorCode],
ENDCASE];
PROCEDURE MODELS
Print: PROCEDURE [
master: Source,
printAttributes: PrintAttributes,
printOptions: PrintOptions,
systemElement: SystemElement]
RETURNS [printRequestID: RequestID];
GetPrinterProperties: PROCEDURE [systemElement: SystemElement]
RETURNS [properties: PrinterProperties];
GetPrinterStatus: PROCEDURE [systemElement: SystemElement]
RETURNS [status: PrinterStatus];
GetPrintRequestStatus: PROCEDURE [
printRequestID: RequestID, systemElement: SystemElement]
RETURNS [status: RequestStatus];
AddressTranslationStringToNetworkAddress: PROCEDURE [
name: LONG STRING]
RETURNS [systemElement: SystemElement, chUsed: BOOLEAN];
END...