<> <> <> <> <<>> <> <> <PressFormat.Press.>> <> <> <> <<(this can be done at any time once the file is open)>> <> <> <> <> <> <> <> <> <> <> <> <> <> <> DIRECTORY FS USING [OpenFile], IO USING [STREAM], Rope USING [ROPE]; PressReader: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; Handle: TYPE = REF PressReaderRec; PressReaderRec: TYPE; DocumentDirectory: PUBLIC TYPE = REF DocumentDirectoryRec; DocumentDirectoryRec: PUBLIC TYPE = RECORD [ passwd: INT, nRecs: INT, nParts: INT, pdStart: INT, pdRecs: INT, backP: INT, date: LONG CARDINAL, fCopy: INT, lCopy: INT, fPage: INT, lPage: INT, fileName: ROPE, creator: ROPE, dateText: ROPE ]; PartDirectoryEntry: PUBLIC TYPE = RECORD [ partType: PartType, typeNumber: INT, partStart: INT, partRecs: INT, padding: INT ]; PartType: PUBLIC TYPE = { private, printedPage, fontDirectory, other }; FontDirectoryEntry: PUBLIC TYPE = RECORD [ length: INT, fontSet: INT, font: INT, firstChar: INT, lastChar: INT, family: ROPE, face: FontFace, source: INT, size: INT, rotation: INT ]; FontFace: PUBLIC TYPE = RECORD [ encoding: INT, texDesignSize: REAL, weight: {medium, bold, light, none}, slope: {regular, italic, none}, expansion: {regular, condensed, expanded, none} ]; EntityTrailer: PUBLIC TYPE = RECORD [ entityType: INT, fontSet: INT, dataStart: INT, dataLength: INT, Xe: INT, Ye: INT, xLeft: INT, yBottom: INT, width: INT, height: INT, length:INT ]; Dots: TYPE = RECORD [ file: IO.STREAM, numberPages: NAT, pageNumber: NAT, byteOffset: INT, length: INT ]; OpenPressFile: PROC [name: ROPE] RETURNS [handle: Handle]; <> <> <<];>> <> <<>> FromOpenFile: PROC [openFile: FS.OpenFile] RETURNS [handle: Handle]; <> <<];>> <> <<>> GetDocumentDirectory: PROC [Handle] RETURNS [DocumentDirectory]; <> <> <<];>> <> <<>> GetParts: PUBLIC PROC [handle: Handle, partNumber: INT, pageProc: PageProc _ NIL, fontDirectoryProc: FontDirectoryProc _ NIL]; <> <> <> <> <<];>> <> <<>> GetFonts: PUBLIC PROC [handle: Handle, fontEntryProc: FontEntryProc]; <> <> <> <<];>> <> <<>> GetPage: PUBLIC PROC [handle: Handle, entityProc: EntityProc]; <> <> <> <<];>> <> <<>> GetCommands: PUBLIC PROC [ handle: Handle, showCharactersProc: ShowCharactersProc _ NIL, skipProc: SkipProc _ NIL, spacingProc: SpacingProc _ NIL, spaceProc: SpaceProc _ NIL, positionProc: PositionProc _ NIL, colorProc: ColorProc _ NIL, fontProc: FontProc _ NIL, noOpProc: NoOpProc _ NIL, showRectangleProc: ShowRectangleProc _ NIL, showObjectProc: ShowObjectProc _ NIL, showDotsProc: ShowDotsProc _ NIL, copyProc: CopyProc _ NIL, alternativeProc: AlternativeProc _ NIL, badProc: BadProc _ NIL ]; <> <> <> <<];>> <> <<>> GetObject: PROC [ handle: Handle, moveToProc: MoveToProc _ NIL, drawToProc: DrawToProc _ NIL, drawCurveProc: DrawCurveProc _ NIL ]; <> <> <> <<>> GetDots: PROC [ handle: Handle, setCoding: SetCodingProc _ NIL, setMode: SetModeProc _ NIL, setWindow: SetWindowProc _ NIL, setSize: SetSizeProc _ NIL, setSamplingProperties: SetSamplingPropertiesProc _ NIL, dotsFollow: DotsFollowProc _ NIL ]; <> <> <> <> <<>> ClosePressFile: PROC [Handle]; <> PageProc: TYPE = PROC [handle: Handle, partDirectoryEntry: PartDirectoryEntry]; <> <<>> FontDirectoryProc: TYPE = PROC [handle: Handle, partDirectoryEntry: PartDirectoryEntry]; <> <<>> FontEntryProc: TYPE = PROC [fontDirectoryEntry: FontDirectoryEntry]; <> <<>> EntityProc: TYPE = PROC [handle: Handle, entityTrailer: EntityTrailer]; <> <> ShowCharactersProc: TYPE = PROC [ opCode: {showCharactersShort, showCharactersAndSkip, showCharacters, showCharacterImmediate}, length: INT, text: ROPE ]; SkipProc: TYPE = PROC [ opCode: {skipCharacters, skipControlBytes, skipControlBytesImmediate, skipCharactersShort}, length: INT ]; SpacingProc: TYPE = PROC [ opCode: {setSpaceX, setSpaceY, setSpaceXShort, setSpaceYShort, resetSpace}, value: INT ]; SpaceProc: TYPE = PROC; PositionProc: TYPE = PROC [opCode: {setX, setY}, value: INT]; ColorProc: TYPE = PROC [opCode: {setHue, setSaturation, setBrightness}, value: INT]; FontProc: TYPE = PROC [font: INT]; NoOpProc: TYPE = PROC; ShowRectangleProc: TYPE = PROC [width, height: INT]; CopyProc: TYPE = PROC [value: INT]; AlternativeProc: TYPE = PROC [types: CARDINAL, elBytes, dlBytes: INT]; ShowObjectProc: TYPE = PROC [handle: Handle, length: INT]; ShowDotsProc: TYPE = PROC [handle: Handle, opCode: {showDots, showDotsOpaque}, length: INT]; BadProc: TYPE = PROC [opCode, command, data: INT]; MoveToProc: TYPE = PROC [x,y: INT]; DrawToProc: TYPE = PROC [x,y: INT]; DrawCurveProc: TYPE = PROC [cX, cY, bX, bY, aX, aY: REAL]; SetCodingProc: TYPE = PROC [code, dots, lines: INT]; SetModeProc: TYPE = PROC [mode: INT]; SetWindowProc: TYPE = PROC [pd,dd,pl,dl: INT]; SetSizeProc: TYPE = PROC [width, height: INT]; DotsFollowProc: TYPE = PROC [dots: Dots]; SetSamplingPropertiesProc: TYPE ~ PROC [samplingProperties: LIST OF SamplingProperty]; SamplingProperty: TYPE ~ REF; <> SSPInputIntensity: TYPE ~ REF SSPInputIntensityRep; SSPInputIntensityRep: TYPE ~ MACHINE DEPENDENT RECORD [ min: INTEGER, max: INTEGER ]; SSPOutputIntensity: TYPE ~ REF SSPOutputIntensityRep; SSPOutputIntensityRep: TYPE ~ MACHINE DEPENDENT RECORD [ minBrightness, minHue, minSaturation, maxBrightness, maxHue, maxSaturation: [0..255] ]; <<-- not used in any known press files>> SSPScreen: TYPE ~ REF SSPScreenRep; SSPScreenRep: TYPE ~ MACHINE DEPENDENT RECORD [ angle, amplitude, frequency: INTEGER ]; SSPDot: TYPE ~ REF SSPDotRep; SSPDotRep: TYPE ~ MACHINE DEPENDENT RECORD [ nCells: CARDINAL, nLines: CARDINAL, nShifts: CARDINAL, thresholds: SEQUENCE COMPUTED CARDINAL OF CARDINAL ]; PressReaderError: ERROR [errorCode: ErrorCode]; ErrorCode: PUBLIC TYPE = { FileNotAPressFile, BadHandle, BadPartType, PartNotFound, NoFontDirectoryPart, CurrentPartNotAPage, NoEntity, NotAtObject, NotAtDots, AbortedBecauseGetFailed, UnexpectedOpCode, MalformedPressFile, Unimplemented, Bug }; END. <<>> <> <> <<>> <> <> <> <<>> <> <> <<>> <> <> <<>> <> <> <<>> <> <> <<>> <> <> <<>> <> <> <<>>