]>
Commit | Line | Data |
---|---|---|
08f60074 | 1 | /* Copyright (C) 1996, 1997, 2000, 2001, 2002 Free Software Foundation, Inc. |
c84142e8 UD |
2 | This file is part of the GNU C Library. |
3 | ||
4 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
5 | modify it under the terms of the GNU Lesser General Public |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
c84142e8 UD |
8 | |
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 12 | Lesser General Public License for more details. |
c84142e8 | 13 | |
41bdb6e2 AJ |
14 | You should have received a copy of the GNU Lesser General Public |
15 | License along with the GNU C Library; if not, write to the Free | |
16 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | |
17 | 02111-1307 USA. */ | |
c84142e8 | 18 | |
c84142e8 | 19 | #include <wctype.h> |
b02b9253 | 20 | #include <stdint.h> |
6d6e4021 | 21 | #include <locale.h> |
4c7d276e | 22 | #include <locale/localeinfo.h> |
b02b9253 UD |
23 | |
24 | #define USE_IN_EXTENDED_LOCALE_MODEL | |
ef446144 | 25 | #include "wchar-lookup.h" |
c84142e8 UD |
26 | |
27 | /* Provide real-function versions of all the wctype macros. */ | |
28 | ||
29 | #define func(name, type) \ | |
30 | int name (wint_t wc, __locale_t locale) \ | |
ef446144 | 31 | { \ |
4c7d276e UD |
32 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \ |
33 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; \ | |
34 | return wctype_table_lookup (desc, wc); \ | |
08f60074 | 35 | } \ |
a20d8dbe | 36 | libc_hidden_def (name) |
ef446144 UD |
37 | |
38 | func (__iswalnum_l, __ISwalnum) | |
39 | func (__iswalpha_l, __ISwalpha) | |
4c7d276e | 40 | func (__iswblank_l, __ISwblank) |
ef446144 UD |
41 | func (__iswcntrl_l, __ISwcntrl) |
42 | func (__iswdigit_l, __ISwdigit) | |
43 | func (__iswlower_l, __ISwlower) | |
44 | func (__iswgraph_l, __ISwgraph) | |
45 | func (__iswprint_l, __ISwprint) | |
46 | func (__iswpunct_l, __ISwpunct) | |
47 | func (__iswspace_l, __ISwspace) | |
48 | func (__iswupper_l, __ISwupper) | |
49 | func (__iswxdigit_l, __ISwxdigit) | |
c84142e8 UD |
50 | |
51 | wint_t | |
52 | (__towlower_l) (wint_t wc, __locale_t locale) | |
53 | { | |
4c7d276e UD |
54 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower; |
55 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; | |
56 | return wctrans_table_lookup (desc, wc); | |
c84142e8 | 57 | } |
a20d8dbe | 58 | libc_hidden_def (__towlower_l) |
c84142e8 UD |
59 | |
60 | wint_t | |
61 | (__towupper_l) (wint_t wc, __locale_t locale) | |
62 | { | |
4c7d276e UD |
63 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper; |
64 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; | |
65 | return wctrans_table_lookup (desc, wc); | |
c84142e8 | 66 | } |
a20d8dbe | 67 | libc_hidden_def (__towupper_l) |