diff options
author | Denys Vlasenko | 2010-05-16 21:15:03 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-05-16 21:15:03 +0200 |
commit | 26e2c1db0df35df1affa558efc12d2bcfd7718e2 (patch) | |
tree | 7b1b65e1aafd93ab4c7d0681ff45c28de154b4af | |
parent | b8909c52fe850d2731326534822164c2f5258bf5 (diff) | |
download | busybox-26e2c1db0df35df1affa558efc12d2bcfd7718e2.zip busybox-26e2c1db0df35df1affa558efc12d2bcfd7718e2.tar.gz |
stop using LAST_SUPPORTED_WCHAR and CONFIG_LAST_SUPPORTED_WCHAR, it's confusing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | include/unicode.h | 11 | ||||
-rw-r--r-- | libbb/lineedit.c | 5 | ||||
-rw-r--r-- | libbb/unicode.c | 26 |
3 files changed, 20 insertions, 22 deletions
diff --git a/include/unicode.h b/include/unicode.h index 747026a..eaf67c8 100644 --- a/include/unicode.h +++ b/include/unicode.h @@ -30,22 +30,21 @@ enum { #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 diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 9f2d657..72a1786 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -282,9 +282,8 @@ static wchar_t adjust_width_and_validate_wc(wchar_t wc) int w = 1; if (unicode_status == UNICODE_ON) { - if (unicode_is_raw_byte(wc) - || (CONFIG_LAST_SUPPORTED_WCHAR && wc > CONFIG_LAST_SUPPORTED_WCHAR) - ) { + if (wc > CONFIG_LAST_SUPPORTED_WCHAR) { + /* note: also true for unicode_is_raw_byte(wc) */ goto subst; } w = wcwidth(wc); diff --git a/libbb/unicode.c b/libbb/unicode.c index eb0ea61..b2c2823 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c @@ -240,7 +240,7 @@ int FAST_FUNC iswpunct(wint_t wc) } -# if LAST_SUPPORTED_WCHAR >= 0x300 +# if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300 struct interval { uint16_t first; uint16_t last; @@ -420,7 +420,7 @@ static int in_uint16_table(unsigned ucs, const uint16_t *table, unsigned max) */ 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 }, @@ -579,14 +579,14 @@ int FAST_FUNC wcwidth(unsigned ucs) 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; @@ -594,25 +594,25 @@ int FAST_FUNC wcwidth(unsigned ucs) 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[] = { @@ -625,7 +625,7 @@ int FAST_FUNC wcwidth(unsigned ucs) 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) @@ -644,7 +644,7 @@ int FAST_FUNC wcwidth(unsigned ucs) || 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 */ |