a977ae5cfcc45aa303f7e3cbd9559417d7400feb
[p5sagit/p5-mst-13.2.git] / x2p / hash.h
1 /* $RCSfile: hash.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:21 $
2  *
3  *    Copyright (c) 1991, Larry Wall
4  *
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.
7  *
8  * $Log:        hash.h,v $
9  * Revision 4.1  92/08/07  18:29:21  lwall
10  * 
11  * Revision 4.0.1.1  91/06/07  12:16:04  lwall
12  * patch4: new copyright notice
13  * 
14  * Revision 4.0  91/03/20  01:57:53  lwall
15  * 4.0 baseline.
16  * 
17  */
18
19 #define FILLPCT 60              /* don't make greater than 99 */
20
21 #ifdef DOINIT
22 char coeff[] = {
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                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
30                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
31 #else
32 extern char coeff[];
33 #endif
34
35 typedef struct hentry HENT;
36
37 struct hentry {
38     HENT        *hent_next;
39     char        *hent_key;
40     STR         *hent_val;
41     int         hent_hash;
42 };
43
44 struct htbl {
45     HENT        **tbl_array;
46     int         tbl_max;
47     int         tbl_fill;
48     int         tbl_riter;      /* current root of iterator */
49     HENT        *tbl_eiter;     /* current entry of iterator */
50 };
51
52 STR *hfetch();
53 bool hstore();
54 bool hdelete();
55 HASH *hnew();
56 int hiterinit();
57 HENT *hiternext();
58 char *hiterkey();
59 STR *hiterval();