• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <wchar.h>
2 #include <wctype.h>
3 #ifndef __LITEOS__
4 #ifdef FEATURE_ICU_LOCALE
5 #include <string.h>
6 #include "locale_impl.h"
7 #endif
8 #endif
9 
10 /* Our definition of whitespace is the Unicode White_Space property,
11  * minus non-breaking spaces (U+00A0, U+2007, and U+202F) and script-
12  * specific characters with non-blank glyphs (U+1680 and U+180E). */
13 
iswspace(wint_t wc)14 int iswspace(wint_t wc)
15 {
16 	static const wchar_t spaces[] = {
17 		' ', '\t', '\n', '\r', 11, 12,  0x0085,
18 		0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005,
19 		0x2006, 0x2008, 0x2009, 0x200a,
20 		0x2028, 0x2029, 0x205f, 0x3000, 0
21 	};
22 	return wc && wcschr(spaces, wc);
23 }
24 
__iswspace_l(wint_t c,locale_t l)25 int __iswspace_l(wint_t c, locale_t l)
26 {
27 #ifndef __LITEOS__
28 #ifdef FEATURE_ICU_LOCALE
29 	if (icu_locale_wctype_enable && l && l->cat[LC_CTYPE]
30 		&& l->cat[LC_CTYPE]->flag == ICU_VALID) {
31 		char* type_name = (char*)(l->cat[LC_CTYPE]->name);
32 		if (!strcmp(type_name, "zh_CN") || !strcmp(type_name, "en_US.UTF-8")) {
33 			return g_icu_opt_func.u_isspace(c);
34 		}
35 	}
36 #endif
37 #endif
38 	return iswspace(c);
39 }
40 
41 weak_alias(__iswspace_l, iswspace_l);
42