diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-16 21:15:03 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-16 21:15:03 +0200 |
| commit | 26e2c1db0df35df1affa558efc12d2bcfd7718e2 (patch) | |
| tree | 7b1b65e1aafd93ab4c7d0681ff45c28de154b4af | |
| parent | b8909c52fe850d2731326534822164c2f5258bf5 (diff) | |
| download | busybox-w32-26e2c1db0df35df1affa558efc12d2bcfd7718e2.tar.gz busybox-w32-26e2c1db0df35df1affa558efc12d2bcfd7718e2.tar.bz2 busybox-w32-26e2c1db0df35df1affa558efc12d2bcfd7718e2.zip | |
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 747026abe..eaf67c833 100644 --- a/include/unicode.h +++ b/include/unicode.h | |||
| @@ -30,22 +30,21 @@ enum { | |||
| 30 | #else | 30 | #else |
| 31 | 31 | ||
| 32 | # if CONFIG_LAST_SUPPORTED_WCHAR < 126 || CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000 | 32 | # if CONFIG_LAST_SUPPORTED_WCHAR < 126 || CONFIG_LAST_SUPPORTED_WCHAR >= 0x30000 |
| 33 | # define LAST_SUPPORTED_WCHAR 0x2ffff | 33 | # undef CONFIG_LAST_SUPPORTED_WCHAR |
| 34 | # else | 34 | # define CONFIG_LAST_SUPPORTED_WCHAR 0x2ffff |
| 35 | # define LAST_SUPPORTED_WCHAR CONFIG_LAST_SUPPORTED_WCHAR | ||
| 36 | # endif | 35 | # endif |
| 37 | 36 | ||
| 38 | # if LAST_SUPPORTED_WCHAR < 0x300 | 37 | # if CONFIG_LAST_SUPPORTED_WCHAR < 0x300 |
| 39 | # undef ENABLE_UNICODE_COMBINING_WCHARS | 38 | # undef ENABLE_UNICODE_COMBINING_WCHARS |
| 40 | # define ENABLE_UNICODE_COMBINING_WCHARS 0 | 39 | # define ENABLE_UNICODE_COMBINING_WCHARS 0 |
| 41 | # endif | 40 | # endif |
| 42 | 41 | ||
| 43 | # if LAST_SUPPORTED_WCHAR < 0x1100 | 42 | # if CONFIG_LAST_SUPPORTED_WCHAR < 0x1100 |
| 44 | # undef ENABLE_UNICODE_WIDE_WCHARS | 43 | # undef ENABLE_UNICODE_WIDE_WCHARS |
| 45 | # define ENABLE_UNICODE_WIDE_WCHARS 0 | 44 | # define ENABLE_UNICODE_WIDE_WCHARS 0 |
| 46 | # endif | 45 | # endif |
| 47 | 46 | ||
| 48 | # if LAST_SUPPORTED_WCHAR < 0x590 | 47 | # if CONFIG_LAST_SUPPORTED_WCHAR < 0x590 |
| 49 | # undef ENABLE_UNICODE_BIDI_SUPPORT | 48 | # undef ENABLE_UNICODE_BIDI_SUPPORT |
| 50 | # define ENABLE_UNICODE_BIDI_SUPPORT 0 | 49 | # define ENABLE_UNICODE_BIDI_SUPPORT 0 |
| 51 | # endif | 50 | # endif |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 9f2d65717..72a1786ff 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
| @@ -282,9 +282,8 @@ static wchar_t adjust_width_and_validate_wc(wchar_t wc) | |||
| 282 | int w = 1; | 282 | int w = 1; |
| 283 | 283 | ||
| 284 | if (unicode_status == UNICODE_ON) { | 284 | if (unicode_status == UNICODE_ON) { |
| 285 | if (unicode_is_raw_byte(wc) | 285 | if (wc > CONFIG_LAST_SUPPORTED_WCHAR) { |
| 286 | || (CONFIG_LAST_SUPPORTED_WCHAR && wc > CONFIG_LAST_SUPPORTED_WCHAR) | 286 | /* note: also true for unicode_is_raw_byte(wc) */ |
| 287 | ) { | ||
| 288 | goto subst; | 287 | goto subst; |
| 289 | } | 288 | } |
| 290 | w = wcwidth(wc); | 289 | w = wcwidth(wc); |
diff --git a/libbb/unicode.c b/libbb/unicode.c index eb0ea6129..b2c28239b 100644 --- a/libbb/unicode.c +++ b/libbb/unicode.c | |||
| @@ -240,7 +240,7 @@ int FAST_FUNC iswpunct(wint_t wc) | |||
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | 242 | ||
| 243 | # if LAST_SUPPORTED_WCHAR >= 0x300 | 243 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300 |
| 244 | struct interval { | 244 | struct interval { |
| 245 | uint16_t first; | 245 | uint16_t first; |
| 246 | uint16_t last; | 246 | uint16_t last; |
| @@ -420,7 +420,7 @@ static int in_uint16_table(unsigned ucs, const uint16_t *table, unsigned max) | |||
| 420 | */ | 420 | */ |
| 421 | int FAST_FUNC wcwidth(unsigned ucs) | 421 | int FAST_FUNC wcwidth(unsigned ucs) |
| 422 | { | 422 | { |
| 423 | # if LAST_SUPPORTED_WCHAR >= 0x300 | 423 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300 |
| 424 | /* sorted list of non-overlapping intervals of non-spacing characters */ | 424 | /* sorted list of non-overlapping intervals of non-spacing characters */ |
| 425 | /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ | 425 | /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ |
| 426 | # define BIG_(a,b) { a, b }, | 426 | # define BIG_(a,b) { a, b }, |
| @@ -579,14 +579,14 @@ int FAST_FUNC wcwidth(unsigned ucs) | |||
| 579 | if ((ucs & ~0x80) < 0x20 || ucs == 0x7f) | 579 | if ((ucs & ~0x80) < 0x20 || ucs == 0x7f) |
| 580 | return -1; | 580 | return -1; |
| 581 | /* Quick abort if it is an obviously invalid char */ | 581 | /* Quick abort if it is an obviously invalid char */ |
| 582 | if (ucs > LAST_SUPPORTED_WCHAR) | 582 | if (ucs > CONFIG_LAST_SUPPORTED_WCHAR) |
| 583 | return -1; | 583 | return -1; |
| 584 | 584 | ||
| 585 | /* Optimization: no combining chars below 0x300 */ | 585 | /* Optimization: no combining chars below 0x300 */ |
| 586 | if (LAST_SUPPORTED_WCHAR < 0x300 || ucs < 0x300) | 586 | if (CONFIG_LAST_SUPPORTED_WCHAR < 0x300 || ucs < 0x300) |
| 587 | return 1; | 587 | return 1; |
| 588 | 588 | ||
| 589 | # if LAST_SUPPORTED_WCHAR >= 0x300 | 589 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x300 |
| 590 | /* Binary search in table of non-spacing characters */ | 590 | /* Binary search in table of non-spacing characters */ |
| 591 | if (in_interval_table(ucs, combining, ARRAY_SIZE(combining) - 1)) | 591 | if (in_interval_table(ucs, combining, ARRAY_SIZE(combining) - 1)) |
| 592 | return 0; | 592 | return 0; |
| @@ -594,25 +594,25 @@ int FAST_FUNC wcwidth(unsigned ucs) | |||
| 594 | return 0; | 594 | return 0; |
| 595 | 595 | ||
| 596 | /* Optimization: all chars below 0x1100 are not double-width */ | 596 | /* Optimization: all chars below 0x1100 are not double-width */ |
| 597 | if (LAST_SUPPORTED_WCHAR < 0x1100 || ucs < 0x1100) | 597 | if (CONFIG_LAST_SUPPORTED_WCHAR < 0x1100 || ucs < 0x1100) |
| 598 | return 1; | 598 | return 1; |
| 599 | 599 | ||
| 600 | # if LAST_SUPPORTED_WCHAR >= 0x1100 | 600 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x1100 |
| 601 | /* Invalid code points: */ | 601 | /* Invalid code points: */ |
| 602 | /* High (d800..dbff) and low (dc00..dfff) surrogates (valid only in UTF16) */ | 602 | /* High (d800..dbff) and low (dc00..dfff) surrogates (valid only in UTF16) */ |
| 603 | /* Private Use Area (e000..f8ff) */ | 603 | /* Private Use Area (e000..f8ff) */ |
| 604 | /* Noncharacters fdd0..fdef */ | 604 | /* Noncharacters fdd0..fdef */ |
| 605 | if ((LAST_SUPPORTED_WCHAR >= 0xd800 && ucs >= 0xd800 && ucs <= 0xf8ff) | 605 | if ((CONFIG_LAST_SUPPORTED_WCHAR >= 0xd800 && ucs >= 0xd800 && ucs <= 0xf8ff) |
| 606 | || (LAST_SUPPORTED_WCHAR >= 0xfdd0 && ucs >= 0xfdd0 && ucs <= 0xfdef) | 606 | || (CONFIG_LAST_SUPPORTED_WCHAR >= 0xfdd0 && ucs >= 0xfdd0 && ucs <= 0xfdef) |
| 607 | ) { | 607 | ) { |
| 608 | return -1; | 608 | return -1; |
| 609 | } | 609 | } |
| 610 | /* 0xfffe and 0xffff in every plane are invalid */ | 610 | /* 0xfffe and 0xffff in every plane are invalid */ |
| 611 | if (LAST_SUPPORTED_WCHAR >= 0xfffe && ((ucs & 0xfffe) == 0xfffe)) { | 611 | if (CONFIG_LAST_SUPPORTED_WCHAR >= 0xfffe && ((ucs & 0xfffe) == 0xfffe)) { |
| 612 | return -1; | 612 | return -1; |
| 613 | } | 613 | } |
| 614 | 614 | ||
| 615 | # if LAST_SUPPORTED_WCHAR >= 0x10000 | 615 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0x10000 |
| 616 | if (ucs >= 0x10000) { | 616 | if (ucs >= 0x10000) { |
| 617 | /* Combining chars in Supplementary Multilingual Plane 0x1xxxx */ | 617 | /* Combining chars in Supplementary Multilingual Plane 0x1xxxx */ |
| 618 | static const struct interval combining0x10000[] = { | 618 | static const struct interval combining0x10000[] = { |
| @@ -625,7 +625,7 @@ int FAST_FUNC wcwidth(unsigned ucs) | |||
| 625 | if (in_interval_table(ucs ^ 0x10000, combining0x10000, ARRAY_SIZE(combining0x10000) - 1)) | 625 | if (in_interval_table(ucs ^ 0x10000, combining0x10000, ARRAY_SIZE(combining0x10000) - 1)) |
| 626 | return 0; | 626 | return 0; |
| 627 | /* Check a few non-spacing chars in Supplementary Special-purpose Plane 0xExxxx */ | 627 | /* Check a few non-spacing chars in Supplementary Special-purpose Plane 0xExxxx */ |
| 628 | if (LAST_SUPPORTED_WCHAR >= 0xE0001 | 628 | if (CONFIG_LAST_SUPPORTED_WCHAR >= 0xE0001 |
| 629 | && ( ucs == 0xE0001 | 629 | && ( ucs == 0xE0001 |
| 630 | || (ucs >= 0xE0020 && ucs <= 0xE007F) | 630 | || (ucs >= 0xE0020 && ucs <= 0xE007F) |
| 631 | || (ucs >= 0xE0100 && ucs <= 0xE01EF) | 631 | || (ucs >= 0xE0100 && ucs <= 0xE01EF) |
| @@ -644,7 +644,7 @@ int FAST_FUNC wcwidth(unsigned ucs) | |||
| 644 | || ucs == 0x2329 /* left-pointing angle bracket; also CJK punct. char */ | 644 | || ucs == 0x2329 /* left-pointing angle bracket; also CJK punct. char */ |
| 645 | || ucs == 0x232a /* right-pointing angle bracket; also CJK punct. char */ | 645 | || ucs == 0x232a /* right-pointing angle bracket; also CJK punct. char */ |
| 646 | || (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) /* CJK ... Yi */ | 646 | || (ucs >= 0x2e80 && ucs <= 0xa4cf && ucs != 0x303f) /* CJK ... Yi */ |
| 647 | # if LAST_SUPPORTED_WCHAR >= 0xac00 | 647 | # if CONFIG_LAST_SUPPORTED_WCHAR >= 0xac00 |
| 648 | || (ucs >= 0xac00 && ucs <= 0xd7a3) /* Hangul Syllables */ | 648 | || (ucs >= 0xac00 && ucs <= 0xd7a3) /* Hangul Syllables */ |
| 649 | || (ucs >= 0xf900 && ucs <= 0xfaff) /* CJK Compatibility Ideographs */ | 649 | || (ucs >= 0xf900 && ucs <= 0xfaff) /* CJK Compatibility Ideographs */ |
| 650 | || (ucs >= 0xfe10 && ucs <= 0xfe19) /* Vertical forms */ | 650 | || (ucs >= 0xfe10 && ucs <= 0xfe19) /* Vertical forms */ |
