perl 3.0 patch #4 Patch #2 continued
[p5sagit/p5-mst-13.2.git] / hash.h
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.
7  *
8  * $Log:        hash.h,v $
9  * Revision 3.0  89/10/18  15:18:39  lwall
10  * 3.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 array below */
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;
40     int         hent_klen;
41 };
42
43 struct htbl {
44     HENT        **tbl_array;
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 */
48     int         tbl_riter;      /* current root of iterator */
49     HENT        *tbl_eiter;     /* current entry of iterator */
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 */
59 };
60
61 STR *hfetch();
62 bool hstore();
63 STR *hdelete();
64 HASH *hnew();
65 void hclear();
66 void hentfree();
67 int hiterinit();
68 HENT *hiternext();
69 char *hiterkey();
70 STR *hiterval();
71 bool hdbmopen();
72 void hdbmclose();
73 bool hdbmstore();