DEFINITION MODULE Ctrl;

(*
    Title: 	A module to deal with control characters
    LastEdit:	"Tue Feb 12 16:37:43 1985"
    Author: 	jd
		Cambridge University Computer Laboratory
*)

FROM Streams IMPORT Stream;

EXPORT QUALIFIED
    CtrlCh, CtrlPut, EscapeCh;

CONST EscapeCh = 33C;

PROCEDURE CtrlCh (c: CHAR): CHAR;
    (* Returns the control character corresponding to its argument, whose
       case is disregarded. E.g.
            CtrlCh ("A") = CtrlCh ("a") = VAL (CHAR, 1)
       which is the value delivered when CTRL-A is struck on the keyboard.
       If the argument does not correspond to a valid control character, it
       is returned unchanged.
    *)

PROCEDURE CtrlPut (s: Stream; c: CHAR);
    (* Writes on the given output steam. A control character is prefixed
       by "^", and EscapeCh is translated into "ESC-". All other characters
       are unmodified
    *)


END Ctrl.
