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.ROPENIL] RETURNS [Rope.ROPE];
RequestChar: PROC [text, text2: Rope.ROPENIL] RETURNS [CHAR];
RequestInt: PROC [text, text2: Rope.ROPENIL] RETURNS [INT];
UserSaysYes: PROC [label, text: Rope.ROPENIL, default: BOOLEANFALSE] RETURNS [BOOLEAN];
RequestSelection: PROC [label: Rope.ROPENIL, choice: LIST OF Rope.ROPE, text: Rope.ROPENIL, 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.