# HG changeset patch # User Kenichi Handa # Date 895715332 0 # Node ID 2156ac6d054f2be7523dd992b1ea3ee67e65eaf8 # Parent bb7c53dee594c7a958194d73981118739dd764f8 (find_charset_in_str): New arg CMPCHARP. (Ffind_charset_region): Call find_charset_in_str with CMPCHARP 0. (Ffind_charset_string): Likewise. diff -r bb7c53dee594 -r 2156ac6d054f src/charset.c --- a/src/charset.c Thu May 21 01:48:52 1998 +0000 +++ b/src/charset.c Thu May 21 01:48:52 1998 +0000 @@ -630,13 +630,18 @@ /* Return number of different charsets in STR of length LEN. In addition, for each found charset N, CHARSETS[N] is set 1. The caller should allocate CHARSETS (MAX_CHARSET + 1 elements) in advance. - It may lookup a translation table TABLE if supplied. */ + It may lookup a translation table TABLE if supplied. + + If CMPCHARP is nonzero and some composite character is found, + CHARSETS[128] is also set 1 and the returned number is incremented + by 1. */ int -find_charset_in_str (str, len, charsets, table) +find_charset_in_str (str, len, charsets, table, cmpcharp) unsigned char *str; int len, *charsets; Lisp_Object table; + int cmpcharp; { register int num = 0, c; @@ -653,7 +658,7 @@ int cmpchar_id = str_cmpchar_id (str, len); GLYPH *glyph; - if (cmpchar_id > 0) + if (cmpchar_id >= 0) { struct cmpchar_info *cmpcharp = cmpchar_table[cmpchar_id]; int i; @@ -676,6 +681,11 @@ } str += cmpcharp->len; len -= cmpcharp->len; + if (!charsets[LEADING_CODE_COMPOSITION]) + { + charsets[LEADING_CODE_COMPOSITION] = 1; + num += 1; + } continue; } @@ -735,7 +745,7 @@ while (1) { find_charset_in_str (BYTE_POS_ADDR (from_byte), stop_byte - from_byte, - charsets, table); + charsets, table, 0); if (stop < to) { from = stop, from_byte = stop_byte; @@ -770,7 +780,7 @@ bzero (charsets, (MAX_CHARSET + 1) * sizeof (int)); find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)), - charsets, table); + charsets, table, 0); val = Qnil; for (i = MAX_CHARSET; i >= 0; i--) if (charsets[i])