home *** CD-ROM | disk | FTP | other *** search
-
- /* i4select.c (c)Copyright Sequiter Software Inc., 1987-1990
-
- Selects the active index file for the current database.
-
- Returns
- 0 Success
- -1 Error
- */
-
- #include "d4all.h"
- #include "u4error.h"
-
- extern INDEX *v4index ;
- extern BASE *v4base ;
- extern int v4cur_base ;
-
- i4seek_ref()
- {
- int i_ref ;
-
- if ( v4cur_base < 0 ) return -1 ;
- i_ref = v4base[v4cur_base].current_index ;
- if ( i_ref < 0 ) i_ref = v4base[v4cur_base].index_ref ;
-
- return i_ref ;
- }
-
-
- i4select( int index_ref )
- {
- int index_on, previous_ref ;
- BASE *base_ptr ;
-
- base_ptr = d4ptr() ;
- previous_ref = base_ptr->current_index ;
-
- i4unselect() ;
- if ( index_ref < 0 ) return( previous_ref ) ;
-
- index_on = base_ptr->index_ref ;
- while ( index_on >= 0)
- {
- if (index_on == index_ref )
- {
- base_ptr->current_index = index_ref ;
- return( previous_ref ) ;
- }
- index_on = v4index[index_on].prev ;
- }
-
- return( previous_ref ) ;
- }
-
-
- void i4unselect()
- {
- if ( d4ptr()->current_index >= 0 ) i4unlock( d4ptr()->current_index ) ;
- d4ptr()->current_index = -1 ;
- }
-
-
-