]> git.ipfire.org Git - thirdparty/glibc.git/blob - include/ctype.h
posix/glob.c: update from gnulib
[thirdparty/glibc.git] / include / ctype.h
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 libc_hidden_proto (tolower)
15 libc_hidden_proto (toupper)
16
17 # if IS_IN (libc)
18
19 /* These accessors are used by the optimized macros to find the
20 thread-local cache of ctype information from the current thread's
21 locale. For inside libc, define them as inlines using the _NL_CURRENT
22 accessors. We don't use _NL_CURRENT_LOCALE->__ctype_b here because we
23 want to cause a link-time ref to _nl_current_LC_CTYPE under
24 NL_CURRENT_INDIRECT. */
25
26 # include "../locale/localeinfo.h"
27 # include <libc-tsd.h>
28
29 # ifndef CTYPE_EXTERN_INLINE /* Used by ctype/ctype-info.c, which see. */
30 # define CTYPE_EXTERN_INLINE extern inline
31 # endif
32
33 __libc_tsd_define (extern, const uint16_t *, CTYPE_B)
34 __libc_tsd_define (extern, const int32_t *, CTYPE_TOUPPER)
35 __libc_tsd_define (extern, const int32_t *, CTYPE_TOLOWER)
36
37
38 CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
39 __ctype_b_loc (void)
40 {
41 return __libc_tsd_address (const uint16_t *, CTYPE_B);
42 }
43
44 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
45 __ctype_toupper_loc (void)
46 {
47 return __libc_tsd_address (const int32_t *, CTYPE_TOUPPER);
48 }
49
50 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
51 __ctype_tolower_loc (void)
52 {
53 return __libc_tsd_address (const int32_t *, CTYPE_TOLOWER);
54 }
55
56 # ifndef __NO_CTYPE
57 /* The spec says that isdigit must only match the decimal digits. We
58 can check this without a memory access. */
59 # undef isdigit
60 # define isdigit(c) ({ int __c = (c); __c >= '0' && __c <= '9'; })
61 # undef isdigit_l
62 # define isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
63 # undef __isdigit_l
64 # define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
65 # endif /* Not __NO_CTYPE. */
66
67 # endif /* IS_IN (libc). */
68 #endif /* Not _ISOMAC. */
69
70 #endif /* ctype.h */