summaryrefslogtreecommitdiff
path: root/utfebcdic.h
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2013-02-07 13:52:31 -0700
committerKarl Williamson <public@khwilliamson.com>2013-08-29 09:55:48 -0600
commit59a449d552a392b1e9daa9122be82f385d8c1f04 (patch)
treefff647105c8139c11220e4a5405020b8b99038b1 /utfebcdic.h
parent077dbbf3d59ab49208d31bc4c46823f66b78b02a (diff)
downloadperl-59a449d552a392b1e9daa9122be82f385d8c1f04.tar.gz
utf8.h, utfebcdic.h: Create less confusing #defines
This commit creates macros whose names mean something to me, and which I don't find confusing. The older names are retained for backwards compatibility. Future commits will fix bugs I introduced from misunderstanding the meaning of the older names. The older names are now #defined in terms of the newer ones, and moved so that they are only defined once, valid for both ASCII and EBCDIC platforms.
Diffstat (limited to 'utfebcdic.h')
-rw-r--r--utfebcdic.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/utfebcdic.h b/utfebcdic.h
index e7f5f32c69..9f2bfa6d9f 100644
--- a/utfebcdic.h
+++ b/utfebcdic.h
@@ -521,14 +521,12 @@ END_EXTERN_C
/* EBCDIC-happy ways of converting native code to UTF-8 */
-/* Native to iso-8859-1 */
-#define NATIVE_TO_ASCII(ch) PL_e2a[(U8)(ch)]
-#define ASCII_TO_NATIVE(ch) PL_a2e[(U8)(ch)]
-/* Transform after encoding, essentially converts to/from I8 */
-#define NATIVE_TO_UTF(ch) PL_e2utf[(U8)(ch)] /* to I8 */
-#define NATIVE_TO_I8(ch) NATIVE_TO_UTF(ch) /* synonym */
-#define UTF_TO_NATIVE(ch) PL_utf2e[(U8)(ch)] /* from I8 */
-#define I8_TO_NATIVE(ch) UTF_TO_NATIVE(ch) /* synonym */
+#define NATIVE_TO_LATIN1(ch) PL_e2a[(U8)(ch)]
+#define LATIN1_TO_NATIVE(ch) PL_a2e[(U8)(ch)]
+
+#define NATIVE_UTF8_TO_I8(ch) (ch) PL_e2utf[(U8)(ch)]
+#define I8_TO_NATIVE_UTF8(ch) (ch) PL_utf2e[(U8)(ch)]
+
/* Transform in wide UV char space */
#define NATIVE_TO_UNI(ch) (((ch) > 255) ? (ch) : NATIVE_TO_ASCII(ch))
#define UNI_TO_NATIVE(ch) (((ch) > 255) ? (ch) : ASCII_TO_NATIVE(ch))