This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove the -P switch
[perl5.git] / dump.c
diff --git a/dump.c b/dump.c
index dee5c10..3e4db86 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1289,7 +1289,7 @@ Perl_do_magic_dump(pTHX_ I32 level, PerlIO *file, const MAGIC *mg, I32 nest, I32
                    = pv_pretty(dsv, RX_WRAPPED(re), RX_WRAPLEN(re), 
                     60, NULL, NULL,
                     ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_PRETTY_ELLIPSES |
-                    ((RX_EXTFLAGS(re) & RXf_UTF8) ? PERL_PV_ESCAPE_UNI : 0))
+                    (RX_UTF8(re) ? PERL_PV_ESCAPE_UNI : 0))
                 );
                Perl_dump_indent(aTHX_ level+1, file, "    PAT = %s\n", s);
                Perl_dump_indent(aTHX_ level+1, file, "    REFCNT = %"IVdf"\n",
@@ -1539,8 +1539,6 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
            Perl_dump_indent(aTHX_ level, file, "  UV = %"UVuf, (UV)SvUVX(sv));
        else
            Perl_dump_indent(aTHX_ level, file, "  IV = %"IVdf, (IV)SvIVX(sv));
-       if (SvOOK(sv))
-           PerlIO_printf(file, "  (OFFSET)");
 #ifdef PERL_OLD_COPY_ON_WRITE
        if (SvIsCOW_shared_hash(sv))
            PerlIO_printf(file, "  (HASH)");
@@ -1555,8 +1553,8 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
        Perl_dump_indent(aTHX_ level, file, "  COP_HIGH = %"UVuf"\n",
                         (UV) COP_SEQ_RANGE_HIGH(sv));
     } else if ((type >= SVt_PVNV && type != SVt_PVAV && type != SVt_PVHV
-               && type != SVt_PVCV && type != SVt_PVFM && !isGV_with_GP(sv)
-               && !SvVALID(sv))
+               && type != SVt_PVCV && type != SVt_PVFM  && type != SVt_REGEXP
+               && !isGV_with_GP(sv) && !SvVALID(sv))
               || type == SVt_NV) {
        STORE_NUMERIC_LOCAL_SET_STANDARD();
        /* %Vg doesn't work? --jhi */
@@ -1578,9 +1576,20 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
     }
     if (type <= SVt_PVLV && !isGV_with_GP(sv)) {
        if (SvPVX_const(sv)) {
+           STRLEN delta;
+           if (SvOOK(sv)) {
+               SvOOK_offset(sv, delta);
+               Perl_dump_indent(aTHX_ level, file,"  OFFSET = %"UVuf"\n",
+                                (UV) delta);
+           } else {
+               delta = 0;
+           }
            Perl_dump_indent(aTHX_ level, file,"  PV = 0x%"UVxf" ", PTR2UV(SvPVX_const(sv)));
-           if (SvOOK(sv))
-               PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
+           if (SvOOK(sv)) {
+               PerlIO_printf(file, "( %s . ) ",
+                             pv_display(d, SvPVX_const(sv) - delta, delta, 0,
+                                        pvlim));
+           }
            PerlIO_printf(file, "%s", pv_display(d, SvPVX_const(sv), SvCUR(sv), SvLEN(sv), pvlim));
            if (SvUTF8(sv)) /* the 6?  \x{....} */
                PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 6 * SvCUR(sv), UNI_DISPLAY_QQ));
@@ -2411,7 +2420,7 @@ Perl_sv_xmlpeek(pTHX_ SV *sv)
     case SVt_BIND:
        sv_catpv(t, " BIND=\"");
        break;
-    case SVt_ORANGE:
+    case SVt_REGEXP:
        sv_catpv(t, " ORANGE=\"");
        break;
     case SVt_PVFM:
@@ -2458,9 +2467,9 @@ Perl_do_pmop_xmldump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
     Perl_xmldump_indent(aTHX_ level, file, "<pmop \n");
     level++;
     if (PM_GETRE(pm)) {
-       const regexp *const r = PM_GETRE(pm);
-       SV * const tmpsv = newSVpvn(RX_PRECOMP(r),r->prelen);
-       SvUTF8_on(tmpsv);
+       REGEXP *const r = PM_GETRE(pm);
+       SV * const tmpsv = newSVsv((SV*)r);
+       sv_utf8_upgrade(tmpsv);
        Perl_xmldump_indent(aTHX_ level, file, "pre=\"%s\"\n",
             SvPVX(tmpsv));
        SvREFCNT_dec(tmpsv);
@@ -2469,7 +2478,7 @@ Perl_do_pmop_xmldump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
     }
     else
        Perl_xmldump_indent(aTHX_ level, file, "pre=\"\" when=\"RUN\"\n");
-    if (pm->op_pmflags || (PM_GETRE(pm) && PM_GETRE(pm)->check_substr)) {
+    if (pm->op_pmflags || (PM_GETRE(pm) && RX_CHECK_SUBSTR(PM_GETRE(pm)))) {
        SV * const tmpsv = pm_description(pm);
        Perl_xmldump_indent(aTHX_ level, file, "pmflags=\"%s\"\n", SvCUR(tmpsv) ? SvPVX(tmpsv) + 1 : "");
        SvREFCNT_dec(tmpsv);
@@ -2745,12 +2754,10 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o)
        S_xmldump_attr(aTHX_ level, file, "padix=\"%" IVdf "\"", (IV)cPADOPo->op_padix);
 #else
        if (cSVOPo->op_sv) {
-           SV * const tmpsv1 = newSV(0);
-           SV * const tmpsv2 = newSVpvn("",0);
+           SV * const tmpsv1 = newSVpvn_utf8(NULL, 0, TRUE);
+           SV * const tmpsv2 = newSVpvn_utf8("", 0, TRUE);
            char *s;
            STRLEN len;
-           SvUTF8_on(tmpsv1);
-           SvUTF8_on(tmpsv2);
            ENTER;
            SAVEFREESV(tmpsv1);
            SAVEFREESV(tmpsv2);
@@ -2836,10 +2843,9 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o)
 
     if (PL_madskills && o->op_madprop) {
        char prevkey = '\0';
-       SV * const tmpsv = newSVpvn("", 0);
+       SV * const tmpsv = newSVpvn_utf8("", 0, TRUE);
        const MADPROP* mp = o->op_madprop;
 
-       sv_utf8_upgrade(tmpsv);
        if (!contents) {
            contents = 1;
            PerlIO_printf(file, ">\n");