]> git.ipfire.org Git - thirdparty/glibc.git/blame - wctype/wcfuncs.c
Use <> for include of kernel-features.h.
[thirdparty/glibc.git] / wctype / wcfuncs.c
CommitLineData
5d953aef 1/* Copyright (C) 1996-2001, 2002, 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. */
19bc17a9 18
5d953aef 19#include <ctype.h>
19bc17a9 20#include <wctype.h>
4c7d276e 21#include <locale/localeinfo.h>
19bc17a9 22
ef446144 23#include "wchar-lookup.h"
390955cb 24
19bc17a9
RM
25/* Provide real-function versions of all the wctype macros. */
26
0f283ffc 27#define func(name, type) \
5d953aef 28 extern int __isw##name (wint_t __wc); \
0f283ffc 29 int \
5d953aef 30 __isw##name (wint_t wc) \
0f283ffc 31 { \
5d953aef
UD
32 if (isascii (wc)) \
33 return is##name ((int) wc); \
0f283ffc
RM
34 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + type; \
35 const char *desc = _NL_CURRENT (LC_CTYPE, i); \
36 return wctype_table_lookup (desc, wc); \
37 } \
5d953aef 38 weak_alias (__isw##name, isw##name)
19bc17a9 39
390955cb 40#undef iswalnum
5d953aef 41func (alnum, __ISwalnum)
85d1401f 42libc_hidden_weak (iswalnum)
390955cb 43#undef iswalpha
5d953aef 44func (alpha, __ISwalpha)
0752d008 45libc_hidden_weak (iswalpha)
4c7d276e 46#undef iswblank
5d953aef 47func (blank, __ISwblank)
390955cb 48#undef iswcntrl
5d953aef 49func (cntrl, __ISwcntrl)
390955cb 50#undef iswdigit
5d953aef 51func (digit, __ISwdigit)
0752d008 52libc_hidden_weak (iswdigit)
390955cb 53#undef iswlower
5d953aef 54func (lower, __ISwlower)
0752d008 55libc_hidden_weak (iswlower)
390955cb 56#undef iswgraph
5d953aef 57func (graph, __ISwgraph)
390955cb 58#undef iswprint
5d953aef 59func (print, __ISwprint)
390955cb 60#undef iswpunct
5d953aef 61func (punct, __ISwpunct)
390955cb 62#undef iswspace
5d953aef 63func (space, __ISwspace)
0752d008 64libc_hidden_weak (iswspace)
390955cb 65#undef iswupper
5d953aef 66func (upper, __ISwupper)
390955cb 67#undef iswxdigit
5d953aef 68func (xdigit, __ISwxdigit)
0752d008 69libc_hidden_weak (iswxdigit)
19bc17a9 70
0752d008 71#undef towlower
19bc17a9 72wint_t
0752d008 73towlower (wc)
19bc17a9
RM
74 wint_t wc;
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}
b1b54458 80libc_hidden_def (towlower)
19bc17a9 81
0752d008 82#undef towupper
19bc17a9 83wint_t
0752d008 84towupper (wc)
19bc17a9
RM
85 wint_t wc;
86{
0f283ffc
RM
87 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper;
88 const char *desc = _NL_CURRENT (LC_CTYPE, i);
89 return wctrans_table_lookup (desc, wc);
19bc17a9 90}
b1b54458 91libc_hidden_def (towupper)