#else
# if CONFIG_LAST_SUPPORTED_WCHAR < 126 || CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000
-# define LAST_SUPPORTED_WCHAR 0x2ffff
-# else
-# define LAST_SUPPORTED_WCHAR CONFIG_LAST_SUPPORTED_WCHAR
+# undef CONFIG_LAST_SUPPORTED_WCHAR
+# define CONFIG_LAST_SUPPORTED_WCHAR 0x2ffff
# endif
-# if LAST_SUPPORTED_WCHAR < 0x300
+# if CONFIG_LAST_SUPPORTED_WCHAR < 0x300
# undef ENABLE_UNICODE_COMBINING_WCHARS
# define ENABLE_UNICODE_COMBINING_WCHARS 0
# endif
-# if LAST_SUPPORTED_WCHAR < 0x1100
+# if CONFIG_LAST_SUPPORTED_WCHAR < 0x1100
# undef ENABLE_UNICODE_WIDE_WCHARS
# define ENABLE_UNICODE_WIDE_WCHARS 0
# endif
-# if LAST_SUPPORTED_WCHAR < 0x590
+# if CONFIG_LAST_SUPPORTED_WCHAR < 0x590
# undef ENABLE_UNICODE_BIDI_SUPPORT
# define ENABLE_UNICODE_BIDI_SUPPORT 0
# endif
}
-# if LAST_SUPPORTED_WCHAR >= 0x300
+# if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300
struct interval {
uint16_t first;
uint16_t last;
*/
int FAST_FUNC wcwidth(unsigned ucs)
{
-# if LAST_SUPPORTED_WCHAR >= 0x300
+# if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300
/* sorted list of non-overlapping intervals of non-spacing characters */
/* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */
# define BIG_(a,b) { a, b },
if ((ucs & ~0x80) < 0x20 || ucs == 0x7f)
return -1;
/* Quick abort if it is an obviously invalid char */
- if (ucs > LAST_SUPPORTED_WCHAR)
+ if (ucs > CONFIG_LAST_SUPPORTED_WCHAR)
return -1;
/* Optimization: no combining chars below 0x300 */
- if (LAST_SUPPORTED_WCHAR < 0x300 || ucs < 0x300)
+ if (CONFIG_LAST_SUPPORTED_WCHAR < 0x300 || ucs < 0x300)
return 1;
-# if LAST_SUPPORTED_WCHAR >= 0x300
+# if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300
/* Binary search in table of non-spacing characters */
if (in_interval_table(ucs, combining, ARRAY_SIZE(combining) - 1))
return 0;
return 0;
/* Optimization: all chars below 0x1100 are not double-width */
- if (LAST_SUPPORTED_WCHAR < 0x1100 || ucs < 0x1100)
+ if (CONFIG_LAST_SUPPORTED_WCHAR < 0x1100 || ucs < 0x1100)
return 1;
-# if LAST_SUPPORTED_WCHAR >= 0x1100
+# if CONFIG_LAST_SUPPORTED_WCHAR >= 0x1100
/* Invalid code points: */
/* High (d800..dbff) and low (dc00..dfff) surrogates (valid only in UTF16) */
/* Private Use Area (e000..f8ff) */
/* Noncharacters fdd0..fdef */
- if ((LAST_SUPPORTED_WCHAR >= 0xd800 && ucs >= 0xd800 && ucs <= 0xf8ff)
- || (LAST_SUPPORTED_WCHAR >= 0xfdd0 && ucs >= 0xfdd0 && ucs <= 0xfdef)
+ if ((CONFIG_LAST_SUPPORTED_WCHAR >= 0xd800 && ucs >= 0xd800 && ucs <= 0xf8ff)
+ || (CONFIG_LAST_SUPPORTED_WCHAR >= 0xfdd0 && ucs >= 0xfdd0 && ucs <= 0xfdef)
) {
return -1;
}
/* 0xfffe and 0xffff in every plane are invalid */
- if (LAST_SUPPORTED_WCHAR >= 0xfffe && ((ucs & 0xfffe) == 0xfffe)) {
+ if (CONFIG_LAST_SUPPORTED_WCHAR >= 0xfffe && ((ucs & 0xfffe) == 0xfffe)) {
return -1;
}
-# if LAST_SUPPORTED_WCHAR >= 0x10000
+# if CONFIG_LAST_SUPPORTED_WCHAR >= 0x10000
if (ucs >= 0x10000) {
/* Combining chars in Supplementary Multilingual Plane 0x1xxxx */
static const struct interval combining0x10000[] = {
if (in_interval_table(ucs ^ 0x10000, combining0x10000, ARRAY_SIZE(combining0x10000) - 1))
return 0;
/* Check a few non-spacing chars in Supplementary Special-purpose Plane 0xExxxx */
- if (LAST_SUPPORTED_WCHAR >= 0xE0001
+ if (CONFIG_LAST_SUPPORTED_WCHAR >= 0xE0001
&& ( ucs == 0xE0001
|| (ucs >= 0xE0020 && ucs <= 0xE007F)
|| (ucs >= 0xE0100 && ucs <= 0xE01EF)
|| ucs == 0x2329 /* left-pointing angle bracket; also CJK punct. char */
|| ucs == 0x232a /* right-pointing angle bracket; also CJK punct. char */
|| (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) /* CJK ... Yi */
-# if LAST_SUPPORTED_WCHAR >= 0xac00
+# if CONFIG_LAST_SUPPORTED_WCHAR >= 0xac00
|| (ucs >= 0xac00 && ucs <= 0xd7a3) /* Hangul Syllables */
|| (ucs >= 0xf900 && ucs <= 0xfaff) /* CJK Compatibility Ideographs */
|| (ucs >= 0xfe10 && ucs <= 0xfe19) /* Vertical forms */