guile-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

guile/guile-core/libguile strports.c


From: Marius Vollmer
Subject: guile/guile-core/libguile strports.c
Date: Sat, 02 Jun 2001 11:34:48 -0700

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/06/02 11:34:48

Modified files:
        guile-core/libguile: strports.c 

Log message:
        (scm_eval_string): Use scm_primitive_eval_x instead
        of scm_eval_x to allow module changes between the forms in the
        string.  Set/restore module using scm_c_call_with_current_module.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/guile/guile-core/libguile/strports.c.diff?cvsroot=OldCVS&tr1=1.77&tr2=1.78&r1=text&r2=text

Patches:
Index: guile/guile-core/libguile/strports.c
diff -u guile/guile-core/libguile/strports.c:1.77 
guile/guile-core/libguile/strports.c:1.78
--- guile/guile-core/libguile/strports.c:1.77   Sun May 27 15:00:03 2001
+++ guile/guile-core/libguile/strports.c        Sat Jun  2 11:34:48 2001
@@ -447,24 +447,16 @@
   return scm_eval_string (scm_makfrom0str (expr));
 }
 
-
-SCM_DEFINE (scm_eval_string, "eval-string", 1, 0, 0, 
-            (SCM string),
-           "Evaluate @var{string} as the text representation of a Scheme\n"
-           "form or forms, and return whatever value they produce.\n"
-           "Evaluation takes place in the environment returned by the\n"
-           "procedure @code{interaction-environment}.")
-#define FUNC_NAME s_scm_eval_string
+static SCM
+inner_eval_string (void *data)
 {
-  SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
-                           "scm_eval_0str");
+  SCM port = (SCM)data;
   SCM form;
   SCM ans = SCM_UNSPECIFIED;
-  SCM module = scm_interaction_environment ();
 
   /* Read expressions from that port; ignore the values.  */
   while (!SCM_EOF_OBJECT_P (form = scm_read (port)))
-    ans = scm_eval_x (form, module);
+    ans = scm_primitive_eval_x (form);
 
   /* Don't close the port here; if we re-enter this function via a
      continuation, then the next time we enter it, we'll get an error.
@@ -472,6 +464,20 @@
      early.  */
 
   return ans;
+}
+
+SCM_DEFINE (scm_eval_string, "eval-string", 1, 0, 0, 
+            (SCM string),
+           "Evaluate @var{string} as the text representation of a Scheme\n"
+           "form or forms, and return whatever value they produce.\n"
+           "Evaluation takes place in the environment returned by the\n"
+           "procedure @code{interaction-environment}.")
+#define FUNC_NAME s_scm_eval_string
+{
+  SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
+                           "scm_eval_0str");
+  return scm_c_call_with_current_module (scm_interaction_environment (),
+                                        inner_eval_string, (void *)port);
 }
 #undef FUNC_NAME
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]