(*----------------------------------------------------------------------*)
(*         Read_Ctrls --- Fix up ctrl key definitions in string         *)
(*----------------------------------------------------------------------*)

FUNCTION Read_Ctrls( S : AnyStr ) : AnyStr;

(*----------------------------------------------------------------------*)
(*                                                                      *)
(*     Function:   Read_Ctrls                                           *)
(*                                                                      *)
(*     Purpose:    Convert control sequences in strings.                *)
(*                                                                      *)
(*     Calling Sequence:                                                *)
(*                                                                      *)
(*        Fixed_S := Read_Ctrls( S: AnyStr ) : AnyStr;                  *)
(*                                                                      *)
(*           S       --- the string with potential ctrl seqs to convert *)
(*           Fixed_S --- fixed up string                                *)
(*                                                                      *)
(*     Remarks:                                                         *)
(*                                                                      *)
(*        This routine replaces a character sequence of the form        *)
(*        '^G' -- ascii 94 + ascii 71 -- with the single control        *)
(*        character ctrl-G -- ascii 07.  The actual '^' character       *)
(*        is the global parameter FK_Ctrl_Mark and can be set with      *)
(*        a configuration file.                                         *)
(*                                                                      *)
(*----------------------------------------------------------------------*)

VAR
   T: AnyStr;
   I: INTEGER;
   L: INTEGER;

BEGIN (* Read_Ctrls *)
                                   (* Scan for ctrl markers *)
   T := '';
   I := 1;
   L := LENGTH( S );

   WHILE( I <= L ) DO
      BEGIN                        (* Ctrl marker -- convert next char *)
                                   (* to control character             *)

         IF S[I] = FK_Ctrl_Mark THEN
            BEGIN
               I := I + 1;
               T := T + CHR( ORD( S[I] ) - 64 );
               I := I + 1;
            END
         ELSE
            BEGIN                  (* Regular character -- just copy *)
               T := T + S[I];
               I := I + 1;
            END;

      END;

   Read_Ctrls := T;

END   (* Read_Ctrls *);
