1 /* Copyright (C) 1996, 1997, 2000, 2001, 2002 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
22 #include <locale/localeinfo.h>
24 #define USE_IN_EXTENDED_LOCALE_MODEL
25 #include "wchar-lookup.h"
32 /* Provide real-function versions of all the wctype macros. */
34 #define func(name, type) \
35 int name (wint_t wc, __locale_t locale) \
37 size_t i = locale->__locales[LC_CTYPE]->values[_NL_ITEM_INDEX (_NL_CTYPE_CLASS_OFFSET)].word + type; \
38 const char *desc = locale->__locales[LC_CTYPE]->values[i].string; \
39 return wctype_table_lookup (desc, wc); \
43 func (__iswalnum_l
, __ISwalnum
)
44 func (__iswalpha_l
, __ISwalpha
)
45 func (__iswblank_l
, __ISwblank
)
46 func (__iswcntrl_l
, __ISwcntrl
)
47 func (__iswdigit_l
, __ISwdigit
)
48 func (__iswlower_l
, __ISwlower
)
49 func (__iswgraph_l
, __ISwgraph
)
50 func (__iswprint_l
, __ISwprint
)
51 func (__iswpunct_l
, __ISwpunct
)
52 func (__iswspace_l
, __ISwspace
)
53 func (__iswupper_l
, __ISwupper
)
54 func (__iswxdigit_l
, __ISwxdigit
)
57 (__towlower_l
) (wint_t wc
, __locale_t locale
)
59 size_t i
= locale
->__locales
[LC_CTYPE
]->values
[_NL_ITEM_INDEX (_NL_CTYPE_MAP_OFFSET
)].word
+ __TOW_tolower
;
60 const char *desc
= locale
->__locales
[LC_CTYPE
]->values
[i
].string
;
61 return wctrans_table_lookup (desc
, wc
);
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
);