cdb_make.h 2.1 KB

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