This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Protection against trailing spaces in embed.fnc
[perl5.git] / x2p / hash.h
1 /* $RCSfile: hash.h,v $$Revision: 4.1 $$Date: 92/08/07 18:29:21 $
2  *
3  *    Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000,
4  *    by Larry Wall and others
5  *
6  *    You may distribute under the terms of either the GNU General Public
7  *    License or the Artistic License, as specified in the README file.
8  *
9  * $Log:        hash.h,v $
10  */
11
12 #define FILLPCT 60              /* don't make greater than 99 */
13
14 #ifdef DOINIT
15 char coeff[] = {
16                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
17                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
18                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
19                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
20                 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
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 #else
25 extern char coeff[];
26 #endif
27
28 typedef struct hentry HENT;
29
30 struct hentry {
31     HENT        *hent_next;
32     char        *hent_key;
33     STR         *hent_val;
34     int         hent_hash;
35 };
36
37 struct htbl {
38     HENT        **tbl_array;
39     int         tbl_max;
40     int         tbl_fill;
41     int         tbl_riter;      /* current root of iterator */
42     HENT        *tbl_eiter;     /* current entry of iterator */
43 };
44
45 bool hdelete (HASH *tb, char *key);
46 STR * hfetch ( HASH *tb, char *key );
47 int hiterinit ( HASH *tb );
48 char * hiterkey ( HENT *entry );
49 HENT * hiternext ( HASH *tb );
50 STR * hiterval ( HENT *entry );
51 HASH * hnew ( void );
52 void hsplit ( HASH *tb );
53 bool hstore ( HASH *tb, char *key, STR *val );