changeset 2267:5753220a0f80

[xemacs-hg @ 2004-09-14 02:53:13 by james] Preformat syntax error messages.
author james
date Tue, 14 Sep 2004 02:53:16 +0000
parents 7561cb77a6e6
children 61855263cb07
files src/ChangeLog src/doprnt.c src/eval.c
diffstat 3 files changed, 21 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Sep 13 21:50:38 2004 +0000
+++ b/src/ChangeLog	Tue Sep 14 02:53:16 2004 +0000
@@ -1,3 +1,10 @@
+2004-08-18  Felix H. Gatzemeier  <f.g@tzemeier.info>
+
+	* doprnt.c (emacs_doprnt_1): Use sprintf to format error messages
+	from the formatting function.
+	* eval.c (syntax_error): Emphasize that `reason' is not processed
+	as a format string.
+
 2004-09-11  Malcolm Purvis  <malcolmp@xemacs.org>
 
 	* config.h.in: Added entries for sys/resource.h, sys/vlimit.h,
--- a/src/doprnt.c	Mon Sep 13 21:50:38 2004 +0000
+++ b/src/doprnt.c	Tue Sep 14 02:53:16 2004 +0000
@@ -597,9 +597,12 @@
 	      if (!INT_OR_FLOATP (obj))
 #endif
 		{
-		  syntax_error
-		    ("format specifier %%%c doesn't match argument type",
-		     make_char (ch));
+		  /* WARNING!  This MUST be big enough for the sprintf below */
+		  CIbyte message[48];
+		  sprintf (message,
+			   "format specifier %%%c doesn't match argument type",
+			   ch);
+		  syntax_error (message, Qnil);
 		}
 	      else if (strchr (double_converters, ch))
 		{
@@ -715,8 +718,13 @@
 	      a = (Ichar) arg.l;
 
 	      if (!valid_ichar_p (a))
-		syntax_error ("invalid character value %d to %%c spec",
-			      make_int (a));
+		{
+		  /* WARNING!  This MUST be big enough for the sprintf below */
+		  CIbyte message[60];
+		  sprintf (message, "invalid character value %d to %%c spec",
+			   a);
+		  syntax_error (message, Qnil);
+		}
 
 	      charlen = set_itext_ichar (charbuf, a);
 	      doprnt_2 (stream, charbuf, charlen, spec->minwidth,
--- a/src/eval.c	Mon Sep 13 21:50:38 2004 +0000
+++ b/src/eval.c	Tue Sep 14 02:53:16 2004 +0000
@@ -2833,6 +2833,7 @@
   signal_error (Qcircular_property_list, 0, list);
 }
 
+/* Called from within emacs_doprnt_1, so REASON is not formatted. */
 DOESNT_RETURN
 syntax_error (const CIbyte *reason, Lisp_Object frob)
 {