"BIND",
"IV",
"NV",
- "RV",
"PV",
"PVIV",
"PVNV",
"PVMG",
+ "ORANGE",
"PVGV",
"PVLV",
"PVAV",
"BIND",
"IV",
"NV",
- "RV",
"PV",
"PVIV",
"PVNV",
"PVMG",
+ "ORANGE",
"GV",
"PVLV",
"AV",
Normally the SV will be cleared before the escaped string is prepared,
but when PERL_PV_ESCAPE_NOCLEAR is set this will not occur.
-If PERL_PV_ESCAPE_UNI is set then the input string is treated as unicode,
+If PERL_PV_ESCAPE_UNI is set then the input string is treated as Unicode,
if PERL_PV_ESCAPE_UNI_DETECT is set then the input string is scanned
-using C<is_utf8_string()> to determine if it is unicode.
+using C<is_utf8_string()> to determine if it is Unicode.
If PERL_PV_ESCAPE_ALL is set then all input chars will be output
using C<\x01F1> style escapes, otherwise only chars above 255 will be
STRLEN wrote = 0; /* chars written so far */
STRLEN chsize = 0; /* size of data to be written */
STRLEN readsize = 1; /* size of data just read */
- bool isuni= flags & PERL_PV_ESCAPE_UNI ? 1 : 0; /* is this unicode */
+ bool isuni= flags & PERL_PV_ESCAPE_UNI ? 1 : 0; /* is this Unicode */
const char *pv = str;
const char * const end = pv + count; /* end of string */
octbuf[0] = esc;
- if (!flags & PERL_PV_ESCAPE_NOCLEAR)
+ if (!(flags & PERL_PV_ESCAPE_NOCLEAR)) {
+ /* This won't alter the UTF-8 flag */
sv_setpvn(dsv, "", 0);
+ }
if ((flags & PERL_PV_ESCAPE_UNI_DETECT) && is_utf8_string((U8*)pv, count))
isuni = 1;
sv_catpvn(dsv, octbuf, chsize);
wrote += chsize;
} else {
+ /* If PERL_PV_ESCAPE_NOBACKSLASH is set then bytes in the range
+ 128-255 can be appended raw to the dsv. If dsv happens to be
+ UTF-8 then we need catpvf to upgrade them for us.
+ Or add a new API call sv_catpvc(). Think about that name, and
+ how to keep it clear that it's unlike the s of catpvs, which is
+ really an array octets, not a string. */
Perl_sv_catpvf( aTHX_ dsv, "%c", c);
wrote++;
}
|const U32 flags
Converts a string into something presentable, handling escaping via
-pv_escape() and supporting quoting and elipses.
+pv_escape() and supporting quoting and ellipses.
If the PERL_PV_PRETTY_QUOTE flag is set then the result will be
double quoted with any double quotes in the string escaped. Otherwise
if the PERL_PV_PRETTY_LTGT flag is set then the result be wrapped in
angle brackets.
-If the PERL_PV_PRETTY_ELIPSES flag is set and not all characters in
-string were output then an elipses C<...> will be appended to the
+If the PERL_PV_PRETTY_ELLIPSES flag is set and not all characters in
+string were output then an ellipsis C<...> will be appended to the
string. Note that this happens AFTER it has been quoted.
If start_color is non-null then it will be inserted after the opening
quote (if there is one) but before the escaped text. If end_color
is non-null then it will be inserted after the escaped text but before
-any quotes or elipses.
+any quotes or ellipses.
Returns a pointer to the prettified text as held by dsv.
const U8 dq = (flags & PERL_PV_PRETTY_QUOTE) ? '"' : '%';
STRLEN escaped;
+ if (!(flags & PERL_PV_PRETTY_NOCLEAR)) {
+ /* This won't alter the UTF-8 flag */
+ sv_setpvn(dsv, "", 0);
+ }
+
if ( dq == '"' )
- sv_setpvn(dsv, "\"", 1);
+ sv_catpvn(dsv, "\"", 1);
else if ( flags & PERL_PV_PRETTY_LTGT )
- sv_setpvn(dsv, "<", 1);
- else
- sv_setpvn(dsv, "", 0);
+ sv_catpvn(dsv, "<", 1);
if ( start_color != NULL )
Perl_sv_catpv( aTHX_ dsv, start_color);
else if ( flags & PERL_PV_PRETTY_LTGT )
sv_catpvn( dsv, ">", 1);
- if ( (flags & PERL_PV_PRETTY_ELIPSES) && ( escaped < count ) )
+ if ( (flags & PERL_PV_PRETTY_ELLIPSES) && ( escaped < count ) )
sv_catpvn( dsv, "...", 3 );
return SvPVX(dsv);
Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, SvPVX_const(sv), SvCUR(sv), SvLEN(sv), 127));
if (SvUTF8(sv))
Perl_sv_catpvf(aTHX_ t, " [UTF8 \"%s\"]",
- sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv),
+ sv_uni_display(tmp, sv, 6 * SvCUR(sv),
UNI_DISPLAY_QQ));
SvREFCNT_dec(tmp);
}
switch (o->op_type) {
case OP_STUB:
if ((o->op_flags & OPf_WANT) != OPf_WANT_LIST) {
- hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
+ (void)hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
break;
}
goto nothin;
nothin:
if (oldop && o->op_next)
continue;
- hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
+ (void)hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
break;
case OP_MAPWHILE:
case OP_DORASSIGN:
case OP_COND_EXPR:
case OP_RANGE:
- hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
+ (void)hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
sequence_tail(cLOGOPo->op_other);
break;
case OP_ENTERLOOP:
case OP_ENTERITER:
- hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
+ (void)hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
sequence_tail(cLOOPo->op_redoop);
sequence_tail(cLOOPo->op_nextop);
sequence_tail(cLOOPo->op_lastop);
break;
case OP_SUBST:
- hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
+ (void)hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
sequence_tail(cPMOPo->op_pmstashstartu.op_pmreplstart);
break;
break;
default:
- hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
+ (void)hv_store(Sequence, key, len, newSVuv(++PL_op_seq), 0);
break;
}
oldop = o;
SV * const dsv = sv_newmortal();
const char * const s = pv_pretty(dsv, re->wrapped, re->wraplen,
60, NULL, NULL,
- ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_PRETTY_ELIPSES |
+ ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_PRETTY_ELLIPSES |
((re->extflags & RXf_UTF8) ? PERL_PV_ESCAPE_UNI : 0))
);
Perl_dump_indent(aTHX_ level+1, file, " PAT = %s\n", s);
}
if ((type >= SVt_PVIV && type != SVt_PVAV && type != SVt_PVHV
&& type != SVt_PVCV && !isGV_with_GP(sv))
- || type == SVt_IV) {
+ || (type == SVt_IV && !SvROK(sv))) {
if (SvIsUV(sv)
#ifdef PERL_OLD_COPY_ON_WRITE
|| SvIsCOW(sv)
if (SvOOK(sv))
PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX_const(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
PerlIO_printf(file, "%s", pv_display(d, SvPVX_const(sv), SvCUR(sv), SvLEN(sv), pvlim));
- if (SvUTF8(sv)) /* the 8? \x{....} */
- PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 8 * sv_len_utf8(sv), UNI_DISPLAY_QQ));
+ if (SvUTF8(sv)) /* the 6? \x{....} */
+ PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 6 * SvCUR(sv), UNI_DISPLAY_QQ));
PerlIO_printf(file, "\n");
Perl_dump_indent(aTHX_ level, file, " CUR = %"IVdf"\n", (IV)SvCUR(sv));
Perl_dump_indent(aTHX_ level, file, " LEN = %"IVdf"\n", (IV)SvLEN(sv));
Perl_dump_indent(aTHX_ level+1, file, "Elt %s ", pv_display(d, keypv, len, 0, pvlim));
if (SvUTF8(keysv))
- PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 8 * sv_len_utf8(keysv), UNI_DISPLAY_QQ));
+ PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 6 * SvCUR(keysv), UNI_DISPLAY_QQ));
if (HeKREHASH(he))
PerlIO_printf(file, "[REHASH] ");
PerlIO_printf(file, "HASH = 0x%"UVxf"\n", (UV)hash);
do_sv_dump (level+1, file, (SV *) IoBOTTOM_GV(sv), nest+1, maxnest,
dumpops, pvlim);
}
- Perl_dump_indent(aTHX_ level, file, " SUBPROCESS = %"IVdf"\n", (IV)IoSUBPROCESS(sv));
if (isPRINT(IoTYPE(sv)))
Perl_dump_indent(aTHX_ level, file, " TYPE = '%c'\n", IoTYPE(sv));
else
Perl_sv_dump(pTHX_ SV *sv)
{
dVAR;
- do_sv_dump(0, Perl_debug_log, sv, 0, 0, 0, 0);
+ if (SvROK(sv))
+ do_sv_dump(0, Perl_debug_log, sv, 0, 4, 0, 0);
+ else
+ do_sv_dump(0, Perl_debug_log, sv, 0, 0, 0, 0);
}
int
{
SV * const sv = sv_newmortal();
- gv_fullname3(sv, gv, Nullch);
+ gv_fullname3(sv, gv, NULL);
Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "\nSUB %s = ", SvPVX(sv));
if (CvXSUB(GvCV(gv)))
Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "(xsub 0x%"UVxf" %d)\n",
{
SV * const sv = sv_newmortal();
- gv_fullname3(sv, gv, Nullch);
+ gv_fullname3(sv, gv, NULL);
Perl_xmldump_indent(aTHX_ 0, PL_xmlfp, "\nFORMAT %s = ", SvPVX(sv));
if (CvROOT(GvFORM(gv)))
op_xmldump(CvROOT(GvFORM(gv)));
Perl_sv_catpvf(aTHX_ dsv, "STUPIDXML(#x%X)", c);
break;
case '<':
- Perl_sv_catpvf(aTHX_ dsv, "<");
+ sv_catpvs(dsv, "<");
break;
case '>':
- Perl_sv_catpvf(aTHX_ dsv, ">");
+ sv_catpvs(dsv, ">");
break;
case '&':
- Perl_sv_catpvf(aTHX_ dsv, "&");
+ sv_catpvs(dsv, "&");
break;
case '"':
- Perl_sv_catpvf(aTHX_ dsv, """);
+ sv_catpvs(dsv, """);
break;
default:
if (c < 0xD800) {
Perl_sv_catpvf(aTHX_ dsv, "&#x%X;", c);
}
else {
- Perl_sv_catpvf(aTHX_ dsv, "%c", c);
+ const char string = (char) c;
+ sv_catpvn(dsv, &string, 1);
}
break;
}
case SVt_NV:
sv_catpv(t, " NV=\"");
break;
- case SVt_RV:
- sv_catpv(t, " RV=\"");
- break;
case SVt_PV:
sv_catpv(t, " PV=\"");
break;
case SVt_BIND:
sv_catpv(t, " BIND=\"");
break;
+ case SVt_ORANGE:
+ sv_catpv(t, " ORANGE=\"");
+ break;
case SVt_PVFM:
sv_catpv(t, " FM=\"");
break;
Perl_xmldump_indent(aTHX_ level, file, "<pmop \n");
level++;
if (PM_GETRE(pm)) {
- const char * const s = PM_GETRE(pm)->precomp;
- SV * const tmpsv = newSVpvn("",0);
+ const regexp *const r = PM_GETRE(pm);
+ SV * const tmpsv = newSVpvn(r->precomp,r->prelen);
SvUTF8_on(tmpsv);
- sv_catxmlpvn(tmpsv, s, strlen(s), 1);
Perl_xmldump_indent(aTHX_ level, file, "pre=\"%s\"\n",
SvPVX(tmpsv));
SvREFCNT_dec(tmpsv);
ENTER;
SAVEFREESV(tmpsv1);
SAVEFREESV(tmpsv2);
- gv_fullname3(tmpsv1, (GV*)cSVOPo->op_sv, Nullch);
+ gv_fullname3(tmpsv1, (GV*)cSVOPo->op_sv, NULL);
s = SvPV(tmpsv1,len);
sv_catxmlpvn(tmpsv2, s, len, 1);
S_xmldump_attr(aTHX_ level, file, "gv=\"%s\"", SvPV(tmpsv2, len));