-- StreamImpl.mesa, edit: -- MAS: Apr 23, 1980 4:04 PM -- HGM: October 16, 1979 7:35 PM -- Copyright Xerox Corporation 1979, 1980 DIRECTORY Stream: FROM "Stream"; StreamImpl: PROGRAM EXPORTS Stream = BEGIN OPEN Stream; GetChar: PUBLIC PROCEDURE [sH: Handle] RETURNS [char: CHARACTER] = LOOPHOLE[GetByte]; GetByte: PUBLIC PROCEDURE [sH: Handle] RETURNS [byte: Byte] = BEGIN array: PACKED ARRAY [0..2) OF Byte; bl: Block = [@array, 0, 1]; options: InputOptions = [FALSE, FALSE, FALSE, TRUE, TRUE]; [] ← sH.get[sH, bl, options]; RETURN[array[0]]; END; GetWord: PUBLIC PROCEDURE [sH: Handle] RETURNS [word: Word] = BEGIN bl: Block = [@word, 0, 2]; options: InputOptions = [FALSE, FALSE, FALSE, TRUE, TRUE]; [] ← sH.get[sH, bl, options]; RETURN; END; PutChar: PUBLIC PROCEDURE [sH: Handle, char: CHARACTER] = LOOPHOLE[PutByte]; PutByte: PUBLIC PROCEDURE [sH: Handle, byte: Byte] = BEGIN array: PACKED ARRAY [0..2) OF Byte ← [byte, ----]; bl: Block = [@array, 0, 1]; sH.put[sH, bl, FALSE]; END; PutWord: PUBLIC PROCEDURE [sH: Handle, word: Word] = BEGIN bl: Block = [@word, 0, 2]; sH.put[sH, bl, FALSE]; END; -- Signals and Errors EndOfStream: PUBLIC SIGNAL[nextIndex: CARDINAL] = CODE; LongBlock: PUBLIC SIGNAL[nextIndex: CARDINAL] = CODE; ShortBlock: PUBLIC ERROR = CODE; SSTChange: PUBLIC SIGNAL[sst: SubSequenceType, nextIndex: CARDINAL] = CODE; TimeOut: PUBLIC SIGNAL[nextIndex: CARDINAL] = CODE; END.