Commit | Line | Data |
a687059c |
1 | /* $Header: hash.h,v 3.0 89/10/18 15:18:39 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. |
8d063cd8 |
7 | * |
8 | * $Log: hash.h,v $ |
a687059c |
9 | * Revision 3.0 89/10/18 15:18:39 lwall |
10 | * 3.0 baseline |
8d063cd8 |
11 | * |
12 | */ |
13 | |
a687059c |
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)*/ |
8d063cd8 |
17 | |
378cc40b |
18 | #define COEFFSIZE (16 * 8) /* size of array below */ |
8d063cd8 |
19 | #ifdef DOINIT |
20 | char coeff[] = { |
21 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
22 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
23 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
24 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
25 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
26 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
27 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1, |
28 | 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1}; |
29 | #else |
30 | extern char coeff[]; |
31 | #endif |
32 | |
33 | typedef struct hentry HENT; |
34 | |
35 | struct hentry { |
36 | HENT *hent_next; |
37 | char *hent_key; |
38 | STR *hent_val; |
39 | int hent_hash; |
a687059c |
40 | int hent_klen; |
8d063cd8 |
41 | }; |
42 | |
43 | struct htbl { |
44 | HENT **tbl_array; |
a687059c |
45 | int tbl_max; /* subscript of last element of tbl_array */ |
46 | int tbl_dosplit; /* how full to get before splitting */ |
47 | int tbl_fill; /* how full tbl_array currently is */ |
8d063cd8 |
48 | int tbl_riter; /* current root of iterator */ |
49 | HENT *tbl_eiter; /* current entry of iterator */ |
a687059c |
50 | SPAT *tbl_spatroot; /* list of spats for this package */ |
51 | #ifdef SOME_DBM |
52 | #ifdef NDBM |
53 | DBM *tbl_dbm; |
54 | #else |
55 | int tbl_dbm; |
56 | #endif |
57 | #endif |
58 | unsigned char tbl_coeffsize; /* is 0 for symbol tables */ |
8d063cd8 |
59 | }; |
60 | |
61 | STR *hfetch(); |
62 | bool hstore(); |
378cc40b |
63 | STR *hdelete(); |
8d063cd8 |
64 | HASH *hnew(); |
378cc40b |
65 | void hclear(); |
378cc40b |
66 | void hentfree(); |
8d063cd8 |
67 | int hiterinit(); |
68 | HENT *hiternext(); |
69 | char *hiterkey(); |
70 | STR *hiterval(); |
a687059c |
71 | bool hdbmopen(); |
72 | void hdbmclose(); |
73 | bool hdbmstore(); |