OSDN Git Service

Added __BEGIN_DECLS and __END_DECLS to the files that didn't have
[uclinux-h8/uClibc.git] / include / ctype.h
1 /* ctype.h
2  * Character classification and conversion */
3
4 #ifndef __CTYPE_H
5 #define __CTYPE_H
6
7 #include <features.h>
8
9 __BEGIN_DECLS
10
11 /* For now, just always use the functions instead of the macros...*/
12 #define __USE_CTYPE_C_FUNCTIONS
13
14 /* Locale-compatible macros/inlines have yet to be implemented. */
15 #if defined(__UCLIBC_HAS_LOCALE__) && !defined(__USE_CTYPE_C_FUNCTIONS)
16 #define __USE_CTYPE_C_FUNCTIONS
17 #endif
18
19 #ifdef __USE_CTYPE_C_FUNCTIONS
20 /* function prototpes */ 
21 extern int isalnum(int c);
22 extern int isalpha(int c);
23 extern int isascii(int c);
24 extern int iscntrl(int c);
25 extern int isdigit(int c);
26 extern int isgraph(int c);
27 extern int islower(int c);
28 extern int isprint(int c);
29 extern int ispunct(int c);
30 extern int isspace(int c);
31 extern int isupper(int c);
32 extern int isxdigit(int c);
33 extern int isxlower(int c);
34 extern int isxupper(int c);
35 extern int toascii(int c);
36 extern int tolower(int c);
37 extern int toupper(int c);
38
39 #else
40
41 /* macro definitions */
42 #define isalnum(c)  (isalpha(c) || isdigit(c))
43 #define isalpha(c)  (isupper(c) || islower(c))
44 #define isascii(c)  (c > 0 && c <= 0x7f)
45 #define iscntrl(c)  ((c >= 0) && ((c <= 0x1F) || (c == 0x7f)))
46 #define isdigit(c)  (c >= '0' && c <= '9')
47 #define isgraph(c)  (c != ' ' && isprint(c))
48 #define islower(c)  (c >=  'a' && c <= 'z')
49 #define isprint(c)  (c >= ' ' && c <= '~')
50 #define ispunct(c)  ((c > ' ' && c <= '~') && !isalnum(c))
51 #define isspace(c)  (c == ' ' || c == '\f' || c == '\n' || c == '\r' ||\
52                         c == '\t' || c == '\v')
53 #define isupper(c)  (c >=  'A' && c <= 'Z')
54 #define isxdigit(c) (isxupper(c) || isxlower(c))
55 #define isxlower(c) (isdigit(c) || (c >= 'a' && c <= 'f'))
56 #define isxupper(c) (isdigit(c) || (c >= 'A' && c <= 'F'))
57 #define toascii(c)  (c & 0x7f)
58 #define tolower(c)  (isupper(c) ? ( c - 'A' + 'a') : (c))
59 #define toupper(c)  (islower(c) ? (c - 'a' + 'A') : (c))
60
61 #endif
62
63 __END_DECLS
64
65 #endif /* __CTYPE_H */