DEFINITION MODULE SCTermIO;
(*
    Title: 	Single Character Terminal IO
    LastEdit:	Fri May 25 15:32:33 1984
    Author: 	jd
		Cambridge University Computer Laboratory

    This interface provides a means of getting at single character
    terminal input. FindSC returns a stream to the terminal
    which will give each character to you as soon as it is typed.

    Unfortunately this usually affects both input and output, these being 
    handled by the same code in an operating system.  This is why the stream
    returned from FindSC is an InOut stream; you should write to the terminal
    using it so that the right things happen when you write NewLineCh
    (CReturnCh is inserted by Wrch (but not by BinWrch)).
    Similarly, in Rdch, CReturnCh will be converted to NewLineCh while the
    genuine input can be read by calling BinRdch.

    If possible, the implementation will allow any special characters used
    by the operating system to maintain their functions (so that programs
    can still be killed easily).

    Be warned that most operating systems will only allow one such single
    character stream to be open at a time, and it should be properly closed
    on leaving the program.
*)
   

FROM Streams IMPORT STREAM;

EXPORT QUALIFIED FindInOutput, TranslateCR;


PROCEDURE FindInOutput () : STREAM;
(*  Returns a single character InOut stream to the standard input. *)

PROCEDURE TranslateCR(yes: BOOLEAN);
(*  controls the translation of carriage return into
    newline (line-feed).
    Translation occurs iff 'yes=TRUE'.
    Default is 'yes=TRUE'.
*)

END SCTermIO.
