diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 21:04:40 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-05-06 21:04:40 +0000 |
commit | 50a6ca39ad4ed01922aa4f755f0ca579788226cf (patch) | |
tree | c7881b015b220558167310345b162324c96be15a /firmware/libc/include/ctype.h | |
parent | adb506df14aded06ed6e9ebf8540e6fd383ffd6a (diff) | |
download | rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.tar.gz rockbox-50a6ca39ad4ed01922aa4f755f0ca579788226cf.zip |
Move c/h files implementing/defining standard library stuff into a new libc directory, also standard'ify some parts of the code base (almost entirely #include fixes).
This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/libc/include/ctype.h')
-rw-r--r-- | firmware/libc/include/ctype.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/firmware/libc/include/ctype.h b/firmware/libc/include/ctype.h new file mode 100644 index 0000000000..648e06dc5c --- /dev/null +++ b/firmware/libc/include/ctype.h | |||
@@ -0,0 +1,75 @@ | |||
1 | #ifndef _CTYPE_H_ | ||
2 | #ifdef __cplusplus | ||
3 | extern "C" { | ||
4 | #endif | ||
5 | #define _CTYPE_H_ | ||
6 | |||
7 | #include "_ansi.h" | ||
8 | |||
9 | int _EXFUN(isalnum, (int __c)); | ||
10 | int _EXFUN(isalpha, (int __c)); | ||
11 | int _EXFUN(iscntrl, (int __c)); | ||
12 | int _EXFUN(isdigit, (int __c)); | ||
13 | int _EXFUN(isgraph, (int __c)); | ||
14 | int _EXFUN(islower, (int __c)); | ||
15 | int _EXFUN(isprint, (int __c)); | ||
16 | int _EXFUN(ispunct, (int __c)); | ||
17 | int _EXFUN(isspace, (int __c)); | ||
18 | int _EXFUN(isupper, (int __c)); | ||
19 | int _EXFUN(isxdigit,(int __c)); | ||
20 | int _EXFUN(tolower, (int __c)); | ||
21 | int _EXFUN(toupper, (int __c)); | ||
22 | |||
23 | #ifndef __STRICT_ANSI__ | ||
24 | int _EXFUN(isascii, (int __c)); | ||
25 | int _EXFUN(toascii, (int __c)); | ||
26 | int _EXFUN(_tolower, (int __c)); | ||
27 | int _EXFUN(_toupper, (int __c)); | ||
28 | #endif | ||
29 | |||
30 | #define _U 01 | ||
31 | #define _L 02 | ||
32 | #define _N 04 | ||
33 | #define _S 010 | ||
34 | #define _P 020 | ||
35 | #define _C 040 | ||
36 | #define _X 0100 | ||
37 | #define _B 0200 | ||
38 | |||
39 | #ifdef PLUGIN | ||
40 | #define _ctype_ (rb->_rbctype_) | ||
41 | #else | ||
42 | extern const unsigned char _ctype_[257]; | ||
43 | #endif | ||
44 | |||
45 | #ifndef __cplusplus | ||
46 | #define isalpha(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L)) | ||
47 | #define isupper(c) ((_ctype_+1)[(unsigned char)(c)]&_U) | ||
48 | #define islower(c) ((_ctype_+1)[(unsigned char)(c)]&_L) | ||
49 | #define isdigit(c) ((_ctype_+1)[(unsigned char)(c)]&_N) | ||
50 | #define isxdigit(c) ((_ctype_+1)[(unsigned char)(c)]&(_X|_N)) | ||
51 | #define isspace(c) ((_ctype_+1)[(unsigned char)(c)]&_S) | ||
52 | #define ispunct(c) ((_ctype_+1)[(unsigned char)(c)]&_P) | ||
53 | #define isalnum(c) ((_ctype_+1)[(unsigned char)(c)]&(_U|_L|_N)) | ||
54 | #define isprint(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N|_B)) | ||
55 | #define isgraph(c) ((_ctype_+1)[(unsigned char)(c)]&(_P|_U|_L|_N)) | ||
56 | #define iscntrl(c) ((_ctype_+1)[(unsigned char)(c)]&_C) | ||
57 | /* Non-gcc versions will get the library versions, and will be | ||
58 | slightly slower */ | ||
59 | #ifdef __GNUC__ | ||
60 | # define toupper(c) \ | ||
61 | __extension__ ({ int __x = (unsigned char) (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) | ||
62 | # define tolower(c) \ | ||
63 | __extension__ ({ int __x = (unsigned char) (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) | ||
64 | #endif | ||
65 | #endif /* !__cplusplus */ | ||
66 | |||
67 | #ifndef __STRICT_ANSI__ | ||
68 | #define isascii(c) ((unsigned char)(c)<=0177) | ||
69 | #define toascii(c) ((c)&0177) | ||
70 | #endif | ||
71 | |||
72 | #ifdef __cplusplus | ||
73 | } | ||
74 | #endif | ||
75 | #endif /* _CTYPE_H_ */ | ||