

            makpat (2) --- make pattern, terminate at delimiter      08/17/84


          | _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 integer function makpat (arg, from, delim, pat)
                 character arg (ARB), delim, pat (MAXPAT)
                 integer from

                 Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 'Makpat'  converts  the  standard character-string form of a
                 regular expression  into  the  internal  form  used  by  the
                 remainder  of  the  pattern matching routines.  The argument
                 'arg' is the regular  expression  to  be  converted;  'from'
                 specifies  the  starting  position  of the pattern in 'arg';
                 'delim'  contains  a  termination  character   which,   when
                 encountered,  causes  conversion to stop; 'pat' receives the
          |      internal form  of  the  regular  expression.   The  function
          |      returns  the  index of the delimiter in 'arg' if the conver-
                 sion succeeded, ERR otherwise.

                 For a full discussion of patterns and pattern matching,  see
                 _I_n_t_r_o_d_u_c_t_i_o_n  _t_o  _t_h_e  _S_o_f_t_w_a_r_e  _T_o_o_l_s  _T_e_x_t  _E_d_i_t_o_r  or, of
                 course, _S_o_f_t_w_a_r_e _T_o_o_l_s.


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'Makpat' traverses the regular expression a character  at  a
          |      time,  building the internal pattern with calls to 'addset'.
          |      To build character  classes,  'makpat'  calls  'getccl';  to
          |      build  closures  it  calls  'stclos'.  Calls to 'esc' handle
          |      escape sequences in the regular expression.  'Makpat' treats
          |      the special cases of "*" at beginning-of-line,  "%"  not  at
          |      BOL, and "$" not at end-of-line as regular characters.

          |      'Makpat'  takes an error return if the internal form becomes
          |      too large, if an attempt  is  made  to  use  closure  on  an
          |      illegal  pattern  element, if there are too many tagged sub-
          |      patterns, if not all tagged subpatterns are properly closed,
          |      or if 'delim' is never encountered.


            _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d

                 pat


            _C_a_l_l_s

                 addset, esc, getccl, stclos






            makpat (2)                    - 1 -                    makpat (2)




            makpat (2) --- make pattern, terminate at delimiter      08/17/84


            _S_e_e _A_l_s_o

                 match (2), amatch (2), find (1), change (1), ed (1), se (1),
                 _I_n_t_r_o_d_u_c_t_i_o_n _t_o _t_h_e _S_o_f_t_w_a_r_e  _T_o_o_l_s  _T_e_x_t  _E_d_i_t_o_r,  _S_o_f_t_w_a_r_e
                 _T_o_o_l_s





















































            makpat (2)                    - 2 -                    makpat (2)


