summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@khw-desktop.(none)>2010-05-12 11:50:19 -0600
committerRafael Garcia-Suarez <rgs@consttype.org>2010-05-17 10:19:45 +0200
commit6ae9f32af6f08fad4023edda45596d5c654483de (patch)
treedd28d23beba82e55a20c728cf080aa35caffc92f /handy.h
parent3e462cdc2087ddf90984010fabd80c30db92bfa0 (diff)
downloadperl-6ae9f32af6f08fad4023edda45596d5c654483de.tar.gz
PATCH: Clean up EBCDIC handling of \cX
The function perl_ebcdic_control() is unnecessary, as the toCTRL macro that calls it can be changed to just map EBCDIC to ASCII first, and then doing the normal procedure. This means that EBCDIC and ASCII will no longer diverge. Currently, EBCIDIC gives a syntax error for inputs outside its domain, whereas the ASCII version accepts some of them.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h13
1 files changed, 3 insertions, 10 deletions
diff --git a/handy.h b/handy.h
index 3f44c69cba..d17b8d3f2c 100644
--- a/handy.h
+++ b/handy.h
@@ -664,16 +664,9 @@ parameter, casts can silently truncate and yield wrong results.
#define isPSXSPC_LC_utf8(c) (isSPACE_LC_utf8(c) ||(c) == '\f')
#define isBLANK_LC_utf8(c) isBLANK(c) /* could be wrong */
-#ifdef EBCDIC
-# ifdef PERL_IMPLICIT_CONTEXT
-# define toCTRL(c) Perl_ebcdic_control(aTHX_ c)
-# else
-# define toCTRL Perl_ebcdic_control
-# endif
-#else
- /* This conversion works both ways, strangely enough. */
-# define toCTRL(c) (toUPPER(c) ^ 64)
-#endif
+/* This conversion works both ways, strangely enough. On EBCDIC platforms,
+ * CTRL-@ is 0, CTRL-A is 1, etc, just like on ASCII */
+# define toCTRL(c) (toUPPER(NATIVE_TO_UNI(c)) ^ 64)
/* Line numbers are unsigned, 32 bits. */
typedef U32 line_t;