]>
Commit | Line | Data |
---|---|---|
6d7e8eda | 1 | /* Copyright (C) 1996-2023 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 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
19bc17a9 | 17 | |
5d953aef | 18 | #include <ctype.h> |
19bc17a9 | 19 | #include <wctype.h> |
4c7d276e | 20 | #include <locale/localeinfo.h> |
19bc17a9 | 21 | |
ef446144 | 22 | #include "wchar-lookup.h" |
390955cb | 23 | |
19bc17a9 RM |
24 | /* Provide real-function versions of all the wctype macros. */ |
25 | ||
0f283ffc | 26 | #define func(name, type) \ |
5d953aef | 27 | extern int __isw##name (wint_t __wc); \ |
0f283ffc | 28 | int \ |
5d953aef | 29 | __isw##name (wint_t wc) \ |
0f283ffc | 30 | { \ |
5d953aef UD |
31 | if (isascii (wc)) \ |
32 | return is##name ((int) wc); \ | |
0f283ffc RM |
33 | size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + type; \ |
34 | const char *desc = _NL_CURRENT (LC_CTYPE, i); \ | |
35 | return wctype_table_lookup (desc, wc); \ | |
36 | } \ | |
5d953aef | 37 | weak_alias (__isw##name, isw##name) |
19bc17a9 | 38 | |
390955cb | 39 | #undef iswalnum |
5d953aef | 40 | func (alnum, __ISwalnum) |
9dd6b779 | 41 | libc_hidden_def (__iswalnum) |
85d1401f | 42 | libc_hidden_weak (iswalnum) |
390955cb | 43 | #undef iswalpha |
5d953aef | 44 | func (alpha, __ISwalpha) |
0752d008 | 45 | libc_hidden_weak (iswalpha) |
4c7d276e | 46 | #undef iswblank |
5d953aef | 47 | func (blank, __ISwblank) |
390955cb | 48 | #undef iswcntrl |
5d953aef | 49 | func (cntrl, __ISwcntrl) |
390955cb | 50 | #undef iswdigit |
5d953aef | 51 | func (digit, __ISwdigit) |
0752d008 | 52 | libc_hidden_weak (iswdigit) |
390955cb | 53 | #undef iswlower |
5d953aef | 54 | func (lower, __ISwlower) |
9dd6b779 | 55 | libc_hidden_def (__iswlower) |
0752d008 | 56 | libc_hidden_weak (iswlower) |
390955cb | 57 | #undef iswgraph |
5d953aef | 58 | func (graph, __ISwgraph) |
390955cb | 59 | #undef iswprint |
5d953aef | 60 | func (print, __ISwprint) |
390955cb | 61 | #undef iswpunct |
5d953aef | 62 | func (punct, __ISwpunct) |
390955cb | 63 | #undef iswspace |
5d953aef | 64 | func (space, __ISwspace) |
0752d008 | 65 | libc_hidden_weak (iswspace) |
390955cb | 66 | #undef iswupper |
5d953aef | 67 | func (upper, __ISwupper) |
390955cb | 68 | #undef iswxdigit |
5d953aef | 69 | func (xdigit, __ISwxdigit) |
0752d008 | 70 | libc_hidden_weak (iswxdigit) |
19bc17a9 | 71 | |
0752d008 | 72 | #undef towlower |
19bc17a9 | 73 | wint_t |
9d46370c | 74 | __towlower (wint_t wc) |
19bc17a9 | 75 | { |
0f283ffc RM |
76 | size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower; |
77 | const char *desc = _NL_CURRENT (LC_CTYPE, i); | |
78 | return wctrans_table_lookup (desc, wc); | |
19bc17a9 | 79 | } |
bb4acb52 JM |
80 | libc_hidden_def (__towlower) |
81 | weak_alias (__towlower, towlower) | |
82 | libc_hidden_weak (towlower) | |
19bc17a9 | 83 | |
0752d008 | 84 | #undef towupper |
19bc17a9 | 85 | wint_t |
9d46370c | 86 | __towupper (wint_t wc) |
19bc17a9 | 87 | { |
0f283ffc RM |
88 | size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper; |
89 | const char *desc = _NL_CURRENT (LC_CTYPE, i); | |
90 | return wctrans_table_lookup (desc, wc); | |
19bc17a9 | 91 | } |
bb4acb52 JM |
92 | libc_hidden_def (__towupper) |
93 | weak_alias (__towupper, towupper) | |
94 | libc_hidden_weak (towupper) |