sysdeps/powerpc/nofpu moved to ports
[glibc.git] / wctype / wcfuncs_l.c
blobc10af761023c41c3ac33592e4110e01fb02cc1b5
1 /* Copyright (C) 1996,1997,2000,2001,2002,2004 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 <stdint.h>
21 #include <locale.h>
22 #include <locale/localeinfo.h>
24 #define USE_IN_EXTENDED_LOCALE_MODEL
25 #include "wchar-lookup.h"
27 /* Provide real-function versions of all the wctype macros. */
29 #define func(name, type) \
30 int __##name (wint_t wc, __locale_t locale) \
31 { \
32 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \
33 const char *desc = locale->__locales[LC_CTYPE]->values[i].string; \
34 return wctype_table_lookup (desc, wc); \
35 } \
36 libc_hidden_def (__##name) \
37 weak_alias (__##name, name)
39 func (iswalnum_l, __ISwalnum)
40 func (iswalpha_l, __ISwalpha)
41 func (iswblank_l, __ISwblank)
42 func (iswcntrl_l, __ISwcntrl)
43 #undef iswdigit_l
44 #undef __iswdigit_l
45 func (iswdigit_l, __ISwdigit)
46 func (iswlower_l, __ISwlower)
47 func (iswgraph_l, __ISwgraph)
48 func (iswprint_l, __ISwprint)
49 func (iswpunct_l, __ISwpunct)
50 func (iswspace_l, __ISwspace)
51 func (iswupper_l, __ISwupper)
52 func (iswxdigit_l, __ISwxdigit)
54 wint_t
55 (__towlower_l) (wint_t wc, __locale_t locale)
57 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower;
58 const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
59 return wctrans_table_lookup (desc, wc);
61 libc_hidden_def (__towlower_l)
62 weak_alias (__towlower_l, towlower_l)
64 wint_t
65 (__towupper_l) (wint_t wc, __locale_t locale)
67 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper;
68 const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
69 return wctrans_table_lookup (desc, wc);
71 libc_hidden_def (__towupper_l)
72 weak_alias (__towupper_l, towupper_l)