

            gctol (2) --- generalized character to long integer conversion  03/23/80


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 long_int function gctol (str, i, radix)
                 character str (ARB)
                 integer radix, i

                 Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 'Gctol'  is  similar  to  the routine 'ctol', except that it
                 accepts base indicators and signs.  Conversion begins on the
                 string 'str' at position  'i'.   The  converted  integer  is
                 returned  as the value of the function.  'I' will be updated
                 to indicate the first position not used in the conversion.

                 Input to 'gctol' consists of a number containing an optional
                 plus or minus sign, an optional base indicator, and a string
                 of digits allowable for the input base.  The base  indicator
                 consists of the (decimal) radix of the desired base followed
                 by  the  letter  "r" (in the style of Algol 68).  The digits
                 corresponding to the numbers 10 through 15  are  entered  as
                 the letters "a" through "f".  If no base indicator occurs in
                 the  string,  the  number  in 'radix' is used as the default
                 base.  Conversion stops when a character  not  allowable  in
                 the number is encountered.


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'Gctol'  first  checks for a leading sign, and records it if
                 found.  If the first one or two digits  of  the  number  are
                 numeric  and  if they are followed by a lower case "r", then
                 they are converted to binary and used as the  radix  of  the
                 remaining  digits;  otherwise, the 'radix' argument is used.
                 The remaining digits of the number are converted by a simple
                 multiply-and-add-successive-digits algorithm.


            _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d

                 i


            _C_a_l_l_s

                 index


            _S_e_e _A_l_s_o

                 gctoi (2), ctol (2), other conversion routines ('cto?*'  and
                 '?*toc') (2)




            gctol (2)                     - 1 -                     gctol (2)


