use pic_try/catch in stdlib_load
This commit is contained in:
parent
d227c22379
commit
851187f7bb
19
src/init.c
19
src/init.c
|
@ -33,17 +33,8 @@ void
|
||||||
pic_load_stdlib(pic_state *pic)
|
pic_load_stdlib(pic_state *pic)
|
||||||
{
|
{
|
||||||
static const char *filename = "piclib/built-in.scm";
|
static const char *filename = "piclib/built-in.scm";
|
||||||
jmp_buf jmp, *prev_jmp = pic->jmp;
|
|
||||||
|
|
||||||
if (setjmp(jmp) == 0) {
|
pic_try {
|
||||||
pic->jmp = &jmp;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* error! */
|
|
||||||
fputs("fatal error: failure in loading built-in.scm\n", stderr);
|
|
||||||
fputs(pic_errmsg(pic), stderr);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* load 'built-in.scm' */
|
/* load 'built-in.scm' */
|
||||||
pic_load(pic, filename);
|
pic_load(pic, filename);
|
||||||
|
@ -52,7 +43,13 @@ pic_load_stdlib(pic_state *pic)
|
||||||
puts("successfully loaded stdlib");
|
puts("successfully loaded stdlib");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pic->jmp = prev_jmp;
|
}
|
||||||
|
pic_catch {
|
||||||
|
/* error! */
|
||||||
|
fputs("fatal error: failure in loading built-in.scm\n", stderr);
|
||||||
|
fputs(pic_errmsg(pic), stderr);
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PUSH_SYM(pic, lst, name) \
|
#define PUSH_SYM(pic, lst, name) \
|
||||||
|
|
Loading…
Reference in New Issue