summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-10-23 21:52:45 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-10-23 21:52:45 +0000
commitb2ff9928c77b24737570b67197be87aa48019afe (patch)
tree97bc1d7c007e4068a875eeab5df93393d00f4337
parent1edbfb88dca645450f44e4bcbb3df8372f66c904 (diff)
downloadperl-b2ff9928c77b24737570b67197be87aa48019afe.tar.gz
sv_uni_display(): do not add the "...", let the caller
do it if wanted, and be prepared for more display options. p4raw-id: //depot/perl@12612
-rw-r--r--dump.c13
-rw-r--r--embed.h2
-rwxr-xr-xembed.pl2
-rw-r--r--proto.h2
4 files changed, 9 insertions, 10 deletions
diff --git a/dump.c b/dump.c
index 07ef295480..b5e9fbfa53 100644
--- a/dump.c
+++ b/dump.c
@@ -143,12 +143,12 @@ Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim)
}
char *
-Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim)
+Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags)
{
int truncated = 0;
char *s, *e;
- sv_setpvn(dsv, "\"", 1);
+ sv_setpvn(dsv, "", 0);
for (s = SvPVX(ssv), e = s + SvCUR(ssv); s < e; s += UTF8SKIP(s)) {
UV u;
if (pvlim && SvCUR(dsv) >= pvlim) {
@@ -158,7 +158,6 @@ Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim)
u = utf8_to_uvchr((U8*)s, 0);
Perl_sv_catpvf(aTHX_ dsv, "\\x{%"UVxf"}", u);
}
- sv_catpvn(dsv, "\"", 1);
if (truncated)
sv_catpvn(dsv, "...", 3);
@@ -301,8 +300,8 @@ Perl_sv_peek(pTHX_ SV *sv)
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 %s]",
- sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv)));
+ Perl_sv_catpvf(aTHX_ t, " [UTF8 \"%s\"]",
+ sv_uni_display(tmp, sv, 8 * sv_len_utf8(sv), 0));
SvREFCNT_dec(tmp);
}
}
@@ -1135,7 +1134,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
PerlIO_printf(file, "( %s . ) ", pv_display(d, SvPVX(sv)-SvIVX(sv), SvIVX(sv), 0, pvlim));
PerlIO_printf(file, "%s", pv_display(d, SvPVX(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)));
+ PerlIO_printf(file, " [UTF8 \"%s\"]", sv_uni_display(d, sv, 8 * sv_len_utf8(sv), 0));
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));
@@ -1267,7 +1266,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo
elt = hv_iterval(hv, he);
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)));
+ PerlIO_printf(file, "[UTF8 \"%s\"] ", sv_uni_display(d, keysv, 8 * sv_len_utf8(keysv), 0));
PerlIO_printf(file, "HASH = 0x%"UVxf"\n", (UV)hash);
do_sv_dump(level+1, file, elt, nest+1, maxnest, dumpops, pvlim);
}
diff --git a/embed.h b/embed.h
index 8c584a5a08..3a85dd4bde 100644
--- a/embed.h
+++ b/embed.h
@@ -2311,7 +2311,7 @@
#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 sv_uni_display(a,b,c,d) Perl_sv_uni_display(aTHX_ a,b,c,d)
#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)
diff --git a/embed.pl b/embed.pl
index 6c20660961..f88a919828 100755
--- a/embed.pl
+++ b/embed.pl
@@ -1904,7 +1904,7 @@ Apd |void |sv_usepvn_mg |SV *sv|char *ptr|STRLEN len
Ap |MGVTBL*|get_vtbl |int vtbl_id
p |char* |pv_display |SV *dsv|char *pv|STRLEN cur|STRLEN len \
|STRLEN pvlim
-p |char* |sv_uni_display |SV *dsv|SV *ssv|STRLEN pvlim
+p |char* |sv_uni_display |SV *dsv|SV *ssv|STRLEN pvlim|UV flags
Afp |void |dump_indent |I32 level|PerlIO *file|const char* pat|...
Ap |void |dump_vindent |I32 level|PerlIO *file|const char* pat \
|va_list *args
diff --git a/proto.h b/proto.h
index b56817a7c9..1dba98c3a9 100644
--- a/proto.h
+++ b/proto.h
@@ -897,7 +897,7 @@ PERL_CALLCONV void Perl_sv_setsv_mg(pTHX_ SV *dstr, SV *sstr);
PERL_CALLCONV void Perl_sv_usepvn_mg(pTHX_ SV *sv, char *ptr, STRLEN len);
PERL_CALLCONV MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id);
PERL_CALLCONV char* Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim);
-PERL_CALLCONV char* Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim);
+PERL_CALLCONV char* Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags);
PERL_CALLCONV void Perl_dump_indent(pTHX_ I32 level, PerlIO *file, const char* pat, ...)
#ifdef CHECK_FORMAT
__attribute__((format(printf,pTHX_3,pTHX_4)))