| 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 { uint32 h; uint32 p; } ; |
| 13 | |
| 14 | struct cdb_hplist { |
| 15 | struct cdb_hp hp[CDB_HPLIST]; |
| 16 | struct cdb_hplist *next; |
| 17 | int num; |
| 18 | } ; |
| 19 | |
| 20 | struct cdb_make { |
| 21 | /* char bspace[8192]; */ |
| 22 | char final[2048]; |
| 23 | uint32 count[256]; |
| 24 | uint32 start[256]; |
| 25 | struct cdb_hplist *head; |
| 26 | struct cdb_hp *split; /* includes space for hash */ |
| 27 | struct cdb_hp *hash; |
| 28 | uint32 numentries; |
| 29 | /* buffer b; */ |
| 30 | uint32 pos; |
| 31 | /* int fd; */ |
| 32 | FILE * fp; |
| 33 | } ; |
| 34 | |
| 35 | extern int cdb_make_start(struct cdb_make *, FILE *); |
| 36 | extern int cdb_make_addbegin(struct cdb_make *,unsigned int,unsigned int); |
| 37 | extern int cdb_make_addend(struct cdb_make *,unsigned int,unsigned int,uint32); |
| 38 | extern int cdb_make_add(struct cdb_make *,char *,unsigned int,char *,unsigned int); |
| 39 | extern int cdb_make_finish(struct cdb_make *); |
| 40 | |
| 41 | #endif |