1 /* Copyright (C) 1996,1997,2000-2002,2004,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
23 #include <locale/localeinfo.h>
25 #define USE_IN_EXTENDED_LOCALE_MODEL
26 #include "wchar-lookup.h"
28 /* Provide real-function versions of all the wctype macros. */
30 #define func(name, type) \
31 int __isw##name (wint_t wc, __locale_t locale) \
34 return is##name ((int) wc, locale); \
35 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \
36 const char *desc = locale->__locales[LC_CTYPE]->values[i].string; \
37 return wctype_table_lookup (desc, wc); \
39 libc_hidden_def (__isw##name) \
40 weak_alias (__isw##name, isw##name)
42 func (alnum_l
, __ISwalnum
)
43 func (alpha_l
, __ISwalpha
)
44 func (blank_l
, __ISwblank
)
45 func (cntrl_l
, __ISwcntrl
)
48 func (digit_l
, __ISwdigit
)
49 func (lower_l
, __ISwlower
)
50 func (graph_l
, __ISwgraph
)
51 func (print_l
, __ISwprint
)
52 func (punct_l
, __ISwpunct
)
53 func (space_l
, __ISwspace
)
54 func (upper_l
, __ISwupper
)
55 func (xdigit_l
, __ISwxdigit
)
58 (__towlower_l
) (wint_t wc
, __locale_t locale
)
60 size_t i
= locale
->__locales
[LC_CTYPE
]->values
[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET
)].word
+ __TOW_tolower
;
61 const char *desc
= locale
->__locales
[LC_CTYPE
]->values
[i
].string
;
62 return wctrans_table_lookup (desc
, wc
);
64 libc_hidden_def (__towlower_l
)
65 weak_alias (__towlower_l
, towlower_l
)
68 (__towupper_l
) (wint_t wc
, __locale_t locale
)
70 size_t i
= locale
->__locales
[LC_CTYPE
]->values
[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET
)].word
+ __TOW_toupper
;
71 const char *desc
= locale
->__locales
[LC_CTYPE
]->values
[i
].string
;
72 return wctrans_table_lookup (desc
, wc
);
74 libc_hidden_def (__towupper_l
)
75 weak_alias (__towupper_l
, towupper_l
)