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

yamaken at freedesktop.org yamaken at freedesktop.org
Sun Oct 2 07:13:08 PDT 2005


Author: yamaken
Date: 2005-10-02 07:13:06 -0700 (Sun, 02 Oct 2005)
New Revision: 1735

Modified:
   branches/r5rs/sigscheme/operations-srfi8.c
   branches/r5rs/sigscheme/operations.c
Log:
* sigscheme/operations.c
  - (ScmOp_call_with_values): Simplify with Scm_tailcall()
* sigscheme/operations-srfi8.c
  - (ScmOp_SRFI8_receive): Simplify with Scm_tailcall()


Modified: branches/r5rs/sigscheme/operations-srfi8.c
===================================================================
--- branches/r5rs/sigscheme/operations-srfi8.c	2005-10-02 14:11:53 UTC (rev 1734)
+++ branches/r5rs/sigscheme/operations-srfi8.c	2005-10-02 14:13:06 UTC (rev 1735)
@@ -70,7 +70,7 @@
      * (receive <formals> <expression> <body>)
      */
     ScmObj env     = eval_state->env;
-    ScmObj actuals = SCM_NULL;
+    ScmObj actuals = SCM_FALSE;
 
     /* FIXME: do we have to extend the environment first?  The SRFI-8
      * document contradicts itself on this part. */
@@ -81,8 +81,18 @@
     else
         actuals = CONS(actuals, SCM_NULL);
 
-    return ScmOp_apply(Scm_NewClosure(CONS(formals, body), env),
-                       actuals,
-                       SCM_NULL,
-                       eval_state);
+#if 1
+    return Scm_tailcall(Scm_NewClosure(CONS(formals, body), env),
+                        actuals,
+                        eval_state);
+#else
+    /* fast path */
+
+    /* TODO: Support (receive args <exp> <body>) and (receive (a b . rest)
+     * <exp> <body>)style forms by revising the Scm_ExtendEnvironment().
+     */
+    eval_state->env = env = Scm_ExtendEnvironment(formals, actuals, env);
+
+    return ScmExp_begin(body, eval_state);
+#endif
 }

Modified: branches/r5rs/sigscheme/operations.c
===================================================================
--- branches/r5rs/sigscheme/operations.c	2005-10-02 14:11:53 UTC (rev 1734)
+++ branches/r5rs/sigscheme/operations.c	2005-10-02 14:13:06 UTC (rev 1735)
@@ -1855,10 +1855,8 @@
         vals = SCM_VALUEPACKET_VALUES(vals);
     }
 #endif
-
-    /* call(consumer, vals, eval_state, 1) as proper tail recursion */
-    eval_state->ret_type = SCM_RETTYPE_NEED_CALL_AS_IS;
-    return CONS(consumer, vals);
+    
+    return Scm_tailcall(consumer, vals, eval_state);
 }
 
 #if SCM_USE_SRFI1



More information about the uim-commit mailing list