Update.
[glibc.git] / wctype / wcfuncs_l.c
blobac04ff3375fd16375a3ed58f800062e596bd0a44
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 Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 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);