From: tomo Date: Sat, 17 Jul 2004 13:54:47 +0000 (+0000) Subject: (Fsave_charset_properties): New function when HAVE_LIBCHISE is defined. X-Git-Tag: r21-4-15-chise-0_21-30-ccs-props^2~19 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=a823a1d7b8f8680d1685001592f7a2f4ca77e386;p=chise%2Fxemacs-chise.git- (Fsave_charset_properties): New function when HAVE_LIBCHISE is defined. (syms_of_mule_charset): Add new builtin function `save-charset-properties' when HAVE_LIBCHISE is defined. --- diff --git a/src/mule-charset.c b/src/mule-charset.c index 6c07d63..6af8460 100644 --- a/src/mule-charset.c +++ b/src/mule-charset.c @@ -2363,6 +2363,57 @@ load_char_decoding_entry_maybe (Lisp_Object ccs, int code_point) return -1; #endif /* not HAVE_LIBCHISE */ } + +#ifdef HAVE_LIBCHISE +DEFUN ("save-charset-properties", Fsave_charset_properties, 1, 1, 0, /* +Save properties of CHARSET. +*/ + (charset)) +{ + struct Lisp_Charset *cs; + CHISE_Property property; + Lisp_Object ccs; + unsigned char* feature_name; + + ccs = Fget_charset (charset); + cs = XCHARSET (ccs); + + if ( open_chise_data_source_maybe () ) + return -1; + + if (SYMBOLP (charset)) + { + property = chise_ds_get_property (default_chise_data_source, + "true-name"); + feature_name = XSTRING_DATA (Fsymbol_name (charset)); + chise_feature_set_property_value + (chise_ds_get_feature (default_chise_data_source, feature_name), + property, XSTRING_DATA (Fprin1_to_string (CHARSET_NAME (cs), + Qnil))); + chise_property_sync (property); + } + charset = XCHARSET_NAME (ccs); + feature_name = XSTRING_DATA (Fsymbol_name (charset)); + + property = chise_ds_get_property (default_chise_data_source, "chars"); + chise_feature_set_property_value + (chise_ds_get_feature (default_chise_data_source, feature_name), + property, XSTRING_DATA (Fprin1_to_string (make_int + (CHARSET_CHARS (cs)), + Qnil))); + chise_property_sync (property); + + property = chise_ds_get_property (default_chise_data_source, "dimension"); + chise_feature_set_property_value + (chise_ds_get_feature (default_chise_data_source, feature_name), + property, XSTRING_DATA (Fprin1_to_string (make_int + (CHARSET_DIMENSION (cs)), + Qnil))); + chise_property_sync (property); + return Qnil; +} +#endif /* HAVE_LIBCHISE */ + #endif /* HAVE_CHISE */ #endif /* UTF2000 */ @@ -2703,6 +2754,9 @@ syms_of_mule_charset (void) DEFSUBR (Fset_charset_mapping_table); #ifdef HAVE_CHISE DEFSUBR (Fsave_charset_mapping_table); +#ifdef HAVE_LIBCHISE + DEFSUBR (Fsave_charset_properties); +#endif /* HAVE_LIBCHISE */ DEFSUBR (Freset_charset_mapping_table); #endif /* HAVE_CHISE */ DEFSUBR (Fdecode_char);