changeset 35883:aedc87e25ce2

(CCL_WRITE_CHAR): Check if CH is valid or not. If invalid, execute CCL_INVALID_CMD. (ccl_driver): If the CCL program is terminated because of CCL_STAT_INVALID_CMD, copy the remaining source data to the destination instead of throwing them away.
author Kenichi Handa <handa@m17n.org>
date Mon, 05 Feb 2001 01:20:55 +0000
parents 77f591ec2038
children 3d9c9fe711c4
files src/ccl.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ccl.c	Mon Feb 05 01:20:37 2001 +0000
+++ b/src/ccl.c	Mon Feb 05 01:20:55 2001 +0000
@@ -721,8 +721,10 @@
 		 multibyte form later.  */				\
 	      extra_bytes++;						\
 	  }								\
+	else if (CHAR_VALID_P (ch, 0))					\
+	  dst += CHAR_STRING (ch, dst);					\
 	else								\
-	  dst += CHAR_STRING (ch, dst);					\
+	  CCL_INVALID_CMD;						\
       }									\
     else								\
       CCL_SUSPEND (CCL_STAT_SUSPEND_BY_DST);				\
@@ -1781,6 +1783,16 @@
 	  bcopy (msg, dst, msglen);
 	  dst += msglen;
 	}
+      if (ccl->status == CCL_STAT_INVALID_CMD)
+	{
+	  /* Copy the remaining source data.  */
+	  int i = src_end - src;
+	  if (dst_bytes && (dst_end - dst) < i)
+	    i = dst_end - dst;
+	  bcopy (src, dst, i);
+	  src += i;
+	  dst += i;
+	}
     }
 
  ccl_finish: