1 /* Define current locale data for LC_CTYPE category.
2 Copyright (C) 1995-1999, 2000, 2002 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, write to the Free
17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 #include "localeinfo.h"
25 _NL_CURRENT_DEFINE (LC_CTYPE);
27 /* We are called after loading LC_CTYPE data to load it into
28 the variables used by the ctype.h macros. */
31 _nl_postload_ctype (void)
33 #define current(type,x,offset) \
34 ((const type *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_##x) + offset)
36 /* These are defined in ctype-info.c.
37 The declarations here must match those in localeinfo.h.
39 These point into arrays of 384, so they can be indexed by any `unsigned
40 char' value [0,255]; by EOF (-1); or by any `signed char' value
41 [-128,-1). ISO C requires that the ctype functions work for `unsigned
42 char' values and for EOF; we also support negative `signed char' values
43 for broken old programs. The case conversion arrays are of `int's
44 rather than `unsigned char's because tolower (EOF) must be EOF, which
45 doesn't fit into an `unsigned char'. But today more important is that
46 the arrays are also used for multi-byte character sets. */
48 if (_NL_CURRENT_LOCALE == &_nl_global_locale)
50 __libc_tsd_set (CTYPE_B, (void *) current (uint16_t, CLASS, 128));
51 __libc_tsd_set (CTYPE_TOUPPER, (void *) current (int32_t, TOUPPER, 128));
52 __libc_tsd_set (CTYPE_TOLOWER, (void *) current (int32_t, TOLOWER, 128));
55 #include <shlib-compat.h>
56 #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3)
57 extern __const unsigned short int *__ctype_old_b; /* Characteristics. */
58 extern __const __int32_t *__ctype_old_tolower; /* Case conversions. */
59 extern __const __int32_t *__ctype_old_toupper; /* Case conversions. */
61 extern const uint32_t *__ctype32_old_b;
62 extern const uint32_t *__ctype32_old_toupper;
63 extern const uint32_t *__ctype32_old_tolower;
65 __ctype_old_b = current (uint16_t, CLASS, 128);
66 __ctype_old_toupper = current (uint32_t, TOUPPER, 128);
67 __ctype_old_tolower = current (uint32_t, TOLOWER, 128);
68 __ctype32_old_b = current (uint32_t, CLASS32, 0);
69 __ctype32_old_toupper = current (uint32_t, TOUPPER32, 0);
70 __ctype32_old_tolower = current (uint32_t, TOLOWER32, 0);