1 /* Public domain */ 2 /* Adapted from DJB's original cdb-0.75 package */ 3 4 #ifndef CDB_MAKE_H 5 #define CDB_MAKE_H 6 7 #include <stdio.h> 8 #include "uint32.h" 9 10 #define CDB_HPLIST 1000 11 12 struct cdb_hp { 13 uint32 h; 14 uint32 p; 15 } ; 16 17 struct cdb_hplist { 18 struct cdb_hp hp[CDB_HPLIST]; 19 struct cdb_hplist *next; 20 int num; 21 } ; 22 23 struct cdb_make { 24 /* char bspace[8192]; */ 25 char final[2048]; 26 uint32 count[256]; 27 uint32 start[256]; 28 struct cdb_hplist *head; 29 struct cdb_hp *split; /* includes space for hash */ 30 struct cdb_hp *hash; 31 uint32 numentries; 32 /* buffer b; */ 33 uint32 pos; 34 /* int fd; */ 35 FILE *fp; 36 } ; 37 38 extern int cdb_make_start(struct cdb_make *, FILE *); 39 extern int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int); 40 extern int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32); 41 extern int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int); 42 extern int cdb_make_finish(struct cdb_make *); 43 44 #endif 45