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

yamaken at freedesktop.org yamaken at freedesktop.org
Fri Jan 27 20:55:33 PST 2006


Author: yamaken
Date: 2006-01-27 20:55:29 -0800 (Fri, 27 Jan 2006)
New Revision: 3013

Modified:
   branches/r5rs/sigscheme/src/main.c
Log:
* sigscheme/src/main.c
  - (repl_loop): Fix broken evaluation. Sexps are now evaluated in
    top-level


Modified: branches/r5rs/sigscheme/src/main.c
===================================================================
--- branches/r5rs/sigscheme/src/main.c	2006-01-28 04:47:59 UTC (rev 3012)
+++ branches/r5rs/sigscheme/src/main.c	2006-01-28 04:55:29 UTC (rev 3013)
@@ -94,13 +94,15 @@
 static void
 repl_loop(void)
 {
+    ScmEvalState eval_state;
     ScmBaseCharPort *cport;
     ScmBytePort *bport;
     ScmObj sexp, result;
 #if SCM_USE_SRFI34
-    ScmObj sym_guard, cond_catch, proc_read, err;
+    ScmObj sym_guard, cond_catch, proc_read, proc_eval, err;
 
     proc_read = scm_symbol_value(scm_intern("read"), SCM_INTERACTION_ENV);
+    proc_eval = scm_symbol_value(scm_intern("eval"), SCM_INTERACTION_ENV);
     err = CONS(SCM_UNDEF, SCM_UNDEF); /* unique ID */
 
     /* prepare the constant part of the form to get the loop fast */
@@ -118,12 +120,24 @@
 
 #if SCM_USE_SRFI34
         /* error-proof read */
-        sexp = EVAL(LIST_3(sym_guard, cond_catch,
-                           LIST_2(proc_read, scm_in)),
-                    SCM_INTERACTION_ENV);
+        SCM_EVAL_STATE_INIT1(eval_state, SCM_INTERACTION_ENV);
+        sexp = scm_s_srfi34_guard(cond_catch,
+                                  LIST_1(LIST_2(proc_read, scm_in)),
+                                  &eval_state);
+        if (eval_state.ret_type == SCM_VALTYPE_NEED_EVAL)
+            sexp = EVAL(sexp, eval_state.env);
         if (EOFP(sexp))
             break;
 
+        SCM_EVAL_STATE_INIT1(eval_state, SCM_INTERACTION_ENV);
+        sexp = scm_s_srfi34_guard(cond_catch,
+                                  LIST_1(LIST_3(proc_eval,
+                                                sexp,
+                                                SCM_INTERACTION_ENV)),
+                                  &eval_state);
+        if (eval_state.ret_type == SCM_VALTYPE_NEED_EVAL)
+            sexp = EVAL(sexp, eval_state.env);
+
         /* parse error */
         if (EQ(sexp, err)) {
             cport = SCM_CHARPORT_DYNAMIC_CAST(ScmBaseCharPort,



More information about the uim-commit mailing list