changeset 24567:36e004c54eaf

(ccl_driver) <CCL_ReadMultibyteChar2>: Fix bug of handling a composite character by skipping its leading code. <CCL_WriteMultibyteChar2>: Handle non-ascii single byte character correctly.
author Kenichi Handa <handa@m17n.org>
date Tue, 06 Apr 1999 12:33:42 +0000
parents 5082c3adfa2f
children 05c797dbc451
files src/ccl.c
diffstat 1 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/ccl.c	Tue Apr 06 10:25:31 1999 +0000
+++ b/src/ccl.c	Tue Apr 06 12:33:42 1999 +0000
@@ -1097,6 +1097,7 @@
 	    case CCL_ReadMultibyteChar2:
 	      if (!src)
 		CCL_INVALID_CMD;
+
 	      do {
 		if (src >= src_end)
 		  {
@@ -1116,14 +1117,24 @@
 		      }
 		    else
 		      ccl->private_state = COMPOSING_NO_RULE_HEAD;
+
+		    continue;
 		  }
-		if (ccl->private_state != 0)
+		if (ccl->private_state != COMPOSING_NO)
 		  {
 		    /* composite character */
-		    if (*src < 0xA0)
-		      ccl->private_state = 0;
+		    if (i < 0xA0)
+		      ccl->private_state = COMPOSING_NO;
 		    else
 		      {
+			if (COMPOSING_WITH_RULE_RULE == ccl->private_state)
+			  {
+			    ccl->private_state = COMPOSING_WITH_RULE_HEAD;
+			    continue;
+			  }
+			else if (COMPOSING_WITH_RULE_HEAD == ccl->private_state)
+			  ccl->private_state = COMPOSING_WITH_RULE_RULE;
+
 			if (i == 0xA0)
 			  {
 			    if (src >= src_end)
@@ -1132,16 +1143,9 @@
 			  }
 			else
 			  i -= 0x20;
-
-			if (COMPOSING_WITH_RULE_RULE == ccl->private_state)
-			  {
-			    ccl->private_state = COMPOSING_WITH_RULE_HEAD;
-			    continue;
-			  }
-			else if (COMPOSING_WITH_RULE_HEAD == ccl->private_state)
-			  ccl->private_state = COMPOSING_WITH_RULE_RULE;
 		      }
 		  }
+
 		if (i < 0x80)
 		  {
 		    /* ASCII */
@@ -1188,7 +1192,8 @@
 		    reg[RRR] = CHARSET_ASCII;
 		    reg[rrr] = i;
 		  }
-	      } while (0);
+		break;
+	      } while (1);
 	      break;
 
 	    ccl_read_multibyte_character_suspend:
@@ -1206,7 +1211,7 @@
 	    case CCL_WriteMultibyteChar2:
 	      i = reg[RRR]; /* charset */
 	      if (i == CHARSET_ASCII)
-		i = reg[rrr] & 0x7F;
+		i = reg[rrr] & 0x8F;
 	      else if (i == CHARSET_COMPOSITION)
 		i = MAKE_COMPOSITE_CHAR (reg[rrr]);
 	      else if (CHARSET_DIMENSION (i) == 1)