Add DECC to the symbol list
[p5sagit/p5-mst-13.2.git] / hv.h
diff --git a/hv.h b/hv.h
index 63454b9..3898e12 100644 (file)
--- a/hv.h
+++ b/hv.h
@@ -34,7 +34,7 @@ struct hek {
    Don't access this directly.
 */
 struct xpvhv_aux {
-    char       *xhv_name;      /* name, if a symbol table */
+    HEK                *xhv_name;      /* name, if a symbol table */
     HE         *xhv_eiter;     /* current entry of iterator */
     I32                xhv_riter;      /* current root of iterator */
 };
@@ -42,17 +42,38 @@ struct xpvhv_aux {
 /* hash structure: */
 /* This structure must match the beginning of struct xpvmg in sv.h. */
 struct xpvhv {
+    NV         xnv_nv;         /* numeric value, if any */
     STRLEN     xhv_fill;       /* how full xhv_array currently is */
     STRLEN     xhv_max;        /* subscript of last element of xhv_array */
-    IV         xhv_keys;       /* how many elements in the array */
-    NV         xnv_nv;         /* numeric value, if any */
+    union {
+       IV      xivu_iv;        /* integer value or pv offset */
+       UV      xivu_uv;
+       void *  xivu_p1;
+    }          xiv_u;
     MAGIC*     xmg_magic;      /* magic for scalar array */
     HV*                xmg_stash;      /* class package */
-
-    struct xpvhv_aux* xhv_aux;
-    /* list of pm's for this package is now stored in symtab magic.  */
+    struct xpvhv_aux *xhv_aux;
 };
 
+#define xhv_keys xiv_u.xivu_iv
+
+#if !defined(PERL_EXPERIMENTAL_LAYOUT)
+typedef struct xpvhv xpvhv_allocated;
+#else
+typedef struct {
+    STRLEN     xhv_fill;       /* how full xhv_array currently is */
+    STRLEN     xhv_max;        /* subscript of last element of xhv_array */
+    union {
+       IV      xivu_iv;        /* integer value or pv offset */
+       UV      xivu_uv;
+       void *  xivu_p1;
+    }          xiv_u;
+    MAGIC*     xmg_magic;      /* magic for scalar array */
+    HV*                xmg_stash;      /* class package */
+    struct xpvhv_aux *xhv_aux;
+} xpvhv_allocated;
+#endif
+
 /* hash a key */
 /* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins
  * from requirements by Colin Plumb.
@@ -182,7 +203,7 @@ C<SV*>.
 
 
 #define Nullhv Null(HV*)
-#define HvARRAY(hv)    (*(HE***)&((hv)->sv_u.sv_array))
+#define HvARRAY(hv)    (*(HE***)&((hv)->sv_u.svu_array))
 #define HvFILL(hv)     ((XPVHV*)  SvANY(hv))->xhv_fill
 #define HvMAX(hv)      ((XPVHV*)  SvANY(hv))->xhv_max
 #define HvRITER(hv)    (*Perl_hv_riter_p(aTHX_ (HV*)(hv)))
@@ -193,11 +214,15 @@ C<SV*>.
                         ((struct xpvhv_aux*)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_riter : -1)
 #define HvEITER_get(hv)        (((XPVHV *)SvANY(hv))->xhv_aux ? \
                         ((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_eiter : 0)
-#define HvNAME(hv)     (*Perl_hv_name_p(aTHX_ (HV*)hv))
+#define HvNAME(hv)     HvNAME_get(hv)
 /* FIXME - all of these should use a UTF8 aware API, which should also involve
    getting the length. */
+/* This macro may go away without notice.  */
+#define HvNAME_HEK(hv) (((XPVHV *)SvANY(hv))->xhv_aux && (((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) ? ((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name: 0)
 #define HvNAME_get(hv) (((XPVHV *)SvANY(hv))->xhv_aux ? \
-                        ((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name : 0)
+                        (((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) ? HEK_KEY(((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) : 0 : 0)
+#define HvNAMELEN_get(hv)      (((XPVHV *)SvANY(hv))->xhv_aux ? \
+                        (((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) ? HEK_LEN(((struct xpvhv_aux *)((XPVHV *)SvANY(hv))->xhv_aux)->xhv_name) : 0 : 0)
 
 /* the number of keys (including any placeholers) */
 #define XHvTOTALKEYS(xhv)      ((xhv)->xhv_keys)