[uim-commit] r1649 - branches/r5rs/sigscheme
yamaken at freedesktop.org
yamaken at freedesktop.org
Wed Sep 28 05:09:11 PDT 2005
Author: yamaken
Date: 2005-09-28 05:09:02 -0700 (Wed, 28 Sep 2005)
New Revision: 1649
Modified:
branches/r5rs/sigscheme/error.c
branches/r5rs/sigscheme/sigscheme.h
Log:
* sigscheme/sigscheme.h
- (SCM_ASSERT): Rewrite the expression to Perl-like 'true or die'
style
* sigscheme/error.c
- Include lacking stdlib.h for exit(3)
- (SigScm_Error, SigScm_ErrorObj):
* Replace -1 for exit(3) with C89-compliant EXIT_FAILURE
- (SigScm_Die):
* Ditto
* Change the dummy return value from -1 to 1 to make sense on
(cond || die || foo)
Modified: branches/r5rs/sigscheme/error.c
===================================================================
--- branches/r5rs/sigscheme/error.c 2005-09-28 11:42:53 UTC (rev 1648)
+++ branches/r5rs/sigscheme/error.c 2005-09-28 12:09:02 UTC (rev 1649)
@@ -35,6 +35,7 @@
/*=======================================
System Include
=======================================*/
+#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -78,10 +79,9 @@
if (SigScm_DebugCategories() & SCM_DBG_BACKTRACE)
SigScm_ShowBacktrace();
- /* TODO: doesn't exit here */
- exit(-1);
-
- return -1;
+ exit(EXIT_FAILURE);
+ /* NOTREACHED */
+ return 1;
}
void SigScm_Error(const char *msg, ...)
@@ -101,8 +101,8 @@
if (SigScm_DebugCategories() & SCM_DBG_BACKTRACE)
SigScm_ShowBacktrace();
- /* TODO: doesn't exit here */
- exit(-1);
+ /* TODO: throw an exception instead of exiting */
+ exit(EXIT_FAILURE);
}
void SigScm_ErrorObj(const char *msg, ScmObj obj)
@@ -121,8 +121,8 @@
if (SigScm_DebugCategories() & SCM_DBG_BACKTRACE)
SigScm_ShowBacktrace();
- /* TODO: doesn't exit here*/
- exit(-1);
+ /* TODO: throw an exception instead of exiting */
+ exit(EXIT_FAILURE);
}
void SigScm_ShowBacktrace(void)
Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h 2005-09-28 11:42:53 UTC (rev 1648)
+++ branches/r5rs/sigscheme/sigscheme.h 2005-09-28 12:09:02 UTC (rev 1649)
@@ -71,9 +71,8 @@
#define SCM_DBG(args)
#endif /* SCM_DEBUG */
-int SigScm_Die(const char *msg, const char *filename, int line); /* error.c */
#define SCM_ASSERT(cond) \
- (cond ? 0 : SigScm_Die("assertion failed.", __FILE__, __LINE__))
+ ((cond) || SigScm_Die("assertion failed.", __FILE__, __LINE__))
#define SCM_SYMBOL_BOUNDP(sym) (SCM_NEQ(SCM_SYMBOL_VCELL(sym), SCM_UNBOUND))
@@ -569,6 +568,7 @@
ScmObj SigScm_Read_Char(ScmObj port);
/* error.c */
+int SigScm_Die(const char *msg, const char *filename, int line);
void SigScm_Error(const char *msg, ...);
void SigScm_ErrorObj(const char *msg, ScmObj obj);
void SigScm_ShowBacktrace(void);
More information about the uim-commit
mailing list