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.
30 There are three arrays of short ints which need to be indexable
31 from -128 to 255 inclusive. Stored in the locale data file are
32 a copy of each for each byte order. */
35 _nl_postload_ctype (void)
37 const struct locale_data
*data
= _NL_CURRENT_DATA (LC_CTYPE
);
39 #define paste(a,b) paste1(a,b)
40 #define paste1(a,b) a##b
42 #define current(type,x,offset) \
43 ((const type *) _NL_CURRENT (LC_CTYPE, paste(_NL_CTYPE_,x)) + offset)
45 extern const uint32_t *__ctype32_b
;
46 extern const uint32_t *__ctype32_toupper
;
47 extern const uint32_t *__ctype32_tolower
;
48 extern const char *__ctype32_wctype
[12] attribute_hidden
;
49 extern const char *__ctype32_wctrans
[2] attribute_hidden
;
50 extern const char *__ctype32_width attribute_hidden
;
54 __ctype_b
= current (uint16_t, CLASS
, 128);
55 __ctype_toupper
= current (uint32_t, TOUPPER
, 128);
56 __ctype_tolower
= current (uint32_t, TOLOWER
, 128);
57 __ctype32_b
= current (uint32_t, CLASS32
, 0);
58 __ctype32_toupper
= current (uint32_t, TOUPPER32
, 0);
59 __ctype32_tolower
= current (uint32_t, TOLOWER32
, 0);
61 offset
= _NL_CURRENT_WORD (LC_CTYPE
, _NL_CTYPE_CLASS_OFFSET
);
62 for (cnt
= 0; cnt
< 12; cnt
++)
63 __ctype32_wctype
[cnt
] = data
->values
[offset
+ cnt
].string
;
65 offset
= _NL_CURRENT_WORD (LC_CTYPE
, _NL_CTYPE_MAP_OFFSET
);
66 for (cnt
= 0; cnt
< 2; cnt
++)
67 __ctype32_wctrans
[cnt
] = data
->values
[offset
+ cnt
].string
;
69 __ctype32_width
= current (char, WIDTH
, 0);