<> <> <> <> <> <> DIRECTORY FileIO USING [Open], IO USING [STREAM], Rope USING [ROPE], UserTerminal USING [CursorArray]; SirPress: CEDAR DEFINITIONS IMPORTS FileIO = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; <> <> pt: INT = (25400000/72)+1; -- a 72 per inch point, used for PARC fonts texpt: INT = 351460; -- a 72.27 per inch point, used for TEX fonts in: INT = 25400000; -- an inch mm: INT = 1000000; cm: INT = 10000000; mica: INT = 10000; -- a mica PrintingMode: TYPE = {normal, reverse, solid, transparent}; tShirt: PrintingMode = reverse; PressStateVector: TYPE; PressHandle: TYPE = REF PressStateVector; <> CursorObject: TYPE = REF CursorObjectRec; CursorObjectRec: TYPE = RECORD[ cursorProc: CursorProc, clientData: REF ANY ]; CursorProc: TYPE = PROC [clientData: REF ANY, bits: REF UserTerminal.CursorArray]; <> NewPressHandle: PROC [pressFileName: ROPE] RETURNS [PressHandle] = INLINE {RETURN[Create[FileIO.Open[pressFileName, overwrite], pressFileName]]}; Create: PUBLIC PROC [ outputStream: STREAM, fileNameForHeaderPage: ROPE _ NIL, creatorName: ROPE _ NIL, printingMode: PrintingMode _ normal, cursorObject: CursorObject _ NIL] -- Starts making a new press file RETURNS [p: PressHandle]; SetPageSize: PUBLIC PROC [ -- applies for the current and following pages. Setting width bigger than hieght will result in landscape output. p: PressHandle, height: INT _ 110, width: INT _ 85, unit: INT _ in/10]; SetSpace: PUBLIC PROC [ p: PressHandle, xSpace: INT, ySpace: INT _ 0, unit: INT _ mica]; ResetSpace: PUBLIC PROC [p: PressHandle]; PutSpace: PUBLIC PROC [p: PressHandle]; SetColor: PUBLIC PROC [p: PressHandle, hue, saturation, brightness: INT]; SetHue: PUBLIC PROC [p: PressHandle, hue: INT]; SetSaturation: PUBLIC PROC [p: PressHandle, saturation: INT]; SetBrightness: PUBLIC PROC [p: PressHandle, brightness: INT]; SetFont: PUBLIC PROC [ p: PressHandle, family: ROPE, size: INT, face: INT _ 0, rotation: INT _ 0, unit: INT _ pt -- unit for size, in nanometers--]; PutText: PUBLIC PROC [ p: PressHandle, textString: ROPE, xCoordinateOfLeftEdge: INT, yCoordinateOfBaseline: INT, unit: INT _ mica]; PutTextHere: PUBLIC PROC [ p: PressHandle, textString: ROPE]; PutRectangle: PUBLIC PROC [ p: PressHandle, xstart, ystart, xlen, ylen: INT, unit: INT _ mica]; WritePage: PUBLIC PROC [p: PressHandle]; ClosePress: PUBLIC PROC [p: PressHandle]; <> ScanLine: TYPE = RECORD [ pixels: SELECT coding: DotCoding FROM bitMap => [bit: PACKED SEQUENCE length: NAT OF [0..1]], packedMap => [bitWord: SEQUENCE length: NAT OF CARDINAL], bitSampled => [intensity: PACKED SEQUENCE length: NAT OF [0..2)], bitBitSampled=>[intensity: PACKED SEQUENCE length: NAT OF [0..4)], nybbleSampled=>[intensity: PACKED SEQUENCE length: NAT OF [0..16)], byteSampled => [intensity: PACKED SEQUENCE length: NAT OF [0..256)] ENDCASE ]; Direction: TYPE = MACHINE DEPENDENT {right(0), left(1), up(2), down(3)}; DotCoding: TYPE = {bitMap, bitSampled, bitBitSampled, nybbleSampled, byteSampled, packedMap}; <> <> BeginScannedRectangle: PROC [ p: PressHandle, x, y: INT, -- coordinate of lower left corner dotsPerLine: INT, numberOfLines: INT, width: INT _ -1, height: INT _ -1, unit: INT _ mica, nextLineDirection: Direction _ down, nextDotDirection: Direction _ right, coding: DotCoding _ bitMap, samplingProperties: SamplingProperties _ [omitted: TRUE] ]; SamplingProperties: TYPE = RECORD [ -- For fine control of the halftone screens omitted: BOOLEAN _ FALSE, screenAngle: INT _ 0, screenAmplitude: INT _ 100, screenFrequency: INT _ 85, minIntensity: INT _ 0, maxIntensity: INT _ 255 ]; ShowLine: PROC [p: PressHandle, s: REF ScanLine]; UnsafeShowLine: UNSAFE PROC [p: PressHandle, dataPointer: LONG POINTER]; EndScannedRectangle: PROC [p: PressHandle]; <> StartOutline: PUBLIC PROC [p: PressHandle]; PutMoveTo: PUBLIC PROC [p: PressHandle, x, y: INT, unit: INT _ mica]; PutDrawTo: PUBLIC PROC [p: PressHandle, x, y: INT, unit: INT _ mica]; PutCubic: PUBLIC PROC [p: PressHandle, x1, y1, x2, y2, x3, y3: REAL, unit: INT _ mica]; EndOutline: PUBLIC PROC [p: PressHandle]; <> FontCode: TYPE = NAT _ 0; GetFontCode: PUBLIC PROC [ p: PressHandle, family: ROPE, size: INT, face: INT _ 0, rotation: INT _ 0, unit: INT _ pt -- unit for size, in nanometers--] RETURNS [FontCode]; SetFontFromCode: PUBLIC PROC [p: PressHandle, f: FontCode]; Pipe: TYPE = REF PipeRec; NewPipe: PUBLIC PROC [maximumNumberOfSpacesInPipe: INT _ 200] RETURNS [Pipe]; OpenPipe: PUBLIC PROC [p: PressHandle, pipe: Pipe]; <> <> PipeChar: PUBLIC PROCEDURE [pipe: Pipe, c: CHARACTER] = INLINE {OPEN pipe^; i:NAT _ text.length; text.length _ i + 1; text[i] _ c}; PipePosition: PUBLIC PROCEDURE [pipe: Pipe, x: INTEGER] = INLINE BEGIN OPEN pipe^; i:NAT _ scount; scount_i+1; slist[i] _ [text.length, x] END; ClosePipe: PUBLIC PROCEDURE [ p: PressHandle, pipe: Pipe, y: INT, -- all chars on the same line unit: INT _ mica]; <> <> PipeRec: TYPE = RECORD [text: REF TEXT _ NIL, scount: NAT _ 0, slist: SEQUENCE maxscount: NAT OF CharPtrAndPosition--couldntresistreadingthiscouldya--]; CharPtrAndPosition: TYPE = RECORD [charPtr: NAT, x: INTEGER]; END. Michael Plass, September 27, 1982 2:06 pm: Changed to use FileIO. Michael Plass, October 21, 1982 2:46 pm: Added SetSamplingProperties. Michael Plass, October 25, 1982 10:55 am: Fixed up formatting of source. Michael Plass, November 1, 1982 9:50 am: Removed Transaction import. Michael Plass, November 3, 1982 10:27 am: Replaced cursor proc with cursor object. Michael Plass, November 15, 1982 11:26 am: Added UnsafeShowLine. Michael Plass, November 16, 1982 10:49 am: Put portrait/landscape logic into SetPageSize.