2.3.3-93
[glibc.git] / wctype / wcfuncs.c
blob5d0e219fb2a3000c3689b808b3efa37f495b043f
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 libc_hidden_weak (iswalnum)
40 #undef iswalpha
41 func (iswalpha, __ISwalpha)
42 libc_hidden_weak (iswalpha)
43 #undef iswblank
44 func (iswblank, __ISwblank)
45 #undef iswcntrl
46 func (iswcntrl, __ISwcntrl)
47 #undef iswdigit
48 func (iswdigit, __ISwdigit)
49 libc_hidden_weak (iswdigit)
50 #undef iswlower
51 func (iswlower, __ISwlower)
52 libc_hidden_weak (iswlower)
53 #undef iswgraph
54 func (iswgraph, __ISwgraph)
55 #undef iswprint
56 func (iswprint, __ISwprint)
57 #undef iswpunct
58 func (iswpunct, __ISwpunct)
59 #undef iswspace
60 func (iswspace, __ISwspace)
61 libc_hidden_weak (iswspace)
62 #undef iswupper
63 func (iswupper, __ISwupper)
64 #undef iswxdigit
65 func (iswxdigit, __ISwxdigit)
66 libc_hidden_weak (iswxdigit)
68 #undef towlower
69 wint_t
70 towlower (wc)
71 wint_t wc;
73 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_tolower;
74 const char *desc = _NL_CURRENT (LC_CTYPE, i);
75 return wctrans_table_lookup (desc, wc);
77 libc_hidden_def (towlower)
79 #undef towupper
80 wint_t
81 towupper (wc)
82 wint_t wc;
84 size_t i = _NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_OFFSET) + __TOW_toupper;
85 const char *desc = _NL_CURRENT (LC_CTYPE, i);
86 return wctrans_table_lookup (desc, wc);
88 libc_hidden_def (towupper)