DicentraRS232CAsync.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Tim Diebert: August 6, 1985 11:45:51 am PDT
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE]
;
DicentraRS232CAsync: CEDAR DEFINITIONS ~ BEGIN
CharLength: TYPE = MACHINE DEPENDENT {lengthIs5bits (0), lengthIs6bits (1), lengthIs7bits (2), lengthIs8bits (3), (255)};
LineSpeed: TYPE = MACHINE DEPENDENT {bps50 (0), bps75 (1), bps110 (2), bps150 (3), bps300 (4), bps600 (5), bps1200 (6), bps2400 (7), bps3600 (8), bps4800 (9), bps7200 (10), bps9600 (11), bps14400 (12), bps16800 (13), bps19200 (14), (255)};
Parity: TYPE = MACHINE DEPENDENT {none (0), odd (1), even (2), (255)};
StopBits: TYPE = MACHINE DEPENDENT {none (0), one (1), oneAndHalf (2), two (3), (255)};
PortNumber: TYPE = [0 .. 16);
CommParams: TYPE = RECORD
[
charLength: CharLength ← lengthIs7bits,
speed: LineSpeed ← bps1200,
parity: Parity ← even,
stop: StopBits ← one
];
defaultParams: CommParams =
[charLength: lengthIs7bits, speed: bps1200, parity: even, stop: one];
CreateStream: PROC
[host: Rope.ROPE, port: PortNumber ← 0, commParams: CommParams ← defaultParams]
RETURNS [s: IO.STREAM];
This procedure returns an IO.STREAM that supports the following procedures.
GetChar, PutChar, CharsAvail, EndOf, Flush, Close. It may raise IO.Error and IO.EndOfStream. The connection with the host is terminated by a call to Close. This proc raises CommBusy if port is busy.
CommBusy: ERROR [currentUser: Rope.ROPE];
CommError: ERROR [ec: Rope.ROPE];
END.