DIRECTORY IO USING [STREAM], Rope USING [ROPE]; PressReader: 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, weight: {medium, bold, light}, slope: {regular, italic}, expansion: {regular, condensed, expanded}]; 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: PROCEDURE [name: ROPE] RETURNS [handle: Handle]; GetDocumentDirectory: PROCEDURE [Handle] RETURNS [DocumentDirectory]; GetParts: PUBLIC PROCEDURE [handle: Handle, partNumber: INT, pageProc: PageProc _ NIL, fontDirectoryProc: FontDirectoryProc _ NIL]; GetFonts: PUBLIC PROCEDURE [handle: Handle, fontEntryProc: FontEntryProc]; GetPage: PUBLIC PROCEDURE [handle: Handle, entityProc: EntityProc]; GetCommands: PUBLIC PROCEDURE [handle: Handle, commandProcs: CommandProcs]; GetObject: PROCEDURE [handle: Handle, objectProcs: ObjectProcs]; GetDots: PROCEDURE [handle: Handle, dotProcs: DotProcs]; ClosePressFile: PROCEDURE [Handle]; PageProc: TYPE = PROCEDURE [handle: Handle, partDirectoryEntry: PartDirectoryEntry]; FontDirectoryProc: TYPE = PROCEDURE [handle: Handle, partDirectoryEntry: PartDirectoryEntry]; FontEntryProc: TYPE = PROCEDURE [fontDirectoryEntry: FontDirectoryEntry]; EntityProc: TYPE = PROCEDURE [handle: Handle, entityTrailer: EntityTrailer]; ShowCharactersProc: TYPE = PROCEDURE [ opCode: {showCharactersShort, showCharactersAndSkip, showCharacters, showCharacterImmediate}, length: INT, text: ROPE]; SkipProc: TYPE = PROCEDURE [ opCode: {skipCharacters, skipControlBytes, skipControlBytesImmediate, skipCharactersShort}, length: INT]; SpacingProc: TYPE = PROCEDURE [ opCode: {setSpaceX, setSpaceY, setSpaceXShort, setSpaceYShort, resetSpace}, value: INT]; SpaceProc: TYPE = PROCEDURE; PositionProc: TYPE = PROCEDURE [opCode: {setX, setY}, value: INT]; ColorProc: TYPE = PROCEDURE [opCode: {setHue, setSaturation, setBrightness}, value: INT]; FontProc: TYPE = PROCEDURE [font: INT]; NoOpProc: TYPE = PROCEDURE; ShowRectangleProc: TYPE = PROCEDURE [width, height: INT]; CopyProc: TYPE = PROCEDURE [value: INT]; AlternativeProc: TYPE = PROCEDURE [types: CARDINAL, elBytes, dlBytes: INT]; ShowObjectProc: TYPE = PROCEDURE [handle: Handle, length: INT]; ShowDotsProc: TYPE = PROCEDURE [handle: Handle, opCode: {showDots, showDotsOpaque}, length: INT]; BadProc: TYPE = PROCEDURE [opCode, command, data: INT]; MoveToProc: TYPE = PROCEDURE [x,y: INT]; DrawToProc: TYPE = PROCEDURE [x,y: INT]; DrawCurveProc: TYPE = PROCEDURE [cX, cY, bX, bY, aX, aY: REAL]; SetCodingProc: TYPE = PROCEDURE [code, dots, lines: INT]; SetModeProc: TYPE = PROCEDURE [mode: INT]; SetWindowProc: TYPE = PROCEDURE [pd,dd,pl,dl: INT]; SetSizeProc: TYPE = PROCEDURE [width, height: INT]; DotsFollowProc: TYPE = PROCEDURE [dots: Dots]; ObjectProcs: TYPE = RECORD[ moveToProc: MoveToProc _ NIL, drawToProc: DrawToProc _ NIL, drawCurveProc: DrawCurveProc _ NIL ]; DotProcs: TYPE = RECORD[ setCoding: SetCodingProc _ NIL, setMode: SetModeProc _ NIL, setWindow: SetWindowProc _ NIL, setSize: SetSizeProc _ NIL, dotsFollow: DotsFollowProc _ NIL ]; CommandProcs: TYPE = RECORD[ 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 ]; PressReaderError: ERROR [errorCode: ErrorCode]; ErrorCode: PUBLIC TYPE = { FileNotAvailableForRead, FileNotAPressFile, BadHandle, BadPartType, PartNotFound, NoFontDirectoryPart, CurrentPartNotAPage, NoEntity, NotAtObject, NotAtDots, AbortedBecauseGetFailed }; END. œPressReader.mesa Last Modified by Shore; November 22, 1982 11:47 am Last Modified by Wyatt; December 1, 1983 4:53 pm This is for applications that wish to read Press files For an explanation of Press files see "Press File Format" Filed on [Maxc]PressFormat.Press. The expected way of using it is as follows: open the press file using OpenPressFile read the document directory using GetDocumentDirectory (this can be done at any time once the file is open) read the parts using GetParts the PageProc may wish to call GetPage the EntityProc may wish to call GetCommands the appropriate member of CommandProcs gets called for each command the ShowObjectProc may wish to call GetObject the appropriate member of ObjectProcs gets called for each object command the ShowDotsProc may wish to call GetDots the appropriate member of DotProcs gets called for each dot command the FontDirectoryProc may wish to call GetFonts the FontEntryProc gets called for each font in the font directory the FontEntryProc may wish to call GetObject for a graphically defined font the appropriate member of ObjectProcs gets called for each object command close the press file with ClosePressFile note that GetFonts can actually be called at any time after the file is open Open's file for reading, checks that it is a Press file ERRORS: Error[FileNotAvailableForRead, FileNotAPressFile, AbortedBecauseGetFailed] Returns the file's Document Directory ERRORS: Error[BadHandle, AbortedBecauseGetFailed] calls pageProc or fontDirectoryProc (depending on part type) for the specified part, if partNumber = 0 then pageProc is called for each Printed Page part and fontDirectoryProc for the Font Directory in the order in which they occur in the Press file ERRORS: Error[BadHandle, BadPartType, PartNotFound, AbortedBecauseGetFailed] calls fontEntryProc for each Font Entry in the Font Directory may call objectProcs for a graphically defined font ERRORS: Error[BadHandle, NoFontDirectoryPart, AbortedBecauseGetFailed] calls entityProc for each entity in the (current) printed page, thus, GetPage should be called from within a GetParts pageProc ERRORS: Error[BadHandle, CurrentPartNotAPage, AbortedBecauseGetFailed] calls members of commandProcs for each command in the (current) entity, thus GetCommands should be called from within a GetPage entityProc, else NoEntity is raised ERRORS: Error[BadHandle, NoEntity, AbortedBecauseGetFailed] calls members of ObjectProcs for each object command, thus GetObject should be called from within a GetCommands showObjectProc ERRORS: Error[BadHandle, NotAtObject, AbortedBecauseGetFailed]; calls members of DotProcs for each dots command, thus GetDots should be called from within a GetCommands showDotsProc passUpDots allows the dots in the file to be skipped ERRORS: Error[BadHandle, NotAtDots, AbortedBecauseGetFailed]; called when Press file reading is complete called (from GetParts) for each printedPage part called (from GetParts) for the fontDirectory part called (from GetFonts) for each font directory entry called (from GetPage) for each entity on a page the following procedure types make up a CommandProcs record, they are called (from GetCommands) for the entity commands Change Log Created by Shore; June 1982 Changed by Shore; August 22, 1982 3:28 pm converted to formatted Tioga file revisions for Cedar 3.3 Changed by Shore; August 26, 1982 12:29 am made Dots and Objects one level deeper to permit exit actions by the Commands Changed by Shore; September 2, 1982 9:08 am made Parts individually gettable (partNumber parameter to GetParts) Changed by Shore; September 3, 1982 5:08 pm now pass up Dots Changed by Shore; November 14, 1982 2:58 pm changed to Cedar.Style and added formats ส บ– "Cedar" style˜head1šฯc™Jš2™2Jš0™0J™—Jš6™6š9™9Jš/™/—š+™+Jšะcn ™'š"ž™6Jš4™4—šž™šž™%š ž ™+JšC™Cš$ž ™-JšI™I—š"ž™)JšC™C———š'ž™/šA™Aš#ž ™KJšI™I————Jšž™(J˜Jš ž:™Lunitšฯk ˜ JšŸœŸœŸœ˜JšœŸœŸœ˜——šฯn œŸ œŸ˜ JšŸœŸœŸœ˜J˜JšœŸœŸœ˜"JšœŸœ˜J˜JšœŸœŸœŸœ˜:šœŸœŸœŸœ˜,JšœŸœ˜ JšœŸœ˜ JšœŸœ˜ Jšœ Ÿœ˜ JšœŸœ˜ JšœŸœ˜ JšœŸœŸœ˜JšœŸœ˜ JšœŸœ˜ JšœŸœ˜ JšœŸœ˜ Jšœ Ÿœ˜Jšœ Ÿœ˜Jšœ Ÿœ˜—šœŸœŸœŸœ˜*Jšœ˜Jšœ Ÿœ˜Jšœ Ÿœ˜Jšœ Ÿœ˜Jšœ Ÿœ˜—Lšœ ŸœŸœ2˜GšœŸœŸœŸœ˜*JšœŸœ˜ Jšœ Ÿœ˜ JšœŸœ˜ Jšœ Ÿœ˜Jšœ Ÿœ˜JšœŸœ˜ Jšœ˜JšœŸœ˜ JšœŸœ˜ Jšœ Ÿœ˜—šœ ŸœŸœŸœ˜ Jšœ Ÿœ˜Jšœ˜Jšœ˜Jšœ+˜+—šœŸœŸœŸœ˜%Jšœ Ÿœ˜Jšœ Ÿœ˜ Jšœ Ÿœ˜Jšœ Ÿœ˜JšœŸœ˜JšœŸœ˜JšœŸœ˜ Jšœ Ÿœ˜ JšœŸœ˜ JšœŸœ˜ JšœŸœ˜ —šœŸœŸœ˜JšœŸœŸœ˜Jšœ Ÿœ˜Jšœ Ÿœ˜Jšœ Ÿœ˜JšœŸœ˜—š  œŸ œŸœŸœ˜?Jš7™7JšR™R—š œŸ œ Ÿœ˜EJš%™%Jš1™1—š  œŸœŸ œŸœŸœ)Ÿœ˜ƒJšT™TJšH™HJš[™[JšL™L—š œŸœŸ œ0˜JJš=™=Jš3™3JšF™F—š œŸœŸ œ*˜CJš?™?Jš>™>JšF™F—š  œŸœŸ œ.˜KJšG™GJš[™[Jš;™;—š  œŸ œ,˜@Jš5™5JšH™HJš?™?—š œŸ œ&˜8Jš0™0JšD™DJš4™4Jš=™=—š œŸ œ ˜#Jš*™*—J˜š œŸœŸ œ:˜TJš0™0—š œŸœŸ œ:˜]Jš1™1—š  œŸœŸ œ*˜IJš4™4—š  œŸœŸ œ0˜LJš/™/—J˜Jš<™<š:™:š œŸœŸ œ˜&Jšœ^˜^JšœŸœ˜ JšœŸœ˜ —š œŸœŸ œ˜Jšœ\˜\JšœŸœ˜ —š  œŸœŸ œ˜JšœK˜KJšœŸœ˜ —Lš  œŸœŸ œ˜Lš  œŸœŸ œŸœ˜BLš  œŸœŸ œ9Ÿœ˜YLš œŸœŸ œŸœ˜'Lš œŸœŸ œ˜Lš œŸœŸ œŸœ˜9Lš œŸœŸ œ Ÿœ˜(Lš  œŸœŸ œ ŸœŸœ˜KLš œŸœŸ œŸœ˜?Lš  œŸœŸ œ>Ÿœ˜aLš œŸœŸ œŸœ˜7Lš  œŸœŸ œŸœ˜(Lš  œŸœŸ œŸœ˜(Lš  œŸœŸ œŸœ˜@Lš  œŸœŸ œŸœ˜9Lš  œŸœŸ œŸœ˜*Lš  œŸœŸ œŸœ˜3Lš  œŸœŸ œŸœ˜3Lš œŸœŸ œ˜.—šœ ŸœŸœ˜JšœŸœ˜JšœŸœ˜JšœŸœ˜%—šœ ŸœŸœ˜JšœŸœ˜JšœŸœ˜JšœŸœ˜JšœŸœ˜JšœŸœ˜#—šœŸœŸœ˜Jšœ(Ÿœ˜,JšœŸœ˜JšœŸœ˜JšœŸœ˜JšœŸœ˜!JšœŸœ˜JšœŸœ˜JšœŸœ˜Jšœ'Ÿœ˜+Jšœ!Ÿœ˜%JšœŸœ˜!JšœŸœ˜Jšœ#Ÿœ˜'JšœŸœ˜—LšœŸœ˜/šœ ŸœŸœ˜Jšœ˜Jšœ˜Jšœ ˜ Jšœ ˜ Jšœ ˜ Jšœ˜Jšœ˜Jšœ ˜ J˜ J˜ Jšœ˜—J˜JšŸœ˜—š ™ Jšœ™J™™)J™!J™—J™™*J™M—J™™+J™C—J™™+J™—J™™+J™(———…—ฎ+