Back to index

php5  5.3.10
cdb_make.h
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | Copyright (c) 1997-2010 The PHP Group                                |
00006    +----------------------------------------------------------------------+
00007    | This source file is subject to version 3.01 of the PHP license,      |
00008    | that is bundled with this package in the file LICENSE, and is        |
00009    | available through the world-wide-web at the following url:           |
00010    | http://www.php.net/license/3_01.txt                                  |
00011    | If you did not receive a copy of the PHP license and are unable to   |
00012    | obtain it through the world-wide-web, please send a note to          |
00013    | license@php.net so we can mail you a copy immediately.               |
00014    +----------------------------------------------------------------------+
00015    | Author: Marcus Boerger <helly@php.net>                               |
00016    +----------------------------------------------------------------------+
00017  */
00018 
00019 /* $Id: cdb_make.h 293036 2010-01-03 09:23:27Z sebastian $ */
00020 
00021 /* incorporated from D.J.Bernstein's cdb-0.75 (http://cr.yp.to/cdb.html)*/
00022 
00023 #ifndef CDB_MAKE_H
00024 #define CDB_MAKE_H
00025 
00026 #include <stdio.h>
00027 #include "uint32.h"
00028 
00029 #define CDB_HPLIST 1000
00030 
00031 struct cdb_hp {
00032        uint32 h;
00033        uint32 p;
00034 };
00035 
00036 struct cdb_hplist {
00037        struct cdb_hp hp[CDB_HPLIST];
00038        struct cdb_hplist *next;
00039        int num;
00040 } ;
00041 
00042 struct cdb_make {
00043        /* char bspace[8192]; */
00044        char final[2048];
00045        uint32 count[256];
00046        uint32 start[256];
00047        struct cdb_hplist *head;
00048        struct cdb_hp *split; /* includes space for hash */
00049        struct cdb_hp *hash;
00050        uint32 numentries;
00051        /* buffer b; */
00052        uint32 pos;
00053        /* int fd; */
00054        php_stream * fp;
00055 };
00056 
00057 int cdb_make_start(struct cdb_make *, php_stream * TSRMLS_DC);
00058 int cdb_make_addbegin(struct cdb_make *, unsigned int, unsigned int TSRMLS_DC);
00059 int cdb_make_addend(struct cdb_make *, unsigned int, unsigned int, uint32 TSRMLS_DC);
00060 int cdb_make_add(struct cdb_make *, char *, unsigned int, char *, unsigned int TSRMLS_DC);
00061 int cdb_make_finish(struct cdb_make * TSRMLS_DC);
00062 char *cdb_make_version();
00063 
00064 #endif