From: tomo Date: Mon, 16 Feb 2004 17:13:23 +0000 (+0000) Subject: (encode_char_2): New inline function. X-Git-Tag: r21-4-14-chise-0_21-25^2~39 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=fb4120b96d4cf0e8aef1e36def2e66159636a6ff;p=chise%2Fxemacs-chise.git.1 (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; }