* __scm.h: Added SCM_DEBUG as default debug option.
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Wed, 17 May 2000 08:35:30 +0000 (08:35 +0000)
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>
Wed, 17 May 2000 08:35:30 +0000 (08:35 +0000)
* __scm.h: Added debug option SCM_DEBUG_REST_ARGUMENTS.
* eval.c:  Make sure all parameter lists for map and for-each have the
  same length.  Also, removed redundant parameter checks.

libguile/ChangeLog
libguile/__scm.h
libguile/eval.c

index d0b2c2b..1efa6da 100644 (file)
@@ -1,3 +1,12 @@
+2000-05-17  Dirk Herrmann  <D.Herrmann@tu-bs.de>
+
+       * __scm.h:  Added SCM_DEBUG as default debug option. (Thanks to
+       Keisuke Nishida for the suggestion.)  Added debug option
+       SCM_DEBUG_REST_ARGUMENTS.
+
+       * eval.c (scm_map, scm_for_each):  Make sure all lists have the
+       same length.  Also, removed redundant parameter checks.
+
 2000-05-16  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * Makefile.am:  Let 'make clean' remove *.x and *.doc files.
@@ -26,7 +35,7 @@
 
         * stime.c (scm_strftime): don't reset TZ if zone is an empty
        string.  append a "0" to the zone for TZ.
-       
+
 2000-05-15  Dirk Herrmann  <D.Herrmann@tu-bs.de>
 
        * numbers.c (scm_logbit_p, scm_bit_extract):  Reordered dispatch
index da510f3..6572fd9 100644 (file)
  */
 
 
+/* The value of SCM_DEBUG determines the default for most of the not yet
+ * defined debugging options.  This allows, for example, to enable most of the
+ * debugging options by simply defining SCM_DEBUG as 1.
+ */
+#ifndef SCM_DEBUG
+#define SCM_DEBUG 0
+#endif
+
 /* If SCM_DEBUG_DEPRECATED is set to 1, deprecated code is not compiled.  This
  * can be used by developers to get rid of references to deprecated code.
  */
 #ifndef SCM_DEBUG_DEPRECATED
-#define SCM_DEBUG_DEPRECATED 0
+#define SCM_DEBUG_DEPRECATED SCM_DEBUG
+#endif
+
+/* If SCM_DEBUG_REST_ARGUMENTS is set to 1, functions that take rest arguments
+ * will check whether the rest arguments actually form a proper list.
+ * Otherwise it is assumed that the rest arguments form a proper list and only
+ * the parameters themselves, which are given as rest arguments, are checked.
+ */
+#ifndef SCM_DEBUG_REST_ARGUMENTS
+#define SCM_DEBUG_REST_ARGUMENTS SCM_DEBUG
 #endif
 
 /* Use this for _compile time_ type checking only, since the compiled result
  * will be quite inefficient.  The right way to make use of this option is to
  * do a 'make clean; make CFLAGS=-DSCM_DEBUG_TYPING_STRICTNESS=1', fix your
  * errors, and then do 'make clean; make'.
-*/
+ */
 #ifndef SCM_DEBUG_TYPING_STRICTNESS
 #define SCM_DEBUG_TYPING_STRICTNESS 0
 #endif
index 91009fc..0fa2217 100644 (file)
@@ -3581,8 +3581,6 @@ scm_map (SCM proc, SCM arg1, SCM args)
   SCM *pres = &res;
   SCM *ve = &args;             /* Keep args from being optimized away. */
 
-  if (SCM_NULLP (arg1))
-    return res;
   len = scm_ilength (arg1);
   SCM_GASSERTn (len >= 0,
                g_map, scm_cons2 (proc, arg1, args), SCM_ARG2, s_map);
@@ -3590,7 +3588,6 @@ scm_map (SCM proc, SCM arg1, SCM args)
     {
       while (SCM_NIMP (arg1))
        {
-         SCM_GASSERT2 (SCM_CONSP (arg1), g_map, proc, arg1, SCM_ARG2, s_map);
          *pres = scm_cons (scm_apply (proc, SCM_CAR (arg1), scm_listofnull),
                            SCM_EOL);
          pres = SCM_CDRLOC (*pres);
@@ -3626,8 +3623,6 @@ scm_for_each (SCM proc, SCM arg1, SCM args)
 {
   SCM *ve = &args;             /* Keep args from being optimized away. */
   long i, len;
-  if SCM_NULLP (arg1)
-    return SCM_UNSPECIFIED;
   len = scm_ilength (arg1);
   SCM_GASSERTn (len >= 0, g_for_each, scm_cons2 (proc, arg1, args),
                SCM_ARG2, s_for_each);
@@ -3635,8 +3630,6 @@ scm_for_each (SCM proc, SCM arg1, SCM args)
     {
       while SCM_NIMP (arg1)
        {
-         SCM_GASSERT2 (SCM_CONSP (arg1),
-                       g_for_each, proc, arg1, SCM_ARG2, s_for_each);
          scm_apply (proc, SCM_CAR (arg1), scm_listofnull);
          arg1 = SCM_CDR (arg1);
        }