xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/x2p/hash.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /* $RCSfile: hash.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:21 $
2*0Sstevel@tonic-gate  *
3*0Sstevel@tonic-gate  *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000,
4*0Sstevel@tonic-gate  *    by Larry Wall and others
5*0Sstevel@tonic-gate  *
6*0Sstevel@tonic-gate  *    You may distribute under the terms of either the GNU General Public
7*0Sstevel@tonic-gate  *    License or the Artistic License, as specified in the README file.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * $Log:	hash.h,v $
10*0Sstevel@tonic-gate  */
11*0Sstevel@tonic-gate 
12*0Sstevel@tonic-gate #define FILLPCT 60		/* don't make greater than 99 */
13*0Sstevel@tonic-gate 
14*0Sstevel@tonic-gate #ifdef DOINIT
15*0Sstevel@tonic-gate char coeff[] = {
16*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
17*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
18*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
19*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
20*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
21*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
22*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
23*0Sstevel@tonic-gate 		61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
24*0Sstevel@tonic-gate #else
25*0Sstevel@tonic-gate extern char coeff[];
26*0Sstevel@tonic-gate #endif
27*0Sstevel@tonic-gate 
28*0Sstevel@tonic-gate typedef struct hentry HENT;
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate struct hentry {
31*0Sstevel@tonic-gate     HENT	*hent_next;
32*0Sstevel@tonic-gate     char	*hent_key;
33*0Sstevel@tonic-gate     STR		*hent_val;
34*0Sstevel@tonic-gate     int		hent_hash;
35*0Sstevel@tonic-gate };
36*0Sstevel@tonic-gate 
37*0Sstevel@tonic-gate struct htbl {
38*0Sstevel@tonic-gate     HENT	**tbl_array;
39*0Sstevel@tonic-gate     int		tbl_max;
40*0Sstevel@tonic-gate     int		tbl_fill;
41*0Sstevel@tonic-gate     int		tbl_riter;	/* current root of iterator */
42*0Sstevel@tonic-gate     HENT	*tbl_eiter;	/* current entry of iterator */
43*0Sstevel@tonic-gate };
44*0Sstevel@tonic-gate 
45*0Sstevel@tonic-gate bool hdelete (HASH *tb, char *key);
46*0Sstevel@tonic-gate STR * hfetch ( HASH *tb, char *key );
47*0Sstevel@tonic-gate int hiterinit ( HASH *tb );
48*0Sstevel@tonic-gate char * hiterkey ( HENT *entry );
49*0Sstevel@tonic-gate HENT * hiternext ( HASH *tb );
50*0Sstevel@tonic-gate STR * hiterval ( HENT *entry );
51*0Sstevel@tonic-gate HASH * hnew ( void );
52*0Sstevel@tonic-gate void hsplit ( HASH *tb );
53*0Sstevel@tonic-gate bool hstore ( HASH *tb, char *key, STR *val );
54