TerminalIO.mesa
By Ch. Jacobi August 3, 1983 9:54 am
Last edited by Ch. Jacobi August 5, 1983 5:18 pm
Sequential IO for "terminal and keyboard"
DIRECTORY
Rope USING [ROPE];
TerminalIO: CEDAR DEFINITIONS =
BEGIN
UserAbort: SIGNAL;
WriteRope: PROC [text: Rope.ROPE];
WriteLn: PROC [];
WriteChar: PROC [ch: CHAR];
WriteInt: PROC [c: INT];
RequestRope: PROC [text, text2: Rope.ROPE ← NIL] RETURNS [Rope.ROPE];
RequestChar: PROC [text, text2: Rope.ROPE ← NIL] RETURNS [CHAR];
RequestInt: PROC [text, text2: Rope.ROPE ← NIL] RETURNS [INT];
UserSaysYes: PROC [label, text: Rope.ROPE ← NIL, default: BOOLEAN←FALSE] RETURNS [BOOLEAN];
RequestSelection:
PROC [label: Rope.
ROPE ←
NIL, choice:
LIST
OF Rope.
ROPE, text: Rope.
ROPE ←
NIL, default:
CARDINAL𡤀]
RETURNS [CARDINAL];
--label and choices may be clipped to one line!
--returns 1 for first choice, 2 for second...
--returns 0 if discarded
AddLock:
PROC [lock, unLock:
PROC];
--Procedures to prevent other processes of accepting userinput
--while the user is expected to answer a request.
--The lock, unLock procedures are called within the monitorlock
--locks cannot (yet?) be removed, use only one lock per module
END.
Restrictions:
Current implementation may deadlock if routines are called from inside
a viewers repaint-procedure.