

            lsinit (4) --- initialize linked string space            02/23/82


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 subroutine lsinit

                 Library:  vlslb


            _F_u_n_c_t_i_o_n

                 'Lsinit'   initializes   the  string  space  and  associated
                 variables.  It _m_u_s_t be called before using any other  linked
                 string routines.

                 The  routines  in  the linked string library are intended to
                 overcome several disadvantages of  the  contiguously  stored
                 character  strings  used  throughout the Software Tools Sub-
                 system.  They facilitate operations such as insertion, dele-
                 tion and concatenation with a minimum of wasted storage  and
                 time.   These  routines also free the programmer from having
                 to explicitly manage the string storage.   However,  use  of
                 the  linked string routines is costly in that for operations
                 such as copying or replacing  single  characters,  they  are
                 slower   and   require  more  subprogram  calls  than  their
                 equivalent contiguous string  routines.   Therefore,  linked
                 strings  are  not  intended  to  replace contiguously stored
                 strings, but to provide an extension that  facilitates  com-
                 plex string manipulation.

                 All  linked  strings are allocated in the named common block
                 'ls$buf'.  Normally, the user does  not  directly  reference
                 this  block;  rather,  references  are made through pointers
                 returned from and passed  to  the  linked  string  routines.
                 Pointers are single-precision integer variables that contain
                 an  index of the starting location of the string in the com-
                 mon block.  The user has no need  to  examine  the  pointers
                 other  than  to  pass them as arguments to the linked string
                 routines.

                 Linked strings are stored  one  ASCII  character  per  word,
                 right-justified  with  zero  fill  and  terminated by an EOS
                 character.   Any  word  having  a  value  greater  than  300
                 (decimal)  is  interpreted  to  be  a pointer whose value is
                 obtained by subtracting 300 from the word.  This allows  for
                 the  non-contiguity  of  characters in the string, hence the
                 name "linked".

                 Space  for  new  strings  is  obtained  either  directly  or
                 indirectly through the 'lsallo' function.  'Lsallo' attempts
                 to allocate the string contiguously at the end of the common
                 block.  If this fails, the available space list is examined;
                 if  no space is found here, the garbage collector is invoked
                 and the searches are repeated.  Upon  a  second  failure  to
                 find sufficient space, an error diagnostic is issued and the
                 program terminated.

                 Old  strings  are deallocated using the 'lsfree' subroutine.


            lsinit (4)                    - 1 -                    lsinit (4)




            lsinit (4) --- initialize linked string space            02/23/82


                 Deallocated strings are marked with a special value and  are
                 not available for use until after garbage collection.


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 The  pointers  in the common block 'ls$buf' are set to their
                 proper values.  A call to 'lsinit' has the effect  of  deal-
                 locating all strings.


            _B_u_g_s

                 'Lsinit' must be called to initialize the string space.

                 No  provision  is made for specifying the size of the string
                 space.

                 Locally supported.







































            lsinit (4)                    - 2 -                    lsinit (4)


