

            dsget (2) --- obtain a block of dynamic storage          01/07/83


            _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n

                 pointer function dsget (w)
                 integer w

                 Library:  vswtlb (standard Subsystem library)


            _F_u_n_c_t_i_o_n

                 'Dsget'  searches its available memory list for a block that
                 is at least as large as its first argument.  If such a block
                 is found, its index in the memory list is  returned;  other-
                 wise,   an   error   message  is  printed  and  the  program
                 terminates.

                 In order to use 'dsget', the following declarations must  be
                 present:

                    integer mem (MEMSIZE)
                    common /ds$mem/ mem

                 or  the "DS_DECL" system macro can used for the declarations
                 as follows:

                    DS_DECL (mem, MEMSIZE)

                 where MEMSIZE is supplied by the user, and may take  on  any
                 positive value between 6 and 32767, inclusive.  Furthermore,
                 memory must have been initialized with a call to 'dsinit':

                    call dsinit (MEMSIZE)


            _I_m_p_l_e_m_e_n_t_a_t_i_o_n

                 'Dsget'  is  an implementation of Algorithm A' on pages 437-
                 438 of Volume 1 of  _T_h_e  _A_r_t  _o_f  _C_o_m_p_u_t_e_r  _P_r_o_g_r_a_m_m_i_n_g,  by
                 Donald E.  Knuth.  The reader is referred to that source for
                 detailed information.

                 'Dsget'  searches  a linear list of available blocks for one
                 of sufficient size.   If  none  are  available,  a  call  to
                 'error'  results;  otherwise, the block found is broken into
                 two pieces, and the index (in array 'mem') of the  piece  of
                 the  desired  size  is  returned to the user.  The remaining
                 piece is left on the  available  space  list.   Should  this
          |      procedure  cause  a  block to be left on the available space
          |      list that is smaller than a threshold size,  the  few  extra
                 words  are  awarded  to  the  user  and the block is removed
                 entirely, thus speeding up the next search  for  space.   If
                 insufficient  space  is  available,  'dsget' reports "out of
                 storage space" and allows the  user  to  obtain  a  dump  of
                 dynamic storage space if he desires.




            dsget (2)                     - 1 -                     dsget (2)




            dsget (2) --- obtain a block of dynamic storage          01/07/83


            _C_a_l_l_s

                 dsdump, error, getlin, remark


            _B_u_g_s

                 Should  probably return error status to the user if space is
                 not found.  It is also somewhat annoying  for  the  user  to
                 have  to  declare  the  storage  area,  but Fortran prevents
                 effective use of pointers, so this inconvenience  is  neces-
                 sary for now.


            _S_e_e _A_l_s_o

                 dsfree (2), dsinit (2), dsdump (2), dsdbiu (6)









































            dsget (2)                     - 2 -                     dsget (2)


