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 #define _DEFAULT_SOURCE
7 #include <ctype.h>
8 #include <wctype.h>
9 #include "local.h"
10 #include "categories.h"
11 
12 int
iswpunct_l(wint_t c,struct __locale_t * locale)13 iswpunct_l (wint_t c, struct __locale_t *locale)
14 {
15   (void) locale;
16 #ifdef _MB_CAPABLE
17   //return !iswalnum (c) && iswgraph (c);
18   c = _jp2uc_l (c, locale);
19   enum category cat = category (c);
20   return cat == CAT_Pc || cat == CAT_Pd || cat == CAT_Pe || cat == CAT_Pf || cat == CAT_Pi || cat == CAT_Po || cat == CAT_Ps
21       || cat == CAT_Sm // Math Symbols
22       // the following are included for backwards consistency:
23       || cat == CAT_Sc // Currency Symbols
24       || cat == CAT_Sk // Modifier_Symbol
25       || cat == CAT_So // Other_Symbol
26       || cat == CAT_No // Other_Number
27       ;
28 #else
29   return c < (wint_t)0x100 ? ispunct (c) : 0;
30 #endif /* _MB_CAPABLE */
31 }
32