home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / SOURCE / D4BUF_CA.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  1.0 KB  |  53 lines

  1.  
  2. /*  (c)Copyright Sequiter Software Inc., 1987-1990.  All rights reserved.
  3.  
  4.     d4buf_calc()
  5. */
  6.  
  7. #include "d4all.h"
  8.  
  9. extern BASE *v4base ;
  10. extern int   v4cur_base ;
  11.  
  12.  
  13. int  d4buf_calc()
  14. {
  15.    int  rc, ref_may_lend, base_on ;
  16.    BASE *base_ptr ;
  17.  
  18.    d4buf_reset() ;
  19.    ref_may_lend  = -1 ;
  20.    rc = 0 ;
  21.  
  22.    for ( base_on = h4first( (char **) &v4base, v4cur_base); base_on >= 0;
  23.          base_on =  base_ptr->next )
  24.    {
  25.       base_ptr =  v4base + base_on ;
  26.  
  27.       if ( base_ptr->rec_tot <= 0L )  continue ;
  28.  
  29.       if ( ref_may_lend < 0 )
  30.      if ( base_ptr->buf_may_lend )
  31.      {
  32.         ref_may_lend =  base_on ;
  33.         d4buf_sub_set() ;  /* Specify lend position. */
  34.      }
  35.  
  36.       base_ptr->buf_ptr =  (char H_PTR) d4buf_alloc( base_ptr->rec_tot* base_ptr->buffer_len, 1 ) ;
  37.       if ( base_ptr->buf_ptr == (char H_PTR) 0 )
  38.       {
  39.          base_ptr->n_bufs     =  0 ;
  40.          base_ptr->buf_status =  0 ;
  41.      rc =  1 ;
  42.       }
  43.    }
  44.  
  45.    if ( ref_may_lend < 0 )
  46.       d4buf_sub_set() ;
  47.  
  48.    return rc ;
  49. }
  50.  
  51.          
  52.  
  53.