changeset 1494:210683f31426

[xemacs-hg @ 2003-05-22 06:09:03 by stephent] coding detection debug code <87vfw3tt4b.fsf@tleepslib.sk.tsukuba.ac.jp> typo in comment <87r86rtt18.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Thu, 22 May 2003 06:09:04 +0000
parents 277e2dba97ac
children c3cf7db99b98
files src/ChangeLog src/event-Xt.c src/file-coding.c
diffstat 3 files changed, 33 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed May 21 21:52:27 2003 +0000
+++ b/src/ChangeLog	Thu May 22 06:09:04 2003 +0000
@@ -1,3 +1,18 @@
+2003-05-22  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* file-coding.c: DEFSYMBOL Qslightly_unlikely.
+	(detection_result_number_to_symbol):
+	(detection_result_symbol_to_number):
+	Decode/encode corresponding result numbers.
+	(detection_result_number_to_symbol):
+	Use switch to get warnings about unhandled enumerators.
+	(detect_coding_type): Add debug check for 0 detector categories.
+	(undecided_init_coding_stream): Add debug output.
+
+2003-05-15  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* event-Xt.c (x_to_emacs_keysym): Fix typo in comment.
+
 2003-05-10  Steve Youngs  <youngs@xemacs.org>
 
 	* XEmacs 21.5.13 "cauliflower" is released.
--- a/src/event-Xt.c	Wed May 21 21:52:27 2003 +0000
+++ b/src/event-Xt.c	Thu May 22 06:09:04 2003 +0000
@@ -1010,7 +1010,7 @@
 #else /* XIM_XLIB */
   if (xic)
     len = XmbLookupString (xic, event, bufptr, bufsiz, &keysym, &status);
-#endif /* HAVE_XIM */
+#endif /* XIM_MOTIF */
 
 #ifdef DEBUG_XEMACS
   if (debug_x_events > 0)
--- a/src/file-coding.c	Wed May 21 21:52:27 2003 +0000
+++ b/src/file-coding.c	Thu May 22 06:09:04 2003 +0000
@@ -474,6 +474,7 @@
 Lisp_Object Qconvert_eol_autodetect;
 
 Lisp_Object Qnear_certainty, Qquite_probable, Qsomewhat_likely;
+Lisp_Object Qslightly_likely;
 Lisp_Object Qas_likely_as_unlikely, Qsomewhat_unlikely, Qquite_improbable;
 Lisp_Object Qnearly_impossible;
 
@@ -3488,15 +3489,19 @@
 static Lisp_Object
 detection_result_number_to_symbol (enum detection_result result)
 {
-#define FROB(sym, num) if (result == num) return (sym)
+  /* let compiler warn if not all enumerators are handled */
+  switch (result) {
+#define FROB(sym, num) case num: return (sym)
   FROB (Qnear_certainty, DET_NEAR_CERTAINTY);
   FROB (Qquite_probable, DET_QUITE_PROBABLE);
   FROB (Qsomewhat_likely, DET_SOMEWHAT_LIKELY);
+  FROB (Qslightly_likely, DET_SLIGHTLY_LIKELY);
   FROB (Qas_likely_as_unlikely, DET_AS_LIKELY_AS_UNLIKELY);
   FROB (Qsomewhat_unlikely, DET_SOMEWHAT_UNLIKELY);
   FROB (Qquite_improbable, DET_QUITE_IMPROBABLE);
   FROB (Qnearly_impossible, DET_NEARLY_IMPOSSIBLE);
 #undef FROB
+  }
 
   abort ();
   return Qnil; /* (usually) not reached */
@@ -3506,10 +3511,12 @@
 static enum detection_result
 detection_result_symbol_to_number (Lisp_Object symbol)
 {
+  /* using switch here would be bad style, and doesn't help */
 #define FROB(sym, num) if (EQ (symbol, sym)) return (num)
   FROB (Qnear_certainty, DET_NEAR_CERTAINTY);
   FROB (Qquite_probable, DET_QUITE_PROBABLE);
   FROB (Qsomewhat_likely, DET_SOMEWHAT_LIKELY);
+  FROB (Qslightly_likely, DET_SLIGHTLY_LIKELY);
   FROB (Qas_likely_as_unlikely, DET_AS_LIKELY_AS_UNLIKELY);
   FROB (Qsomewhat_unlikely, DET_SOMEWHAT_UNLIKELY);
   FROB (Qquite_improbable, DET_QUITE_IMPROBABLE);
@@ -3642,6 +3649,9 @@
   if (!NILP (Vdebug_coding_detection))
     {
       stderr_out ("seen_non_ascii: %d\n", st->seen_non_ascii);
+      if (coding_detector_category_count <= 0)
+	stderr_out ("found %d detector categories\n",
+		    coding_detector_category_count);
       for (i = 0; i < coding_detector_category_count; i++)
 	stderr_out_lisp
 	  ("%s: %s\n",
@@ -3923,6 +3933,11 @@
 	/* We can determine the coding system now. */
 	data->actual = determine_real_coding_system (lst);
     }
+
+#ifdef DEBUG_XEMACS
+  if (!NILP (Vdebug_coding_detection))
+    stderr_out_lisp ("detected coding system: %s\n", 1, data->actual);
+#endif /* DEBUG_XEMACS */
 }
 
 static void
@@ -4621,6 +4636,7 @@
   DEFSYMBOL (Qnear_certainty);
   DEFSYMBOL (Qquite_probable);
   DEFSYMBOL (Qsomewhat_likely);
+  DEFSYMBOL (Qslightly_likely);
   DEFSYMBOL (Qas_likely_as_unlikely);
   DEFSYMBOL (Qsomewhat_unlikely);
   DEFSYMBOL (Qquite_improbable);