summaryrefslogtreecommitdiff
path: root/libguile/strports.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2011-03-08 09:29:24 +0100
committerAndy Wingo <wingo@pobox.com>2011-03-08 20:53:17 +0100
commit0b0e066a26b437f7320abd126ec05a7a7c056dd9 (patch)
treedcf3f6c2da0f93c581e2e28212b369f00aabc066 /libguile/strports.c
parentef8e9356de2494d378948614945ec9aa4498d91c (diff)
downloadguile-0b0e066a26b437f7320abd126ec05a7a7c056dd9.tar.gz
core eval-string uses (ice-9 eval-string)
* libguile/strports.c (scm_eval_string_in_module): Use eval-string from (ice-9 eval-string).
Diffstat (limited to 'libguile/strports.c')
-rw-r--r--libguile/strports.c33
1 files changed, 10 insertions, 23 deletions
diff --git a/libguile/strports.c b/libguile/strports.c
index 957c6a157..594d03011 100644
--- a/libguile/strports.c
+++ b/libguile/strports.c
@@ -507,25 +507,6 @@ scm_c_eval_string_in_module (const char *expr, SCM module)
}
-static SCM
-inner_eval_string (void *data)
-{
- SCM port = (SCM)data;
- SCM form;
- SCM ans = SCM_UNSPECIFIED;
-
- /* Read expressions from that port; ignore the values. */
- while (!SCM_EOF_OBJECT_P (form = scm_read (port)))
- 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.
- It's a string port anyway, so there's no advantage to closing it
- early. */
-
- return ans;
-}
-
SCM_DEFINE (scm_eval_string_in_module, "eval-string", 1, 1, 0,
(SCM string, SCM module),
"Evaluate @var{string} as the text representation of a Scheme\n"
@@ -537,14 +518,20 @@ SCM_DEFINE (scm_eval_string_in_module, "eval-string", 1, 1, 0,
"procedure returns.")
#define FUNC_NAME s_scm_eval_string_in_module
{
- SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
- FUNC_NAME);
+ static SCM eval_string = SCM_BOOL_F, k_module = SCM_BOOL_F;
+
+ if (scm_is_false (eval_string))
+ {
+ eval_string = scm_c_public_lookup ("ice-9 eval-string", "eval-string");
+ k_module = scm_from_locale_keyword ("module");
+ }
+
if (SCM_UNBNDP (module))
module = scm_current_module ();
else
SCM_VALIDATE_MODULE (2, module);
- return scm_c_call_with_current_module (module,
- inner_eval_string, (void *)port);
+
+ return scm_call_3 (scm_variable_ref (eval_string), string, k_module, module);
}
#undef FUNC_NAME