b58306dd286583ad9fc4a48c7bf87ff0c8d49bfc
[platform/upstream/glibc.git] / include / ctype.h
1 #ifndef _CTYPE_H
2
3 extern int __isctype (int __c, int __mask);
4
5 # include <ctype/ctype.h>
6
7 # ifndef NOT_IN_libc
8
9 /* The optimized macros are not defined for users because they can't see
10    the thread-local locale state.  For inside libc, define them using the
11    _NL_CURRENT accessors.  We don't use _NL_CURRENT_LOCALE->__ctype_b here
12    because we want to cause a link-time ref to _nl_current_LC_CTYPE under
13    NL_CURRENT_INDIRECT.  */
14
15 #  include "../locale/localeinfo.h"
16 #  ifndef __NO_CTYPE
17 #   undef __isctype
18 #   define __isctype(c, type) \
19      (((uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128) \
20       [(int) (c)] & (uint16_t) type)
21
22 #   undef tolower
23 #   define tolower(c) \
24       __tobody (c, tolower, \
25                 (uint32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128, \
26                 (c))
27 #   undef _tolower
28 #   define _tolower(c) tolower (c)
29 #   undef toupper
30 #   define toupper(c) \
31       __tobody (c, toupper, \
32                 (uint32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128, \
33                 (c))
34 #   undef _toupper
35 #   define _toupper(c) toupper (c)
36
37 #  endif /* Not __NO_CTYPE.  */
38 # endif /* _LIBC_REENTRANT.  */
39
40 #endif /* ctype.h */