From: tomo Date: Wed, 12 Mar 2003 13:09:04 +0000 (+0000) Subject: Include when `CHISE' is defined. X-Git-Tag: r21-4-11-chise-0_21-pre1^2~6 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5853c09cc76a16d312ca86b78c8fc614508b1b05;p=chise%2Fxemacs-chise.git.1 Include when `CHISE' is defined. (load_char_decoding_entry_maybe): Use libchise when `CHISE' is defined. --- diff --git a/src/mule-charset.c b/src/mule-charset.c index 038ec5b..7cdc61f 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -25,6 +25,9 @@ Boston, MA 02111-1307, USA. */ /* Rewritten by MORIOKA Tomohiko for XEmacs UTF-2000. */ #include +#ifdef CHISE +#include +#endif #ifdef UTF2000 #include #endif @@ -2219,6 +2222,64 @@ Reset mapping-table of CCS with database file. Emchar load_char_decoding_entry_maybe (Lisp_Object ccs, int code_point) { +#ifdef CHISE + Lisp_Object db_dir = Vexec_directory; + CHISE_DS ds; + CHISE_Decoding_Table *dt_ccs; + int modemask; + int accessmask = 0; + DBTYPE real_subtype; + int status; + CHISE_Char_ID char_id; + + if (NILP (db_dir)) + db_dir = build_string ("../lib-src"); + db_dir = Fexpand_file_name (build_string ("char-db"), db_dir); + + status = chise_open_data_source (&ds, CHISE_DS_Berkeley_DB, + XSTRING_DATA (db_dir)); + if (status) + { + chise_close_data_source (&ds); + return -1; + } + + modemask = 0755; /* rwxr-xr-x */ + real_subtype = DB_HASH; + accessmask = DB_RDONLY; + + status + = chise_open_decoding_table (&dt_ccs, &ds, + XSTRING_DATA (Fsymbol_name + (XCHARSET_NAME(ccs))), + real_subtype, + accessmask, modemask); + if (status) + { + printf ("Can't open decoding-table %s\n", + XSTRING_DATA (Fsymbol_name (XCHARSET_NAME(ccs)))); + chise_close_decoding_table (dt_ccs); + chise_close_data_source (&ds); + return -1; + } + + char_id = chise_dt_get_char (dt_ccs, code_point); + /* + printf ("%s's 0x%X (%d) => 0x%X\n", + XSTRING_DATA (Fsymbol_name (XCHARSET_NAME(ccs))), + code_point, code_point, char_id); + */ + if (char_id >= 0) + decoding_table_put_char (ccs, code_point, make_char (char_id)); + else + decoding_table_put_char (ccs, code_point, Qnil); + + chise_close_decoding_table (dt_ccs); + + chise_close_data_source (&ds); + + return char_id; +#else Lisp_Object db; Lisp_Object db_file = char_attribute_system_db_file (XCHARSET_NAME(ccs), Qsystem_char_id, @@ -2244,6 +2305,7 @@ load_char_decoding_entry_maybe (Lisp_Object ccs, int code_point) Fclose_database (db); } return -1; +#endif } #endif /* HAVE_CHISE_CLIENT */ #endif /* UTF2000 */