1 /*  Copyright (C) 2008  Denys Vlasenko  <vda.linux@googlemail.com>
2  *
3  *  This library is free software; you can redistribute it and/or
4  *  modify it under the terms of the GNU Lesser General Public
5  *  License as published by the Free Software Foundation; either
6  *  version 2.1 of the License, or (at your option) any later version.
7  */
8 
9 #ifndef _BITS_UCLIBC_CHARCLASS_H
10 #define _BITS_UCLIBC_CHARCLASS_H
11 
12 /* Taking advantage of the C99 mutual-exclusion guarantees for the various
13  * (w)ctype classes, including the descriptions of printing and control
14  * (w)chars, we can place each in one of the following mutually-exlusive
15  * subsets.  Since there are less than 16, we can store the data for
16  * each (w)chars in a nibble. In contrast, glibc uses an unsigned int
17  * per (w)char, with one bit flag for each is* type.  While this allows
18  * a simple '&' operation to determine the type vs. a range test and a
19  * little special handling for the "blank" and "xdigit" types in my
20  * approach, it also uses 8 times the space for the tables on the typical
21  * 32-bit archs we supported.*/
22 enum {
23 	__CTYPE_unclassified = 0,
24 	__CTYPE_alpha_nonupper_nonlower,
25 	__CTYPE_alpha_lower,
26 	__CTYPE_alpha_upper_lower,
27 	__CTYPE_alpha_upper,
28 	__CTYPE_digit,
29 	__CTYPE_punct,
30 	__CTYPE_graph,
31 	__CTYPE_print_space_nonblank,
32 	__CTYPE_print_space_blank,
33 	__CTYPE_space_nonblank_noncntrl,
34 	__CTYPE_space_blank_noncntrl,
35 	__CTYPE_cntrl_space_nonblank,
36 	__CTYPE_cntrl_space_blank,
37 	__CTYPE_cntrl_nonspace
38 };
39 
40 #endif
41