]>
Commit | Line | Data |
---|---|---|
5d953aef | 1 | /* Copyright (C) 1996,1997,2000-2002,2004,2005 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 | |
5d953aef | 19 | #include <ctype.h> |
c84142e8 | 20 | #include <wctype.h> |
b02b9253 | 21 | #include <stdint.h> |
6d6e4021 | 22 | #include <locale.h> |
4c7d276e | 23 | #include <locale/localeinfo.h> |
b02b9253 UD |
24 | |
25 | #define USE_IN_EXTENDED_LOCALE_MODEL | |
ef446144 | 26 | #include "wchar-lookup.h" |
c84142e8 UD |
27 | |
28 | /* Provide real-function versions of all the wctype macros. */ | |
29 | ||
30 | #define func(name, type) \ | |
5d953aef | 31 | int __isw##name (wint_t wc, __locale_t locale) \ |
ef446144 | 32 | { \ |
5d953aef UD |
33 | if (isascii (wc)) \ |
34 | return is##name ((int) wc, locale); \ | |
4c7d276e UD |
35 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \ |
36 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; \ | |
37 | return wctype_table_lookup (desc, wc); \ | |
08f60074 | 38 | } \ |
5d953aef UD |
39 | libc_hidden_def (__isw##name) \ |
40 | weak_alias (__isw##name, isw##name) | |
ef446144 | 41 | |
5d953aef UD |
42 | func (alnum_l, __ISwalnum) |
43 | func (alpha_l, __ISwalpha) | |
44 | func (blank_l, __ISwblank) | |
45 | func (cntrl_l, __ISwcntrl) | |
f83aa16c UD |
46 | #undef iswdigit_l |
47 | #undef __iswdigit_l | |
5d953aef UD |
48 | func (digit_l, __ISwdigit) |
49 | func (lower_l, __ISwlower) | |
50 | func (graph_l, __ISwgraph) | |
51 | func (print_l, __ISwprint) | |
52 | func (punct_l, __ISwpunct) | |
53 | func (space_l, __ISwspace) | |
54 | func (upper_l, __ISwupper) | |
55 | func (xdigit_l, __ISwxdigit) | |
c84142e8 UD |
56 | |
57 | wint_t | |
58 | (__towlower_l) (wint_t wc, __locale_t locale) | |
59 | { | |
4c7d276e UD |
60 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower; |
61 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; | |
62 | return wctrans_table_lookup (desc, wc); | |
c84142e8 | 63 | } |
a20d8dbe | 64 | libc_hidden_def (__towlower_l) |
1ab62b32 | 65 | weak_alias (__towlower_l, towlower_l) |
c84142e8 UD |
66 | |
67 | wint_t | |
68 | (__towupper_l) (wint_t wc, __locale_t locale) | |
69 | { | |
4c7d276e UD |
70 | size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper; |
71 | const char *desc = locale->__locales[LC_CTYPE]->values[i].string; | |
72 | return wctrans_table_lookup (desc, wc); | |
c84142e8 | 73 | } |
a20d8dbe | 74 | libc_hidden_def (__towupper_l) |
1ab62b32 | 75 | weak_alias (__towupper_l, towupper_l) |