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