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