Support for type-generic libm function implementations libm
[glibc.git] / include / ctype.h
blobac6db790b74cb85a1cb4e178d80a7a5ed4de4eed
1 #ifndef _CTYPE_H
3 #include <ctype/ctype.h>
5 #ifndef _ISOMAC
6 /* Initialize ctype locale data. */
7 extern void __ctype_init (void);
8 libc_hidden_proto (__ctype_init)
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);
14 # if IS_IN (libc)
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. */
23 # include "../locale/localeinfo.h"
24 # include <libc-tsd.h>
26 # ifndef CTYPE_EXTERN_INLINE /* Used by ctype/ctype-info.c, which see. */
27 # define CTYPE_EXTERN_INLINE extern inline
28 # endif
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)
35 CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
36 __ctype_b_loc (void)
38 return __libc_tsd_address (const uint16_t *, CTYPE_B);
41 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
42 __ctype_toupper_loc (void)
44 return __libc_tsd_address (const int32_t *, CTYPE_TOUPPER);
47 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
48 __ctype_tolower_loc (void)
50 return __libc_tsd_address (const int32_t *, CTYPE_TOLOWER);
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. */
64 # endif /* IS_IN (libc). */
65 #endif /* Not _ISOMAC. */
67 #endif /* ctype.h */