mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
core eval-string uses (ice-9 eval-string)
* libguile/strports.c (scm_eval_string_in_module): Use eval-string from (ice-9 eval-string).
This commit is contained in:
parent
ef8e9356de
commit
0b0e066a26
1 changed files with 10 additions and 23 deletions
|
@ -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_DEFINE (scm_eval_string_in_module, "eval-string", 1, 1, 0,
|
||||||
(SCM string, SCM module),
|
(SCM string, SCM module),
|
||||||
"Evaluate @var{string} as the text representation of a Scheme\n"
|
"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.")
|
"procedure returns.")
|
||||||
#define FUNC_NAME s_scm_eval_string_in_module
|
#define FUNC_NAME s_scm_eval_string_in_module
|
||||||
{
|
{
|
||||||
SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
|
static SCM eval_string = SCM_BOOL_F, k_module = SCM_BOOL_F;
|
||||||
FUNC_NAME);
|
|
||||||
|
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))
|
if (SCM_UNBNDP (module))
|
||||||
module = scm_current_module ();
|
module = scm_current_module ();
|
||||||
else
|
else
|
||||||
SCM_VALIDATE_MODULE (2, module);
|
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
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue