<> <> <> DIRECTORY IO USING [STREAM], Rope USING [ROPE]; TapeOps: CEDAR DEFINITIONS = BEGIN ROPE: TYPE ~ Rope.ROPE; maxBufferLength: INT ~ 16384; Density: TYPE ~ {NRZI800, PE1600}; DriveNumber: TYPE ~ [0..7]; RetryCount: TYPE ~ [0 .. 256); ErrorCode: TYPE ~ { DataError, -- Error in reading or writing the data on the tape. NameLookUpError, -- Server name specified could not be found. ServerControlStreamAbort, -- The BSP connection with the Tape Server was broken. ServerProtocolError, -- The Server made a protocol error that could not be recovered from. See Implimentor if this error is encountered. TapeOperationError, -- The Tape Server could not complete the operation because the tape drive status was not as expected. TapeUserError -- This error is raised when an operation could not be performed because of an inapropriate user operation like Tape Not Mounted, Write Protect Ring Out on a Write, Drive Number In use or SetDensity attempted while tape was not at BOT. }; <> TapeOpsError: ERROR [ec: ROPE, code: ErrorCode]; TapeOpsWarning: SIGNAL [ec: ROPE, code: ErrorCode] RETURNS [procced: BOOL]; TapeHandle: TYPE ~ REF TapeHandleRep; TapeHandleRep: TYPE ~ RECORD [ serverName: ROPE _ NIL, commStream: IO.STREAM, versionString: ROPE _ NIL, driveNumber: NAT _ 0, density: Density _ PE1600, densityIsSet: BOOL _ FALSE, status: TapeStatus _ ALL[FALSE], open: BOOL _ FALSE, buffer: REF TEXT _ NIL ]; -- Status from tape server TapeStatusIndex: TYPE = MACHINE DEPENDENT { RDY(0), --100000 ReaDY. Unit loaded, Tape not in motion ONL(1), -- 40000 ON Line. Unit loaded, Tape may be in motion RWD(2), -- 20000 ReWinDing. Unit is rewinding FPT(3), -- 10000 File ProTect. Write Ring removed. BOT(4), -- 4000 Beginning Of Tape. Tape is at load point EOT(5), -- 2000 End Of Tape. EOT marker was crossed in a forward direction FMK(6), -- 1000 End Of File. Last record (R/W) was an EOF mark (Tape Mark) NRZI(7), -- 400 NRZI Status is present in the drive. 800: BOOL,s per inch mode. errHE(8), -- 200 Hard Error. A non recoverable error occured during R/W operation errSE(9), -- 100 Soft Error. A correctable error occured during R/W operation. errDL(10), -- 40 Data Late. Write or Read buffer went empty or overflowed errRDP(11), -- 20 Read Data Parity. A read parity error occured. errICL(12), -- 10 InCorrect Length on write errHDW(13), -- 4 HarDWare ERRor. THe controller microcode detected an error. errWFP(14), -- 2 Write on File Protected reel. (FPT & Write-Op) errCMD(15) -- 1 ComManD ERror. Unkown command type. }; FBool: TYPE = BOOL _ FALSE; TapeStatus: TYPE = PACKED ARRAY TapeStatusIndex OF FBool; -- Procs OpenDrive: PROC [serverName: ROPE, driveNumber: NAT _ 0, density: Density _ PE1600, justOpen: BOOL _ FALSE] RETURNS [tapeHandle: TapeHandle]; <> <> CloseDrive: PROC [tapeHandle: TapeHandle]; <> GetStatus: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> <> SetRetry: PROC [tapeHandle: TapeHandle, retryCount: RetryCount _ 4]; <> SetDensity: PROC [tapeHandle: TapeHandle, density: Density]; <> Rewind: PROC [tapeHandle: TapeHandle, waitForCompletion: BOOL _ FALSE] RETURNS [status: TapeStatus]; <> Unload: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> ReadRecord: PROC [tapeHandle: TapeHandle, buffer: REF TEXT _ NIL] RETURNS [tapeMark: BOOL, record: REF TEXT, status: TapeStatus]; <> WriteRecord: PROC [tapeHandle: TapeHandle, writeData: REF READONLY TEXT] RETURNS [status: TapeStatus]; <> WriteFileMark: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> ForwardSpaceFile: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> ForwardSpaceRecord: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> BackSpaceFile: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> BackSpaceRecord: PROC [tapeHandle: TapeHandle] RETURNS [status: TapeStatus]; <> END.