From: Nicholas Clark Date: Mon, 31 Oct 2005 14:51:48 +0000 (+0000) Subject: A more elegant way to deal with utf8n_to_uvchr() and utf8n_to_uvuni(). X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1754c1a12c44346c579c5581660df4064b19f4a0;p=p5sagit%2Fp5-mst-13.2.git A more elegant way to deal with utf8n_to_uvchr() and utf8n_to_uvuni(). p4raw-id: //depot/perl@25926 --- diff --git a/embed.fnc b/embed.fnc index de28479..a3746fe 100644 --- a/embed.fnc +++ b/embed.fnc @@ -857,9 +857,21 @@ ApMd |U8* |bytes_from_utf8|NN const U8 *s|NN STRLEN *len|NULLOK bool *is_utf8 ApMd |U8* |bytes_to_utf8 |NN const U8 *s|NN STRLEN *len Apd |UV |utf8_to_uvchr |NN const U8 *s|NULLOK STRLEN *retlen Apd |UV |utf8_to_uvuni |NN const U8 *s|NULLOK STRLEN *retlen + +#ifdef EBCDIC Adp |UV |utf8n_to_uvchr |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags +#else +Adpbm |UV |utf8n_to_uvchr |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags +#endif + Adp |UV |utf8n_to_uvuni |NN const U8 *s|STRLEN curlen|NULLOK STRLEN *retlen|U32 flags + +#ifdef EBCDIC Apd |U8* |uvchr_to_utf8 |NN U8 *d|UV uv +#else +Apdbm |U8* |uvchr_to_utf8 |NN U8 *d|UV uv +#endif + Apbm |U8* |uvuni_to_utf8 |NN U8 *d|UV uv Ap |U8* |uvchr_to_utf8_flags |NN U8 *d|UV uv|UV flags Apd |U8* |uvuni_to_utf8_flags |NN U8 *d|UV uv|UV flags diff --git a/embed.h b/embed.h index bc51e88..1309bc8 100644 --- a/embed.h +++ b/embed.h @@ -884,9 +884,15 @@ #define bytes_to_utf8 Perl_bytes_to_utf8 #define utf8_to_uvchr Perl_utf8_to_uvchr #define utf8_to_uvuni Perl_utf8_to_uvuni +#ifdef EBCDIC #define utf8n_to_uvchr Perl_utf8n_to_uvchr +#else +#endif #define utf8n_to_uvuni Perl_utf8n_to_uvuni +#ifdef EBCDIC #define uvchr_to_utf8 Perl_uvchr_to_utf8 +#else +#endif #define uvchr_to_utf8_flags Perl_uvchr_to_utf8_flags #define uvuni_to_utf8_flags Perl_uvuni_to_utf8_flags #define pv_uni_display Perl_pv_uni_display @@ -2860,9 +2866,15 @@ #define bytes_to_utf8(a,b) Perl_bytes_to_utf8(aTHX_ a,b) #define utf8_to_uvchr(a,b) Perl_utf8_to_uvchr(aTHX_ a,b) #define utf8_to_uvuni(a,b) Perl_utf8_to_uvuni(aTHX_ a,b) +#ifdef EBCDIC #define utf8n_to_uvchr(a,b,c,d) Perl_utf8n_to_uvchr(aTHX_ a,b,c,d) +#else +#endif #define utf8n_to_uvuni(a,b,c,d) Perl_utf8n_to_uvuni(aTHX_ a,b,c,d) +#ifdef EBCDIC #define uvchr_to_utf8(a,b) Perl_uvchr_to_utf8(aTHX_ a,b) +#else +#endif #define uvchr_to_utf8_flags(a,b,c) Perl_uvchr_to_utf8_flags(aTHX_ a,b,c) #define uvuni_to_utf8_flags(a,b,c) Perl_uvuni_to_utf8_flags(aTHX_ a,b,c) #define pv_uni_display(a,b,c,d,e) Perl_pv_uni_display(aTHX_ a,b,c,d,e) diff --git a/proto.h b/proto.h index 3aa73de..294d62b 100644 --- a/proto.h +++ b/proto.h @@ -2388,15 +2388,31 @@ PERL_CALLCONV UV Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) PERL_CALLCONV UV Perl_utf8_to_uvuni(pTHX_ const U8 *s, STRLEN *retlen) __attribute__nonnull__(pTHX_1); + +#ifdef EBCDIC PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) __attribute__nonnull__(pTHX_1); +#else +/* PERL_CALLCONV UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) + __attribute__nonnull__(pTHX_1); */ + +#endif + PERL_CALLCONV UV Perl_utf8n_to_uvuni(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) __attribute__nonnull__(pTHX_1); + +#ifdef EBCDIC PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) __attribute__nonnull__(pTHX_1); +#else +/* PERL_CALLCONV U8* Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) + __attribute__nonnull__(pTHX_1); */ + +#endif + /* PERL_CALLCONV U8* Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) __attribute__nonnull__(pTHX_1); */ diff --git a/utf8.c b/utf8.c index e9794fc..84d5553 100644 --- a/utf8.c +++ b/utf8.c @@ -614,8 +614,8 @@ returned and retlen is set, if possible, to -1. UV Perl_utf8_to_uvchr(pTHX_ const U8 *s, STRLEN *retlen) { - return Perl_utf8n_to_uvchr(aTHX_ s, UTF8_MAXBYTES, retlen, - ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); + return utf8n_to_uvchr(s, UTF8_MAXBYTES, retlen, + ckWARN(WARN_UTF8) ? 0 : UTF8_ALLOW_ANY); } /* @@ -1773,7 +1773,6 @@ is the recommended wide native character-aware way of saying /* On ASCII machines this is normally a macro but we want a real function in case XS code wants it */ -#undef Perl_uvchr_to_utf8 U8 * Perl_uvchr_to_utf8(pTHX_ U8 *d, UV uv) { @@ -1802,7 +1801,6 @@ Allows length and flags to be passed to low level routine. /* On ASCII machines this is normally a macro but we want a real function in case XS code wants it */ -#undef Perl_utf8n_to_uvchr UV Perl_utf8n_to_uvchr(pTHX_ const U8 *s, STRLEN curlen, STRLEN *retlen, U32 flags) diff --git a/utf8.h b/utf8.h index 18cb7b2..837f7fb 100644 --- a/utf8.h +++ b/utf8.h @@ -58,8 +58,8 @@ END_EXTERN_C #define ASCII_TO_NEED(enc,ch) (ch) /* As there are no translations avoid the function wrapper */ -#define Perl_utf8n_to_uvchr Perl_utf8n_to_uvuni -#define Perl_uvchr_to_utf8 Perl_uvuni_to_utf8 +#define utf8n_to_uvchr utf8n_to_uvuni +#define uvchr_to_utf8 uvuni_to_utf8 /*