1 /* $Id: dict-p.h,v 1.1 2004-12-08 12:23:08 adam Exp $
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
26 #include <idzebra/dict.h>
30 #define DICT_MAGIC "dict01"
32 #define DICT_DEFAULT_PAGESIZE 4096
38 Dict_ptr root, last, freelist;
41 struct Dict_file_block
43 struct Dict_file_block *h_next, **h_prev;
44 struct Dict_file_block *lru_next, *lru_prev;
51 typedef struct Dict_file_struct
56 struct Dict_file_block *all_blocks;
57 struct Dict_file_block *free_list;
58 struct Dict_file_block **hash_array;
60 struct Dict_file_block *lru_back, *lru_front;
73 const char **(*grep_cmap)(void *vp, const char **from, int len);
75 struct Dict_head head;
78 int dict_bf_readp (Dict_BFile bf, int no, void **bufp);
79 int dict_bf_newp (Dict_BFile bf, int no, void **bufp, int nbytes);
80 int dict_bf_touch (Dict_BFile bf, int no);
81 void dict_bf_flush_blocks (Dict_BFile bf, int no_to_flush);
82 Dict_BFile dict_bf_open (BFiles bfs, const char *name, int block_size,
84 int dict_bf_close (Dict_BFile dbf);
85 void dict_bf_compact (Dict_BFile dbf);
88 #define DICT_type(x) 0[(Dict_ptr*) x]
89 #define DICT_backptr(x) 1[(Dict_ptr*) x]
90 #define DICT_bsize(x) 2[(short*)((char*)(x)+2*sizeof(Dict_ptr))]
91 #define DICT_nodir(x) 0[(short*)((char*)(x)+2*sizeof(Dict_ptr))]
92 #define DICT_size(x) 1[(short*)((char*)(x)+2*sizeof(Dict_ptr))]
93 #define DICT_infoffset (2*sizeof(Dict_ptr)+3*sizeof(short))
94 #define DICT_xxxxpagesize(x) ((x)->head.page_size)
96 #define DICT_to_str(x) sizeof(Dict_info)+sizeof(Dict_ptr)
100 backptr pointer to parent
101 nextptr pointer to next page (if any)
103 size size of strings,info,ptr entries