diff options
Diffstat (limited to 'regexp/utf8.c')
-rw-r--r-- | regexp/utf8.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/regexp/utf8.c b/regexp/utf8.c index 405c20d22..35f866626 100644 --- a/regexp/utf8.c +++ b/regexp/utf8.c @@ -76,19 +76,6 @@ int utf8_strlen(const char *str, int bytelen) return charlen; } -int utf8_strwidth(const char *str, int charlen) -{ - int width = 0; - while (charlen) { - int c; - int l = utf8_tounicode(str, &c); - width += utf8_width(c); - str += l; - charlen--; - } - return width; -} - int utf8_index(const char *str, int index) { const char *s = str; @@ -165,11 +152,6 @@ struct casemap { unsigned short altcode; /* alternate case code point */ }; -struct utf8range { - unsigned lower; /* lower inclusive */ - unsigned upper; /* upper exclusive */ -}; - /* Generated mapping tables */ #include "_unicode_mapping.c" @@ -195,30 +177,6 @@ static int utf8_map_case(const struct casemap *mapping, int num, int ch) return ch; } -static int cmp_range(const void *key, const void *cm) -{ - const struct utf8range *range = (const struct utf8range *)cm; - unsigned ch = *(unsigned *)key; - if (ch < range->lower) { - return -1; - } - if (ch >= range->upper) { - return 1; - } - return 0; -} - -static int utf8_in_range(const struct utf8range *range, int num, int ch) -{ - const struct utf8range *r = - bsearch(&ch, range, num, sizeof(*range), cmp_range); - - if (r) { - return 1; - } - return 0; -} - int utf8_upper(int ch) { if (isascii(ch)) { @@ -234,29 +192,4 @@ int utf8_lower(int ch) } return utf8_map_case(unicode_case_mapping_lower, ARRAYSIZE(unicode_case_mapping_lower), ch); } - -int utf8_title(int ch) -{ - if (!isascii(ch)) { - int newch = utf8_map_case(unicode_case_mapping_title, ARRAYSIZE(unicode_case_mapping_title), ch); - if (newch != ch) { - return newch ? newch : ch; - } - } - return utf8_upper(ch); -} - -int utf8_width(int ch) -{ - if (!isascii(ch)) { - if (utf8_in_range(unicode_range_combining, ARRAYSIZE(unicode_range_combining), ch)) { - return 0; - } - if (utf8_in_range(unicode_range_wide, ARRAYSIZE(unicode_range_wide), ch)) { - return 2; - } - } - return 1; -} - #endif /* JIM_BOOTSTRAP */ |