This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Let state sub fwd decls and nested subs work in anons
[perl5.git] / x2p / hash.h
CommitLineData
8665f9e4 1/* hash.h
a687059c 2 *
8665f9e4 3 * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1999, 2000, 2005
4bb101f2 4 * by Larry Wall and others
a687059c 5 *
352d5a3a
LW
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.
8d063cd8
LW
8 */
9
10#define FILLPCT 60 /* don't make greater than 99 */
11
12#ifdef DOINIT
a4ca311e 13EXTERN_C char const coeff[] = {
8d063cd8
LW
14 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
15 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
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#else
a4ca311e 23EXTERN_C const char coeff[];
8d063cd8
LW
24#endif
25
26typedef struct hentry HENT;
27
28struct hentry {
29 HENT *hent_next;
30 char *hent_key;
31 STR *hent_val;
32 int hent_hash;
33};
34
35struct htbl {
36 HENT **tbl_array;
37 int tbl_max;
38 int tbl_fill;
39 int tbl_riter; /* current root of iterator */
40 HENT *tbl_eiter; /* current entry of iterator */
41};
42
20ce7b12
GS
43STR * hfetch ( HASH *tb, char *key );
44int hiterinit ( HASH *tb );
20ce7b12
GS
45HASH * hnew ( void );
46void hsplit ( HASH *tb );
47bool hstore ( HASH *tb, char *key, STR *val );