mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
oops, broke module loading with that last patch :)
This commit is contained in:
parent
d978e750aa
commit
b0bcf1a0e6
2 changed files with 10 additions and 5 deletions
3
eval.c
3
eval.c
|
@ -2469,8 +2469,9 @@ sexp sexp_load_standard_env (sexp ctx, sexp e, sexp version) {
|
|||
if (! sexp_envp(tmp=sexp_global(ctx, SEXP_G_CONFIG_ENV))) {
|
||||
tmp = sexp_make_env(ctx);
|
||||
if (! sexp_exceptionp(tmp)) {
|
||||
sexp_env_copy(ctx, tmp, e, SEXP_FALSE);
|
||||
sexp_global(ctx, SEXP_G_CONFIG_ENV) = tmp;
|
||||
sexp_env_copy(ctx, tmp, e, SEXP_FALSE);
|
||||
sexp_load_module_file(ctx, sexp_config_file, tmp);
|
||||
sexp_env_define(ctx, tmp, sym, tmp);
|
||||
}
|
||||
}
|
||||
|
|
12
main.c
12
main.c
|
@ -49,7 +49,9 @@ static sexp check_exception (sexp ctx, sexp res) {
|
|||
sexp err;
|
||||
if (res && sexp_exceptionp(res)) {
|
||||
err = sexp_current_error_port(ctx);
|
||||
if (sexp_oportp(err)) sexp_print_exception(ctx, res, err);
|
||||
if (! sexp_oportp(err))
|
||||
err = sexp_make_output_port(ctx, stderr, SEXP_FALSE);
|
||||
sexp_print_exception(ctx, res, err);
|
||||
exit_failure();
|
||||
}
|
||||
return res;
|
||||
|
@ -63,7 +65,7 @@ void run_main (int argc, char **argv) {
|
|||
ctx = sexp_make_eval_context(NULL, NULL, NULL);
|
||||
sexp_gc_preserve2(ctx, str, args);
|
||||
env = sexp_context_env(ctx);
|
||||
out = sexp_eval_string(ctx, "(current-output-port)", env);
|
||||
out = SEXP_FALSE;
|
||||
args = SEXP_NULL;
|
||||
|
||||
/* parse options */
|
||||
|
@ -73,9 +75,11 @@ void run_main (int argc, char **argv) {
|
|||
case 'p':
|
||||
if (! init_loaded++)
|
||||
check_exception(ctx, sexp_load_standard_env(ctx, env, SEXP_FIVE));
|
||||
check_exception(ctx, sexp_read_from_string(ctx, argv[i+1]));
|
||||
check_exception(ctx, sexp_eval(ctx, res, env));
|
||||
res = check_exception(ctx, sexp_read_from_string(ctx, argv[i+1]));
|
||||
res = check_exception(ctx, sexp_eval(ctx, res, env));
|
||||
if (argv[i][1] == 'p') {
|
||||
if (! sexp_oportp(out))
|
||||
out = sexp_eval_string(ctx, "(current-output-port)", env);
|
||||
sexp_write(ctx, res, out);
|
||||
sexp_write_char(ctx, '\n', out);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue