This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 5.0 alpha 2
[perl5.git] / hv.h
CommitLineData
79072805
LW
1/* $RCSfile: hash.h,v $$Revision: 4.1 $$Date: 92/08/07 18:21:52 $
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:21:52 lwall
10 *
11 * Revision 4.0.1.2 91/11/05 17:24:31 lwall
12 * patch11: random cleanup
13 *
14 * Revision 4.0.1.1 91/06/07 11:10:33 lwall
15 * patch4: new copyright notice
16 *
17 * Revision 4.0 91/03/20 01:22:38 lwall
18 * 4.0 baseline.
19 *
20 */
21
22#define FILLPCT 80 /* don't make greater than 99 */
23#define DBM_CACHE_MAX 63 /* cache 64 entries for dbm file */
24 /* (resident array acts as a write-thru cache)*/
25
26#define COEFFSIZE (16 * 8) /* size of coeff array */
27
28typedef struct he HE;
29
30struct he {
31 HE *hent_next;
32 char *hent_key;
33 SV *hent_val;
34 I32 hent_hash;
35 I32 hent_klen;
36};
37
38struct xpvhv {
39 char * xpv_pv; /* pointer to malloced string */
40 STRLEN xpv_cur; /* length of xp_pv as a C string */
41 STRLEN xpv_len; /* allocated size */
42 STRLEN xof_off; /* ptr is incremented by offset */
43 double xnv_nv; /* numeric value, if any */
44 MAGIC* xmg_magic; /* magic for scalar array */
45 HV* xmg_stash; /* class package */
46
47 MAGIC* xhv_magic; /* magic for elements */
48
49 HE **xhv_array;
50 I32 xhv_max; /* subscript of last element of xhv_array */
51 I32 xhv_dosplit; /* how full to get before splitting */
52 I32 xhv_fill; /* how full xhv_array currently is */
53 I32 xhv_riter; /* current root of iterator */
54 HE *xhv_eiter; /* current entry of iterator */
55 PMOP *xhv_pmroot; /* list of pm's for this package */
56 char *xhv_name; /* name, if a symbol table */
57#ifdef SOME_DBM
58#ifdef HAS_GDBM
59 GDBM_FILE xhv_dbm;
60#else
61#ifdef HAS_NDBM
62 DBM *xhv_dbm;
63#else
64 I32 xhv_dbm;
65#endif
66#endif
67#endif
68 unsigned char xhv_coeffsize; /* is 0 for symbol tables */
69};
70
71#define Nullhv Null(HV*)
72#define HvMAGIC(hv) ((XPVHV*) SvANY(hv))->xhv_magic
73#define HvARRAY(hv) ((XPVHV*) SvANY(hv))->xhv_array
74#define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max
75#define HvDOSPLIT(hv) ((XPVHV*) SvANY(hv))->xhv_dosplit
76#define HvFILL(hv) ((XPVHV*) SvANY(hv))->xhv_fill
77#define HvRITER(hv) ((XPVHV*) SvANY(hv))->xhv_riter
78#define HvEITER(hv) ((XPVHV*) SvANY(hv))->xhv_eiter
79#define HvPMROOT(hv) ((XPVHV*) SvANY(hv))->xhv_pmroot
80#define HvNAME(hv) ((XPVHV*) SvANY(hv))->xhv_name
81#define HvDBM(hv) ((XPVHV*) SvANY(hv))->xhv_dbm
82#define HvCOEFFSIZE(hv) ((XPVHV*) SvANY(hv))->xhv_coeffsize