Mercurial > emacs
changeset 19983:a62008636710
(find_charset_in_str): Return also charsets in
composite characters.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Thu, 25 Sep 1997 12:25:01 +0000 |
parents | 199256234202 |
children | 2195c8746e05 |
files | src/charset.c |
diffstat | 1 files changed, 35 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/charset.c Thu Sep 25 01:33:26 1997 +0000 +++ b/src/charset.c Thu Sep 25 12:25:01 1997 +0000 @@ -546,23 +546,53 @@ Lisp_Object table; { int num = 0; + int cmpcharp = 0; + unsigned char str_work[4], *str_tmp; if (! CHAR_TABLE_P (table)) table = Qnil; while (len > 0) { - int bytes = BYTES_BY_CHAR_HEAD (*str); - int charset; + int bytes, charset; + if (*str == LEADING_CODE_COMPOSITION) + { + str++; + len--; + cmpcharp = 1; + } + else if (CHAR_HEAD_P (str)) + cmpcharp = 0; + + if (cmpcharp) + { + if (*str == 0xA0) + { + str++; + len--; + str_work[0] = *str & 0x7F; + } + else + { + bcopy (str, str_work, min (4, len)); + str_work[0] -= 0x20; + } + str_tmp = str_work; + } + else + str_tmp = str; + + bytes = BYTES_BY_CHAR_HEAD (*str_tmp); + if (NILP (table)) - charset = CHARSET_AT (str); + charset = CHARSET_AT (str_tmp); else { - int c, charset; + int c; unsigned char c1, c2; - SPLIT_STRING(str, bytes, charset, c1, c2); + SPLIT_STRING(str_tmp, bytes, charset, c1, c2); if ((c = unify_char (table, -1, charset, c1, c2)) >= 0) charset = CHAR_CHARSET (c); }