changeset 90214:460ee00505d5

(QCascii_compatible_p): New variable. (syms_of_coding): Initialize it. (ONE_MORE_BYTE): Decrement `src' before calling string_char. (ONE_MORE_BYTE_NO_CHECK): Likewise. (record_conversion_result): Add `default:' case. (coding_charset_list): Delete unused variable `coding_type'. (Fdefine_coding_system_internal): Add `ascii-compatible-p' property in the plist of the coding system. (Fcoding_system_put): Check QCascii_compatible_p.
author Kenichi Handa <handa@m17n.org>
date Fri, 29 Jul 2005 06:20:30 +0000
parents 90706d6433c9
children 7217d5a385f8
files src/coding.c
diffstat 1 files changed, 18 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Fri Jul 29 06:18:00 2005 +0000
+++ b/src/coding.c	Fri Jul 29 06:20:30 2005 +0000
@@ -314,6 +314,7 @@
 Lisp_Object QCcategory, QCmnemonic, QCdefalut_char;
 Lisp_Object QCdecode_translation_table, QCencode_translation_table;
 Lisp_Object QCpost_read_conversion, QCpre_write_conversion;
+Lisp_Object QCascii_compatible_p;
 
 extern Lisp_Object Qinsert_file_contents, Qwrite_region;
 Lisp_Object Qcall_process, Qcall_process_region;
@@ -706,7 +707,8 @@
 	  c = ((c & 1) << 6) | *src++;			\
 	else						\
 	  {						\
-	    c = - string_char (--src, &src, NULL);	\
+	    src--;					\
+	    c = - string_char (src, &src, NULL);	\
 	    record_conversion_result			\
 	      (coding, CODING_RESULT_INVALID_SRC);	\
 	  }						\
@@ -724,7 +726,8 @@
 	  c = ((c & 1) << 6) | *src++;			\
 	else						\
 	  {						\
-	    c = - string_char (--src, &src, NULL);	\
+	    src--;					\
+	    c = - string_char (src, &src, NULL);	\
 	    record_conversion_result			\
 	      (coding, CODING_RESULT_INVALID_SRC);	\
 	  }						\
@@ -918,6 +921,8 @@
     case CODING_RESULT_INSUFFICIENT_MEM:
       Vlast_code_conversion_error = Qinsufficient_memory;
       break;
+    default:
+      Vlast_code_conversion_error = intern ("Unknown error");
     }
 }
 
@@ -5091,7 +5096,7 @@
 coding_charset_list (coding)
      struct coding_system *coding;
 {
-  Lisp_Object attrs, charset_list, coding_type;
+  Lisp_Object attrs, charset_list;
 
   CODING_GET_INFO (coding, attrs, charset_list);
   if (EQ (CODING_ATTR_TYPE (attrs), Qiso_2022))
@@ -8871,6 +8876,10 @@
   CODING_ATTR_PLIST (attrs)
     = Fcons (QCcategory, Fcons (AREF (Vcoding_category_table, category),
 				CODING_ATTR_PLIST (attrs)));
+  CODING_ATTR_PLIST (attrs)
+    = Fcons (QCascii_compatible_p, 
+	     Fcons (CODING_ATTR_ASCII_COMPAT (attrs),
+		    CODING_ATTR_PLIST (attrs)));
 
   eol_type = args[coding_arg_eol_type];
   if (! NILP (eol_type)
@@ -8972,6 +8981,10 @@
       CHECK_SYMBOL (val);
       CODING_ATTR_PRE_WRITE (attrs) = val;
     }
+  else if (EQ (prop, QCascii_compatible_p))
+    {
+      CODING_ATTR_ASCII_COMPAT (attrs) = val;
+    }
 
   CODING_ATTR_PLIST (attrs)
     = Fplist_put (CODING_ATTR_PLIST (attrs), prop, val);
@@ -9247,6 +9260,7 @@
   DEFSYM (QCencode_translation_table, ":encode-translation-table");
   DEFSYM (QCpost_read_conversion, ":post-read-conversion");
   DEFSYM (QCpre_write_conversion, ":pre-write-conversion");
+  DEFSYM (QCascii_compatible_p, ":ascii-compatible-p");
 
   Vcoding_category_table
     = Fmake_vector (make_number (coding_category_max), Qnil);
@@ -9635,7 +9649,7 @@
     plist[3] = args[coding_arg_mnemonic] = make_number ('-');
     plist[5] = args[coding_arg_coding_type] = Qundecided;
     /* This is already set.
-    /*plist[7] = args[coding_arg_ascii_compatible_p] = Qt;*/
+       plist[7] = args[coding_arg_ascii_compatible_p] = Qt; */
     plist[8] = intern (":charset-list");
     plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil);
     plist[11] = args[coding_arg_for_unibyte] = Qnil;