changeset 89373:4cc9e57fcabc

(decode_coding_ccl, encode_coding_ccl): Call ccl_driver with the last arg charset_list acquired from coding. (Fdefine_coding_system_internal): For ccl-based coding system, fix the attribute coding_attr_ccl_valids.
author Kenichi Handa <handa@m17n.org>
date Thu, 30 Jan 2003 02:23:12 +0000
parents 95c081cdbd5f
children dfa404e46975
files src/coding.c
diffstat 1 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Jan 30 02:20:43 2003 +0000
+++ b/src/coding.c	Thu Jan 30 02:23:12 2003 +0000
@@ -4302,7 +4302,9 @@
   struct ccl_program ccl;
   int source_charbuf[1024];
   int source_byteidx[1024];
-
+  Lisp_Object attrs, eol_type, charset_list, valids;
+
+  CODING_GET_INFO (coding, attrs, eol_type, charset_list);
   setup_ccl_program (&ccl, CODING_CCL_DECODER (coding));
 
   while (src < src_end)
@@ -4329,7 +4331,8 @@
       while (source < source_end)
 	{
 	  ccl_driver (&ccl, source, charbuf,
-		      source_end - source, charbuf_end - charbuf);
+		      source_end - source, charbuf_end - charbuf,
+		      charset_list);
 	  source += ccl.consumed;
 	  charbuf += ccl.produced;
 	  if (ccl.status != CCL_STAT_SUSPEND_BY_DST)
@@ -4379,7 +4382,9 @@
   unsigned char *adjusted_dst_end = dst_end - 1;
   int destination_charbuf[1024];
   int i, produced_chars = 0;
-
+  Lisp_Object attrs, eol_type, charset_list;
+
+  CODING_GET_INFO (coding, attrs, eol_type, charset_list);
   setup_ccl_program (&ccl, CODING_CCL_ENCODER (coding));
 
   ccl.last_block = coding->mode & CODING_MODE_LAST_BLOCK;
@@ -4392,7 +4397,7 @@
 	dst_bytes = 1024;
 
       ccl_driver (&ccl, charbuf, destination_charbuf,
-		  charbuf_end - charbuf, dst_bytes);
+		  charbuf_end - charbuf, dst_bytes, charset_list);
       charbuf += ccl.consumed;
       if (multibytep)
 	for (i = 0; i < ccl.produced; i++)
@@ -7909,21 +7914,31 @@
       valids = Fmake_string (make_number (256), make_number (0));
       for (tail = val; !NILP (tail); tail = Fcdr (tail))
 	{
+	  int from, to;
+
 	  val = Fcar (tail);
 	  if (INTEGERP (val))
-	    ASET (valids, XINT (val), make_number (1));
+	    {
+	      from = to = XINT (val);
+	      if (from < 0 || from > 255)
+		args_out_of_range_3 (val, make_number (0), make_number (255));
+	    }
 	  else
 	    {
-	      int from, to;
-
 	      CHECK_CONS (val);
 	      CHECK_NUMBER (XCAR (val));
 	      CHECK_NUMBER (XCDR (val));
 	      from = XINT (XCAR (val));
+	      if (from < 0 || from > 255)
+		args_out_of_range_3 (XCAR (val),
+				     make_number (0), make_number (255));
 	      to = XINT (XCDR (val));
-	      for (i = from; i <= to; i++)
-		ASET (valids, i, make_number (1));
+	      if (to < from || to > 255)
+		args_out_of_range_3 (XCDR (val),
+				     XCAR (val), make_number (255));
 	    }
+	  for (i = from; i <= to; i++)
+	    XSTRING (valids)->data[i] = 1;
 	}
       ASET (attrs, coding_attr_ccl_valids, valids);