home *** CD-ROM | disk | FTP | other *** search
-
-
- /* d4init.c (c)Copyright Sequiter Software Inc., 1987, 1988, 1989. All rights reserved. */
-
- #include "d4base.h"
- #include "w4.h"
-
- /* External Variable start with 'v4' to reduce potential name conficts */
- BASE *v4base ;
-
- /* Storage for the first reference to the list of open databases */
- int v4last_base ;
- int v4cur_base ; /* The currently selected database */
- int v4index_free = -1 ; /* The next index file to free a block from */
- int v4block_max = 20 ;
-
- /*
- Some index files must have unique keys. Any attempt to add duplicate
- keys are ignored. This can cause these index files to have keys
- for only a portion of the records in the database. In some cases
- it would be better to generate an error message instead of writing
- a database record which would have no corresponding key in an unique
- key index file. To generate such an error message (E_UNIQUE), set
- 'unique_error' to '(int)1'. Otherwise, set 'unique_error' to '(int)0'.
- */
- int v4unique_error = 1 ;
- int v4first = 1 ;
-
- extern int v4error ;
-
- #ifndef SMALL
- char *v4eval_space ;
- char *v4eval_end ;
- INDEX *v4index ;
- BLOCK *v4block ;
- #endif
-
- #ifndef NOIO
- extern CB_WINDOW *v4window ;
- #endif
-
- d4init()
- {
- return( d4init_memory( 10, 10, 12, 3000 ) ) ;
- }
-
- d4init_memory( num_base, num_index, num_block, eval_space )
- int num_base, num_index, num_block, eval_space ;
- {
- if ( v4first == 0 ) return( -1 ) ; /* Already Called by d4use */
- v4first = 0 ;
-
- if ( h4create( (char **) &v4base, num_base, sizeof(BASE), 5) < 0 ) return -1 ;
-
- v4last_base = -1 ;
- v4cur_base = -1 ;
- v4error = 0 ;
-
- #ifndef NOIO
- if( w4init( 5,0,0) < 0 ) return -1 ;
- #endif
-
- #ifndef SMALL
- if ( h4create( (char **) &v4index, num_index, sizeof(INDEX), 5) < 0 ) return -1 ;
- /* Warning: Do not make 'block' starting memory allocation less than 12
- or 'i4reindex' will not work on large databases */
- if ( h4create( (char **) &v4block, num_block, sizeof(BLOCK), 5) < 0 ) return -1 ;
-
- v4eval_space = h4alloc( eval_space ) ; /* Space for the Stack */
- if ( v4eval_space == (char *) 0 ) return -1 ;
-
- v4eval_end = v4eval_space+ eval_space ;
- #endif
-
- return( 0) ;
- }
-