TTY.Mesa Edited by
Copyright (C) Xerox Corporation 1982, 1986. All rights reserved.
Tim Diebert: December 9, 1986 11:02:39 am PST
DIRECTORY
Ascii USING [CR],
Basics USING [UnsafeBlock],
BasicTime USING [GMT],
IO USING [STREAM],
Rope USING [ROPE];
TTY: CEDAR DEFINITIONS = BEGIN
Types
Handle: TYPE = REF Object;
Object: TYPE;
nullHandle: Handle = NIL;
EchoClass: TYPE = {none, plain, stars};
DateFormat: TYPE = {dateOnly, noSeconds, dateTime, full, mailDate};
NetFormat: TYPE = {octal, hex, productSoftware};
NumberFormat: TYPE = RECORD [
base: [2..36] ← 10,
zerofill: BOOLEANFALSE,
unsigned: BOOLEANTRUE,
columns: [0..255] ← 0];
CharStatus: TYPE = {ok, stop, ignore};
Signals
LineOverflow: SIGNAL [s: REF TEXT] RETURNS [ns: REF TEXT];
Rubout: SIGNAL;
NoBackingFile: ERROR; -- raised by BackingStream
OutOfInstances: ERROR; -- raised by Create
NoDefaultInstance: ERROR; -- raised by Create
Starting and stopping
Create: PROCEDURE [name: Rope.ROPENIL, backingStream, ttyImpl: IO.STREAMNIL]
RETURNS [h: Handle];
Destroy: PROCEDURE [h: Handle, deleteBackingFile: BOOLEANFALSE];
BackingFile deleted only if subsystem created file
UserAbort: PROCEDURE [h: Handle] RETURNS [yes: BOOLEAN];
ResetUserAbort: PROCEDURE [h: Handle];
SetUserAbort: PROCEDURE [h: Handle];
CreateTTYInstance exported by TTY instance implementation
CreateTTYInstance: PROCEDURE [name: Rope.ROPE, backingStream: IO.STREAM, tty: Handle]
RETURNS [ttyImpl, backing: IO.STREAM];
Utilities
BackingStream: PROCEDURE [h: Handle] RETURNS [stream: IO.STREAM];
BlinkDisplay: PROCEDURE [h: Handle];
CharsAvailable: PROCEDURE [h: Handle] RETURNS [number: CARDINAL];
GetEcho: PROCEDURE [h: Handle] RETURNS [old: EchoClass];
NewLine: PROCEDURE [h: Handle] RETURNS [yes: BOOLEAN];
PopAlternateInputStreams: PROCEDURE [h: Handle, howMany: CARDINAL ← 1];
PushAlternateInputStream: PROCEDURE [h: Handle, stream: IO.STREAM];
PutBackChar: PROCEDURE [h: Handle, c: CHARACTER];
SetBackingSize: PROCEDURE [h: Handle, size: LONG CARDINAL];
SetEcho: PROCEDURE [h: Handle, new: EchoClass] RETURNS [old: EchoClass];
Read & write procedures
GetChar: PROCEDURE [h: Handle] RETURNS [c: CHARACTER];
PutChar: PROCEDURE [h: Handle, c: CHARACTER];
PutCR: PROCEDURE [h: Handle] = INLINE {PutChar[h, Ascii.CR]};
PutBlank, PutBlanks: PROCEDURE [h: Handle, n: CARDINAL ← 1];
RemoveCharacter, RemoveCharacters: PROCEDURE [h: Handle, n: CARDINAL ← 1];
GetString: PROCEDURE [h: Handle, s: REF TEXT,
t: PROCEDURE [c: CHARACTER] RETURNS [status: CharStatus]];
GetEditedString: PROCEDURE [h: Handle, s: REF TEXT,
t: PROCEDURE [c: CHARACTER] RETURNS [status: CharStatus]]
RETURNS
[c: CHARACTER];
PutString, PutLongString, PutText: PROCEDURE [h: Handle, s: REF TEXT];
PutDate: PROCEDURE [h: Handle, gmt: BasicTime.GMT, format: DateFormat ← noSeconds];
GetID, GetLine, GetPassword: PROCEDURE [h: Handle, s: REF TEXT];
PutLine: PROCEDURE [h: Handle, s: REF TEXT];
GetNumber: PROCEDURE [h: Handle, default: UNSPECIFIED, radix: CARDINAL,
showDefault: BOOLEANTRUE] RETURNS [n: UNSPECIFIED];
GetLongNumber: PROCEDURE [h: Handle, default: LONG UNSPECIFIED, radix: CARDINAL,
showDefault: BOOLEANTRUE] RETURNS [n: LONG UNSPECIFIED];
PutNumber: PROCEDURE [h: Handle, n: UNSPECIFIED, format: NumberFormat];
PutLongNumber: PROCEDURE [h: Handle, n: LONG UNSPECIFIED, format: NumberFormat];
GetOctal: PROCEDURE [h: Handle] RETURNS [n: UNSPECIFIED];
GetLongOctal: PROCEDURE [h: Handle] RETURNS [n: LONG UNSPECIFIED];
PutOctal: PROCEDURE [h: Handle, n: UNSPECIFIED];
PutLongOctal: PROCEDURE [h: Handle, n: LONG UNSPECIFIED];
GetDecimal: PROCEDURE [h: Handle] RETURNS [n: INTEGER];
GetLongDecimal: PROCEDURE [h: Handle] RETURNS [n: LONG INTEGER];
PutDecimal: PROCEDURE [h: Handle, n: INTEGER];
PutLongDecimal: PROCEDURE [h: Handle, n: LONG INTEGER];
PutBlock: PROCEDURE [h: Handle, block: Basics.UnsafeBlock];
Narrow: PROC [ra: REF ANY] RETURNS [Handle];
Provides NARROW function for the opaque type of Handle.
END....