diff options
| author | Kenichi Handa | 1998-05-21 01:48:52 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-05-21 01:48:52 +0000 |
| commit | 1d67c29bf7614499fd3991945409356a3866e2b5 (patch) | |
| tree | cf850a2528324b9fbdf4d505c75cc21bbb470e5d /src | |
| parent | 3f639f85625e8900090e36febe0cbfbacbdaa469 (diff) | |
| download | emacs-1d67c29bf7614499fd3991945409356a3866e2b5.tar.gz emacs-1d67c29bf7614499fd3991945409356a3866e2b5.zip | |
(find_charset_in_str): New arg CMPCHARP.
(Ffind_charset_region): Call find_charset_in_str with CMPCHARP 0.
(Ffind_charset_string): Likewise.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charset.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/charset.c b/src/charset.c index 0017ac1b9bf..326d7f19de1 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -630,13 +630,18 @@ CHARSET should be defined by `defined-charset' in advance.") | |||
| 630 | /* Return number of different charsets in STR of length LEN. In | 630 | /* Return number of different charsets in STR of length LEN. In |
| 631 | addition, for each found charset N, CHARSETS[N] is set 1. The | 631 | addition, for each found charset N, CHARSETS[N] is set 1. The |
| 632 | caller should allocate CHARSETS (MAX_CHARSET + 1 elements) in advance. | 632 | caller should allocate CHARSETS (MAX_CHARSET + 1 elements) in advance. |
| 633 | It may lookup a translation table TABLE if supplied. */ | 633 | It may lookup a translation table TABLE if supplied. |
| 634 | |||
| 635 | If CMPCHARP is nonzero and some composite character is found, | ||
| 636 | CHARSETS[128] is also set 1 and the returned number is incremented | ||
| 637 | by 1. */ | ||
| 634 | 638 | ||
| 635 | int | 639 | int |
| 636 | find_charset_in_str (str, len, charsets, table) | 640 | find_charset_in_str (str, len, charsets, table, cmpcharp) |
| 637 | unsigned char *str; | 641 | unsigned char *str; |
| 638 | int len, *charsets; | 642 | int len, *charsets; |
| 639 | Lisp_Object table; | 643 | Lisp_Object table; |
| 644 | int cmpcharp; | ||
| 640 | { | 645 | { |
| 641 | register int num = 0, c; | 646 | register int num = 0, c; |
| 642 | 647 | ||
| @@ -653,7 +658,7 @@ find_charset_in_str (str, len, charsets, table) | |||
| 653 | int cmpchar_id = str_cmpchar_id (str, len); | 658 | int cmpchar_id = str_cmpchar_id (str, len); |
| 654 | GLYPH *glyph; | 659 | GLYPH *glyph; |
| 655 | 660 | ||
| 656 | if (cmpchar_id > 0) | 661 | if (cmpchar_id >= 0) |
| 657 | { | 662 | { |
| 658 | struct cmpchar_info *cmpcharp = cmpchar_table[cmpchar_id]; | 663 | struct cmpchar_info *cmpcharp = cmpchar_table[cmpchar_id]; |
| 659 | int i; | 664 | int i; |
| @@ -676,6 +681,11 @@ find_charset_in_str (str, len, charsets, table) | |||
| 676 | } | 681 | } |
| 677 | str += cmpcharp->len; | 682 | str += cmpcharp->len; |
| 678 | len -= cmpcharp->len; | 683 | len -= cmpcharp->len; |
| 684 | if (!charsets[LEADING_CODE_COMPOSITION]) | ||
| 685 | { | ||
| 686 | charsets[LEADING_CODE_COMPOSITION] = 1; | ||
| 687 | num += 1; | ||
| 688 | } | ||
| 679 | continue; | 689 | continue; |
| 680 | } | 690 | } |
| 681 | 691 | ||
| @@ -735,7 +745,7 @@ Optional arg TABLE if non-nil is a translation table to look up.") | |||
| 735 | while (1) | 745 | while (1) |
| 736 | { | 746 | { |
| 737 | find_charset_in_str (BYTE_POS_ADDR (from_byte), stop_byte - from_byte, | 747 | find_charset_in_str (BYTE_POS_ADDR (from_byte), stop_byte - from_byte, |
| 738 | charsets, table); | 748 | charsets, table, 0); |
| 739 | if (stop < to) | 749 | if (stop < to) |
| 740 | { | 750 | { |
| 741 | from = stop, from_byte = stop_byte; | 751 | from = stop, from_byte = stop_byte; |
| @@ -770,7 +780,7 @@ Optional arg TABLE if non-nil is a translation table to look up.") | |||
| 770 | 780 | ||
| 771 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); | 781 | bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); |
| 772 | find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)), | 782 | find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)), |
| 773 | charsets, table); | 783 | charsets, table, 0); |
| 774 | val = Qnil; | 784 | val = Qnil; |
| 775 | for (i = MAX_CHARSET; i >= 0; i--) | 785 | for (i = MAX_CHARSET; i >= 0; i--) |
| 776 | if (charsets[i]) | 786 | if (charsets[i]) |