mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-05 17:20:18 +02:00
* strports.c (scm_eval_string): Evaluate in
scm_interaction_environment (). * strports.c: #include "modules.h".
This commit is contained in:
parent
b3138544ef
commit
07bcf91d63
1 changed files with 5 additions and 2 deletions
|
@ -58,6 +58,7 @@
|
||||||
#include "libguile/root.h"
|
#include "libguile/root.h"
|
||||||
#include "libguile/strings.h"
|
#include "libguile/strings.h"
|
||||||
#include "libguile/vectors.h"
|
#include "libguile/vectors.h"
|
||||||
|
#include "libguile/modules.h"
|
||||||
|
|
||||||
#include "libguile/strports.h"
|
#include "libguile/strports.h"
|
||||||
|
|
||||||
|
@ -387,17 +388,19 @@ scm_eval_0str (const char *expr)
|
||||||
SCM_DEFINE (scm_eval_string, "eval-string", 1, 0, 0,
|
SCM_DEFINE (scm_eval_string, "eval-string", 1, 0, 0,
|
||||||
(SCM string),
|
(SCM string),
|
||||||
"Evaluate @var{string} as the text representation of a Scheme form\n"
|
"Evaluate @var{string} as the text representation of a Scheme form\n"
|
||||||
"or forms, and return whatever value they produce.")
|
"or forms, and return whatever value they produce."
|
||||||
|
"Evaluation takes place in (interaction-environment).")
|
||||||
#define FUNC_NAME s_scm_eval_string
|
#define FUNC_NAME s_scm_eval_string
|
||||||
{
|
{
|
||||||
SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
|
SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
|
||||||
"scm_eval_0str");
|
"scm_eval_0str");
|
||||||
SCM form;
|
SCM form;
|
||||||
SCM ans = SCM_UNSPECIFIED;
|
SCM ans = SCM_UNSPECIFIED;
|
||||||
|
SCM module = scm_interaction_environment ();
|
||||||
|
|
||||||
/* Read expressions from that port; ignore the values. */
|
/* Read expressions from that port; ignore the values. */
|
||||||
while (!SCM_EOF_OBJECT_P (form = scm_read (port)))
|
while (!SCM_EOF_OBJECT_P (form = scm_read (port)))
|
||||||
ans = scm_eval_x (form);
|
ans = scm_eval_x (form, module);
|
||||||
|
|
||||||
/* Don't close the port here; if we re-enter this function via a
|
/* 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.
|
continuation, then the next time we enter it, we'll get an error.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue