diff src/mule-ccl.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents fdefd0186b75
children e38acbeb1cae
line wrap: on
line diff
--- a/src/mule-ccl.c	Fri Mar 08 13:33:14 2002 +0000
+++ b/src/mule-ccl.c	Wed Mar 13 08:54:06 2002 +0000
@@ -21,26 +21,14 @@
 
 /* Synched up with : FSF Emacs 21.0.90 except TranslateCharacter */
 
-#ifdef emacs
 #include <config.h>
-#endif
-
-#include <stdio.h>
+#include "lisp.h"
 
-#ifdef emacs
-
-#include "lisp.h"
 #include "buffer.h"
-#include "mule-charset.h"
+#include "charset.h"
 #include "mule-ccl.h"
 #include "file-coding.h"
 
-#else  /* not emacs */
-
-#include "mulelib.h"
-
-#endif /* not emacs */
-
 Lisp_Object Qccl_error;
 
 /* This contains all code conversion map available to CCL.  */
@@ -701,12 +689,14 @@
 
 /* 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;	\
-  /* The "if (1)" inhibits the warning	\
-     "end-of loop code not reached" */	\
-  if (1) goto ccl_error_handler;	\
+#define CCL_INVALID_CMD					\
+  do {							\
+    ccl->status = CCL_STAT_INVALID_CMD;			\
+    /* enable this to debug invalid cmd errors */	\
+    /* debug_break (); */				\
+    /* 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
@@ -1260,16 +1250,16 @@
 	    case CCL_GE: reg[rrr] = i >= j; break;
 	    case CCL_NE: reg[rrr] = i != j; break;
 	    case CCL_DECODE_SJIS:
-	      /* DECODE_SJIS set MSB for internal format
+	      /* DECODE_SHIFT_JIS set MSB for internal format
 		 as opposed to Emacs.  */
-	      DECODE_SJIS (i, j, reg[rrr], reg[7]);
+	      DECODE_SHIFT_JIS (i, j, reg[rrr], reg[7]);
 	      reg[rrr] &= 0x7F;
 	      reg[7] &= 0x7F;
 	      break;
 	    case CCL_ENCODE_SJIS:
-	      /* ENCODE_SJIS assumes MSB of SJIS-char is set
+	      /* ENCODE_SHIFT_JIS assumes MSB of SHIFT-JIS-char is set
 		 as opposed to Emacs.  */
-	      ENCODE_SJIS (i | 0x80, j | 0x80, reg[rrr], reg[7]);
+	      ENCODE_SHIFT_JIS (i | 0x80, j | 0x80, reg[rrr], reg[7]);
 	      break;
 	    default: CCL_INVALID_CMD;
 	    }
@@ -1389,8 +1379,8 @@
 
 	    case CCL_TranslateCharacterConstTbl:
 #if 0
-	      /* XEmacs does not have translate_char, and its
-		 equivalent nor.  We do nothing on this operation. */
+	      /* XEmacs does not have translate_char or an equivalent.  We
+                 do nothing on this operation. */
 	      op = XINT (ccl_prog[ic]); /* table */
 	      ic++;
 	      CCL_MAKE_CHAR (reg[RRR], reg[rrr], i);
@@ -1942,8 +1932,7 @@
 int
 setup_ccl_program (struct ccl_program *ccl, Lisp_Object ccl_prog)
 {
-  int i;
-
+  xzero (*ccl); /* XEmacs change */
   if (! NILP (ccl_prog))
     {
       ccl_prog = ccl_get_compiled_code (ccl_prog);
@@ -1955,12 +1944,6 @@
       ccl->buf_magnification = XINT (XVECTOR_DATA (ccl_prog)[CCL_HEADER_BUF_MAG]);
     }
   ccl->ic = CCL_HEADER_MAIN;
-  for (i = 0; i < 8; i++)
-    ccl->reg[i] = 0;
-  ccl->last_block = 0;
-  ccl->private_state = 0;
-  ccl->status = 0;
-  ccl->stack_idx = 0;
   ccl->eol_type = CCL_CODING_EOL_LF;
   return 0;
 }