From: tomo Date: Fri, 13 Feb 2004 18:12:52 +0000 (+0000) Subject: (encode_char_2): New inline function. X-Git-Tag: r21-4-14-u2km-0_21-23~2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=da934dc4d93f0e982b662c433f10a96ed6642488;p=chise%2Fxemacs-chise.git- (encode_char_2): New inline function. (CHAR_TO_CHARC): Use `encode_char_2' instead of `encode_char_1'. --- diff --git a/src/char-ucs.h b/src/char-ucs.h index 7b62001..cdba83c 100644 --- a/src/char-ucs.h +++ b/src/char-ucs.h @@ -1,5 +1,5 @@ /* Header for UCS-4 character representation. - Copyright (C) 1999,2000,2001,2002,2003 MORIOKA Tomohiko + Copyright (C) 1999,2000,2001,2002,2003,2004 MORIOKA Tomohiko This file is part of XEmacs. @@ -703,6 +703,30 @@ encode_char_1 (Emchar ch, Lisp_Object* charset) return encode_builtin_char_1 (ch, charset); } +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; + + while (!NILP (charsets)) + { + *charset = Ffind_charset (Fcar (charsets)); + if ( !NILP (*charset) + && (XCHARSET_DIMENSION (*charset) <= 2) ) + { + int code_point = charset_code_point (*charset, ch, 0); + + if (code_point >= 0) + return code_point; + } + charsets = Fcdr (charsets); + } + + /* otherwise --- maybe for bootstrap */ + return encode_builtin_char_1 (ch, charset); +} + #define ENCODE_CHAR(ch, charset) encode_char_1 (ch, &(charset)) INLINE_HEADER void @@ -761,7 +785,7 @@ CHAR_TO_CHARC (Emchar ch) { Charc cc; - cc.code_point = encode_char_1 (ch, &cc.charset); + cc.code_point = encode_char_2 (ch, &cc.charset); return cc; }