1 /*
2 Copyright (c) 2016 Corinna Vinschen <corinna@vinschen.de>
3 Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling
4  */
5 /* Modified (m) 2017 Thomas Wolff: revise Unicode and locale/wchar handling */
6 #include <_ansi.h>
7 #include <ctype.h>
8 #include <wctype.h>
9 #include "local.h"
10 #include "categories.h"
11 
12 int
iswalnum_l(wint_t c,struct __locale_t * locale)13 iswalnum_l (wint_t c, struct __locale_t *locale)
14 {
15   (void) locale;
16 #ifdef _MB_CAPABLE
17   //return iswalpha (c) || iswdigit (c);
18   c = _jp2uc_l (c, locale);
19   enum category cat = category (c);
20   return cat == CAT_LC || cat == CAT_Lu || cat == CAT_Ll || cat == CAT_Lt
21       || cat == CAT_Lm || cat == CAT_Lo
22       || cat == CAT_Nl // Letter_Number
23       || cat == CAT_Nd // Decimal_Number
24       ;
25 #else
26   return c < (wint_t)0x100 ? isalnum (c) : 0;
27 #endif /* _MB_CAPABLE */
28 }
29