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

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Jan 6 08:23:08 PST 2006


Author: yamaken
Date: 2006-01-06 08:23:05 -0800 (Fri, 06 Jan 2006)
New Revision: 2811

Modified:
   branches/r5rs/sigscheme/sigscheme.h
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/sigscheme.h
  - (SCM_PROPER_LISTP): Rewrite meaningfully
  - (SCM_DOTTED_LISTP, SCM_CIRCULAR_LISTP): New macro
  - (SCM_LISTLEN_PROPERP, SCM_LISTLEN_CIRCULARP, SCM_LISTLEN_DOTTEDP,
    SCM_LISTLEN_DOTTED, SCM_LISTLEN_BEFORE_DOT): Moved from
    sigschemeinternal.h
* sigscheme/sigschemeinternal.h
  - (DOTTED_LISTP, CIRCULAR_LISTP): New macro
  - (SCM_LISTLEN_PROPERP, SCM_LISTLEN_CIRCULARP, SCM_LISTLEN_DOTTEDP,
    SCM_LISTLEN_DOTTED, SCM_LISTLEN_BEFORE_DOT): Move to sigscheme.h


Modified: branches/r5rs/sigscheme/sigscheme.h
===================================================================
--- branches/r5rs/sigscheme/sigscheme.h	2006-01-06 16:09:40 UTC (rev 2810)
+++ branches/r5rs/sigscheme/sigscheme.h	2006-01-06 16:23:05 UTC (rev 2811)
@@ -41,6 +41,7 @@
 /*=======================================
    System Include
 =======================================*/
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -151,8 +152,19 @@
 #define SCM_LIST_4_P(lst) (SCM_CONSP(lst) && SCM_LIST_3_P(SCM_CDR(lst)))
 #define SCM_LIST_5_P(lst) (SCM_CONSP(lst) && SCM_LIST_4_P(SCM_CDR(lst)))
 
-#define SCM_PROPER_LISTP(obj) (0 <= scm_length(obj))
+#define SCM_PROPER_LISTP(obj)   (SCM_LISTLEN_PROPERP(scm_length(obj)))
+#define SCM_DOTTED_LISTP(obj)   (CONSP(obj)                                  \
+                                 && SCM_LISTLEN_DOTTEDP(scm_length(obj)))
+#define SCM_CIRCULAR_LISTP(obj) (SCM_LISTLEN_CIRCULARP(scm_length(obj)))
 
+/* result decoders for scm_length() */
+#define SCM_LISTLEN_PROPERP(len)    (0 <= (len))
+#define SCM_LISTLEN_CIRCULARP(len)  ((len) == INT_MIN)
+#define SCM_LISTLEN_DOTTEDP(len)    ((len) < 0                               \
+                                     && !SCM_LISTLEN_CIRCULARP(len))
+#define SCM_LISTLEN_DOTTED(len)     (abs(len))
+#define SCM_LISTLEN_BEFORE_DOT(len) (~(len))  /* abs(len) - 1 */
+
 #define SCM_EVAL(obj, env) (scm_eval((obj), (env)))
 
 #if SCM_GCC4_READY_GC

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-06 16:09:40 UTC (rev 2810)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-06 16:23:05 UTC (rev 2811)
@@ -38,7 +38,7 @@
    System Include
 =======================================*/
 #include <limits.h>
-#include <stdlib.h>
+#include <stddef.h>
 #include <stdarg.h>
 
 /*=======================================
@@ -221,6 +221,8 @@
 #define LIST_4_P       SCM_LIST_4_P
 #define LIST_5_P       SCM_LIST_5_P
 #define PROPER_LISTP   SCM_PROPER_LISTP
+#define DOTTED_LISTP   SCM_DOTTED_LISTP
+#define CIRCULAR_LISTP SCM_CIRCULAR_LISTP
 
 #define CDBG           SCM_CDBG
 #define DBG            SCM_DBG
@@ -348,15 +350,9 @@
 /* error handlings */
 #define SCM_ERR_HEADER "Error: "
 
-/* result encoder/decoders for scm_length() */
+/* result encoders for scm_length() */
 #define SCM_LISTLEN_ENCODE_DOTTED(len)   (-(len))
 #define SCM_LISTLEN_ENCODE_CIRCULAR(len) (INT_MIN)
-#define SCM_LISTLEN_PROPERP(len)         (0 <= (len))
-#define SCM_LISTLEN_CIRCULARP(len)       ((len) == INT_MIN)
-#define SCM_LISTLEN_DOTTEDP(len)         ((len) < 0                          \
-                                          && !SCM_LISTLEN_CIRCULARP(len))
-#define SCM_LISTLEN_DOTTED(len)          (abs(len))
-#define SCM_LISTLEN_BEFORE_DOT(len)      (~(len))  /* abs(len) - 1 */
 
 /*=======================================
    List Constructor



More information about the uim-commit mailing list