-#if 0
-/* Classification codes. */
-
-static const char *typename[] = {
- "C_unclassified",
- "C_alpha_nonupper_nonlower",
- "C_alpha_lower",
- "C_alpha_upper_lower",
- "C_alpha_upper",
- "C_digit",
- "C_punct",
- "C_graph",
- "C_print_space_nonblank",
- "C_print_space_blank",
- "C_space_nonblank_noncntrl",
- "C_space_blank_noncntrl",
- "C_cntrl_space_nonblank",
- "C_cntrl_space_blank",
- "C_cntrl_nonspace",
- "empty_slot"
-};
-#endif
-
-#if 0
-/* Taking advantage of the C99 mutual-exclusion guarantees for the various
- * (w)ctype classes, including the descriptions of printing and control
- * (w)chars, we can place each in one of the following mutually-exlusive
- * subsets. Since there are less than 16, we can store the data for
- * each (w)chars in a nibble. In contrast, glibc uses an unsigned int
- * per (w)char, with one bit flag for each is* type. While this allows
- * a simple '&' operation to determine the type vs. a range test and a
- * little special handling for the "blank" and "xdigit" types in my
- * approach, it also uses 8 times the space for the tables on the typical
- * 32-bit archs we supported.*/
-enum {
- __CTYPE_unclassified = 0,
- __CTYPE_alpha_nonupper_nonlower,
- __CTYPE_alpha_lower,
- __CTYPE_alpha_upper_lower,
- __CTYPE_alpha_upper,
- __CTYPE_digit,
- __CTYPE_punct,
- __CTYPE_graph,
- __CTYPE_print_space_nonblank,
- __CTYPE_print_space_blank,
- __CTYPE_space_nonblank_noncntrl,
- __CTYPE_space_blank_noncntrl,
- __CTYPE_cntrl_space_nonblank,
- __CTYPE_cntrl_space_blank,
- __CTYPE_cntrl_nonspace,
-};
-#endif
-
-#define __CTYPE_isxdigit(D,X) \
- (__CTYPE_isdigit(D) || (((unsigned int)(((X)|0x20) - 'a')) <= 5))
-
-#define mywalnum(x) __CTYPE_isalnum(d)
-#define mywalpha(x) __CTYPE_isalpha(d)
-#define mywblank(x) __CTYPE_isblank(d)
-#define mywcntrl(x) __CTYPE_iscntrl(d)
-#define mywdigit(x) __CTYPE_isdigit(d)
-#define mywgraph(x) __CTYPE_isgraph(d)
-#define mywlower(x) __CTYPE_islower(d)
-#define mywprint(x) __CTYPE_isprint(d)
-#define mywpunct(x) __CTYPE_ispunct(d)
-#define mywspace(x) __CTYPE_isspace(d)
-#define mywupper(x) __CTYPE_isupper(d)
-#define mywxdigit(x) __CTYPE_isxdigit(d,x)
+/* Some macros that test for various (w)ctype classes when passed one of the
+ * designator values enumerated above. */
+#define mywalnum(D,C) ((unsigned)(D - 1) <= (__CTYPE_digit - 1))
+#define mywalpha(D,C) ((unsigned)(D - 1) <= (__CTYPE_alpha_upper - 1))
+#define mywblank(D,C) ((unsigned)(D - __CTYPE_print_space_nonblank) <= 5 && (D & 1))
+#define mywcntrl(D,C) ((unsigned)(D - __CTYPE_cntrl_space_nonblank) <= 2)
+#define mywdigit(D,C) (D == __CTYPE_digit)
+#define mywgraph(D,C) ((unsigned)(D - 1) <= (__CTYPE_graph - 1))
+#define mywlower(D,C) ((unsigned)(D - __CTYPE_alpha_lower) <= 1)
+#define mywprint(D,C) ((unsigned)(D - 1) <= (__CTYPE_print_space_blank - 1))
+#define mywpunct(D,C) (D == __CTYPE_punct)
+#define mywspace(D,C) ((unsigned)(D - __CTYPE_print_space_nonblank) <= 5)
+#define mywupper(D,C) ((unsigned)(D - __CTYPE_alpha_upper_lower) <= 1)
+/* #define mywxdigit(D,C) -- isxdigit is untestable this way.
+ * But that's ok as isxdigit() (and isdigit() too) are locale-invariant. */
+#define mywxdigit(D,C) (mywdigit(D,C) || (unsigned)(((C) | 0x20) - 'a') <= 5)