diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-10 11:55:43 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-10 11:55:43 +0000 |
commit | 9041c2e396c8c7de7680a2007dc341a9f65be0d0 (patch) | |
tree | 19075254fbc0495a697b5e15ca1f19a99e02ac77 /utf8.h | |
parent | 2ef28da1578e18cf36b9a30b71ac471521d2b507 (diff) | |
download | perl-9041c2e396c8c7de7680a2007dc341a9f65be0d0.tar.gz |
EBCDIC sanity - phase I
- rename utf8/uv functions to indicate what sort of uv they provide (uvuni/uvchr)
- use utf8n_xxxx (c.f. pvn) for forms which take length.
- back out vN.N and $^V exceptions to e2a/a2e
- make "locale" isxxx macros be uvchr (may be redundant?)
Not clear yet that toUPPER_uni et. al. return being handled correctly.
The tr// and rexexp stuff still needs an audit, assumption is they are working
in Unicode space.
Need to provide v5.6 names for XS modules (decide is uni or chr ?).
p4raw-id: //depot/perlio@9096
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -65,7 +65,7 @@ END_EXTERN_C #define UTF8_QUAD_MAX UINT64_C(0x1000000000) /* - + The following table is from Unicode 3.1. Code Points 1st Byte 2nd Byte 3rd Byte 4th Byte @@ -100,7 +100,7 @@ END_EXTERN_C (uv) < 0x200000 ? 4 : \ (uv) < 0x4000000 ? 5 : \ (uv) < 0x80000000 ? 6 : \ - (uv) < UTF8_QUAD_MAX ? 7 : 13 ) + (uv) < UTF8_QUAD_MAX ? 7 : 13 ) #else /* No, I'm not even going to *TRY* putting #ifdef inside a #define */ #define UNISKIP(uv) ( (uv) < 0x80 ? 1 : \ @@ -132,21 +132,17 @@ END_EXTERN_C #define isIDFIRST_lazy(p) isIDFIRST_lazy_if(p,1) #define isALNUM_lazy(p) isALNUM_lazy_if(p,1) -/* EBCDIC-happy ways of converting native code to UTF8; the reverse - process is taken care of in utf8_to_uv */ +/* EBCDIC-happy ways of converting native code to UTF8 */ #ifdef EBCDIC #define NATIVE_TO_ASCII(ch) PL_e2a[(ch)] #define ASCII_TO_NATIVE(ch) PL_a2e[(ch)] +#define UNI_TO_NATIVE(ch) (((ch) > 0x100) ? (ch) : (UV) PL_a2e[(ch)]) +#define NATIVE_TO_UNI(ch) (((ch) > 0x100) ? (ch) : (UV) PL_e2a[(ch)]) #else #define NATIVE_TO_ASCII(ch) (ch) #define ASCII_TO_NATIVE(ch) (ch) +#define UNI_TO_NATIVE(ch) (ch) +#define NATIVE_TO_UNI(ch) (ch) #endif -#define UTF8_NEEDS_UPGRADE(ch) (NATIVE_TO_ASCII(ch) & 0x80) -#define NATIVE_TO_UTF8(ch, string) STMT_START { \ - if (!UTF8_NEEDS_UPGRADE(ch)) \ - *(string)++ = NATIVE_TO_ASCII(ch); \ - else /* uv_to_utf8 is EBCDIC-aware */ \ - string = uv_to_utf8(string, ch); \ - } STMT_END |