From 75f67b5474acf110c750ee0a9364b0e6fa5607e8 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Thu, 1 Dec 2011 21:54:56 +0900 Subject: [PATCH] Setting interaction environment to load environment when running scripts. This maintains backwards compatibility, and is convenient in many cases. If you want to run a script which really does want an interaction-environment, such as a repl or editor, you should reset the env to a fresh one. --- main.c | 5 ++++- tools/chibi-ffi | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 38019022..3f7a055d 100644 --- a/main.c +++ b/main.c @@ -411,7 +411,10 @@ void run_main (int argc, char **argv) { #if SEXP_USE_MODULES /* reset the environment to have only the `import' binding */ if (!mods_loaded) { - sexp_context_env(ctx) = env = sexp_make_env(ctx); + env = sexp_make_env(ctx); + sexp_set_parameter(ctx, sexp_context_env(ctx), + sexp_global(ctx, SEXP_G_INTERACTION_ENV_SYMBOL), env); + sexp_context_env(ctx) = env; sym = sexp_intern(ctx, "repl-import", -1); tmp = sexp_env_ref(sexp_global(ctx, SEXP_G_META_ENV), sym, SEXP_VOID); sym = sexp_intern(ctx, "import", -1); diff --git a/tools/chibi-ffi b/tools/chibi-ffi index d5feb970..7ed23d42 100755 --- a/tools/chibi-ffi +++ b/tools/chibi-ffi @@ -1344,7 +1344,7 @@ (define (generate file) (display "/* automatically generated by chibi genstubs */\n") (c-system-include "chibi/eval.h") - (load file (current-environment)) + (load file) (write-init)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;