TerminalIO.mesa
Copyright © 1983, 1985 by Xerox Corporation. All rights reserved.
By Ch. Jacobi, August 3, 1983 9:54 am
Last edited by Ch. Jacobi, May 18, 1985 4:30:25 pm PDT
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 [i: 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:
BOOL←
FALSE]
RETURNS [
BOOL];
--default returned if discarded.
RequestSelection:
PROC [label: Rope.
ROPE ←
NIL, choice:
LIST
OF Rope.
ROPE, text: Rope.
ROPE ←
NIL, default:
NAT𡤀]
RETURNS [NAT];
--returns 1 for first choice, 2 for second...
--returns 0 if discarded
--default means: the cursor is initially moved to this line.
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.