[uim-commit] r2711 - branches/r5rs/sigscheme

yamaken at freedesktop.org yamaken at freedesktop.org
Thu Dec 29 13:05:16 PST 2005


Author: yamaken
Date: 2005-12-29 13:05:05 -0800 (Thu, 29 Dec 2005)
New Revision: 2711

Modified:
   branches/r5rs/sigscheme/TODO
   branches/r5rs/sigscheme/config.h
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/config.h
  - (SCM_CHICKEN_DEBUG): New macro
* sigscheme/sigscheme.h
  - (SCM_ASSERT): Add alternative implementation for each
    SCM_CHICKEN_DEBUG and !SCM_DEBUG
  - (SCM_ENSURE): New macro
  - (SCM_ASSERT_ALLOCATED, SCM_ASSERT_LIVE_PORT): Add FIXME comment
    about future renaming
* sigscheme/sigschemeinternal.h
  - (ASSERT_TYPE, ASSERT_INTP, ASSERT_ALLOCATED, ASSERT_MUTABLEP): Add
    FIXME comment about future renaming
* sigscheme/TODO
  - Update


Modified: branches/r5rs/sigscheme/TODO
===================================================================
--- branches/r5rs/sigscheme/TODO	2005-12-29 19:36:53 UTC (rev 2710)
+++ branches/r5rs/sigscheme/TODO	2005-12-29 21:05:05 UTC (rev 2711)
@@ -93,7 +93,7 @@
 ==============================================================================
 Assigned to YamaKen:
 
-* Separate SCM_ASSERT into required validation (SCM_VALIDATE) and optional
+* Separate SCM_ASSERT into required validation (SCM_ENSURE) and optional
   assertion (SCM_ASSERT)
 
 * Add CCS identity for each codec and use it to check Unicode compatibility on

Modified: branches/r5rs/sigscheme/config.h
===================================================================
--- branches/r5rs/sigscheme/config.h	2005-12-29 19:36:53 UTC (rev 2710)
+++ branches/r5rs/sigscheme/config.h	2005-12-29 21:05:05 UTC (rev 2711)
@@ -102,6 +102,7 @@
   Debugging
 ===========================================================================*/
 #define SCM_DEBUG               1  /* enable debugging features */
+#define SCM_CHICKEN_DEBUG       1  /* allow survival recovery */
 #define SCM_DEBUG_GC            0  /* enable GC debugging */
 #define SCM_DEBUG_PORT          0  /* enable port debugging */
 #define SCM_DEBUG_PARSER        0  /* enable parser debugging */

Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2005-12-29 19:36:53 UTC (rev 2710)
+++ branches/r5rs/sigscheme/sigscheme.h	2005-12-29 21:05:05 UTC (rev 2711)
@@ -84,13 +84,22 @@
 #define SCM_DBG(args)
 #endif /* SCM_DEBUG */
 
-/* FIXME:
- * - separate required validation from optional assertion
- * - support immediate termination to produce core instead of robust recovery
- */
+#if SCM_DEBUG
+#if SCM_CHICKEN_DEBUG
+/* allows survival recovery */
 #define SCM_ASSERT(cond)                                                     \
     ((cond) || scm_die("assertion failed", __FILE__, __LINE__))
+#else /* SCM_CHICKEN_DEBUG */
+#include <assert.h>
+#define SCM_ASSERT(cond) (assert(cond))
+#endif /* SCM_CHICKEN_DEBUG */
+#else /* SCM_DEBUG */
+#define SCM_ASSERT(cond)
+#endif /* SCM_DEBUG */
+#define SCM_ENSURE(cond)                                                     \
+    ((cond) || scm_die("invalid condition", __FILE__, __LINE__))
 
+/* FIXME: Rename to SCM_ENSURE_ALLOCATED() */
 #define SCM_ASSERT_ALLOCATED(p)                                              \
     ((p) || (scm_fatal_error(SCM_ERRMSG_MEMORY_EXHAUSTED), 1))
 
@@ -171,6 +180,7 @@
 /* Above five macros must be defined before this inclusion. */
 #include "baseport.h"
 
+/* FIXME: Rename to SCM_ENSURE_LIVE_PORT() */
 #define SCM_ASSERT_LIVE_PORT(port)                                           \
     (SCM_PORT_IMPL(port)                                                     \
      || (scm_error_obj("(unknown)", "operated on closed port", port), 1))

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2005-12-29 19:36:53 UTC (rev 2710)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2005-12-29 21:05:05 UTC (rev 2711)
@@ -325,9 +325,11 @@
       ? (SCM_MANGLE(tmp) = CAR(args), (args) = CDR(args), SCM_MANGLE(tmp)) \
       : (ERR("missing argument(s)"), NULL))
 
+/* FIXME: Rename to ENSURE_TYPE() */
 #define ASSERT_TYPE(pred, typename, obj) \
     (pred(obj) || (ERR_OBJ(typename " required but got", (obj)), 1))
 
+/* FIXME: Rename to ENSURE_INT() and so on */
 #define ASSERT_INTP(obj)     ASSERT_TYPE(INTP, "integer", (obj))
 #define ASSERT_CONSP(obj)    ASSERT_TYPE(CONSP, "pair", (obj))
 #define ASSERT_SYMBOLP(obj)  ASSERT_TYPE(SYMBOLP, "symbol", (obj))
@@ -352,11 +354,13 @@
 /* error handlings */
 #define SCM_ERR_HEADER "Error: "
 
+/* FIXME: Rename to ENSURE_ALLOCATED() */
 #define ASSERT_ALLOCATED SCM_ASSERT_ALLOCATED
 
 /*=======================================
    String Mutation Assertion
 =======================================*/
+/* FIXME: Rename to ENSURE_MUTABLE() */
 #define ASSERT_MUTABLEP(str)                                            \
     do {                                                                \
         if (SCM_STRING_MUTATION_TYPE(str) == SCM_STR_IMMUTABLE)         \



More information about the uim-commit mailing list