

            tcook$ (6) --- read and cook a line from the terminal    09/14/84


          | _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

          |      integer function tcook$ (ubuf, size, tbuf, tptr)
          |      character ubuf (ARB), tbuf (MAXTERMBUF)
          |      integer size, tptr

                 Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

          |      'Tcook$'  reads  and processes a line from the terminal.  It
          |      handles the processing of escape sequences, case and charac-
          |      ter set mapping, line kills, character deletes,  EOF's,  and
          |      NEWLINE's.   'Ubuf'  is the user's buffer that is to receive
          |      no more than 'size' characters (including the EOS).   'Tbuf'
          |      is a scratch buffer that is used to process the input before
          |      moving  it  to 'ubuf' and 'tptr' is the index of the current
          |      character  being  processed.   Before  the  first  call   to
          |      'tcook$', 'tptr' should contain a 1 and the first element of
          |      'tbuf'  should  contain an EOS.  If these variables are used
          |      in subsequent calls, they will be updated  automatically  to
          |      contain  the  correct  values.  The function return value is
          |      the number of characters returned in 'ubuf',  not  including
          |      the EOS.


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'Tcook$'  reads  input  from the terminal one character at a
          |      time, interpreting each character as it  is  read.   Special
          |      characters  (the Subsystem escape character, kill character,
          |      retype character, newline character, and EOF character)  are
          |      removed and the appropriate action taken while other charac-
          |      ters  are  echoed  and passed on directly.  When the NEWLINE
          |      character is read or  when  the  end-of-file  is  generated,
          |      reading  terminates and the resulting line is returned after
          |      any required case and character set mapping are performed.

          |      The several special characters used by 'tcook$'  to  provide
          |      extra  functionality  are  explained  below.   Look  at  the
          |      description of the 'escape' character to see  how  to  enter
          |      the  special  characters  without  their  special properties
          |      being interpreted.

          |      eof
          |                The eof character causes the generation of an end-
          |                of-file when read from the terminal.  If there  is
          |                information  already  entered on the current line,
          |                the user's kill response is printed, the  informa-
          |                tion  on  that  line is forgotten, and the end-of-
          |                file is generated.

          |      erase
          |                The erase character  causes  the  removal  of  one
          |                character of previously read input.  The cursor is


            tcook$ (6)                    - 1 -                    tcook$ (6)




            tcook$ (6) --- read and cook a line from the terminal    09/14/84


          |                backed  up  one character position.  If there hap-
          |                pened to be no characters  on  the  line,  nothing
          |                happens.

          |      escape
          |                The escape character is normally used to enter the
          |                Subsystem  special characters and other characters
          |                with special  attributes.   If  any  character  is
          |                preceded  by  the  escape character (including the
          |                escape  character)  it  will  be  passed   without
          |                interpretation  into  the receiving buffer.  If an
          |                escape character is followed by  a  '/'  character
          |                and  then  another  character, that character will
          |                have its parity bit (normally on) turned off.  The
          |                final case is an escape followed by three octal (0
          |                through 7) digits.  The character formed by  those
          |                three digits is the character that is entered.

          |      kill
          |                The  kill character is used to discard all text on
          |                the current input line.  When entered, the  user's
          |                kill  response  is printed, any information on the
          |                current line is forgotten, and the user is allowed
          |                to retype the line.

          |      newline
          |                The newline character is a  signal  to  the  input
          |                routines  that  the  user  is  finished  with  the
          |                current line of text and is ready for the  machine
          |                to  accept it.  If the character is not a linefeed
          |                character (the standard  newline  character)  then
          |                'tcook$' will echo a carriage return linefeed com-
          |                bination and return a NEWLINE character at the end
          |                of the line.

          |      retype
          |                Occasionally,  the user will have a message forced
          |                to his terminal, or will have typed input ahead of
          |                the system, while the system is generating output.
          |                In such a case, the representation of the  current
          |                input line on the user's terminal will become dis-
          |                rupted.   To  see  what has actually been entered,
          |                the user  may  enter  the  retype  character,  and
          |                'tcook$'  will  echo  the current input text.  The
          |                user can then finish entering his commands.


            _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d

          |      ubuf, tbuf, tptr


            _C_a_l_l_s

                 Primos c1in, Primos duplx$, Primos tonl, Primos t1ou



            tcook$ (6)                    - 2 -                    tcook$ (6)




            tcook$ (6) --- read and cook a line from the terminal    09/14/84


            _S_e_e _A_l_s_o

                 _U_s_e_r_'_s  _G_u_i_d_e  _f_o_r  _t_h_e  _S_o_f_t_w_a_r_e  _T_o_o_l_s  _S_u_b_s_y_s_t_e_m  _C_o_m_m_a_n_d
          |      _I_n_t_e_r_p_r_e_t_e_r,  term  (1),  _P_r_i_m_o_s _S_u_b_r_o_u_t_i_n_e_s _R_e_f_e_r_e_n_c_e _G_u_i_d_e
          |      (_D_O_C _3_6_2_1)





















































            tcook$ (6)                    - 3 -                    tcook$ (6)


