DEFINITION MODULE TermChan;

(* Extra interfaces to the terminal channel, not included in the Standard *)

IMPORT IOChan;
FROM   IOConsts  IMPORT ReadResults;

TYPE
  ChanId = IOChan.ChanId;


PROCEDURE LookKey (    cid : ChanId;
                   VAR ok  : BOOLEAN;
		   VAR ch  : CHAR;
		   VAR res : ReadResults);
(* Performs 'no-wait' input:
   If there is a character available on TermFile channel cid, return ok TRUE
   and the results of a Look(cid/dtp, ch, res);
   otherwise return ok FALSE. *)

PROCEDURE Echo ();
(* Enable echo for all terminal channels.
   Echoing is on by default, and can be controlled by use of
   TextIO.Read (echo) cf IOChan.Look/Skip (no echo).
   However NoEcho truns off echoing globally, and this procedure
   allows it to be turned back on. *)

PROCEDURE NoEcho ();
(* Disable echoing for all terminal channels.
   LookKey disables echo when it checks for (and reads) a character;
   however a typical LookKey loop will often be outside LookKey when a key is
   pressed, and default operatijg system echo will occur.
   This procedure allows echoing to be globally suppressed, so that LookKey
   echo is entirely under user control. *)

END TermChan.
