]>
Commit | Line | Data |
---|---|---|
bfff8b1b | 1 | /* Copyright (C) 1996-2017 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 | 14 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 PE |
15 | License along with the GNU C Library; if not, see |
16 | <http://www.gnu.org/licenses/>. */ | |
c84142e8 | 17 | |
5d953aef | 18 | #include <ctype.h> |
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) \ | |
af85385f | 30 | int __isw##name (wint_t wc, locale_t locale) \ |
ef446144 | 31 | { \ |
5d953aef UD |
32 | if (isascii (wc)) \ |
33 | return is##name ((int) wc, locale); \ | |
4c7d276e UD |
34 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \ |
35 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; \ | |
36 | return wctype_table_lookup (desc, wc); \ | |
08f60074 | 37 | } \ |
5d953aef UD |
38 | libc_hidden_def (__isw##name) \ |
39 | weak_alias (__isw##name, isw##name) | |
ef446144 | 40 | |
5d953aef UD |
41 | func (alnum_l, __ISwalnum) |
42 | func (alpha_l, __ISwalpha) | |
43 | func (blank_l, __ISwblank) | |
44 | func (cntrl_l, __ISwcntrl) | |
f83aa16c UD |
45 | #undef iswdigit_l |
46 | #undef __iswdigit_l | |
5d953aef UD |
47 | func (digit_l, __ISwdigit) |
48 | func (lower_l, __ISwlower) | |
49 | func (graph_l, __ISwgraph) | |
50 | func (print_l, __ISwprint) | |
51 | func (punct_l, __ISwpunct) | |
52 | func (space_l, __ISwspace) | |
53 | func (upper_l, __ISwupper) | |
54 | func (xdigit_l, __ISwxdigit) | |
c84142e8 UD |
55 | |
56 | wint_t | |
af85385f | 57 | (__towlower_l) (wint_t wc, locale_t locale) |
c84142e8 | 58 | { |
4c7d276e UD |
59 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower; |
60 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; | |
61 | return wctrans_table_lookup (desc, wc); | |
c84142e8 | 62 | } |
a20d8dbe | 63 | libc_hidden_def (__towlower_l) |
1ab62b32 | 64 | weak_alias (__towlower_l, towlower_l) |
c84142e8 UD |
65 | |
66 | wint_t | |
af85385f | 67 | (__towupper_l) (wint_t wc, locale_t locale) |
c84142e8 | 68 | { |
4c7d276e UD |
69 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper; |
70 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; | |
71 | return wctrans_table_lookup (desc, wc); | |
c84142e8 | 72 | } |
a20d8dbe | 73 | libc_hidden_def (__towupper_l) |
1ab62b32 | 74 | weak_alias (__towupper_l, towupper_l) |