summaryrefslogtreecommitdiff
path: root/libbb/unicode.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/unicode.c')
-rw-r--r--libbb/unicode.c26
1 files changed, 13 insertions, 13 deletions
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 */