diff options
| author | Kenichi Handa | 1998-10-12 12:00:44 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-10-12 12:00:44 +0000 |
| commit | 020da460989f99035044aad5d97166139af57c1f (patch) | |
| tree | 4a398d1618a0732d01b3a44429f93ca134c0c42c /src | |
| parent | 622fece5320c948892fb2d07e14758ac32e1915f (diff) | |
| download | emacs-020da460989f99035044aad5d97166139af57c1f.tar.gz emacs-020da460989f99035044aad5d97166139af57c1f.zip | |
(Fstring): Call make_string instead of
make_string_from_bytes.
(Ffind_charset_region): Include `composition' in the returned list
if the region contains any composite characters.
(Ffind_charset_string): Include `composition' in the returned list
if the string contains any composite characters.
(find_charset_in_str): Handle CMPCHARP arg correctly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/charset.c b/src/charset.c index f25c6bb0b75..fec2888348d 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -732,16 +732,16 @@ find_charset_in_str (str, len, charsets, table, cmpcharp) | |||
| 732 | 732 | ||
| 733 | if (cmpchar_id >= 0) | 733 | if (cmpchar_id >= 0) |
| 734 | { | 734 | { |
| 735 | struct cmpchar_info *cmpcharp = cmpchar_table[cmpchar_id]; | 735 | struct cmpchar_info *cmp_p = cmpchar_table[cmpchar_id]; |
| 736 | int i; | 736 | int i; |
| 737 | 737 | ||
| 738 | for (i = 0; i < cmpcharp->glyph_len; i++) | 738 | for (i = 0; i < cmp_p->glyph_len; i++) |
| 739 | { | 739 | { |
| 740 | c = cmpcharp->glyph[i]; | 740 | c = cmp_p->glyph[i]; |
| 741 | if (!NILP (table)) | 741 | if (!NILP (table)) |
| 742 | { | 742 | { |
| 743 | if ((c = translate_char (table, c, 0, 0, 0)) < 0) | 743 | if ((c = translate_char (table, c, 0, 0, 0)) < 0) |
| 744 | c = cmpcharp->glyph[i]; | 744 | c = cmp_p->glyph[i]; |
| 745 | } | 745 | } |
| 746 | if ((charset = CHAR_CHARSET (c)) < 0) | 746 | if ((charset = CHAR_CHARSET (c)) < 0) |
| 747 | charset = CHARSET_ASCII; | 747 | charset = CHARSET_ASCII; |
| @@ -751,8 +751,13 @@ find_charset_in_str (str, len, charsets, table, cmpcharp) | |||
| 751 | num += 1; | 751 | num += 1; |
| 752 | } | 752 | } |
| 753 | } | 753 | } |
| 754 | str += cmpcharp->len; | 754 | str += cmp_p->len; |
| 755 | len -= cmpcharp->len; | 755 | len -= cmp_p->len; |
| 756 | if (cmpcharp && !charsets[CHARSET_COMPOSITION]) | ||
| 757 | { | ||
| 758 | charsets[CHARSET_COMPOSITION] = 1; | ||
| 759 | num += 1; | ||
| 760 | } | ||
| 756 | continue; | 761 | continue; |
| 757 | } | 762 | } |
| 758 | 763 | ||
| @@ -786,6 +791,8 @@ DEFUN ("find-charset-region", Ffind_charset_region, Sfind_charset_region, | |||
| 786 | 2, 3, 0, | 791 | 2, 3, 0, |
| 787 | "Return a list of charsets in the region between BEG and END.\n\ | 792 | "Return a list of charsets in the region between BEG and END.\n\ |
| 788 | BEG and END are buffer positions.\n\ | 793 | BEG and END are buffer positions.\n\ |
| 794 | If the region contains any composite character,\n\ | ||
| 795 | `composition' is included in the returned list.\n\ | ||
| 789 | Optional arg TABLE if non-nil is a translation table to look up.") | 796 | Optional arg TABLE if non-nil is a translation table to look up.") |
| 790 | (beg, end, table) | 797 | (beg, end, table) |
| 791 | Lisp_Object beg, end, table; | 798 | Lisp_Object beg, end, table; |
| @@ -817,7 +824,7 @@ Optional arg TABLE if non-nil is a translation table to look up.") | |||
| 817 | while (1) | 824 | while (1) |
| 818 | { | 825 | { |
| 819 | find_charset_in_str (BYTE_POS_ADDR (from_byte), stop_byte - from_byte, | 826 | find_charset_in_str (BYTE_POS_ADDR (from_byte), stop_byte - from_byte, |
| 820 | charsets, table, 0); | 827 | charsets, table, 1); |
| 821 | if (stop < to) | 828 | if (stop < to) |
| 822 | { | 829 | { |
| 823 | from = stop, from_byte = stop_byte; | 830 | from = stop, from_byte = stop_byte; |
| @@ -837,6 +844,8 @@ Optional arg TABLE if non-nil is a translation table to look up.") | |||
| 837 | DEFUN ("find-charset-string", Ffind_charset_string, Sfind_charset_string, | 844 | DEFUN ("find-charset-string", Ffind_charset_string, Sfind_charset_string, |
| 838 | 1, 2, 0, | 845 | 1, 2, 0, |
| 839 | "Return a list of charsets in STR.\n\ | 846 | "Return a list of charsets in STR.\n\ |
| 847 | If the string contains any composite characters,\n\ | ||
| 848 | `composition' is included in the returned list.\n\ | ||
| 840 | Optional arg TABLE if non-nil is a translation table to look up.") | 849 | Optional arg TABLE if non-nil is a translation table to look up.") |
| 841 | (str, table) | 850 | (str, table) |
| 842 | Lisp_Object str, table; | 851 | Lisp_Object str, table; |
| @@ -854,7 +863,7 @@ Optional arg TABLE if non-nil is a translation table to look up.") | |||
| 854 | 863 | ||
| 855 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); | 864 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); |
| 856 | find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)), | 865 | find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)), |
| 857 | charsets, table, 0); | 866 | charsets, table, 1); |
| 858 | val = Qnil; | 867 | val = Qnil; |
| 859 | for (i = MAX_CHARSET; i >= 0; i--) | 868 | for (i = MAX_CHARSET; i >= 0; i--) |
| 860 | if (charsets[i]) | 869 | if (charsets[i]) |
| @@ -1311,7 +1320,9 @@ DEFUN ("string", Fstring, Sstring, 1, MANY, 0, | |||
| 1311 | p += len; | 1320 | p += len; |
| 1312 | } | 1321 | } |
| 1313 | 1322 | ||
| 1314 | val = make_string_from_bytes (buf, n, p - buf); | 1323 | /* Here, we can't use make_string_from_bytes because of byte |
| 1324 | combining problem. */ | ||
| 1325 | val = make_string (buf, p - buf); | ||
| 1315 | return val; | 1326 | return val; |
| 1316 | } | 1327 | } |
| 1317 | 1328 | ||