home *** CD-ROM | disk | FTP | other *** search
-
- /* (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- d4buf_unit.c
- */
-
- #include "d4all.h"
-
- extern int v4cur_base ;
-
-
- int d4buf_unit( long n_recs )
- {
- BASE *base_ptr ;
-
- base_ptr = d4ptr() ;
-
- if ( base_ptr->bufs == (BASE_BUF *) 0 || base_ptr->max_bufs <= 0 ||
- base_ptr->buf_ptr == (char H_PTR) 0)
- return 1 ;
-
- if ( base_ptr->n_bufs > 0 )
- if ( d4buf_clear_base(v4cur_base) < 0 ) return -1 ;
-
- if ( n_recs > base_ptr->rec_tot ) return 1 ;
- if ( (base_ptr->bytes_per_buf = n_recs * f4record_width()) > 0xFFF0L )
- return 1 ;
-
- base_ptr->rec_per_buf = n_recs ;
-
- base_ptr->n_bufs = (int) (base_ptr->rec_tot/ n_recs) ;
- if ( base_ptr->n_bufs > base_ptr->max_bufs )
- base_ptr->n_bufs = base_ptr->max_bufs ;
-
- if ( base_ptr->n_bufs > 0 )
- base_ptr->buf_status = 2 ;
-
- return 0 ;
- }
-
-
-
-