perl 5.002beta2 patch: toke.c
[p5sagit/p5-mst-13.2.git] / hv.h
CommitLineData
a0d0e21e 1/* hv.h
79072805 2 *
a0d0e21e 3 * Copyright (c) 1991-1994, Larry Wall
79072805 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 *
79072805 8 */
9
79072805 10typedef struct he HE;
11
12struct he {
13 HE *hent_next;
14 char *hent_key;
15 SV *hent_val;
93a17b20 16 U32 hent_hash;
79072805 17 I32 hent_klen;
18};
19
20struct xpvhv {
463ee0b2 21 char * xhv_array; /* pointer to malloced string */
22 STRLEN xhv_fill; /* how full xhv_array currently is */
23 STRLEN xhv_max; /* subscript of last element of xhv_array */
a0d0e21e 24 I32 xhv_keys; /* how many elements in the array */
79072805 25 double xnv_nv; /* numeric value, if any */
26 MAGIC* xmg_magic; /* magic for scalar array */
27 HV* xmg_stash; /* class package */
28
79072805 29 I32 xhv_riter; /* current root of iterator */
30 HE *xhv_eiter; /* current entry of iterator */
31 PMOP *xhv_pmroot; /* list of pm's for this package */
32 char *xhv_name; /* name, if a symbol table */
79072805 33};
34
35#define Nullhv Null(HV*)
463ee0b2 36#define HvARRAY(hv) ((HE**)((XPVHV*) SvANY(hv))->xhv_array)
79072805 37#define HvFILL(hv) ((XPVHV*) SvANY(hv))->xhv_fill
463ee0b2 38#define HvMAX(hv) ((XPVHV*) SvANY(hv))->xhv_max
39#define HvKEYS(hv) ((XPVHV*) SvANY(hv))->xhv_keys
79072805 40#define HvRITER(hv) ((XPVHV*) SvANY(hv))->xhv_riter
41#define HvEITER(hv) ((XPVHV*) SvANY(hv))->xhv_eiter
42#define HvPMROOT(hv) ((XPVHV*) SvANY(hv))->xhv_pmroot
43#define HvNAME(hv) ((XPVHV*) SvANY(hv))->xhv_name
a0d0e21e 44
45#ifdef OVERLOAD
46
47/* Maybe amagical: */
48/* #define HV_AMAGICmb(hv) (SvFLAGS(hv) & (SVpgv_badAM | SVpgv_AM)) */
49
50#define HV_AMAGIC(hv) (SvFLAGS(hv) & SVpgv_AM)
51#define HV_AMAGIC_on(hv) (SvFLAGS(hv) |= SVpgv_AM)
52#define HV_AMAGIC_off(hv) (SvFLAGS(hv) &= ~SVpgv_AM)
53
54/*
55#define HV_AMAGICbad(hv) (SvFLAGS(hv) & SVpgv_badAM)
56#define HV_badAMAGIC_on(hv) (SvFLAGS(hv) |= SVpgv_badAM)
57#define HV_badAMAGIC_off(hv) (SvFLAGS(hv) &= ~SVpgv_badAM)
58*/
59
60#endif /* OVERLOAD */