diff src/mule-ccl.c @ 456:e7ef97881643 r21-2-43

Import from CVS: tag r21-2-43
author cvs
date Mon, 13 Aug 2007 11:41:24 +0200
parents 98528da0b7fc
children 223736d75acb
line wrap: on
line diff
--- a/src/mule-ccl.c	Mon Aug 13 11:40:56 2007 +0200
+++ b/src/mule-ccl.c	Mon Aug 13 11:41:24 2007 +0200
@@ -423,7 +423,7 @@
 					  IC += 2;
 					*/
 
-#define CCL_Extention		0x1F /* Extended CCL code
+#define CCL_Extension		0x1F /* Extended CCL code
 					1:ExtendedCOMMNDRrrRRRrrrXXXXX
 					2:ARGUMENT
 					3:...
@@ -634,7 +634,9 @@
     stack_idx++;						\
     ccl_prog = called_ccl.prog;					\
     ic = CCL_HEADER_MAIN;					\
-    goto ccl_repeat;						\
+    /* The "if (1)" prevents warning				\
+       "end-of loop code not reached" */			\
+    if (1) goto ccl_repeat;					\
   } while (0)
 
 #define CCL_MapSingle		0x12 /* Map by single code conversion map
@@ -675,29 +677,35 @@
 				   r[7] = LOWER_BYTE (SJIS (Y, Z) */
 
 /* Terminate CCL program successfully.  */
-#define CCL_SUCCESS		   	\
-  do {				   	\
-    ccl->status = CCL_STAT_SUCCESS;	\
-    goto ccl_finish;		   	\
-  } while (0)
+#define CCL_SUCCESS			\
+do {					\
+  ccl->status = CCL_STAT_SUCCESS;	\
+  /* The "if (1)" inhibits the warning	\
+     "end-of loop code not reached" */	\
+  if (1) goto ccl_finish;		\
+} while (0)
 
 /* Suspend CCL program because of reading from empty input buffer or
    writing to full output buffer.  When this program is resumed, the
    same I/O command is executed.  */
-#define CCL_SUSPEND(stat)	\
-  do {				\
-    ic--;			\
-    ccl->status = stat;		\
-    goto ccl_finish;		\
-  } while (0)
+#define CCL_SUSPEND(stat)		\
+do {					\
+  ic--;					\
+  ccl->status = (stat);			\
+  /* The "if (1)" inhibits the warning	\
+     "end-of loop code not reached" */	\
+  if (1) goto ccl_finish;		\
+} while (0)
 
 /* Terminate CCL program because of invalid command.  Should not occur
    in the normal case.  */
-#define CCL_INVALID_CMD		     	\
-  do {				     	\
-    ccl->status = CCL_STAT_INVALID_CMD;	\
-    goto ccl_error_handler;	     	\
-  } while (0)
+#define CCL_INVALID_CMD			\
+do {					\
+  ccl->status = CCL_STAT_INVALID_CMD;	\
+  /* The "if (1)" inhibits the warning	\
+     "end-of loop code not reached" */	\
+  if (1) goto ccl_error_handler;	\
+} while (0)
 
 /* Encode one character CH to multibyte form and write to the current
    output buffer.  At encoding time, if CH is less than 256, CH is
@@ -709,7 +717,7 @@
       CCL_INVALID_CMD;						\
     if (conversion_mode == CCL_MODE_ENCODING)			\
       {								\
-	if (ch == '\n')						\
+	if ((ch) == '\n')					\
 	  {							\
 	    if (ccl->eol_type == CCL_CODING_EOL_CRLF)		\
 	      {							\
@@ -721,7 +729,7 @@
 	    else						\
 	      Dynarr_add (destination, '\n');			\
 	  }							\
-	else if (ch < 0x100)					\
+	else if ((ch) < 0x100)					\
 	  {							\
 	    Dynarr_add (destination, ch);			\
 	  }							\
@@ -760,7 +768,7 @@
       CCL_INVALID_CMD;						\
     else if (conversion_mode == CCL_MODE_ENCODING)		\
       {								\
-	for (i = 0; i < len; i++)				\
+	for (i = 0; i < (len); i++)				\
 	  {							\
 	    ch = ((XINT (ccl_prog[ic + (i / 3)]))		\
 		  >> ((2 - (i % 3)) * 8)) & 0xFF;		\
@@ -789,7 +797,7 @@
       }								\
     else							\
       {								\
-	for (i = 0; i < len; i++)				\
+	for (i = 0; i < (len); i++)				\
 	  {							\
 	    ch = ((XINT (ccl_prog[ic + (i / 3)]))		\
 		  >> ((2 - (i % 3)) * 8)) & 0xFF;		\
@@ -812,7 +820,7 @@
     if (!src)						\
       CCL_INVALID_CMD;					\
     if (src < src_end)					\
-      r = *src++;					\
+      (r) = *src++;					\
     else						\
       {							\
 	if (ccl->last_block)				\
@@ -837,20 +845,20 @@
 #if 0
 #define CCL_MAKE_CHAR(charset, code, c)				\
   do {								\
-    if (charset == CHARSET_ASCII)				\
-      c = code & 0xFF;						\
+    if ((charset) == CHARSET_ASCII)				\
+      (c) = (code) & 0xFF;						\
     else if (CHARSET_DEFINED_P (charset)			\
-	     && (code & 0x7F) >= 32				\
-	     && (code < 256 || ((code >> 7) & 0x7F) >= 32))	\
+	     && ((code) & 0x7F) >= 32				\
+	     && ((code) < 256 || ((code >> 7) & 0x7F) >= 32))	\
       {								\
-	int c1 = code & 0x7F, c2 = 0;				\
+	int c1 = (code) & 0x7F, c2 = 0;				\
 								\
-	if (code >= 256)					\
-	  c2 = c1, c1 = (code >> 7) & 0x7F;			\
-	c = MAKE_CHAR (charset, c1, c2);			\
+	if ((code) >= 256)					\
+	  c2 = c1, c1 = ((code) >> 7) & 0x7F;			\
+	(c) = MAKE_CHAR (charset, c1, c2);			\
       }								\
     else							\
-      c = code & 0xFF;						\
+      (c) = (code) & 0xFF;						\
   } while (0)
 #endif
 
@@ -1268,67 +1276,64 @@
 	    ic = jump_address;
 	  break;
 
-	case CCL_Extention:
+	case CCL_Extension:
 	  switch (EXCMD)
 	    {
 	    case CCL_ReadMultibyteChar2:
 	      if (!src)
 		CCL_INVALID_CMD;
 
-	      do {
-		if (src >= src_end)
-		  {
-		    src++;
-		    goto ccl_read_multibyte_character_suspend;
-		  }
+	      if (src >= src_end)
+		{
+		  src++;
+		  goto ccl_read_multibyte_character_suspend;
+		}
 
-		i = *src++;
-		if (i < 0x80)
-		  {
-		    /* ASCII */
-		    reg[rrr] = i;
-		    reg[RRR] = LEADING_BYTE_ASCII;
-		  }
-		else if (i <= MAX_LEADING_BYTE_OFFICIAL_1)
-		  {
-		    if (src >= src_end)
-		      goto ccl_read_multibyte_character_suspend;
-		    reg[RRR] = i;
-		    reg[rrr] = (*src++ & 0x7F);
-		  }
-		else if (i <= MAX_LEADING_BYTE_OFFICIAL_2)
-		  {
-		    if ((src + 1) >= src_end)
-		      goto ccl_read_multibyte_character_suspend;
-		    reg[RRR] = i;
-		    i = (*src++ & 0x7F);
-		    reg[rrr] = ((i << 7) | (*src & 0x7F));
-		    src++;
-		  }
-		else if (i == PRE_LEADING_BYTE_PRIVATE_1)
-		  {
-		    if ((src + 1) >= src_end)
-		      goto ccl_read_multibyte_character_suspend;
-		    reg[RRR] = *src++;
-		    reg[rrr] = (*src++ & 0x7F);
-		  }
-		else if (i == PRE_LEADING_BYTE_PRIVATE_2)
-		  {
-		    if ((src + 2) >= src_end)
-		      goto ccl_read_multibyte_character_suspend;
-		    reg[RRR] = *src++;
-		    i = (*src++ & 0x7F);
-		    reg[rrr] = ((i << 7) | (*src & 0x7F));
-		    src++;
-		  }
-		else
-		  {
-		    /* INVALID CODE.  Return a single byte character.  */
-		    reg[RRR] = LEADING_BYTE_ASCII;
-		    reg[rrr] = i;
-		  }
-		break;
-	      } while (1);
+	      i = *src++;
+	      if (i < 0x80)
+		{
+		  /* ASCII */
+		  reg[rrr] = i;
+		  reg[RRR] = LEADING_BYTE_ASCII;
+		}
+	      else if (i <= MAX_LEADING_BYTE_OFFICIAL_1)
+		{
+		  if (src >= src_end)
+		    goto ccl_read_multibyte_character_suspend;
+		  reg[RRR] = i;
+		  reg[rrr] = (*src++ & 0x7F);
+		}
+	      else if (i <= MAX_LEADING_BYTE_OFFICIAL_2)
+		{
+		  if ((src + 1) >= src_end)
+		    goto ccl_read_multibyte_character_suspend;
+		  reg[RRR] = i;
+		  i = (*src++ & 0x7F);
+		  reg[rrr] = ((i << 7) | (*src & 0x7F));
+		  src++;
+		}
+	      else if (i == PRE_LEADING_BYTE_PRIVATE_1)
+		{
+		  if ((src + 1) >= src_end)
+		    goto ccl_read_multibyte_character_suspend;
+		  reg[RRR] = *src++;
+		  reg[rrr] = (*src++ & 0x7F);
+		}
+	      else if (i == PRE_LEADING_BYTE_PRIVATE_2)
+		{
+		  if ((src + 2) >= src_end)
+		    goto ccl_read_multibyte_character_suspend;
+		  reg[RRR] = *src++;
+		  i = (*src++ & 0x7F);
+		  reg[rrr] = ((i << 7) | (*src & 0x7F));
+		  src++;
+		}
+	      else
+		{
+		  /* INVALID CODE.  Return a single byte character.  */
+		  reg[RRR] = LEADING_BYTE_ASCII;
+		  reg[rrr] = i;
+		}
 	      break;
 
 	    ccl_read_multibyte_character_suspend: