diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-10-06 13:42:56 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-10-06 13:42:56 -0700 |
commit | c7e10b85b5e48322352edf631e6c450070f50dfd (patch) | |
tree | 97cc6dd919487024a670d106745bda95c669a87f | |
parent | e1d3e13791af1c076d0a0ee5e6a66a1c93858ffc (diff) |
fix ctypes header
-rw-r--r-- | system/include/libc/ctype.h | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/system/include/libc/ctype.h b/system/include/libc/ctype.h index 32e39bc3..6df2e7c4 100644 --- a/system/include/libc/ctype.h +++ b/system/include/libc/ctype.h @@ -30,23 +30,23 @@ int _EXFUN(toascii, (int __c)); #define _toupper(__c) ((unsigned char)(__c) - 'a' + 'A') #endif -/* XXX Emscripten - these confuse libc++ -#define _U 01 -#define _L 02 -#define _N 04 -#define _S 010 -#define _P 020 -#define _C 040 -#define _X 0100 -#define _B 0200 -*/ - #ifndef _MB_CAPABLE _CONST #endif extern __IMPORT char *__ctype_ptr__; #ifndef __cplusplus + +/* XXX Emscripten - these confuse libc++. moved to inside ifndef __cplusplus, and added CTYPE_ */ +#define CTYPE__U 01 +#define CTYPE__L 02 +#define CTYPE__N 04 +#define CTYPE__S 010 +#define CTYPE__P 020 +#define CTYPE__C 040 +#define CTYPE__X 0100 +#define CTYPE__B 0200 + /* These macros are intentionally written in a manner that will trigger a gcc -Wall warning if the user mistakenly passes a 'char' instead of an int containing an 'unsigned char'. Note that the sizeof will @@ -58,17 +58,17 @@ extern __IMPORT char *__ctype_ptr__; an out-of-bounds reference on a 64-bit machine. */ #define __ctype_lookup(__c) ((__ctype_ptr__+sizeof(""[__c]))[(int)(__c)]) -#define isalpha(__c) (__ctype_lookup(__c)&(_U|_L)) -#define isupper(__c) ((__ctype_lookup(__c)&(_U|_L))==_U) -#define islower(__c) ((__ctype_lookup(__c)&(_U|_L))==_L) -#define isdigit(__c) (__ctype_lookup(__c)&_N) -#define isxdigit(__c) (__ctype_lookup(__c)&(_X|_N)) -#define isspace(__c) (__ctype_lookup(__c)&_S) -#define ispunct(__c) (__ctype_lookup(__c)&_P) -#define isalnum(__c) (__ctype_lookup(__c)&(_U|_L|_N)) -#define isprint(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N|_B)) -#define isgraph(__c) (__ctype_lookup(__c)&(_P|_U|_L|_N)) -#define iscntrl(__c) (__ctype_lookup(__c)&_C) +#define isalpha(__c) (__ctype_lookup(__c)&(CTYPE__U|CTYPE__L)) +#define isupper(__c) ((__ctype_lookup(__c)&(CTYPE__U|CTYPE__L))==CTYPE__U) +#define islower(__c) ((__ctype_lookup(__c)&(CTYPE__U|CTYPE__L))==CTYPE__L) +#define isdigit(__c) (__ctype_lookup(__c)&CTYPE__N) +#define isxdigit(__c) (__ctype_lookup(__c)&(CTYPE__X|CTYPE__N)) +#define isspace(__c) (__ctype_lookup(__c)&CTYPE__S) +#define ispunct(__c) (__ctype_lookup(__c)&CTYPE__P) +#define isalnum(__c) (__ctype_lookup(__c)&(CTYPE__U|CTYPE__L|CTYPE__N)) +#define isprint(__c) (__ctype_lookup(__c)&(CTYPE__P|CTYPE__U|CTYPE__L|CTYPE__N|CTYPE__B)) +#define isgraph(__c) (__ctype_lookup(__c)&(CTYPE__P|CTYPE__U|CTYPE__L|CTYPE__N)) +#define iscntrl(__c) (__ctype_lookup(__c)&CTYPE__C) #if defined(__GNUC__) && \ (!defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901L) |