uClibc_charclass.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #ifndef _BITS_UCLIBC_CHARCLASS_H
  9. #define _BITS_UCLIBC_CHARCLASS_H
  10. /* Taking advantage of the C99 mutual-exclusion guarantees for the various
  11. * (w)ctype classes, including the descriptions of printing and control
  12. * (w)chars, we can place each in one of the following mutually-exlusive
  13. * subsets. Since there are less than 16, we can store the data for
  14. * each (w)chars in a nibble. In contrast, glibc uses an unsigned int
  15. * per (w)char, with one bit flag for each is* type. While this allows
  16. * a simple '&' operation to determine the type vs. a range test and a
  17. * little special handling for the "blank" and "xdigit" types in my
  18. * approach, it also uses 8 times the space for the tables on the typical
  19. * 32-bit archs we supported.*/
  20. enum {
  21. __CTYPE_unclassified = 0,
  22. __CTYPE_alpha_nonupper_nonlower,
  23. __CTYPE_alpha_lower,
  24. __CTYPE_alpha_upper_lower,
  25. __CTYPE_alpha_upper,
  26. __CTYPE_digit,
  27. __CTYPE_punct,
  28. __CTYPE_graph,
  29. __CTYPE_print_space_nonblank,
  30. __CTYPE_print_space_blank,
  31. __CTYPE_space_nonblank_noncntrl,
  32. __CTYPE_space_blank_noncntrl,
  33. __CTYPE_cntrl_space_nonblank,
  34. __CTYPE_cntrl_space_blank,
  35. __CTYPE_cntrl_nonspace
  36. };
  37. #endif