diff options
author | Peter Prymmer <PPrymmer@factset.com> | 2001-03-08 08:23:25 -0800 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-03-09 01:01:27 +0000 |
commit | 3bd709b1a63d554f3d98d5394be78ed628eb46da (patch) | |
tree | b8add48b769c1a6db079b5276eb469d4c75a1ef4 /utf8.h | |
parent | 538c41fbfff9c31ee1c8c40096f132b1ea496531 (diff) | |
download | perl-3bd709b1a63d554f3d98d5394be78ed628eb46da.tar.gz |
Re: Unicode/EBCDIC
Message-ID: <Pine.OSF.4.10.10103081617390.377472-100000@aspara.forte.com>
p4raw-id: //depot/perl@9082
Diffstat (limited to 'utf8.h')
-rw-r--r-- | utf8.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -131,3 +131,22 @@ END_EXTERN_C #endif #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 */ + +#ifdef EBCDIC +#define NATIVE_TO_ASCII(ch) PL_e2a[(ch)] +#define ASCII_TO_NATIVE(ch) PL_a2e[(ch)] +#else +#define NATIVE_TO_ASCII(ch) (ch) +#define ASCII_TO_NATIVE(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 |