[LispM-Hackers] error handling by abusing macro system
Paul Fuqua
pf@ti.com
Tue, 10 Apr 2001 11:21:57 -0500 (CDT)
Date: Mon, 9 Apr 2001 23:23:11 -0400
From: John Morrison <jm@mak.com>
(1) Define a macro that causes the program to complain to stderr,
shoot itself in the head, and leave its corpse in a core file (hmm. A
CORpsE file?)
Or how about
void fail(const char *s, ...)
{
va_list ap;
va_start(ap, s);
fprintf(stderr, "Fatal error: ");
vfprintf(stderr, s, ap);
va_end(ap);
abort();
}
which is part of a set of such notification functions I've carried
around for a while: note(), warn(), error(), and fail(), for the
different levels. Notes are suppressed unless "verbose" is on; errors
throw out to top level using throw() or longjmp(), depending on
environment.
Call it like
fail("bad dtp %d in foo()\n", datatype);
pf