diff options
Diffstat (limited to 'newlib/libc')
-rw-r--r-- | newlib/libc/ctype/ctype_.c | 35 | ||||
-rw-r--r-- | newlib/libc/include/ctype.h | 27 |
2 files changed, 42 insertions, 20 deletions
diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c index 9991dd222..5551dbdc9 100644 --- a/newlib/libc/ctype/ctype_.c +++ b/newlib/libc/ctype/ctype_.c @@ -84,21 +84,40 @@ static _CONST char _ctype_b[128 + 256] = { _CTYPE_DATA_128_256 }; -#if defined(__CYGWIN__) -extern _CONST char __declspec(dllexport) _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127"))); +# if defined(__CYGWIN__) _CONST char __declspec(dllexport) *__ctype_ptr = _ctype_b + 128; -#else -extern _CONST char _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127"))); +# else _CONST char *__ctype_ptr = _ctype_b + 128; -#endif +# endif + +# if defined(_HAVE_ARRAY_ALIASING) + +# if defined(__CYGWIN__) +extern _CONST char __declspec(dllexport) _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127"))); +# else +extern _CONST char _ctype_[1 + 256] __attribute__ ((alias ("_ctype_b+127"))); +# endif + +# else /* !_HAVE_ARRAY_ALIASING */ + +# if defined(__CYGWIN__) +_CONST char __declspec(dllexport) _ctype_[1 + 256] = { +# else +_CONST char _ctype_[1 + 256] = { +# endif + 0, + _CTYPE_DATA_0_127, + _CTYPE_DATA_128_256 +}; +# endif /* !_HAVE_ARRAY_ALIASING */ #else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */ -#if defined(__CYGWIN__) +# if defined(__CYGWIN__) _CONST char __declspec(dllexport) _ctype_[1 + 256] = { -#else +# else _CONST char _ctype_[1 + 256] = { -#endif +# endif 0, _CTYPE_DATA_0_127, _CTYPE_DATA_128_256 diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index a3581df1b..9dccac319 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -36,20 +36,23 @@ int _EXFUN(_toupper, (int __c)); #define _X 0100 #define _B 0200 -extern __IMPORT _CONST char _ctype_[]; +extern __IMPORT _CONST char *__ctype_ptr; #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) +#define isalpha(c) ((__ctype_ptr+1)[(unsigned)(c)]&(_U|_L)) +#define isupper(c) ((__ctype_ptr+1)[(unsigned)(c)]&_U) +#define islower(c) ((__ctype_ptr+1)[(unsigned)(c)]&_L) +#define isdigit(c) ((__ctype_ptr+1)[(unsigned)(c)]&_N) +#define isxdigit(c) ((__ctype_ptr+1)[(unsigned)(c)]&(_X|_N)) +#define isspace(c) ((__ctype_ptr+1)[(unsigned)(c)]&_S) +#define ispunct(c) ((__ctype_ptr+1)[(unsigned)(c)]&_P) +#define isalnum(c) ((__ctype_ptr+1)[(unsigned)(c)]&(_U|_L|_N)) +#define isprint(c) ((__ctype_ptr+1)[(unsigned)(c)]&(_P|_U|_L|_N|_B)) +#define isgraph(c) ((__ctype_ptr+1)[(unsigned)(c)]&(_P|_U|_L|_N)) +#define iscntrl(c) ((__ctype_ptr+1)[(unsigned)(c)]&_C) + +extern __IMPORT _CONST char _ctype_[]; /* Deprecated. */ + /* Non-gcc versions will get the library versions, and will be slightly slower */ #ifdef __GNUC__ |