DIRECTORY Rope USING [ROPE], UnixTapeOps USING [TapeHandle, Density], TapesCommon USING [FileHandleList, FileHandle], BasicTime USING [GMT], ImagerPixel USING [PixelBuffer]; CrosfieldTape: CEDAR DEFINITIONS ~ BEGIN ROPE: TYPE ~ Rope.ROPE; PixelBuffer: TYPE ~ ImagerPixel.PixelBuffer; TapeHandle: TYPE ~ UnixTapeOps.TapeHandle; FileSpec: TYPE = REF FileSpecRep; FileSpecRep: TYPE = RECORD[ pixelsPerInch: PixelsPerInch, nLines, nPixels: NAT, note: ROPE, mapPixel: PixelProc ]; PixelsPerInch: TYPE = {ppi300, ppi450, ppi600}; FileSpecList: TYPE = LIST OF FileSpec; WriteTape: PROC [tapeHandle: TapeHandle, files: FileSpecList, tapeNumber: [1..999] _ 102, name: ROPE] RETURNS [TapesCommon.FileHandleList]; InitializeTape: PROC [tapeHandle: TapeHandle, files: FileSpecList, tapeNumber: [1..999] _ 102, name: ROPE]; AddFileToTape: PROC [tapeHandle: TapeHandle, file: FileSpec, fileNumber, tapeNumber: NAT, inPosition: BOOLEAN _ FALSE] RETURNS [TapesCommon.FileHandle]; Identity: TYPE ~ REF IdentityRep; IdentityRep: TYPE ~ RECORD [ tapeNumber: [1..999], date: BasicTime.GMT, name: ROPE ]; Directory: TYPE ~ REF DirectoryRep; DirectoryRep: TYPE ~ RECORD [ fileNumber: [1..70], contone: BOOL, color: Color, hRes, vRes: PixelsPerInch, pixelsPerLine: CARDINAL, lines: CARDINAL, createDate: BasicTime.GMT, note: ROPE, tapeNumber: [0..999], linesPerCylinder, sectorsPerLine, cylinders, blocks: CARDINAL ]; Color: TYPE ~ MACHINE DEPENDENT RECORD [ cyan(0:7..7): BOOL _ TRUE, magenta(0:6..6): BOOL _ TRUE, yellow(0:5..5): BOOL _ TRUE, black(0:4..4): BOOL _ TRUE, red(0:3..3): BOOL _ FALSE, green(0:2..2): BOOL _ FALSE, blue(0:1..1): BOOL _ FALSE, ws1(0:0..0): BOOL _ FALSE, -- filler negativeImage(0:15..15): BOOL _ FALSE, -- low values represent dark print/film ws2(0:14..14): BOOL _ FALSE, -- filler bytesPerPixel(0:11..13): [0 .. 7) _ 4, ws3(0:8..10): [0 .. 7) _ 0 ]; ReadTapeIdentity: PROC[tapeHandle: TapeHandle] RETURNS[Identity]; ReadMasterDirectory: PROC[tapeHandle: TapeHandle] RETURNS [nFiles: NAT, masterDirectory: LIST OF Directory]; ReadFile: PROC[tapeHandle: TapeHandle, fileNumber: [1..70] _ 1] RETURNS[Directory]; FileTo4AIS: PROC [tapeHandle: TapeHandle, fileNumber: [1..70] _ 1, aisRootName: ROPE, mapPixel: PixelProc, reduce: NAT _ 4] RETURNS [Directory]; SizeOfFile: PROC [fileSpec: FileSpec, density: UnixTapeOps.Density _ GCR6250] RETURNS [sizeInFeet: REAL]; SizeOfHeader: PROC [density: UnixTapeOps.Density _ GCR6250] RETURNS [sizeInFeet: REAL]; SizeOfList: PROC [files: FileSpecList, density: UnixTapeOps.Density _ GCR6250] RETURNS [sizeInFeet: REAL]; PixelProc: TYPE = PROC[pixel: BYTE] RETURNS[BYTE]; IdentityByte: PixelProc; CrosfieldToByte: PixelProc; --(DotPercent*2)+25 in theory, use for read ByteToCrosfield: PixelProc; --25+2*100*pixel/255.0 use for write KOToByte: PixelProc; --range [6..245] => [0..255] ByteToKO: PixelProc; --range [0..255] => [6..245] use for write END. ’CrosfieldTape.mesa Copyright Σ 1987 by Xerox Corporation. All rights reserved. Maureen Stone, Tim Diebert, June 4, 1989 12:51:00 pm PDT Format to read/write Crosfield tape format (for color separations). CMYK pixels interleaved. Types setup to coordinate with ConvertToRaster Write Tape The ppi are approximate. The actual values are: 300x304.8, 450x406.4, 600x609.6. If the exact size is important (or you want to use ppi450), you must compensate for the difference when you generate the rasters. From TapesCommon FileHandle: TYPE = REF FileHandleRep; FileHandleRep: TYPE = RECORD[ newLine: PROC[self: FileHandle, line: PixelBuffer] RETURNS[eof: BOOLEAN], data: REF ]; FileHandleList: TYPE = LIST OF FileHandle; Initializes the tape for writing. Writes the master directory. Returns a list of FileHandle. Client should use SizeOfList to check that the files will fit on the opened tape. Client rasterizes into each FileHandle in turn. newLine.eof is TRUE when tape has recorded nLines worth of rasters. Client can check newLine.eof to verify that the client and the tape are still in sync. WriteTape above requires all the files to be written at once. This guarentees tape integrity. The following procedures allow you to build up a tape over several sessions. Note, however, that you must include in the master directory all the files you will want to add. Then, the files must be added in exactly the same order as they appear in the master directory. It's ok to leave a tape incomplete, however. Must include correct FileSpecs for every file that may appear on the tape. File numbers start at 1. Files must be added in the order specified in the master directory. tapeNumber is included in the local file directory, so it must be included here. If inPosition, will start writing at the current tape position. Otherwise, will rewind and use the file number to position the tape. Read Tape Rewinds tape, reads identity record Rewinds tape, reads identity record, reads master directory Reads a file, verifying that the format is consistant. Makes 4 ais files (cyan, magenta, yellow, black) from the information on the tape. AIS files are 1/reduce2 the size of the original (ie for reduce = 4, 300 spi => 75 spi) Sizes A big tape is 2400 feet, a small tape is 600 feet. The file and its directory The identity and master directory Convenience proc. SizeOfFile for each file in list + SizeOfHeaders Pixel Procs and Utilities Κρ˜code•Mark outsideHeaderšœ™Kšœ<™œœ˜iK™K™—š  œœ*œœ˜WK™!K™—š  œœ?œœ˜jKšœ  œ ™C——™Kš œ œœœœœ˜2Kš  œ ˜Kš œ ‘+˜GKš œ ‘$˜@Kš œ ‘˜1Kš œ ‘*˜?K˜—Kšœ˜—…— Zέ