(Qccs_priority_list): New variable in XEmacs CHISE.
authortomo <tomo>
Mon, 28 Feb 2005 16:09:16 +0000 (16:09 +0000)
committertomo <tomo>
Mon, 28 Feb 2005 16:09:16 +0000 (16:09 +0000)
(Fmake_coding_system): Support new property `ccs-priority-list' in
XEmacs CHISE.
(Fcoding_system_property): Likewise.
(char_encode_iso2022): Prefer CODING_SYSTEM_CCS_PRIORITY_LIST than
Vdefault_coded_charset_priority_list in XEmacs CHISE.
(syms_of_file_coding): Add builtin symbol `ccs-priority-list' in
XEmacs CHISE.
(complex_vars_of_file_coding): Define new coding-system-property
`ccs-priority-list' in XEmacs CHISE.

src/text-coding.c

index b3f80ff..f22cf5a 100644 (file)
@@ -1,7 +1,7 @@
 /* Code conversion functions.
    Copyright (C) 1991, 1995 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
-   Copyright (C) 1999,2000,2001,2002,2003,2004 MORIOKA Tomohiko
+   Copyright (C) 1999,2000,2001,2002,2003,2004,2005 MORIOKA Tomohiko
 
 This file is part of XEmacs.
 
@@ -107,6 +107,7 @@ Lisp_Object Qshort, Qno_ascii_eol, Qno_ascii_cntl, Qseven, Qlock_shift;
 #ifdef UTF2000
 Lisp_Object Qutf_8_mcs;
 Lisp_Object Qdisable_composition;
+Lisp_Object Qccs_priority_list;
 Lisp_Object Quse_entity_reference;
 Lisp_Object Qd, Qx, QX;
 #endif
@@ -1052,6 +1053,12 @@ if TYPE is 'ccl:
                parse_charset_conversion_specs (codesys->iso2022.output_conv,
                                                value);
              }
+#ifdef UTF2000
+           else if (EQ (key, Qccs_priority_list))
+             {
+               codesys->ccs_priority_list = value;
+             }
+#endif
            else
              signal_simple_error ("Unrecognized property", key);
          }
@@ -1484,6 +1491,8 @@ Return the PROP property of CODING-SYSTEM.
     return XCODING_SYSTEM_DISABLE_COMPOSITION (coding_system) ? Qt : Qnil;
   else if (EQ (prop, Quse_entity_reference))
     return XCODING_SYSTEM_USE_ENTITY_REFERENCE (coding_system) ? Qt : Qnil;
+  else if (EQ (prop, Qccs_priority_list))
+    return XCODING_SYSTEM_CCS_PRIORITY_LIST (coding_system);
 #endif
   else if (type == CODESYS_ISO2022)
     {
@@ -5973,7 +5982,19 @@ char_encode_iso2022 (struct encoding_stream *str, Emchar ch,
        {
          Lisp_Object original_default_coded_charset_priority_list
            = Vdefault_coded_charset_priority_list;
-
+         Vdefault_coded_charset_priority_list
+           = CODING_SYSTEM_CCS_PRIORITY_LIST (codesys);
+         while (!EQ (Vdefault_coded_charset_priority_list, Qnil))
+           {
+             code_point = ENCODE_CHAR (ch, charset);
+             if (XCHARSET_FINAL (charset))
+               goto found;
+             Vdefault_coded_charset_priority_list
+               = Fcdr (Fmemq (XCHARSET_NAME (charset),
+                              Vdefault_coded_charset_priority_list));
+           }
+         Vdefault_coded_charset_priority_list
+           = original_default_coded_charset_priority_list;
          while (!EQ (Vdefault_coded_charset_priority_list, Qnil))
            {
              code_point = ENCODE_CHAR (ch, charset);
@@ -6350,6 +6371,7 @@ syms_of_file_coding (void)
 #ifdef UTF2000
   defsymbol (&Qutf_8_mcs, "utf-8-mcs");
   defsymbol (&Qdisable_composition, "disable-composition");
+  defsymbol (&Qccs_priority_list, "ccs-priority-list");
   defsymbol (&Quse_entity_reference, "use-entity-reference");
   defsymbol (&Qd, "d");
   defsymbol (&Qx, "x");
@@ -6523,6 +6545,9 @@ complex_vars_of_file_coding (void)
   DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qescape_quoted);
   DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qinput_charset_conversion);
   DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qoutput_charset_conversion);
+#ifdef UTF2000
+  DEFINE_CODESYS_PROP (CODESYS_PROP_ISO2022, Qccs_priority_list);
+#endif
 
   DEFINE_CODESYS_PROP (CODESYS_PROP_CCL,     Qencode);
   DEFINE_CODESYS_PROP (CODESYS_PROP_CCL,     Qdecode);