1 /* 2 +----------------------------------------------------------------------+ 3 | Copyright (c) The PHP Group | 4 +----------------------------------------------------------------------+ 5 | This source file is subject to version 3.01 of the PHP license, | 6 | that is bundled with this package in the file LICENSE, and is | 7 | available through the world-wide-web at the following url: | 8 | https://www.php.net/license/3_01.txt | 9 | If you did not receive a copy of the PHP license and are unable to | 10 | obtain it through the world-wide-web, please send a note to | 11 | license@php.net so we can mail you a copy immediately. | 12 +----------------------------------------------------------------------+ 13 | Author: Marcus Boerger <helly@php.net> | 14 +----------------------------------------------------------------------+ 15 */ 16 17 /* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/ 18 19 #ifndef CDB_MAKE_H 20 #define CDB_MAKE_H 21 22 #include <stdio.h> 23 #include "uint32.h" 24 25 #define CDB_HPLIST 1000 26 27 struct cdb_hp { 28 uint32 h; 29 uint32 p; 30 }; 31 32 struct cdb_hplist { 33 struct cdb_hp hp[CDB_HPLIST]; 34 struct cdb_hplist *next; 35 int num; 36 } ; 37 38 struct cdb_make { 39 /* char bspace[8192]; */ 40 char final[2048]; 41 uint32 count[256]; 42 uint32 start[256]; 43 struct cdb_hplist *head; 44 struct cdb_hp *split; /* includes space for hash */ 45 struct cdb_hp *hash; 46 uint32 numentries; 47 /* buffer b; */ 48 uint32 pos; 49 /* int fd; */ 50 php_stream * fp; 51 }; 52 53 int cdb_make_start(struct cdb_make *, php_stream *); 54 int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int); 55 int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32); 56 int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int); 57 int cdb_make_finish(struct cdb_make *); 58 char *cdb_make_version(void); 59 60 #endif 61