From: Jarkko Hietaniemi Date: Mon, 19 Nov 2001 18:02:14 +0000 (+0000) Subject: The _uni_display should not be in dump.c since they X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e6b2e7559f25acecc651c2f0d304b65728937d82;p=p5sagit%2Fp5-mst-13.2.git The _uni_display should not be in dump.c since they are used under normal operation (S_not_a_number()). p4raw-id: //depot/perl@13099 --- diff --git a/dump.c b/dump.c index 0ac6b0c..863b006 100644 --- a/dump.c +++ b/dump.c @@ -143,35 +143,6 @@ Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN cur, STRLEN len, STRLEN pvlim) } char * -Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags) -{ - int truncated = 0; - char *s, *e; - - sv_setpvn(dsv, "", 0); - for (s = (char *)spv, e = s + len; 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{%"UVxf"}", u); - } - if (truncated) - sv_catpvn(dsv, "...", 3); - - return SvPVX(dsv); -} - -char * -Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags) -{ - return Perl_pv_uni_display(aTHX_ dsv, (U8*)SvPVX(ssv), SvCUR(ssv), - pvlim, flags); -} - -char * Perl_sv_peek(pTHX_ SV *sv) { SV *t = sv_newmortal(); diff --git a/embed.h b/embed.h index 9f4ab86..269a117 100644 --- a/embed.h +++ b/embed.h @@ -751,6 +751,8 @@ #define utf8n_to_uvuni Perl_utf8n_to_uvuni #define uvchr_to_utf8 Perl_uvchr_to_utf8 #define uvuni_to_utf8 Perl_uvuni_to_utf8 +#define pv_uni_display Perl_pv_uni_display +#define sv_uni_display Perl_sv_uni_display #define vivify_defelem Perl_vivify_defelem #define vivify_ref Perl_vivify_ref #define wait4pid Perl_wait4pid @@ -808,8 +810,6 @@ #define sv_usepvn_mg Perl_sv_usepvn_mg #define get_vtbl Perl_get_vtbl #define pv_display Perl_pv_display -#define pv_uni_display Perl_pv_uni_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 @@ -2265,6 +2265,8 @@ #define utf8n_to_uvuni(a,b,c,d) Perl_utf8n_to_uvuni(aTHX_ a,b,c,d) #define uvchr_to_utf8(a,b) Perl_uvchr_to_utf8(aTHX_ a,b) #define uvuni_to_utf8(a,b) Perl_uvuni_to_utf8(aTHX_ a,b) +#define pv_uni_display(a,b,c,d,e) Perl_pv_uni_display(aTHX_ a,b,c,d,e) +#define sv_uni_display(a,b,c,d) Perl_sv_uni_display(aTHX_ a,b,c,d) #define vivify_defelem(a) Perl_vivify_defelem(aTHX_ a) #define vivify_ref(a,b) Perl_vivify_ref(aTHX_ a,b) #define wait4pid(a,b,c) Perl_wait4pid(aTHX_ a,b,c) @@ -2318,8 +2320,6 @@ #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 pv_uni_display(a,b,c,d,e) Perl_pv_uni_display(aTHX_ a,b,c,d,e) -#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 dc99bdf..d91f2bd 100755 --- a/embed.pl +++ b/embed.pl @@ -1850,6 +1850,9 @@ Adp |UV |utf8n_to_uvchr |U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags Adp |UV |utf8n_to_uvuni |U8 *s|STRLEN curlen|STRLEN* retlen|U32 flags Apd |U8* |uvchr_to_utf8 |U8 *d|UV uv Apd |U8* |uvuni_to_utf8 |U8 *d|UV uv +Ap |char* |pv_uni_display |SV *dsv|U8 *spv|STRLEN len \ + |STRLEN pvlim|UV flags +Ap |char* |sv_uni_display |SV *dsv|SV *ssv|STRLEN pvlim|UV flags p |void |vivify_defelem |SV* sv p |void |vivify_ref |SV* sv|U32 to_what p |I32 |wait4pid |Pid_t pid|int* statusp|int flags @@ -1908,9 +1911,6 @@ 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 -Ap |char* |pv_uni_display |SV *dsv|U8 *spv|STRLEN len \ - |STRLEN pvlim|UV flags -Ap |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/global.sym b/global.sym index 5d0372f..86e1491 100644 --- a/global.sym +++ b/global.sym @@ -495,6 +495,8 @@ Perl_utf8n_to_uvchr Perl_utf8n_to_uvuni Perl_uvchr_to_utf8 Perl_uvuni_to_utf8 +Perl_pv_uni_display +Perl_sv_uni_display Perl_warn Perl_vwarn Perl_warner @@ -530,8 +532,6 @@ Perl_sv_setpvn_mg Perl_sv_setsv_mg Perl_sv_usepvn_mg Perl_get_vtbl -Perl_pv_uni_display -Perl_sv_uni_display Perl_dump_indent Perl_dump_vindent Perl_do_gv_dump diff --git a/proto.h b/proto.h index 00ceb4a..efb987b 100644 --- a/proto.h +++ b/proto.h @@ -828,6 +828,8 @@ PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ U8 *s, STRLEN curlen, STRLEN* retlen, PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ U8 *s, STRLEN curlen, STRLEN* retlen, U32 flags); PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv); PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv); +PERL_CALLCONV char* Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags); +PERL_CALLCONV char* Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags); PERL_CALLCONV void Perl_vivify_defelem(pTHX_ SV* sv); PERL_CALLCONV void Perl_vivify_ref(pTHX_ SV* sv, U32 to_what); PERL_CALLCONV I32 Perl_wait4pid(pTHX_ Pid_t pid, int* statusp, int flags); @@ -901,8 +903,6 @@ 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_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags); -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))) diff --git a/utf8.c b/utf8.c index 576231f..d73809c 100644 --- a/utf8.c +++ b/utf8.c @@ -1515,4 +1515,31 @@ Perl_utf8n_to_uvchr(pTHX_ U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) return UNI_TO_NATIVE(uv); } +char * +Perl_pv_uni_display(pTHX_ SV *dsv, U8 *spv, STRLEN len, STRLEN pvlim, UV flags) +{ + int truncated = 0; + char *s, *e; + + sv_setpvn(dsv, "", 0); + for (s = (char *)spv, e = s + len; 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{%"UVxf"}", u); + } + if (truncated) + sv_catpvn(dsv, "...", 3); + + return SvPVX(dsv); +} +char * +Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags) +{ + return Perl_pv_uni_display(aTHX_ dsv, (U8*)SvPVX(ssv), SvCUR(ssv), + pvlim, flags); +}