Back to index

glibc  2.9
ctype.h
Go to the documentation of this file.
00001 #ifndef _CTYPE_H
00002 
00003 extern int __isctype (int __c, int __mask);
00004 
00005 # ifndef NOT_IN_libc
00006 
00007 /* These accessors are used by the optimized macros to find the
00008    thread-local cache of ctype information from the current thread's
00009    locale.  For inside libc, define them as inlines using the _NL_CURRENT
00010    accessors.  We don't use _NL_CURRENT_LOCALE->__ctype_b here because we
00011    want to cause a link-time ref to _nl_current_LC_CTYPE under
00012    NL_CURRENT_INDIRECT.  */
00013 
00014 #  include "../locale/localeinfo.h"
00015 #  include <bits/libc-tsd.h>
00016 
00017 #  ifndef CTYPE_EXTERN_INLINE      /* Used by ctype/ctype-info.c, which see.  */
00018 #   define CTYPE_EXTERN_INLINE extern inline
00019 #  endif
00020 
00021 __libc_tsd_define (extern, const uint16_t *, CTYPE_B)
00022 __libc_tsd_define (extern, const int32_t *, CTYPE_TOUPPER)
00023 __libc_tsd_define (extern, const int32_t *, CTYPE_TOLOWER)
00024 
00025 CTYPE_EXTERN_INLINE const uint16_t ** __attribute__ ((const))
00026 __ctype_b_loc (void)
00027 {
00028   const uint16_t **tablep = __libc_tsd_address (const uint16_t *, CTYPE_B);
00029   if (__builtin_expect (*tablep == NULL, 0))
00030     *tablep = (const uint16_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_CLASS) + 128;
00031   return tablep;
00032 }
00033 
00034 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
00035 __ctype_toupper_loc (void)
00036 {
00037   const int32_t **tablep = __libc_tsd_address (const int32_t *, CTYPE_TOUPPER);
00038   if (__builtin_expect (*tablep == NULL, 0))
00039     *tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOUPPER) + 128);
00040   return tablep;
00041 }
00042 
00043 CTYPE_EXTERN_INLINE const int32_t ** __attribute__ ((const))
00044 __ctype_tolower_loc (void)
00045 {
00046   const int32_t **tablep = __libc_tsd_address (const int32_t *, CTYPE_TOLOWER);
00047   if (__builtin_expect (*tablep == NULL, 0))
00048     *tablep = ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128);
00049   return tablep;
00050 }
00051 
00052 # endif       /* Not NOT_IN_libc.  */
00053 
00054 # include <ctype/ctype.h>
00055 
00056 # if !defined __NO_CTYPE && !defined NOT_IN_libc
00057 /* The spec says that isdigit must only match the decimal digits.  We
00058    can check this without a memory access.  */
00059 #  undef isdigit
00060 #  define isdigit(c) ({ int __c = (c); __c >= '0' && __c <= '9'; })
00061 #  undef isdigit_l
00062 #  define isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
00063 #  undef __isdigit_l
00064 #  define __isdigit_l(c, l) ({ int __c = (c); __c >= '0' && __c <= '9'; })
00065 # endif
00066 
00067 #endif /* ctype.h */