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