mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
Adding cond-expand to the initial empty environment along with import for writing portable scripts.
This commit is contained in:
parent
c83dbf1cc0
commit
f61204d5e1
1 changed files with 5 additions and 1 deletions
6
main.c
6
main.c
|
@ -409,7 +409,8 @@ void run_main (int argc, char **argv) {
|
|||
sexp_set_parameter(ctx, env, sym=sexp_intern(ctx, sexp_argv_symbol, -1), args);
|
||||
if (i < argc) { /* script usage */
|
||||
#if SEXP_USE_MODULES
|
||||
/* reset the environment to have only the `import' binding */
|
||||
/* reset the environment to have only the `import' and */
|
||||
/* `cond-expand' bindings */
|
||||
if (!mods_loaded) {
|
||||
env = sexp_make_env(ctx);
|
||||
sexp_set_parameter(ctx, sexp_context_env(ctx),
|
||||
|
@ -419,6 +420,9 @@ void run_main (int argc, char **argv) {
|
|||
tmp = sexp_env_ref(sexp_global(ctx, SEXP_G_META_ENV), sym, SEXP_VOID);
|
||||
sym = sexp_intern(ctx, "import", -1);
|
||||
sexp_env_define(ctx, env, sym, tmp);
|
||||
sym = sexp_intern(ctx, "cond-expand", -1);
|
||||
tmp = sexp_env_ref(sexp_global(ctx, SEXP_G_META_ENV), sym, SEXP_VOID);
|
||||
sexp_env_define(ctx, env, sym, tmp);
|
||||
}
|
||||
#endif
|
||||
/* load the script */
|
||||
|
|
Loading…
Add table
Reference in a new issue