PDFileReader.mesa
Michael Plass, November 29, 1983 4:43 pm
Last Edited by: Pier, December 13, 1983 12:06 pm
DIRECTORY
IO, PDFileFormat, Rope, ImagerPixelMaps;
PDFileReader: CEDAR DEFINITIONS ~ BEGIN
ROPE: TYPE ~ Rope.ROPE;
Handle definition
Handle: TYPE ~ REF Rep;
Rep: TYPE ~ RECORD [
herald: PDFileFormat.Herald,
image: PDFileFormat.StartImage,
bandNumber: CARDINAL,
sMinBand: CARDINAL,
sSizeBand: CARDINAL,
colorType: ColorType,
colorTileLoadAddress: INT,
priority: INT,
loadWords: INT,
private: REF,
stream: IO.STREAM,
warningCount: INT
];
ColorType: TYPE ~ {none, clear, ink, opaqueTile, transparentTile};
Errors and Signals
Error: ERROR [handle: Handle, code: ErrorCode, wordIndex, wordCount: INT, description: ROPE];
Client may use handle.stream to read the offending data.
Warning: SIGNAL [handle: Handle, code: ErrorCode, wordIndex, wordCount: INT, description: ROPE];
ErrorCode: TYPE ~ {
errors:
invalidPassword,
objectOutOfBounds,
missingStartImage,
badLoadReference,
unrecognisedImagingCommand,
loadOutOfBounds,
unrecognisedControlCommand,
unrecognisedCommandType,
unexpectedEOF,
warnings:
wrongFormatVersion,
unreasonableResolution,
unreasonableBandSSize,
unreasonableImageSize,
unreasonableLoadSize,
unreasonableNumberOfCopies,
objectOutOfBand,
emptyRunGroup,
nonZeroFill,
imageBoundsExceedPageBounds,
tooFewBands,
unknownColorTileFlag
};
File control
Open: PROC [fileName: ROPE] RETURNS [Handle];
May raise FileIO.OpenFailed, PDFileReader.Error, or PDFileReader.Warning
FromStream: PROC [stream: IO.STREAM] RETURNS [Handle];
May raise PDFileReader.Error or PDFileReader.Warning
Close: PROC [handle: Handle];
Reading operations
Get: PROC [handle: Handle, scanning: BOOLEAN ← FALSE] RETURNS [REF];
Returns one of the data types below
May raise PDFileReader.Error or PDFileReader.Warning
IF scanning=TRUE, large GetBlocks will not be done for runs, loads, ...
Keep: PROC [handle: Handle, ref: REF] RETURNS [REF];
Normally, storage returned by a call on Get is subject to re-use on later calls. Calling Keep prevents re-use of the specified storage.
ColorTileFromLoad: PROC [handle: Handle, colorTileLoadAddress: INT, scratch: REF ImagerPixelMaps.PixelMapRep ← NIL] RETURNS [colorTile: ImagerPixelMaps.Tile];
Data types returned by Get
MaskRectangle: TYPE ~ REF MaskRectangleRep;
MaskRectangleRep: TYPE ~ RECORD [
sMin, fMin, sSize, fSize: CARDINAL
];
MaskTrapezoid: TYPE ~ REF MaskTrapezoidRep;
MaskTrapezoidRep: TYPE ~ RECORD [
sMin, fMin, fMinLast, sSize, fSize, fSizeLast: CARDINAL
];
MaskRunGroup: TYPE ~ REF MaskRunGroupRep;
MaskRunGroupRep: TYPE ~ RECORD [
sMin, fMin, sSize, fSize: CARDINAL,
fOffset: CARDINAL, -- add this to fMin of each run
runCount: INT, -- number of runs
pointer: LONG POINTER TO PDFileFormat.Run,
loadAddress: INT, -- -1 if not in the load
ref: REF -- for garbage collection hacks
];
MaskSamples: TYPE ~ REF MaskSamplesRep;
MaskSamplesRep: TYPE ~ RECORD [
loadAddress: INT, -- -1 if not in the load
samples: ImagerPixelMaps.PixelMap
];
ColorSamples: TYPE ~ REF ColorSamplesRep;
ColorSamplesRep: TYPE ~ RECORD [
samples: ImagerPixelMaps.PixelMap
];
DeviceCommand: TYPE ~ REF DeviceCommandRep;
DeviceCommandRep: TYPE ~ RECORD [
SEQUENCE wordCount: NAT OF CARDINAL
];
StateChange: TYPE ~ REF StateChangeRep;
StateChangeRep: TYPE ~ RECORD [
whatChanged: WhatChanged,
loadChangeStart, loadChangeLength: INT
];
WhatChanged: TYPE ~ {
imageStart, imageEnd, priorityChange, colorChange, bandChange, loadChange, documentEnd
};
END.