home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / H / D4ALL.H next >
Encoding:
C/C++ Source or Header  |  1990-12-03  |  6.3 KB  |  204 lines

  1. /*  d4all.h   (c)Copyright Sequiter Software Inc., 1987-1990.  All rights reserved. */
  2.  
  3. #include "d4base.h"
  4.  
  5. typedef  int  I4FILTER(void) ;
  6.  
  7. /*    INDEX   */
  8.  
  9. typedef struct index_st
  10. {
  11.    int     next ;
  12.    int     prev ;
  13.  
  14.    char    name[64] ;
  15.    int     file_hand ;
  16.    int     lock ;
  17.  
  18.    int     base_ref ;        /* The corresponding reference number for the
  19.                                 database */
  20.    char   *compile ;         /* A pseudo compiled version of the expression */
  21.  
  22.    int     block_ref ;       /* A reference to the current block of the index file */
  23.  
  24.    int     block_first ;     /* The first used memory block */
  25.    int     block_last ;      /* The last used memory block */
  26.    int     block_num ;         /* The number of blocks in the buffer chain */
  27.    int     block_max ;         /* The maximum number of blocks in the chain */
  28.  
  29.    char    i_type ;          /* 'C' - Character;  'N' - Numeric; 'D' -Date */
  30.    I4FILTER *filter ;        /* A filter routine used by 'i4reindex' and 'i4add' */
  31.  
  32.    /* Index File Header Information */
  33.  
  34.    #ifdef CLIPPER
  35.       short          old_version ;
  36.       long           virtual_eof ;   /* The next available file block */
  37.  
  38.       short          sign ;
  39.       short          version ;
  40.       long           root ;          /* Root Block */
  41.       long           eof ;           /* First Free Block Pointer */
  42.       short          group_len ;     /* Key Length + 2*sizeof(long) */
  43.       short          key_len ;       /* Key Length */
  44.       short          key_dec ;       /* Number of Decimals in Key */
  45.       short          keys_max ;      /* Maximum # of keys per block;  <= 100 */
  46.       short          keys_half ;     /* Maximum # of keys per half block */
  47.       char           expression[256];/* The index expression corresponding to the
  48.                                         database. */
  49.       short          unique   ;      /* TRUE if Unique */
  50.    #else
  51.       long           old_version ;
  52.  
  53.  
  54.       long           root ;
  55.       long           eof  ;
  56.       long           version ;
  57.       short          key_len  ;
  58.       short          keys_max ;      /* Maximum # of keys per block */
  59.       short          int_or_date ;   /* TRUE (1) if Numeric or Date Key */
  60.       short          group_len ;     /* key_len plus 8 increased to a multiple of 2 */
  61.       short          dummy ;                      
  62.       short          unique ;        /* TRUE if Unique */
  63.       char           expression[256];/* The index expression corresponding to the
  64.                                         database. */
  65.    #endif
  66. }  INDEX ;
  67.  
  68.  
  69. typedef struct block_st
  70. {
  71.    int   next ;
  72.    int   prev ;
  73.  
  74.    int   wrt ;         /* Must Write the Block */
  75.    long  file_block ;
  76.    int   key_on     ;  /* The current key.  Starts at 0.  -1 means none.
  77.                           num_keys+1 for key_on indicates EOF */
  78.  
  79.    /* Index File Block Format:
  80.  
  81.       Number of Keys
  82.  
  83.       Repeat for Each Key in Block -
  84.          Block Pointer  (Starting from 0)
  85.          Record Number
  86.          Key
  87.    */
  88.  
  89.    short num_keys ;
  90.  
  91.    #ifdef CLIPPER
  92.       short pointers[511] ;
  93.    #else
  94.       short dummy ;
  95.       KEY   key ;
  96.    #endif
  97.  
  98. }  BLOCK ;
  99.  
  100. typedef  struct  h4buf_st
  101. {
  102.    long   len ;
  103.    long   avail ;
  104.    long   sub_avail ;
  105.    char   H_PTR  buf_ptr ;
  106. }  H4BUF ;
  107.  
  108. typedef struct  x4filter_st
  109. {
  110.    int    next,prev ;
  111.    #ifdef KR
  112.       int (*filter_routine)() ;
  113.    #else
  114.       int (*filter_routine)(void) ;
  115.    #endif
  116. }  X4FILTER ;
  117.  
  118. typedef struct  x4relate_st
  119. {
  120.    int      next,prev ;
  121.  
  122.    int      control_base_ref ;
  123.    char  *compile ;
  124.  
  125.    /* Identify the database and index file to be repositioned */
  126.    int      base_ref, index_ref ;
  127.    long   miss_code ;
  128. }  X4RELATE ;
  129.  
  130. int    b4add( int, KEY *) ;
  131. int    b4down( int, int) ;
  132. int    b4get( int ) ;
  133. int    b4leaf( int) ;
  134. int    b4remove( int) ;
  135. int    b4search( int, char *) ;
  136. long   b4skip( int, long) ;
  137. int    b4up( int) ;
  138. int    b4write( int, int) ;
  139. int    c4clip( char *, int) ;
  140. void H_PTR d4buf_alloc( long, unsigned) ;
  141. long   d4buf_avail(void) ;
  142. void   d4buf_avail_set(void) ;
  143. int    d4buf_calc( void ) ;
  144. int    d4buf_clear( BASE *, int ) ;
  145. int    d4buf_clear_after(int) ;
  146. int    d4buf_clear_all(void) ;
  147. int    d4buf_clear_base( int ) ;
  148. int    d4buf_clear_lend(int) ;
  149. int    d4buf_flush( BASE *, int ) ;
  150. char H_PTR d4buf_read_pos( BASE *, long ) ;
  151. void   d4buf_reset(void) ;
  152. void   d4buf_restore_status( H4BUF * ) ;
  153. void   d4buf_return( void ) ;
  154. void   d4buf_save_status( H4BUF * ) ;
  155. void   d4buf_sub_set(void) ;
  156. char H_PTR d4buf_write_pos( BASE *, long ) ;
  157. int    d4changed( BASE * ) ;
  158. int    d4go_error(long) ;
  159. int    d4init_memory( int, int, int, int ) ;
  160. int    d4read(long) ;
  161. int    d4seek_key( int, void * ) ;
  162. int    h4add( char **, int, int, int) ;
  163. char * h4alloc( int ) ;
  164. char * h4alloc_try( int ) ;
  165. int    h4create( char **, int, int, int) ;
  166. int    h4first( char **, int ) ;
  167. int    h4free( char **, int) ;
  168. void   h4free_memory( void * ) ;
  169. void   h4free_chain( char **, int ) ;
  170. int    h4free_check( int ) ;
  171. void   h4free_test( void * ) ;
  172. int    h4get( char **, int) ;
  173. int    h4move( char **, int, int, int ) ;
  174. char * h4range( int, int ) ;
  175. int    h4remove( char **, int) ;
  176. int    i4filter_check( int ) ;
  177. int    i4keycmp( int, char *, char * ) ;
  178. void H_PTR u4huge_alloc( long ) ;
  179. int    u4huge_cmp( unsigned char H_PTR, unsigned char H_PTR, unsigned);
  180. void   u4huge_cpy( void H_PTR, void H_PTR, long ) ;
  181. void   u4huge_free( void H_PTR ) ;
  182. void H_PTR u4huge_norm( void H_PTR ) ;
  183. long   u4huge_read( int, char H_PTR, long ) ;
  184. void   u4huge_set( char H_PTR, int, long ) ;
  185. int    u4huge_write(int, char H_PTR, long ) ;
  186. char  *u4lower( char * ) ;
  187. int    u4ptr_equal( void *, void * ) ;
  188. int    u4read( char H_PTR, unsigned int ) ;
  189. int    u4read_init( int, char H_PTR, unsigned int, long ) ;
  190. int    u4remove( char * ) ;
  191. void   u4sort_quick( char H_PTR H_PTR, long, int ) ;
  192. int    u4sort_add( char *, char *) ;
  193. long   u4sort_bytes( int, long, int ) ;
  194. void   u4sort_free( void ) ;
  195. int    u4sort_get( char H_PTR * ) ;
  196. int    u4sort_init( long, int, int ) ;
  197. int    u4temp_create( char * ) ;
  198. int    u4tolower( int ) ;
  199. int    u4toupper( int ) ;
  200. char  *u4upper( char * ) ;
  201. int    u4write( char H_PTR, unsigned int ) ;
  202. int    u4write_init( int, char H_PTR, unsigned int, long ) ;
  203. int    u4write_flush( void ) ;
  204.