.
[glibc/history.git] / wctype / wcfuncs.c
blob88430a606230c3b804c4a39a8d9097af4b786a5d
1 /* Copyright (C) 1996-2001, 2002, 2005 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 <ctype.h>
20 #include <wctype.h>
21 #include <locale/localeinfo.h>
23 #include "wchar-lookup.h"
25 /* Provide real-function versions of all the wctype macros. */
27 #define func(name, type) \
28 extern int __isw##name (wint_t __wc); \
29 int \
30 __isw##name (wint_t wc) \
31 { \
32 if (isascii (wc)) \
33 return is##name ((int) wc); \
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 } \
38 weak_alias (__isw##name, isw##name)
40 #undef iswalnum
41 func (alnum, __ISwalnum)
42 libc_hidden_weak (iswalnum)
43 #undef iswalpha
44 func (alpha, __ISwalpha)
45 libc_hidden_weak (iswalpha)
46 #undef iswblank
47 func (blank, __ISwblank)
48 #undef iswcntrl
49 func (cntrl, __ISwcntrl)
50 #undef iswdigit
51 func (digit, __ISwdigit)
52 libc_hidden_weak (iswdigit)
53 #undef iswlower
54 func (lower, __ISwlower)
55 libc_hidden_weak (iswlower)
56 #undef iswgraph
57 func (graph, __ISwgraph)
58 #undef iswprint
59 func (print, __ISwprint)
60 #undef iswpunct
61 func (punct, __ISwpunct)
62 #undef iswspace
63 func (space, __ISwspace)
64 libc_hidden_weak (iswspace)
65 #undef iswupper
66 func (upper, __ISwupper)
67 #undef iswxdigit
68 func (xdigit, __ISwxdigit)
69 libc_hidden_weak (iswxdigit)
71 #undef towlower
72 wint_t
73 towlower (wc)
74 wint_t wc;
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);
80 libc_hidden_def (towlower)
82 #undef towupper
83 wint_t
84 towupper (wc)
85 wint_t wc;
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);
91 libc_hidden_def (towupper)