1 | #ifndef _CTYPE_H |
2 | |
3 | #include <ctype/ctype.h> |
4 | |
5 | #ifndef _ISOMAC |
6 | /* Initialize ctype locale data. */ |
7 | extern void __ctype_init (void); |
8 | libc_hidden_proto (__ctype_init) |
9 | |
10 | /* ctype/ctype.h defined this as a macro and we don't want to #undef it. |
11 | So defeat macro expansion with parens for this declaration. */ |
12 | extern int (__isctype) (int __c, int __mask); |
13 | |
14 | # if IS_IN (libc) |
15 | |
16 | /* These accessors are used by the optimized macros to find the |
17 | thread-local cache of ctype information from the current thread's |
18 | locale. For inside libc, define them as inlines using the _NL_CURRENT |
19 | accessors. We don't use _NL_CURRENT_LOCALE->__ctype_b here because we |
20 | want to cause a link-time ref to _nl_current_LC_CTYPE under |
21 | NL_CURRENT_INDIRECT. */ |
22 | |
23 | # include "../locale/localeinfo.h" |
24 | # include <libc-tsd.h> |
25 | |
26 | # ifndef CTYPE_EXTERN_INLINE /* Used by ctype/ctype-info.c, which see. */ |
27 | # define CTYPE_EXTERN_INLINE extern inline |
28 | # endif |
29 | |
30 | __libc_tsd_define (extern, const uint16_t *, CTYPE_B) |
31 | __libc_tsd_define (extern, const int32_t *, CTYPE_TOUPPER) |
32 | __libc_tsd_define (extern, const int32_t *, CTYPE_TOLOWER) |
33 | |
34 | |
35 | CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const)) |
36 | __ctype_b_loc (void) |
37 | { |
38 | return __libc_tsd_address (const uint16_t *, CTYPE_B); |
39 | } |
40 | |
41 | CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const)) |
42 | __ctype_toupper_loc (void) |
43 | { |
44 | return __libc_tsd_address (const int32_t *, CTYPE_TOUPPER); |
45 | } |
46 | |
47 | CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const)) |
48 | __ctype_tolower_loc (void) |
49 | { |
50 | return __libc_tsd_address (const int32_t *, CTYPE_TOLOWER); |
51 | } |
52 | |
53 | # ifndef __NO_CTYPE |
54 | /* The spec says that isdigit must only match the decimal digits. We |
55 | can check this without a memory access. */ |
56 | # undef isdigit |
57 | # define isdigit(c) ({ int __c = (c); __c >= '0' && __c <= '9'; }) |
58 | # undef isdigit_l |
59 | # define isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; }) |
60 | # undef __isdigit_l |
61 | # define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; }) |
62 | # endif /* Not __NO_CTYPE. */ |
63 | |
64 | # endif /* IS_IN (libc). */ |
65 | #endif /* Not _ISOMAC. */ |
66 | |
67 | #endif /* ctype.h */ |
68 | |