(nscd-modules): Add xmalloc for nscd.
[glibc.git] / wctype / wcfuncs_l.c
bloba6fd3111b8a9bdf7595deaf903babf2e2b1e16d8
1 /* Copyright (C) 1996, 1997, 2000, 2001 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); \
37 func (__iswalnum_l, __ISwalnum)
38 func (__iswalpha_l, __ISwalpha)
39 func (__iswblank_l, __ISwblank)
40 func (__iswcntrl_l, __ISwcntrl)
41 func (__iswdigit_l, __ISwdigit)
42 func (__iswlower_l, __ISwlower)
43 func (__iswgraph_l, __ISwgraph)
44 func (__iswprint_l, __ISwprint)
45 func (__iswpunct_l, __ISwpunct)
46 func (__iswspace_l, __ISwspace)
47 func (__iswupper_l, __ISwupper)
48 func (__iswxdigit_l, __ISwxdigit)
50 wint_t
51 (__towlower_l) (wint_t wc, __locale_t locale)
53 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_tolower;
54 const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
55 return wctrans_table_lookup (desc, wc);
58 wint_t
59 (__towupper_l) (wint_t wc, __locale_t locale)
61 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET)].word + __TOW_toupper;
62 const char *desc = locale->__locales[LC_CTYPE]->values[i].string;
63 return wctrans_table_lookup (desc, wc);