<> <> <> DIRECTORY Environment USING [Block, Byte, Word], IO USING [STREAM]; Stream: DEFINITIONS = BEGIN <> Handle: TYPE = REF Object; Byte: TYPE = Environment.Byte; Word: TYPE = Environment.Word; SubSequenceType: TYPE = [0..256); Block: TYPE = Environment.Block; InputOptions: TYPE = RECORD [ terminateOnEndRecord: BOOLEAN _ FALSE, signalLongBlock: BOOLEAN _ FALSE, signalShortBlock: BOOLEAN _ FALSE, signalSSTChange: BOOLEAN _ FALSE, signalEndOfStream: BOOLEAN _ FALSE, signalAttention: BOOLEAN _ FALSE, signalTimeout: BOOLEAN _ TRUE, signalEndRecord: BOOLEAN _ FALSE]; defaultInputOptions: InputOptions = []; CompletionCode: TYPE = {normal, endRecord, sstChange, endOfStream, attention, timeout}; Position: TYPE = LONG CARDINAL; Milliseconds: TYPE = LONG CARDINAL; <> GetByte: PROCEDURE [sH: Handle] RETURNS [byte: Byte] = INLINE {RETURN[sH.getByte[sH]]}; -- Get the next byte from the stream. GetChar: PROCEDURE [sH: Handle] RETURNS [char: CHARACTER] = INLINE {RETURN[LOOPHOLE[sH.getByte[sH]]]}; -- Get the next character from the stream. GetWord: PROCEDURE [sH: Handle] RETURNS [word: Word] = INLINE {RETURN[sH.getWord[sH]]}; <> <> GetBlock: PROCEDURE [sH: Handle, block: Block] RETURNS [ bytesTransferred: CARDINAL, why: CompletionCode, sst: SubSequenceType] = INLINE {[bytesTransferred, why, sst] _ sH.get[sH, block, sH.options]}; <> <> SetInputOptions: PROCEDURE [sH: Handle, options: InputOptions] = INLINE {sH.options _ options}; <> PutByte: PROCEDURE [sH: Handle, byte: Byte] = INLINE {sH.putByte[sH, byte]}; <> PutChar: PROCEDURE [sH: Handle, char: CHARACTER] = INLINE {sH.putByte[sH, LOOPHOLE[char]]}; <> PutWord: PROCEDURE [sH: Handle, word: Word] = INLINE {sH.putWord[sH, word]}; <> <> PutBlock: PROCEDURE [ sH: Handle, block: Block, endRecord: BOOLEAN _ FALSE] = INLINE {sH.put[sH, block, endRecord]}; <> <> PutString: PROCEDURE [ sH: Handle, string: LONG STRING, endRecord: BOOLEAN _ FALSE] = INLINE BEGIN block: Block = [LOOPHOLE[@string.text], 0, string.length]; sH.put[sH, block, endRecord]; END; SendNow: PROCEDURE [sH: Handle, endRecord: BOOLEAN _ TRUE] = INLINE {sH.sendNow[sH, endRecord]}; SetSST: PROCEDURE [sH: Handle, sst: SubSequenceType] = INLINE {sH.setSST[sH, sst]}; <> SendAttention: PROCEDURE [sH: Handle, byte: Byte] = INLINE {sH.sendAttention[sH, byte]}; <> WaitForAttention: PROCEDURE [sH: Handle] RETURNS [Byte] = INLINE {RETURN[sH.waitAttention[sH]]}; <> Delete: PROCEDURE [sH: Handle] = INLINE {sH.delete[sH]}; <> GetPosition: PROCEDURE [sH: Handle] RETURNS [position: Position] = INLINE {RETURN[sH.getPosition[sH]]}; -- Get the current position of the stream. SetPosition: PROCEDURE [sH: Handle, position: Position] = INLINE {sH.setPosition[sH, position]}; -- Set the current position of the stream <> Attention: SIGNAL [nextIndex: CARDINAL]; EndOfStream: SIGNAL [nextIndex: CARDINAL]; LongBlock: SIGNAL [nextIndex: CARDINAL]; ShortBlock: ERROR; SSTChange: SIGNAL [sst: SubSequenceType, nextIndex: CARDINAL]; TimeOut: SIGNAL [nextIndex: CARDINAL]; InvalidOperation: ERROR; EndRecord: SIGNAL [nextIndex: CARDINAL]; <> Object: TYPE = RECORD [ options: InputOptions, getByte: GetByteProcedure, putByte: PutByteProcedure, getWord: GetWordProcedure, putWord: PutWordProcedure, get: GetProcedure, put: PutProcedure, setSST: SetSSTProcedure, sendAttention: SendAttentionProcedure, waitAttention: WaitAttentionProcedure, delete: DeleteProcedure, getPosition: GetPositionProcedure, setPosition: SetPositionProcedure, sendNow: SendNowProcedure, clientData: REF, getSST: GetSSTProcedure, getTimeout: GetTimeoutProcedure, setTimeout: SetTimeoutProcedure]; GetByteProcedure: TYPE = PROCEDURE [sH: Handle] RETURNS [byte: Byte]; PutByteProcedure: TYPE = PROCEDURE [sH: Handle, byte: Byte]; GetWordProcedure: TYPE = PROCEDURE [sH: Handle] RETURNS [word: Word]; PutWordProcedure: TYPE = PROCEDURE [sH: Handle, word: Word]; GetProcedure: TYPE = PROCEDURE [ sH: Handle, block: Block, options: InputOptions] RETURNS [ bytesTransferred: CARDINAL, why: CompletionCode, sst: SubSequenceType]; PutProcedure: TYPE = PROCEDURE [ sH: Handle, block: Block, endRecord: BOOLEAN]; SetSSTProcedure: TYPE = PROCEDURE [sH: Handle, sst: SubSequenceType]; SendAttentionProcedure: TYPE = PROCEDURE [sH: Handle, byte: Byte]; WaitAttentionProcedure: TYPE = PROCEDURE [sH: Handle] RETURNS [Byte]; DeleteProcedure: TYPE = PROCEDURE [sH: Handle]; GetPositionProcedure: TYPE = PROCEDURE [sH: Handle] RETURNS [position: Position]; SetPositionProcedure: TYPE = PROCEDURE [sH: Handle, position: Position]; SendNowProcedure: TYPE = PROCEDURE [sH: Handle, endRecord: BOOLEAN]; GetSSTProcedure: TYPE = PROCEDURE [sH: Handle] RETURNS [sst: SubSequenceType]; GetTimeoutProcedure: TYPE = PROCEDURE [sH: Handle] RETURNS [waitTime: Milliseconds]; SetTimeoutProcedure: TYPE = PROCEDURE [sH: Handle, waitTime: Milliseconds]; <> defaultObject: READONLY Object; -- = [ <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> FromIOStreams: PROCEDURE [in, out: IO.STREAM] RETURNS [Handle]; END.... LOG Time: March 17, 1978 11:39 AM By: Lauer Created file Time: April 6, 1978 3:24 PM By: Lauer Updated to conform to revised Functional Specifications Time: April 18, 1978 9:58 AM By: Lauer Updated for compilation by Alpha release of Mesa 4.0 (LONG POINTER is allowed). Time: May 5, 1978 2:19 PM By: Lauer Added GetWord and PutWord Time: June 22, 1978 8:57 AM By: Lauer Added EndOfStream signal, input option, and completion code Time: July 21, 1978 11:31 AM By: Lauer Moved type Block from Stream to Environment; added GetChar and PutChar Time: August 14, 1978 2:03 PM By: Lauer Deleted DeleteModule (can be simulated by Runtime.UnNew[GlobalFrame[p]]; moved "DeleteModuleAfterReturn" to Runtime and renamed it SelfDestruct Time: February 22, 1979 2:50 PM By: Dalal Moved a large number of procedures from StreamImpl.mesa to this module as INLINEs; added the parameter sH to all the procedures of Stream.Object; added Delete Time: March 13, 1979 10:17 AM By: Dalal Modified SendAttention and WaitForAttention to take and return a byte of data respectively Time: February 1, 1980 7:16 PM By: McJones Added object procedures for get/put byte/word; new defaults Time: August 13, 1980 5:07 PM By: McJones Deleted defaults within definition of Object Time: 11-Aug-81 10:00:10 By: Luniewski Made a Handle be LONG. Added Get/Set Position procedures and types. Time: 11-Nov-81 11:20:48 By: Luniewski Added PutString. Time: 18-Nov-81 11:36:35 By: Luniewski Changed all references to PhysicalRecord to just Record. Added Attention. Added an endRecord argument to SendNow and made it a first class procedure - no longer an INLINE, it now appears in the Object. Added signalAttention to InputOptions and defaulted it to FALSE in defaultInputOptions. Time: 23-Nov-82 15:41:42 By: Luniewski Added clientData, getSST, getTimeout and setTimeout to Object. Added new types GetSSTProcedure, GetTimeoutProcedure and SetTimeoutProcedure. Updated comment for defaultObject to reflect new fields and that many default procs now raise InvalidOperation instead of Runtime.UnboundProcedure. Added default values for all fields in InputOptions; changed defaultInputOptions to use those defaults. Added type Milliseconds. Added signalEndRecord to InputOptions and the error EndRecord.