summaryrefslogtreecommitdiff
path: root/handy.h
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2014-04-21 20:00:16 -0600
committerKarl Williamson <khw@cpan.org>2014-05-30 09:32:08 -0600
commita4d7a99995775d85baa05f896f05c4848a632792 (patch)
tree3e690d63051666c65d4cc2c99fc5d9906e5154b5 /handy.h
parent837226c8670816658cb9feb82e1b14511241396e (diff)
downloadperl-a4d7a99995775d85baa05f896f05c4848a632792.tar.gz
handy.h: Use some common macros for ASCII/EBCDIC
It turns out that the EBCDIC definitions can be made the same as the ASCII ones, so this moves the ASCII definitions to the spot where other ones common to the 2 platforms reside, and removes the EBCDIC ones. In other words it combines separate definitions into common ones.
Diffstat (limited to 'handy.h')
-rw-r--r--handy.h38
1 files changed, 15 insertions, 23 deletions
diff --git a/handy.h b/handy.h
index 1bf35f691f..ded601705e 100644
--- a/handy.h
+++ b/handy.h
@@ -1106,40 +1106,32 @@ EXTCONST U32 PL_charclass[];
# ifdef EBCDIC
/* Use the native functions. They likely will return false for all
* non-ASCII values, but this makes sure */
-# define isALPHA_A(c) (isASCII(c) && isalpha(c))
-# define isALPHANUMERIC_A(c) (isASCII(c) && isalnum(c))
-# define isCNTRL_A(c) (isASCII(c) && iscntrl(c))
-# define isDIGIT_A(c) (isASCII(c) && isdigit(c))
-# define isGRAPH_A(c) (isASCII(c) && isgraph(c))
# define isLOWER_A(c) (isASCII(c) && islower(c))
# define isPRINT_A(c) (isASCII(c) && isprint(c))
-# define isPUNCT_A(c) (isASCII(c) && ispunct(c))
-# define isSPACE_A(c) (isASCII(c) && isspace(c))
# define isUPPER_A(c) (isASCII(c) && isupper(c))
-# define isXDIGIT_A(c) (isASCII(c) && isxdigit(c))
# else /* ASCII platform. These are coded based on first principals */
-# define isALPHA_A(c) (isUPPER_A(c) || isLOWER_A(c))
-# define isALPHANUMERIC_A(c) (isALPHA_A(c) || isDIGIT_A(c))
-# define isCNTRL_A(c) (isASCII(c) && (! isPRINT_A(c)))
-# define isDIGIT_A(c) ((c) <= '9' && (c) >= '0')
-# define isGRAPH_A(c) (isPRINT_A(c) && (c) != ' ')
# define isLOWER_A(c) ((c) >= 'a' && (c) <= 'z')
# define isPRINT_A(c) (((c) >= 32 && (c) < 127))
-# define isPUNCT_A(c) (isGRAPH_A(c) && (! isALPHANUMERIC_A(c)))
-# define isSPACE_A(c) ((c) == ' ' \
- || (c) == '\t' \
- || (c) == '\n' \
- || (c) == '\r' \
- || (c) =='\v' \
- || (c) == '\f')
# define isUPPER_A(c) ((c) <= 'Z' && (c) >= 'A')
-# define isXDIGIT_A(c) (isDIGIT_A(c) \
- || ((c) >= 'a' && (c) <= 'f') \
- || ((c) <= 'F' && (c) >= 'A'))
# endif /* Below are common definitions for ASCII and non-ASCII */
+# define isALPHA_A(c) (isUPPER_A(c) || isLOWER_A(c))
+# define isALPHANUMERIC_A(c) (isALPHA_A(c) || isDIGIT_A(c))
# define isBLANK_A(c) ((c) == ' ' || (c) == '\t')
+# define isCNTRL_A(c) (isASCII(c) && (! isPRINT_A(c)))
+# define isDIGIT_A(c) ((c) <= '9' && (c) >= '0')
+# define isGRAPH_A(c) (isPRINT_A(c) && (c) != ' ')
# define isIDFIRST_A(c) (isALPHA_A(c) || (c) == '_')
+# define isPUNCT_A(c) (isGRAPH_A(c) && (! isALPHANUMERIC_A(c)))
+# define isSPACE_A(c) ((c) == ' ' \
+ || (c) == '\t' \
+ || (c) == '\n' \
+ || (c) == '\r' \
+ || (c) == '\v' \
+ || (c) == '\f')
# define isWORDCHAR_A(c) (isALPHANUMERIC_A(c) || (c) == '_')
+# define isXDIGIT_A(c) (isDIGIT_A(c) \
+ || ((c) >= 'a' && (c) <= 'f') \
+ || ((c) <= 'F' && (c) >= 'A'))
/* The _L1 macros may be unnecessary for both the utilities and for
* bootstrapping; I (khw) added them during debugging of bootstrapping, and