Update.
[glibc.git] / wctype / wcfuncs_l.c
blob0c75359a41389c3a3b5687b5741ec6c6ae516e34
1 /* Copyright (C) 1996, 1997, 2000 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 #define __NO_WCTYPE
20 #include <wctype.h>
21 #include <stdint.h>
23 #define USE_IN_EXTENDED_LOCALE_MODEL
24 #include "cname-lookup.h"
26 /* Provide real-function versions of all the wctype macros. */
28 #define func(name, type) \
29 int name (wint_t wc, __locale_t locale) \
30 { return __iswctype_l (wc, type, locale); }
32 func (__iswalnum_l, _ISwalnum)
33 func (__iswalpha_l, _ISwalpha)
34 func (__iswcntrl_l, _ISwcntrl)
35 func (__iswdigit_l, _ISwdigit)
36 func (__iswlower_l, _ISwlower)
37 func (__iswgraph_l, _ISwgraph)
38 func (__iswprint_l, _ISwprint)
39 func (__iswpunct_l, _ISwpunct)
40 func (__iswspace_l, _ISwspace)
41 func (__iswupper_l, _ISwupper)
42 func (__iswxdigit_l, _ISwxdigit)
44 wint_t
45 (__towlower_l) (wint_t wc, __locale_t locale)
47 const int32_t *class32_tolower;
48 size_t idx;
50 idx = cname_lookup (wc, locale);
51 if (idx == ~((size_t) 0))
52 return 0;
54 class32_tolower = (const int32_t *)
55 locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOLOWER32)].string;
57 return class32_tolower[idx];
60 wint_t
61 (__towupper_l) (wint_t wc, __locale_t locale)
63 const int32_t *class32_toupper;
64 size_t idx;
66 idx = cname_lookup (wc, locale);
67 if (idx == ~((size_t) 0))
68 return 0;
70 class32_toupper = (const int32_t *)
71 locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_TOUPPER32)].string;
73 return class32_toupper[idx];