diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2002-06-15 15:49:32 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2002-06-15 15:49:32 +0000 |
| commit | 7da93d58fdc73c40a721f9f1c7d7a42609e10a53 (patch) | |
| tree | e16719bcc03f98a1ed0c211a8d381d029bbfc515 /firmware/include/ctype.h | |
| parent | 4f58f6197d8aba3ddbb6976521ea9f814ae1738d (diff) | |
| download | rockbox-7da93d58fdc73c40a721f9f1c7d7a42609e10a53.zip rockbox-7da93d58fdc73c40a721f9f1c7d7a42609e10a53.tar.gz rockbox-7da93d58fdc73c40a721f9f1c7d7a42609e10a53.tar.bz2 rockbox-7da93d58fdc73c40a721f9f1c7d7a42609e10a53.tar.xz | |
This is my initial attempt to get rid of the newlib headers requirement,
for gcc built without newlib.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1017 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/include/ctype.h')
| -rw-r--r-- | firmware/include/ctype.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/firmware/include/ctype.h b/firmware/include/ctype.h new file mode 100644 index 0000000..18dd02f --- /dev/null +++ b/firmware/include/ctype.h @@ -0,0 +1,71 @@ +#ifndef _CTYPE_H_ +#ifdef __cplusplus +extern "C" { +#endif +#define _CTYPE_H_ + +#include "_ansi.h" + +int _EXFUN(isalnum, (int __c)); +int _EXFUN(isalpha, (int __c)); +int _EXFUN(iscntrl, (int __c)); +int _EXFUN(isdigit, (int __c)); +int _EXFUN(isgraph, (int __c)); +int _EXFUN(islower, (int __c)); +int _EXFUN(isprint, (int __c)); +int _EXFUN(ispunct, (int __c)); +int _EXFUN(isspace, (int __c)); +int _EXFUN(isupper, (int __c)); +int _EXFUN(isxdigit,(int __c)); +int _EXFUN(tolower, (int __c)); +int _EXFUN(toupper, (int __c)); + +#ifndef __STRICT_ANSI__ +int _EXFUN(isascii, (int __c)); +int _EXFUN(toascii, (int __c)); +int _EXFUN(_tolower, (int __c)); +int _EXFUN(_toupper, (int __c)); +#endif + +#define _U 01 +#define _L 02 +#define _N 04 +#define _S 010 +#define _P 020 +#define _C 040 +#define _X 0100 +#define _B 0200 + +extern __IMPORT _CONST char _ctype_[]; + +#ifndef __cplusplus +#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L)) +#define isupper(c) ((_ctype_+1)[(unsigned)(c)]&_U) +#define islower(c) ((_ctype_+1)[(unsigned)(c)]&_L) +#define isdigit(c) ((_ctype_+1)[(unsigned)(c)]&_N) +#define isxdigit(c) ((_ctype_+1)[(unsigned)(c)]&(_X|_N)) +#define isspace(c) ((_ctype_+1)[(unsigned)(c)]&_S) +#define ispunct(c) ((_ctype_+1)[(unsigned)(c)]&_P) +#define isalnum(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L|_N)) +#define isprint(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B)) +#define isgraph(c) ((_ctype_+1)[(unsigned)(c)]&(_P|_U|_L|_N)) +#define iscntrl(c) ((_ctype_+1)[(unsigned)(c)]&_C) +/* Non-gcc versions will get the library versions, and will be + slightly slower */ +#ifdef __GNUC__ +# define toupper(c) \ + __extension__ ({ int __x = (c); islower(__x) ? (__x - 'a' + 'A') : __x;}) +# define tolower(c) \ + __extension__ ({ int __x = (c); isupper(__x) ? (__x - 'A' + 'a') : __x;}) +#endif +#endif /* !__cplusplus */ + +#ifndef __STRICT_ANSI__ +#define isascii(c) ((unsigned)(c)<=0177) +#define toascii(c) ((c)&0177) +#endif + +#ifdef __cplusplus +} +#endif +#endif /* _CTYPE_H_ */ |