PDInterpMainImpl.mesa
Copyright (C) 1984, 1985, Xerox Corporation. All rights reserved.
Michael Plass, September 20, 1984 9:14:01 am PDT
Diebert, September 3, 1985 2:10:05 pm PDT
Tim Diebert: September 19, 1985 4:09:41 pm PDT
DIRECTORY
IO,
PDInterpOutput,
PDInterpPage,
PDInterpReader,
PDQueue,
PDRemoteStream,
Process,
Rope;
PDInterpMainImpl: PROGRAM
IMPORTS IO, PDInterpOutput, PDInterpPage, PDInterpReader, PDQueue, PDRemoteStream, Process = BEGIN
ROPE: TYPE ~ Rope.ROPE;
DoFile: PROC [request: PDQueue.Request, requestNumber: CARDINAL, abort: REF BOOLEAN] = {
Action: PROC[stream: IO.STREAM] = {
reader: PDInterpReader.Handle ← PDInterpReader.Open[stream];
WHILE PDInterpPage.InterpretPage[reader, request, abort].ok DO IF abort^ THEN ABORTED ENDLOOP;
[] ← PDInterpReader.Close[reader];
};
IF request.fileName = NIL THEN PDInterpOutput.ReprintLastPage[request.copies]
ELSE {
PDRemoteStream.Read[request.fileName, request.requestor, request.requestorPassword, Action !
PDRemoteStream.Error => {
PDQueue.LogMessage[expl, requestNumber];
CONTINUE;
};
PDInterpReader.Error => {
message: ROPE;
message ← IO.PutFR1["PD file error: %g", IO.rope[(SELECT code FROM
invalidPassword => "Not a PD file",
objectOutOfBounds => "Object out of bounds",
missingStartImage => "Missing start image",
badLoadReference => "Bad load reference",
unrecognisedImagingCommand => "Unrecognised imaging command",
loadOutOfBounds => "Load out of bounds",
unrecognisedControlCommand => "Unrecognised control command",
unrecognisedCommandType => "Unrecognised command type",
unexpectedEOF => "Unexpected EOF",
runGroupTooLong => "Run group too long",
bitmapTooBig => "Bitmap too big",
deviceCommandTooBig => "Device command too big",
ENDCASE => "??")]];
PDQueue.LogMessage[message, requestNumber];
CONTINUE;
};
PDInterpReader.Warning => {
message: ROPE;
message ← IO.PutFR1["PD file warning: %g", IO.rope[(SELECT code FROM
wrongFormatVersion => "Wrong version of PD file format",
unreasonableResolution => "Unreasonable resolution",
unreasonableBandSSize => "Unreasonable bandSSize",
unreasonableImageSize => "Unreasonable imageSize",
unreasonableLoadSize => "Unreasonable loadSize",
unreasonableNumberOfCopies => "Unreasonable number of copies",
objectOutOfBand => "Object out of band",
emptyRunGroup => "Empty run group",
nonZeroFill => "Non-zero fill",
imageBoundsExceedPageBounds => "Image bounds exceed page bounds",
tooFewBands => "Too few bands",
unknownColorTileFlag => "Unknown color tile flag",
ENDCASE => "??")]];
PDQueue.LogMessage[message, requestNumber];
RESUME;
};
];
};
};
Main: PROC = {
DO
PDQueue.DoRequest[DoFile ! ABORTED => CONTINUE]
ENDLOOP
};
PDQueue.LogMessage["Booted."];
Process.Detach[FORK Main[]];
END.