adb00c1a86b6d23d19f3c343873360899d57a854
[p5sagit/p5-mst-13.2.git] / hv.h
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 typedef struct he HE;
23
24 struct he {
25     HE          *hent_next;
26     char        *hent_key;
27     SV          *hent_val;
28     U32         hent_hash;
29     I32         hent_klen;
30 };
31
32 struct xpvhv {
33     char *      xhv_array;      /* pointer to malloced string */
34     STRLEN      xhv_fill;       /* how full xhv_array currently is */
35     STRLEN      xhv_max;        /* subscript of last element of xhv_array */
36     STRLEN      xhv_keys;       /* how many elements in the array */
37     double      xnv_nv;         /* numeric value, if any */
38     MAGIC*      xmg_magic;      /* magic for scalar array */
39     HV*         xmg_stash;      /* class package */
40
41     I32         xhv_riter;      /* current root of iterator */
42     HE          *xhv_eiter;     /* current entry of iterator */
43     PMOP        *xhv_pmroot;    /* list of pm's for this package */
44     char        *xhv_name;      /* name, if a symbol table */
45 };
46
47 #define Nullhv Null(HV*)
48 #define HvARRAY(hv)     ((HE**)((XPVHV*)  SvANY(hv))->xhv_array)
49 #define HvFILL(hv)      ((XPVHV*)  SvANY(hv))->xhv_fill
50 #define HvMAX(hv)       ((XPVHV*)  SvANY(hv))->xhv_max
51 #define HvKEYS(hv)      ((XPVHV*)  SvANY(hv))->xhv_keys
52 #define HvRITER(hv)     ((XPVHV*)  SvANY(hv))->xhv_riter
53 #define HvEITER(hv)     ((XPVHV*)  SvANY(hv))->xhv_eiter
54 #define HvPMROOT(hv)    ((XPVHV*)  SvANY(hv))->xhv_pmroot
55 #define HvNAME(hv)      ((XPVHV*)  SvANY(hv))->xhv_name