c2f9b554f45d9aae0a44d4671efc644e8815386e
[p5sagit/p5-mst-13.2.git] / hash.h
1 /* $Header: hash.h,v 4.0 91/03/20 01:22:38 lwall Locked $
2  *
3  *    Copyright (c) 1989, Larry Wall
4  *
5  *    You may distribute under the terms of the GNU General Public License
6  *    as specified in the README file that comes with the perl 3.0 kit.
7  *
8  * $Log:        hash.h,v $
9  * Revision 4.0  91/03/20  01:22:38  lwall
10  * 4.0 baseline.
11  * 
12  */
13
14 #define FILLPCT 80              /* don't make greater than 99 */
15 #define DBM_CACHE_MAX 63        /* cache 64 entries for dbm file */
16                                 /* (resident array acts as a write-thru cache)*/
17
18 #define COEFFSIZE (16 * 8)      /* size of coeff array */
19
20 typedef struct hentry HENT;
21
22 struct hentry {
23     HENT        *hent_next;
24     char        *hent_key;
25     STR         *hent_val;
26     int         hent_hash;
27     int         hent_klen;
28 };
29
30 struct htbl {
31     HENT        **tbl_array;
32     int         tbl_max;        /* subscript of last element of tbl_array */
33     int         tbl_dosplit;    /* how full to get before splitting */
34     int         tbl_fill;       /* how full tbl_array currently is */
35     int         tbl_riter;      /* current root of iterator */
36     HENT        *tbl_eiter;     /* current entry of iterator */
37     SPAT        *tbl_spatroot;  /* list of spats for this package */
38     char        *tbl_name;      /* name, if a symbol table */
39 #ifdef SOME_DBM
40 #ifdef HAS_GDBM
41     GDBM_FILE   tbl_dbm;
42 #else
43 #ifdef HAS_NDBM
44     DBM         *tbl_dbm;
45 #else
46     int         tbl_dbm;
47 #endif
48 #endif
49 #endif
50     unsigned char tbl_coeffsize;        /* is 0 for symbol tables */
51 };
52
53 STR *hfetch();
54 bool hstore();
55 STR *hdelete();
56 HASH *hnew();
57 void hclear();
58 void hentfree();
59 int hiterinit();
60 HENT *hiternext();
61 char *hiterkey();
62 STR *hiterval();
63 bool hdbmopen();
64 void hdbmclose();
65 bool hdbmstore();