TTYExtras.mesa
Copyright (C) 1984 by Xerox Corporation. All rights reserved.
Last revised by Saund: 19-Jun-84 11:28:07
Tim Diebert: December 9, 1986 12:09:44 pm PST
DIRECTORY
NSString USING [Character, String],
IO USING [STREAM],
TTY USING [CharStatus, Handle, EchoClass];
TTYExtras: CEDAR DEFINITIONS = BEGIN
X: BYTE = 130B;
controlW: BYTE = 27B;
controlX: BYTE = 30B;
cr: BYTE = 15B;
lf: BYTE = 12B;
ff: BYTE = 14B;
bs: BYTE = 10B;
tab: BYTE = 11B;
space: BYTE = 40B;
DEL: BYTE = 177B;
leftParen: BYTE = 50B;
rightParen: BYTE = 51B;
minus: BYTE = 55B;
slash: BYTE = 57B;
star: BYTE = 52B;
zero: BYTE = 060B;
nine: BYTE = 071B;
lowerACode: BYTE = 141B;
lowerBCode: BYTE = 142B;
lowerZCode: BYTE = 172B;
upperACode: BYTE = 101B;
upperBCode: BYTE = 102B;
upperZCode: BYTE = 132B;
grave: BYTE = 301B; -- grave accent
hacek: BYTE = 317B; -- hacek accent
caseMaskCode: BYTE = 40B; -- used for case stripping
lowerAlpha: TYPE = [lowerACode..lowerZCode];
upperAlpha: TYPE = [upperACode..upperZCode];
accents: TYPE = [grave..hacek]; -- range of special accents
numbers: TYPE = [zero..nine];
AltHandle: TYPE = REF AltObject;
AltObject: TYPE = RECORD [s: IO.STREAM, next: AltHandle];
QHead: TYPE = RECORD [front, rear: REF QElement];
QElement: PRIVATE TYPE = RECORD [
flink, rlink: REF QElement ← NIL,
front, rear: CARDINAL ← 0,
data: PACKED SEQUENCE maxLen: CARDINAL OF BYTE];
NullQHead: QHead = [NIL, NIL];
Handle: TYPE = REF Object;
Object: TYPE = MONITORED RECORD [
stream: IO.STREAMNIL,
echo: TTY.EchoClass ← plain,
newline: BOOLEANTRUE,
inputAborted: BOOLEANFALSE,
next: Handle,
buffer: REF QHead ← NIL,
backingStream: IO.STREAMNIL,
altStream: AltHandle ← NIL,
inputProcess: PROCESSNIL,
inputCondition: CONDITION,
tty: TTY.Handle ← NIL,
context: XString.Context ← XString.emptyContext,
col: CARDINAL ← 0,
width: CARDINAL ← 80,
line: CARDINAL ← 0,
pageLength:CARDINAL ← 0,
dataFile: NSTranslate.XlateInfo ← NIL,
inputState: {idle, bs, wait, normal, have} ← idle,
inputChar: NSString.Character ← [0,0],
outputState: {idle, wait} ← idle,
outputChar: NSString.Character ← [0,0]];
NSGetChar: PROCEDURE [h: TTY.Handle] RETURNS [c: NSString.Character];
NSGetString: PROCEDURE [h: TTY.Handle, s: NSString.String,
t: PROCEDURE [c: NSString.Character] RETURNS [status: TTY.CharStatus]];
NSGetEditedString: PROCEDURE [h: TTY.Handle, s: NSString.String,
t: PROCEDURE [c: NSString.Character] RETURNS [status: TTY.CharStatus]]
RETURNS
[c: NSString.Character];
NSPutString: PROCEDURE [h: TTY.Handle, s: NSString.String];
NSPutLine: PROCEDURE [h: TTY.Handle, s: NSString.String];
NSPutChar: PROCEDURE [h: TTY.Handle, c: NSString.Character];
Additional terminal control
NewPage: PUBLIC PROCEDURE [h: TTY.Handle];
GetByte: PROCEDURE [h: TTY.Handle] RETURNS [c: BYTE];
PutByte: PROCEDURE [h: TTY.Handle, c: BYTE];
SetLineWidth: PROCEDURE [h: TTY.Handle, n: CARDINAL];
SetDataFile: PROCEDURE [h: TTY.Handle, d: NSTranslate.XlateInfo];
END.
LOG [Time - Person - Action]
20-Jan-84 13:58:36 - Saund - Created to bridge TTY and NSTTY.
xxxxx - Wu - Reworked to support TDF files.
24-Apr-84 12:59:38 - Alfvin - Added Handle definition.
19-Jun-84 11:27:44 - Saund - changed width of line from 79 to 80.