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. àStream.mesa (last edited by: Plass, September 4, 1984 12:27:47 pm PDT) Cedar PilotBridge version. Copyright (C) Xerox Corporation 1982. All rights reserved. Types Operations Get the next two bytes from the stream, and return them in a word (first in left half). Get the next zero or more bytes from the stream, moving them to the specified block of memory. Set the input options of the stream. Put a byte at the next available position in the stream. Put a character at the next available position in the stream. Put two bytes into the next available positions in the stream, left half of word first. Put zero or more bytes into the next available positions in the stream, moving them from a block in memory. Change the current SubSequenceType. Send an attention down the stream. It goes both in-band and out-of-band. Wait for an attention to arrive. Delete the stream object. Signals and errors Representation The following are default values for stream object records options: defaultInputOptions, (see above) getByte: DefaultGetByte, (requires sH.get defined) putByte: DefaultPutByte, (requires sH.put defined) getWord: DefaultGetWord, (requires one of sH.getByte or sH.get defined) putWord: DefaultPutWord, (requires one of sH.putByte or sH.put defined) get: DefaultGet, (requires sH.getByte defined) put: DefaultPut, (requires sH.putByte defined) setSST: DefaultSetSST, (raises InvalidOperation) sendAttention: DefaultSendAttention, (raises InvalidOperation) waitAttention: DefaultWaitAttention, (raises InvalidOperation) delete: DefaultDelete, (raises InvalidOperation) getPosition: DefaultGetPositionProcedure, (raises InvalidOperation) setPosition: DefaultSetPositionProcedure, (raises InvalidOperation) sendNow: DefaultSendNowProcedure]; (= sH.put[sH, Block[NIL, 0, 0], TRUE]), clientData: NIL, getSST: DefaultGetSST, (raises InvalidOperation) getTimeout: DefaultGetTimeoutProcedure, (raises InvalidOperation) setTimeout: DefaultSetTimeoutProcedure]; (raises InvalidOperation) ʘJšœF™FJ™Jšœ:™:J˜šÏk ˜ 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šœ ™ šÏnœ œœ˜=JšœœÏc%˜J—š žœ œœ œ˜BJšœœœŸ*˜O—šžœ œœ˜=Jšœœ˜JšœH™HJšœ™—šžœ œ˜.šœ˜ Jšœœ.˜H—Jšœ@˜FJšœC™CJšœ™J˜—šžœ œ'˜GJ˜Jšœ$™$J˜—šžœ œœ˜LJšœ8™8—šžœ œ œ˜9Jšœœ ˜!Jšœ=™=—šžœ œœ˜LJšœH™HJšœ™—šžœ œ˜šœ%œœ˜>J˜—JšœG™GJšœ#™#—šž œ œ˜Jš œœœ œœ˜EJš˜Jšœœ"˜:J˜Jšœ˜J˜—š žœ œœœ˜CJ˜J˜—šžœ œ&˜=J˜Jšœ#™#J˜—šž œ œ˜:J˜JšœI™IJ˜—šžœ œœ ˜@Jšœœ˜Jšœ ™ J˜—šžœ œ˜'J˜Jšœ™J˜—šž œ œœ˜IJšœœŸ*˜KJ˜—šž œ œ$˜@Jšœ!Ÿ)˜JJ˜—Jšœ™Jšœœ œ˜,Jšœœ œ˜.Jšœœ œ˜,Jšœœ˜Jšœœ#œ˜BJšœ œ œ˜*Jšœœ˜Jšœœ œ˜,J˜Jšœ™šœœœ˜J˜J˜ J˜ J˜ J˜ J˜J˜J˜J˜&J˜&J˜J˜$J˜$J˜ Jšœœ˜J˜J˜#J˜$J˜—Jšžœœ œœ˜KJšžœœ œ˜BJšžœœ œœ˜KJšžœœ œ˜Bšž œ œ œ˜*J˜0šœ˜ Jšœœ-˜G——šž œ œ œ˜*Jšœ%œ˜.—Jšžœ œ œ$˜LJšžœœ œ˜BJšžœœ œœ˜EJšžœ œ œ˜6Jšžœœ œœ˜SJšžœœ œ"˜JJšžœœ œœ˜JJšžœœ œœ˜PJšžœœ œœ˜WJšžœœ œ&˜NJ˜Jšœ;™;šœœ Ÿ˜'Jšœ9™9JšœG™GJšœG™GJšœ\™\Jšœ\™\JšœK™KJšœK™KJšœG™GJšœG™GJšœG™GJšœG™GJšœG™GJšœG™GJšœU™UJšœ™Jšœ<™