unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* read errors
@ 2002-08-04 23:21 Han-Wen Nienhuys
  2002-08-05 18:02 ` Marius Vollmer
  0 siblings, 1 reply; 6+ messages in thread
From: Han-Wen Nienhuys @ 2002-08-04 23:21 UTC (permalink / raw)



I just added some friendly error messages to the reader. I haven't
committed it yet, though. -- I have the following comment now. Perhaps
someone can shed some light on the proper way to deal with errors?


/*
  Give meaningful error messages for errors

  We use the format

  MESSAGE
  This happened in ....

  This is not standard GNU format, but the test-suite likes the real
  message to be in front.

  Hmmm.

  Maybe this is a kludge? Perhaps we should throw (list EXPR FILENAME
  LINENO COLUMNO), and have the exception handler sort out the error
  message? Where does the handler live, what are the conventions for
  the expression argument of the handler? How does this work for an
  error message like

Backtrace:
In standard input:
   4: 0* [list ...

standard input:4:1: While evaluating arguments to list in expression (list a b):standard input:4:1: Unbound variable: a
ABORT: (unbound-variable)


  In any case, we would have to assemble that information anyway. 
 */

#define  INPUT_ERROR(port, message, arg) { 									\
      char s[1024];\
      int fn_found =  SCM_STRINGP (SCM_FILENAME(port));\
      char *fn = "";\
      if (fn_found)\
         fn = SCM_STRING_CHARS(SCM_FILENAME(port));\
      snprintf (s, 1024, "%s\nThis happened in %s%s%s line %d column %d", message, \
		fn_found ? "`" : "", \
		fn,\
		fn_found ? "'" : "", \
	       SCM_LINUM(port) + 1, SCM_COL(port) + 1);			\
      SCM_MISC_ERROR(s, arg);											\
    }

-- 

Han-Wen Nienhuys   |   hanwen@cs.uu.nl   |   http://www.cs.uu.nl/~hanwen 

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-08-08 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-04 23:21 read errors Han-Wen Nienhuys
2002-08-05 18:02 ` Marius Vollmer
2002-08-05 18:16   ` Han-Wen Nienhuys
2002-08-08 17:50     ` Marius Vollmer
2002-08-05 23:15   ` Han-Wen Nienhuys
2002-08-06 12:02     ` Marius Vollmer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).