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

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


Author: yamaken
Date: 2006-01-06 07:51:03 -0800 (Fri, 06 Jan 2006)
New Revision: 2808

Modified:
   branches/r5rs/sigscheme/operations.c
   branches/r5rs/sigscheme/sigschemeinternal.h
Log:
* sigscheme/sigschemeinternal.h
  - (SCM_LISTLEN_ENCODE_DOT, SCM_LISTLEN_ENCODE_CIRCULAR): New macros
    moved from operations.c
* sigscheme/operations.c
  - (LISTLEN_ENCODE_DOT, LISTLEN_ENCODE_CIRCULAR): Move to
    sigschemeinternal.h and rename to SCM_*
  - (scm_length): Follow the renamings


Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2006-01-06 15:43:13 UTC (rev 2807)
+++ branches/r5rs/sigscheme/operations.c	2006-01-06 15:51:03 UTC (rev 2808)
@@ -815,22 +815,16 @@
     ScmObj slow;
     int len;
 
-#define LISTLEN_ENCODE_DOT(len)      (-(len))
-#define LISTLEN_ENCODE_CIRCULAR(len) (INT_MIN)
-
-    slow = lst;
-    len = 0;
-
-    for (;;) {
+    for (len = 0, slow = lst;;) {
         if (NULLP(lst)) break;
-        if (!CONSP(lst)) return LISTLEN_ENCODE_DOT(len + 1);
-        if (len != 0 && lst == slow) return LISTLEN_ENCODE_CIRCULAR(len);
+        if (!CONSP(lst))             return SCM_LISTLEN_ENCODE_DOT(len + 1);
+        if (len != 0 && lst == slow) return SCM_LISTLEN_ENCODE_CIRCULAR(len);
 
         lst = CDR(lst);
         len++;
         if (NULLP(lst)) break;
-        if (!CONSP(lst)) return LISTLEN_ENCODE_DOT(len + 1);
-        if (lst == slow) return LISTLEN_ENCODE_CIRCULAR(len);
+        if (!CONSP(lst)) return SCM_LISTLEN_ENCODE_DOT(len + 1);
+        if (lst == slow) return SCM_LISTLEN_ENCODE_CIRCULAR(len);
 
         lst = CDR(lst);
         slow = CDR(slow);
@@ -838,8 +832,6 @@
     }
 
     return len;
-#undef LISTLEN_ENCODE_DOT
-#undef LISTLEN_ENCODE_CIRCULAR
 }
 
 ScmObj

Modified: branches/r5rs/sigscheme/sigschemeinternal.h
===================================================================
--- branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-06 15:43:13 UTC (rev 2807)
+++ branches/r5rs/sigscheme/sigschemeinternal.h	2006-01-06 15:51:03 UTC (rev 2808)
@@ -348,7 +348,9 @@
 /* error handlings */
 #define SCM_ERR_HEADER "Error: "
 
-/* result decoders for scm_length() */
+/* result encoder/decoders for scm_length() */
+#define SCM_LISTLEN_ENCODE_DOT(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_DOTP(len)        ((len) < 0                              \



More information about the uim-commit mailing list