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

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Sep 30 05:15:01 PDT 2005


Author: yamaken
Date: 2005-09-30 05:14:58 -0700 (Fri, 30 Sep 2005)
New Revision: 1690

Modified:
   branches/r5rs/sigscheme/eval.c
Log:
* sigscheme/eval.c
  - (extend_environment):
    * Simplify
    * Modify the doc


Modified: branches/r5rs/sigscheme/eval.c
===================================================================
--- branches/r5rs/sigscheme/eval.c	2005-09-30 12:05:59 UTC (rev 1689)
+++ branches/r5rs/sigscheme/eval.c	2005-09-30 12:14:58 UTC (rev 1690)
@@ -94,12 +94,13 @@
   Function Implementations
 =======================================*/
 /**
- * Add a frame to an env
+ * Construct new frame on an env
  *
- * @param vars Symbol list as variable names. It accepts dot list to handle
- *             function arguments directly.
- * @param vals Arbitrary Scheme object list as values. Side effect:
- *             destructively modifyies the vals when vars is a dot list.
+ * @param vars Symbol list as variable names of new frame. It accepts dot list
+ *             to handle function arguments directly.
+ * @param vals Arbitrary Scheme object list as values of new frame. Side
+ *             effect: destructively modifyies the vals when vars is a dot
+ *             list.
  * @see ScmOp_eval()
  */
 ScmObj extend_environment(ScmObj vars, ScmObj vals, ScmObj env)
@@ -107,6 +108,9 @@
     ScmObj frame     = SCM_NULL;
     ScmObj rest_vars, rest_vals;
 
+    if (!CONSP(env) && !NULLP(env))
+        SigScm_Error("extend_environment : broken environment");
+
     /* sanity check & dot list handling */
     for (rest_vars = vars, rest_vals = vals;
          !NULLP(rest_vars);
@@ -125,15 +129,7 @@
     /* create new frame */
     frame = CONS(vars, vals);
 
-    /* add to env */
-    if (NULLP(env))
-        env = CONS(frame, SCM_NULL);
-    else if (CONSP(env))
-        env = CONS(frame, env);
-    else
-        SigScm_Error("broken environment.");
-
-    return env;
+    return CONS(frame, env);
 }
 
 /** Add a binding to newest frame of an env */



More information about the uim-commit mailing list