}
char *
-Perl_pv_display(pTHX_ SV *sv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
+Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
{
int truncated = 0;
int nul_terminated = len > cur && pv[cur] == '\0';
- sv_setpvn(sv, "\"", 1);
+ sv_setpvn(dsv, "\"", 1);
for (; cur--; pv++) {
- if (pvlim && SvCUR(sv) >= pvlim) {
+ if (pvlim && SvCUR(dsv) >= pvlim) {
truncated++;
break;
}
if (isPRINT(*pv)) {
switch (*pv) {
- case '\t': sv_catpvn(sv, "\\t", 2); break;
- case '\n': sv_catpvn(sv, "\\n", 2); break;
- case '\r': sv_catpvn(sv, "\\r", 2); break;
- case '\f': sv_catpvn(sv, "\\f", 2); break;
- case '"': sv_catpvn(sv, "\\\"", 2); break;
- case '\\': sv_catpvn(sv, "\\\\", 2); break;
- default: sv_catpvn(sv, pv, 1); break;
+ case '\t': sv_catpvn(dsv, "\\t", 2); break;
+ case '\n': sv_catpvn(dsv, "\\n", 2); break;
+ case '\r': sv_catpvn(dsv, "\\r", 2); break;
+ case '\f': sv_catpvn(dsv, "\\f", 2); break;
+ case '"': sv_catpvn(dsv, "\\\"", 2); break;
+ case '\\': sv_catpvn(dsv, "\\\\", 2); break;
+ default: sv_catpvn(dsv, pv, 1); break;
}
}
else {
if (cur && isDIGIT(*(pv+1)))
- Perl_sv_catpvf(aTHX_ sv, "\\%03o", (U8)*pv);
+ Perl_sv_catpvf(aTHX_ dsv, "\\%03o", (U8)*pv);
else
- Perl_sv_catpvf(aTHX_ sv, "\\%o", (U8)*pv);
+ Perl_sv_catpvf(aTHX_ dsv, "\\%o", (U8)*pv);
}
}
- sv_catpvn(sv, "\"", 1);
+ sv_catpvn(dsv, "\"", 1);
if (truncated)
- sv_catpvn(sv, "...", 3);
+ sv_catpvn(dsv, "...", 3);
if (nul_terminated)
- sv_catpvn(sv, "\\0", 2);
+ sv_catpvn(dsv, "\\0", 2);
- return SvPVX(sv);
+ return SvPVX(dsv);
+}
+
+char *
+Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim)
+{
+ int truncated = 0;
+ char *s, *e;
+
+ sv_setpvn(dsv, "\"", 1);
+ for (s = SvPVX(ssv), e = s + SvCUR(ssv); s < e; s += UTF8SKIP(s)) {
+ UV u;
+ if (pvlim && SvCUR(dsv) >= pvlim) {
+ truncated++;
+ break;
+ }
+ u = utf8_to_uvchr((U8*)s, 0);
+ Perl_sv_catpvf(aTHX_ dsv, "\\x{%x}", u);
+ }
+ sv_catpvn(dsv, "\"", 1);
+ if (truncated)
+ sv_catpvn(dsv, "...", 3);
+
+ return SvPVX(dsv);
}
char *
Perl_sv_catpvf(aTHX_ t, "[%s]", pv_display(tmp, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, 127));
Perl_sv_catpvf(aTHX_ t, "%s)", pv_display(tmp, SvPVX(sv), SvCUR(sv), SvLEN(sv), 127));
if (SvUTF8(sv))
- Perl_sv_catpvf(aTHX_ t, " [UTF8]");
+ Perl_sv_catpvf(aTHX_ t, " [UTF8 %s]",
+ sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv)));
SvREFCNT_dec(tmp);
}
}
Perl_dump_indent(aTHX_ level, file," PV = 0x%"UVxf" ", PTR2UV(SvPVX(sv)));
if (SvOOK(sv))
PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
- PerlIO_printf(file, "%s\n", pv_display(d, SvPVX(sv), SvCUR(sv), SvLEN(sv), pvlim));
+ PerlIO_printf(file, "%s", pv_display(d, SvPVX(sv), SvCUR(sv), SvLEN(sv), pvlim));
+ if (SvUTF8(sv)) /* the 8? \x{....} */
+ PerlIO_printf(file, " %s", sv_uni_display(d, sv, 8 * sv_len_utf8(sv)));
+ 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));
}
#define sv_usepvn_mg Perl_sv_usepvn_mg
#define get_vtbl Perl_get_vtbl
#define pv_display Perl_pv_display
+#define sv_uni_display Perl_sv_uni_display
#define dump_indent Perl_dump_indent
#define dump_vindent Perl_dump_vindent
#define do_gv_dump Perl_do_gv_dump
#if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)
#define save_scalar_at S_save_scalar_at
#endif
-#if defined(USE_ITHREADS) && (defined(PERL_IN_SHAREDSV_C) || defined(PERL_DECL_PROT))
+#if defined(USE_ITHREADS)
#define sharedsv_init Perl_sharedsv_init
#define sharedsv_new Perl_sharedsv_new
#define sharedsv_find Perl_sharedsv_find
#define sv_usepvn_mg(a,b,c) Perl_sv_usepvn_mg(aTHX_ a,b,c)
#define get_vtbl(a) Perl_get_vtbl(aTHX_ a)
#define pv_display(a,b,c,d,e) Perl_pv_display(aTHX_ a,b,c,d,e)
+#define sv_uni_display(a,b,c) Perl_sv_uni_display(aTHX_ a,b,c)
#define dump_vindent(a,b,c,d) Perl_dump_vindent(aTHX_ a,b,c,d)
#define do_gv_dump(a,b,c,d) Perl_do_gv_dump(aTHX_ a,b,c,d)
#define do_gvgv_dump(a,b,c,d) Perl_do_gvgv_dump(aTHX_ a,b,c,d)
#if defined(PERL_IN_SCOPE_C) || defined(PERL_DECL_PROT)
#define save_scalar_at(a) S_save_scalar_at(aTHX_ a)
#endif
-#if defined(USE_ITHREADS) && (defined(PERL_IN_SHAREDSV_C) || defined(PERL_DECL_PROT))
+#if defined(USE_ITHREADS)
#define sharedsv_init() Perl_sharedsv_init(aTHX)
#define sharedsv_new() Perl_sharedsv_new(aTHX)
#define sharedsv_find(a) Perl_sharedsv_find(aTHX_ a)