Commit | Line | Data |
45d8adaa |
1 | /* $RCSfile: hash.h,v $$Revision: 4.0.1.2 $$Date: 91/11/05 17:24:31 $ |
a687059c |
2 | * |
352d5a3a |
3 | * Copyright (c) 1991, Larry Wall |
a687059c |
4 | * |
352d5a3a |
5 | * You may distribute under the terms of either the GNU General Public |
6 | * License or the Artistic License, as specified in the README file. |
8d063cd8 |
7 | * |
8 | * $Log: hash.h,v $ |
45d8adaa |
9 | * Revision 4.0.1.2 91/11/05 17:24:31 lwall |
10 | * patch11: random cleanup |
11 | * |
352d5a3a |
12 | * Revision 4.0.1.1 91/06/07 11:10:33 lwall |
13 | * patch4: new copyright notice |
14 | * |
fe14fcc3 |
15 | * Revision 4.0 91/03/20 01:22:38 lwall |
16 | * 4.0 baseline. |
8d063cd8 |
17 | * |
18 | */ |
19 | |
a687059c |
20 | #define FILLPCT 80 /* don't make greater than 99 */ |
21 | #define DBM_CACHE_MAX 63 /* cache 64 entries for dbm file */ |
22 | /* (resident array acts as a write-thru cache)*/ |
8d063cd8 |
23 | |
154e51a4 |
24 | #define COEFFSIZE (16 * 8) /* size of coeff array */ |
8d063cd8 |
25 | |
26 | typedef struct hentry HENT; |
27 | |
28 | struct hentry { |
29 | HENT *hent_next; |
30 | char *hent_key; |
31 | STR *hent_val; |
32 | int hent_hash; |
a687059c |
33 | int hent_klen; |
8d063cd8 |
34 | }; |
35 | |
36 | struct htbl { |
37 | HENT **tbl_array; |
a687059c |
38 | int tbl_max; /* subscript of last element of tbl_array */ |
39 | int tbl_dosplit; /* how full to get before splitting */ |
40 | int tbl_fill; /* how full tbl_array currently is */ |
8d063cd8 |
41 | int tbl_riter; /* current root of iterator */ |
42 | HENT *tbl_eiter; /* current entry of iterator */ |
a687059c |
43 | SPAT *tbl_spatroot; /* list of spats for this package */ |
d9d8d8de |
44 | char *tbl_name; /* name, if a symbol table */ |
a687059c |
45 | #ifdef SOME_DBM |
fe14fcc3 |
46 | #ifdef HAS_GDBM |
47 | GDBM_FILE tbl_dbm; |
48 | #else |
49 | #ifdef HAS_NDBM |
a687059c |
50 | DBM *tbl_dbm; |
51 | #else |
52 | int tbl_dbm; |
53 | #endif |
54 | #endif |
fe14fcc3 |
55 | #endif |
a687059c |
56 | unsigned char tbl_coeffsize; /* is 0 for symbol tables */ |
8d063cd8 |
57 | }; |
58 | |
59 | STR *hfetch(); |
60 | bool hstore(); |
378cc40b |
61 | STR *hdelete(); |
8d063cd8 |
62 | HASH *hnew(); |
378cc40b |
63 | void hclear(); |
378cc40b |
64 | void hentfree(); |
45d8adaa |
65 | void hfree(); |
8d063cd8 |
66 | int hiterinit(); |
67 | HENT *hiternext(); |
68 | char *hiterkey(); |
69 | STR *hiterval(); |
a687059c |
70 | bool hdbmopen(); |
71 | void hdbmclose(); |
72 | bool hdbmstore(); |