]> git.ipfire.org Git - thirdparty/glibc.git/blame - wctype/wcfuncs.c
Update copyright notices with scripts/update-copyrights.
[thirdparty/glibc.git] / wctype / wcfuncs.c
CommitLineData
568035b7 1/* Copyright (C) 1996-2013 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/>. */
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 40func (alnum, __ISwalnum)
85d1401f 41libc_hidden_weak (iswalnum)
390955cb 42#undef iswalpha
5d953aef 43func (alpha, __ISwalpha)
0752d008 44libc_hidden_weak (iswalpha)
4c7d276e 45#undef iswblank
5d953aef 46func (blank, __ISwblank)
390955cb 47#undef iswcntrl
5d953aef 48func (cntrl, __ISwcntrl)
390955cb 49#undef iswdigit
5d953aef 50func (digit, __ISwdigit)
0752d008 51libc_hidden_weak (iswdigit)
390955cb 52#undef iswlower
5d953aef 53func (lower, __ISwlower)
0752d008 54libc_hidden_weak (iswlower)
390955cb 55#undef iswgraph
5d953aef 56func (graph, __ISwgraph)
390955cb 57#undef iswprint
5d953aef 58func (print, __ISwprint)
390955cb 59#undef iswpunct
5d953aef 60func (punct, __ISwpunct)
390955cb 61#undef iswspace
5d953aef 62func (space, __ISwspace)
0752d008 63libc_hidden_weak (iswspace)
390955cb 64#undef iswupper
5d953aef 65func (upper, __ISwupper)
390955cb 66#undef iswxdigit
5d953aef 67func (xdigit, __ISwxdigit)
0752d008 68libc_hidden_weak (iswxdigit)
19bc17a9 69
0752d008 70#undef towlower
19bc17a9 71wint_t
0752d008 72towlower (wc)
19bc17a9
RM
73 wint_t wc;
74{
0f283ffc
RM
75 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower;
76 const char *desc = _NL_CURRENT (LC_CTYPE, i);
77 return wctrans_table_lookup (desc, wc);
19bc17a9 78}
b1b54458 79libc_hidden_def (towlower)
19bc17a9 80
0752d008 81#undef towupper
19bc17a9 82wint_t
0752d008 83towupper (wc)
19bc17a9
RM
84 wint_t wc;
85{
0f283ffc
RM
86 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper;
87 const char *desc = _NL_CURRENT (LC_CTYPE, i);
88 return wctrans_table_lookup (desc, wc);
19bc17a9 89}
b1b54458 90libc_hidden_def (towupper)