diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-16 17:23:21 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-03-16 17:23:21 +0000 |
commit | db42d1485c38c3442e7b62e63d45f5e5b9b66ee1 (patch) | |
tree | 3684e9dd00bb3225b0452a0b9bfd12a7840a365f /utf8.h | |
parent | 60f7a97ae5b801dc0b103022b69814f3a1161856 (diff) | |
download | perl-db42d1485c38c3442e7b62e63d45f5e5b9b66ee1.tar.gz |
EBCDIC Fixes.
p4raw-id: //depot/perlio@9180
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -88,7 +88,7 @@ END_EXTERN_C #define UTF8_IS_START(c) (((U8)c) >= 0xc0 && (((U8)c) <= 0xfd)) #define UTF8_IS_CONTINUATION(c) (((U8)c) >= 0x80 && (((U8)c) <= 0xbf)) #define UTF8_IS_CONTINUED(c) (((U8)c) & 0x80) -#define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfc) != 0xc0) +#define UTF8_IS_DOWNGRADEABLE_START(c) (((U8)c & 0xfc) == 0xc0) #define UTF8_CONTINUATION_MASK ((U8)0x3f) #define UTF8_ACCUMULATION_SHIFT 6 @@ -139,14 +139,18 @@ END_EXTERN_C /* 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)]) +#define NATIVE_TO_ASCII(ch) PL_e2a[(ch)&255] +#define ASCII_TO_NATIVE(ch) PL_a2e[(ch)&255] +#define NATIVE_TO_UNI(ch) (((ch) > 255) ? (ch) : (UV) PL_e2a[(ch)]) +#define UNI_TO_NATIVE(ch) (((ch) > 255) ? (ch) : (UV) PL_a2e[(ch)]) +#define NATIVE_TO_NEED(enc,ch) ((enc) ? NATIVE_TO_ASCII(ch) : (ch)) +#define ASCII_TO_NEED(enc,ch) ((enc) ? (ch) : ASCII_TO_NATIVE(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) +#define NATIVE_TO_ASCII(ch) (ch) +#define ASCII_TO_NATIVE(ch) (ch) +#define UNI_TO_NATIVE(ch) (ch) +#define NATIVE_TO_UNI(ch) (ch) +#define NATIVE_TO_NEED(enc,ch) (ch) +#define ASCII_TO_NEED(enc,ch) (ch) #endif |