add pic_void macro
This commit is contained in:
parent
631926aa96
commit
c57f8a5016
|
@ -127,6 +127,13 @@ void pic_gc_run(pic_state *);
|
|||
pic_value pic_gc_protect(pic_state *, pic_value);
|
||||
size_t pic_gc_arena_preserve(pic_state *);
|
||||
void pic_gc_arena_restore(pic_state *, size_t);
|
||||
#define pic_void(exec) \
|
||||
pic_void_(GENSYM(ai), exec)
|
||||
#define pic_void_(ai,exec) do { \
|
||||
size_t ai = pic_gc_arena_preserve(pic); \
|
||||
exec; \
|
||||
pic_gc_arena_restore(pic, ai); \
|
||||
} while (0)
|
||||
|
||||
pic_state *pic_open(int argc, char *argv[], char **envp);
|
||||
void pic_close(pic_state *);
|
||||
|
|
|
@ -204,17 +204,13 @@ macroexpand_deflibrary(pic_state *pic, pic_value expr)
|
|||
pic_in_library(pic, pic_cadr(pic, expr));
|
||||
|
||||
pic_for_each (v, pic_cddr(pic, expr)) {
|
||||
size_t ai = pic_gc_arena_preserve(pic);
|
||||
|
||||
pic_eval(pic, v);
|
||||
|
||||
pic_gc_arena_restore(pic, ai);
|
||||
pic_void(pic_eval(pic, v));
|
||||
}
|
||||
|
||||
pic_in_library(pic, prev->name);
|
||||
}
|
||||
pic_catch {
|
||||
pic_in_library(pic, prev->name); /* restores pic->lib even if an error occurs */
|
||||
pic_in_library(pic, prev->name); /* restores pic->lib even if an error occurs */
|
||||
pic_throw_error(pic, pic->err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue