changeset 23116:6736da064f4a

(detect_coding_iso2022): Handle ESC N and ESC O correctly. They are for SS2 and SS3 respectively. (ccl_coding_driver): Fix previous change.
author Kenichi Handa <handa@m17n.org>
date Thu, 27 Aug 1998 07:47:15 +0000
parents b992f7bb67d7
children 13247082e0ed
files src/coding.c
diffstat 1 files changed, 11 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Thu Aug 27 02:00:35 1998 +0000
+++ b/src/coding.c	Thu Aug 27 07:47:15 1998 +0000
@@ -733,33 +733,14 @@
 		/* Invalid designation sequence.  Just ignore.  */
 		break;
 	    }
-	  else if (c == 'N' || c == 'n')
+	  else if (c == 'N' || c == 'O')
 	    {
-	      if (shift_out == 0
-		  && (reg[1] >= 0
-		      || SHIFT_OUT_OK (CODING_CATEGORY_IDX_ISO_7_ELSE)
-		      || SHIFT_OUT_OK (CODING_CATEGORY_IDX_ISO_8_ELSE)))
-		{
-		  /* Locking shift out.  */
-		  mask &= ~CODING_CATEGORY_MASK_ISO_7BIT;
-		  mask_found |= CODING_CATEGORY_MASK_ISO_SHIFT;
-		  shift_out = 1;
-		}
-	      break;
-	    }
-	  else if (c == 'O' || c == 'o')
-	    {
-	      if (shift_out == 1)
-		{
-		  /* Locking shift in.  */
-		  mask &= ~CODING_CATEGORY_MASK_ISO_7BIT;
-		  mask_found |= CODING_CATEGORY_MASK_ISO_SHIFT;
-		  shift_out = 0;
-		}
+	      /* ESC <Fe> for SS2 or SS3.  */
+	      mask &= CODING_CATEGORY_MASK_ISO_7_ELSE;
 	      break;
 	    }
 	  else if (c == '0' || c == '1' || c == '2')
-	    /* Start/end composition.  Just ignore.  */
+	    /* ESC <Fp> for start/end composition.  Just ignore.  */
 	    break;
 	  else
 	    /* Invalid escape sequence.  Just ignore.  */
@@ -775,9 +756,13 @@
 	    mask_found |= CODING_CATEGORY_MASK_ISO_7_TIGHT;
 	  else
 	    mask &= ~CODING_CATEGORY_MASK_ISO_7_TIGHT;
-	  if (! CHARSET_OK (CODING_CATEGORY_IDX_ISO_7_ELSE, charset))
+	  if (CHARSET_OK (CODING_CATEGORY_IDX_ISO_7_ELSE, charset))
+	    mask_found |= CODING_CATEGORY_MASK_ISO_7_ELSE;
+	  else
 	    mask &= ~CODING_CATEGORY_MASK_ISO_7_ELSE;
-	  if (! CHARSET_OK (CODING_CATEGORY_IDX_ISO_8_ELSE, charset))
+	  if (CHARSET_OK (CODING_CATEGORY_IDX_ISO_8_ELSE, charset))
+	    mask_found |= CODING_CATEGORY_MASK_ISO_8_ELSE;
+	  else
 	    mask &= ~CODING_CATEGORY_MASK_ISO_8_ELSE;
 	  break;
 
@@ -3623,8 +3608,7 @@
     = encodep ? &coding->spec.ccl.encoder : &coding->spec.ccl.decoder;
   int result;
 
-  if (encodep)
-    ccl->last_block = coding->mode & CODING_MODE_LAST_BLOCK;
+  ccl->last_block = coding->mode & CODING_MODE_LAST_BLOCK;
 
   coding->produced = ccl_driver (ccl, source, destination,
 				 src_bytes, dst_bytes, &(coding->consumed));