[uim-commit] r2992 - branches/r5rs/sigscheme/src

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Jan 25 19:14:19 PST 2006


Author: yamaken
Date: 2006-01-25 19:14:15 -0800 (Wed, 25 Jan 2006)
New Revision: 2992

Modified:
   branches/r5rs/sigscheme/src/eval.c
Log:
* sigscheme/src/eval.c
  - (scm_eval): Simplify and make efficient


Modified: branches/r5rs/sigscheme/src/eval.c
===================================================================
--- branches/r5rs/sigscheme/src/eval.c	2006-01-25 07:03:56 UTC (rev 2991)
+++ branches/r5rs/sigscheme/src/eval.c	2006-01-26 03:14:15 UTC (rev 2992)
@@ -395,7 +395,6 @@
 ScmObj
 scm_eval(ScmObj obj, ScmObj env)
 {
-    ScmObj ret;
     ScmEvalState state;
 
 #if SCM_DEBUG
@@ -406,30 +405,23 @@
     state.env = env;
 
 eval_loop:
+    if (SYMBOLP(obj)) {
+        obj = scm_symbol_value(obj, state.env);
+    } else if (CONSP(obj)) {
+        obj = call(CAR(obj), CDR(obj), &state, SCM_VALTYPE_NEED_EVAL);
+        if (state.ret_type == SCM_VALTYPE_NEED_EVAL)
+            goto eval_loop;
+    }
 #if SCM_STRICT_R5RS
     /* () is allowed by default for efficiency */
-    if (NULLP(obj))
+    else if (NULLP(obj))
         ERR("eval: () is not a valid R5RS form. use '() instead");
 #endif
-    switch (SCM_TYPE(obj)) {
-    case ScmSymbol:
-        ret = scm_symbol_value(obj, state.env);
-        break;
 
-    case ScmCons:
-        obj = call(CAR(obj), CDR(obj), &state, SCM_VALTYPE_NEED_EVAL);
-        if (state.ret_type == SCM_VALTYPE_NEED_EVAL)
-            goto eval_loop;
-        /* FALLTHROUGH */
-    default:
-        ret = obj;
-        break;
-    }
-
 #if SCM_DEBUG
     scm_pop_trace_frame();
 #endif
-    return ret;
+    return obj;
 }
 
 ScmObj



More information about the uim-commit mailing list