Update.
[glibc.git] / wctype / wcfuncs.c
bloba3aed3104eff086cc9fba7865b7eacc5008b5192
1 /* Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
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.
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
12 Lesser General Public License for more details.
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. */
19 #include <wctype.h>
20 #include <locale/localeinfo.h>
22 #include "wchar-lookup.h"
24 /* Provide real-function versions of all the wctype macros. */
26 #define func(name, type) \
27 extern int __##name (wint_t __wc); \
28 int \
29 __##name (wint_t wc) \
30 { \
31 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_CLASS_OFFSET) + type; \
32 const char *desc = _NL_CURRENT (LC_CTYPE, i); \
33 return wctype_table_lookup (desc, wc); \
34 } \
35 weak_alias (__##name, name)
37 #undef iswalnum
38 func (iswalnum, __ISwalnum)
39 #undef iswalpha
40 func (iswalpha, __ISwalpha)
41 libc_hidden_weak (iswalpha)
42 #undef iswblank
43 func (iswblank, __ISwblank)
44 #undef iswcntrl
45 func (iswcntrl, __ISwcntrl)
46 #undef iswdigit
47 func (iswdigit, __ISwdigit)
48 libc_hidden_weak (iswdigit)
49 #undef iswlower
50 func (iswlower, __ISwlower)
51 libc_hidden_weak (iswlower)
52 #undef iswgraph
53 func (iswgraph, __ISwgraph)
54 #undef iswprint
55 func (iswprint, __ISwprint)
56 #undef iswpunct
57 func (iswpunct, __ISwpunct)
58 #undef iswspace
59 func (iswspace, __ISwspace)
60 libc_hidden_weak (iswspace)
61 #undef iswupper
62 func (iswupper, __ISwupper)
63 #undef iswxdigit
64 func (iswxdigit, __ISwxdigit)
65 libc_hidden_weak (iswxdigit)
67 #undef towlower
68 wint_t
69 towlower (wc)
70 wint_t wc;
72 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower;
73 const char *desc = _NL_CURRENT (LC_CTYPE, i);
74 return wctrans_table_lookup (desc, wc);
76 libc_hidden_def (towlower)
78 #undef towupper
79 wint_t
80 towupper (wc)
81 wint_t wc;
83 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper;
84 const char *desc = _NL_CURRENT (LC_CTYPE, i);
85 return wctrans_table_lookup (desc, wc);
87 libc_hidden_def (towupper)