From f6ca14e8bc94b7b7319811f900abf40f4cce680f Mon Sep 17 00:00:00 2001 From: tomo Date: Tue, 14 Dec 2004 07:48:47 +0000 Subject: [PATCH] (Vdisplay_coded_charset_priority_use_inheritance): New extern. (Vdisplay_coded_charset_priority_use_hierarchy_order): Likewise. (encode_char_2_search_children): New inline function. (encode_char_2): Refer `Vdisplay_coded_charset_priority_use_{inheritance|hierarchy_order}' and use `encode_char_2_search_children'. --- src/char-ucs.h | 68 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/src/char-ucs.h b/src/char-ucs.h index 9d17239..52342dc 100644 --- a/src/char-ucs.h +++ b/src/char-ucs.h @@ -682,6 +682,9 @@ int charset_code_point (Lisp_Object charset, Emchar ch, int defined_only); int range_charset_code_point (Lisp_Object charset, Emchar ch); extern Lisp_Object Vdefault_coded_charset_priority_list; +extern Lisp_Object Vdisplay_coded_charset_priority_use_inheritance; +extern Lisp_Object Vdisplay_coded_charset_priority_use_hierarchy_order; + EXFUN (Ffind_charset, 1); INLINE_HEADER int encode_char_1 (Emchar ch, Lisp_Object* charset); @@ -707,11 +710,41 @@ encode_char_1 (Emchar ch, Lisp_Object* charset) return encode_builtin_char_1 (ch, charset); } +INLINE_HEADER int +encode_char_2_search_children (Emchar ch, Lisp_Object* charset); +INLINE_HEADER int +encode_char_2_search_children (Emchar ch, Lisp_Object* charset) +{ + int code_point; + Lisp_Object rest; + + rest = Fget_char_attribute (make_char (ch), Q_subsumptive, Qnil); + for ( ; !NILP (rest); rest = XCDR (rest) ) + { + Lisp_Object c = XCAR (rest); + + code_point = charset_code_point (*charset, XCHAR (c), 0); + if (code_point >= 0) + return code_point; + } + rest = Fget_char_attribute (make_char (ch), Q_denotational, Qnil); + for ( ; !NILP (rest); rest = XCDR (rest) ) + { + Lisp_Object c = XCAR (rest); + + code_point = charset_code_point (*charset, XCHAR (c), 0); + if (code_point >= 0) + return code_point; + } + return -1; +} + INLINE_HEADER int encode_char_2 (Emchar ch, Lisp_Object* charset); INLINE_HEADER int encode_char_2 (Emchar ch, Lisp_Object* charset) { Lisp_Object charsets = Vdefault_coded_charset_priority_list; + int code_point; while (!NILP (charsets)) { @@ -719,34 +752,39 @@ encode_char_2 (Emchar ch, Lisp_Object* charset) if ( !NILP (*charset) && (XCHARSET_DIMENSION (*charset) <= 2) ) { - int code_point = charset_code_point (*charset, ch, 0); - Lisp_Object rest; - + code_point = charset_code_point (*charset, ch, 0); if (code_point >= 0) return code_point; - rest = Fget_char_attribute (make_char (ch), Q_subsumptive, Qnil); - for ( ; !NILP (rest); rest = XCDR (rest) ) + if ( !NILP (Vdisplay_coded_charset_priority_use_inheritance) && + NILP (Vdisplay_coded_charset_priority_use_hierarchy_order) ) { - Lisp_Object c = XCAR (rest); - - code_point = charset_code_point (*charset, XCHAR (c), 0); + code_point = encode_char_2_search_children (ch, charset); if (code_point >= 0) return code_point; } - rest = Fget_char_attribute (make_char (ch), Q_denotational, Qnil); - for ( ; !NILP (rest); rest = XCDR (rest) ) + } + charsets = Fcdr (charsets); + } + + if ( !NILP (Vdisplay_coded_charset_priority_use_inheritance) && + !NILP (Vdisplay_coded_charset_priority_use_hierarchy_order) ) + { + charsets = Vdefault_coded_charset_priority_list; + while (!NILP (charsets)) + { + *charset = Ffind_charset (Fcar (charsets)); + if ( !NILP (*charset) + && (XCHARSET_DIMENSION (*charset) <= 2) ) { - Lisp_Object c = XCAR (rest); - - code_point = charset_code_point (*charset, XCHAR (c), 0); + code_point = encode_char_2_search_children (ch, charset); if (code_point >= 0) return code_point; } + charsets = Fcdr (charsets); } - charsets = Fcdr (charsets); } - + /* otherwise --- maybe for bootstrap */ return encode_builtin_char_1 (ch, charset); } -- 1.7.10.4