ctype.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef _CTYPE_H
  2. #define _CTYPE_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <features.h>
  7. int isalnum(int);
  8. int isalpha(int);
  9. int isblank(int);
  10. int iscntrl(int);
  11. int isdigit(int);
  12. int isgraph(int);
  13. int islower(int);
  14. int isprint(int);
  15. int ispunct(int);
  16. int isspace(int);
  17. int isupper(int);
  18. int isxdigit(int);
  19. int tolower(int);
  20. int toupper(int);
  21. #ifndef __cplusplus
  22. static __inline int __isspace(int _c)
  23. {
  24. return _c == ' ' || (unsigned)_c-'\t' < 5;
  25. }
  26. #define isalpha(a) (0 ? isalpha(a) : (((unsigned)(a)|32)-'a') < 26)
  27. #define isdigit(a) (0 ? isdigit(a) : ((unsigned)(a)-'0') < 10)
  28. #define islower(a) (0 ? islower(a) : ((unsigned)(a)-'a') < 26)
  29. #define isupper(a) (0 ? isupper(a) : ((unsigned)(a)-'A') < 26)
  30. #define isprint(a) (0 ? isprint(a) : ((unsigned)(a)-0x20) < 0x5f)
  31. #define isgraph(a) (0 ? isgraph(a) : ((unsigned)(a)-0x21) < 0x5e)
  32. #define isspace(a) __isspace(a)
  33. #endif
  34. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  35. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  36. || defined(_BSD_SOURCE)
  37. #define __NEED_locale_t
  38. #include <bits/alltypes.h>
  39. int isalnum_l(int, locale_t);
  40. int isalpha_l(int, locale_t);
  41. int isblank_l(int, locale_t);
  42. int iscntrl_l(int, locale_t);
  43. int isdigit_l(int, locale_t);
  44. int isgraph_l(int, locale_t);
  45. int islower_l(int, locale_t);
  46. int isprint_l(int, locale_t);
  47. int ispunct_l(int, locale_t);
  48. int isspace_l(int, locale_t);
  49. int isupper_l(int, locale_t);
  50. int isxdigit_l(int, locale_t);
  51. int tolower_l(int, locale_t);
  52. int toupper_l(int, locale_t);
  53. int isascii(int);
  54. int toascii(int);
  55. #define _tolower(a) ((a)|0x20)
  56. #define _toupper(a) ((a)&0x5f)
  57. #ifndef __cplusplus
  58. #define isascii(a) (0 ? isascii(a) : (unsigned)(a) < 128)
  59. #endif
  60. #endif
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif