use pic_try/catch in stdlib_load

This commit is contained in:
Yuichi Nishiwaki 2014-03-10 01:12:19 +09:00
parent d227c22379
commit 851187f7bb
1 changed files with 10 additions and 13 deletions

View File

@ -33,17 +33,8 @@ void
pic_load_stdlib(pic_state *pic)
{
static const char *filename = "piclib/built-in.scm";
jmp_buf jmp, *prev_jmp = pic->jmp;
if (setjmp(jmp) == 0) {
pic->jmp = &jmp;
}
else {
/* error! */
fputs("fatal error: failure in loading built-in.scm\n", stderr);
fputs(pic_errmsg(pic), stderr);
abort();
}
pic_try {
/* load 'built-in.scm' */
pic_load(pic, filename);
@ -52,7 +43,13 @@ pic_load_stdlib(pic_state *pic)
puts("successfully loaded stdlib");
#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) \