refactor pic_deflib
This commit is contained in:
parent
d168e7e1c8
commit
887b6a9f91
|
@ -179,22 +179,13 @@ void pic_in_library(pic_state *, pic_value);
|
|||
struct pic_lib *pic_make_library(pic_state *, pic_value);
|
||||
struct pic_lib *pic_find_library(pic_state *, pic_value);
|
||||
|
||||
#define PIC_DEFLIBRARY_HELPER2(tmp1, tmp2, tmp3, spec) \
|
||||
for (struct pic_lib *tmp1 = pic->lib, \
|
||||
*tmp2 = (pic_make_library(pic, pic_read(pic, spec)), \
|
||||
pic_in_library(pic, pic_read(pic, spec)), \
|
||||
NULL); \
|
||||
tmp3 < 1; \
|
||||
(pic->lib = tmp1), ((void)tmp2), ++tmp3)
|
||||
|
||||
#define PIC_DEFLIBRARY_HELPER1(tmp1, tmp2, spec) \
|
||||
for (int tmp1 = 0, tmp2 = 0; tmp1 < 1; ++tmp1) \
|
||||
PIC_DEFLIBRARY_HELPER2(GENSYM(pic_deflib_tmp3__), \
|
||||
GENSYM(pic_deflib_tmp4__), \
|
||||
tmp2, spec)
|
||||
#define pic_deflibrary_helper__(i, prev_lib, spec) \
|
||||
for (int i = 0; ! i; ) \
|
||||
for (struct pic_lib *prev_lib; ! i; ) \
|
||||
for ((prev_lib = pic->lib), pic_make_library(pic, pic_read(pic, spec)), pic_in_library(pic, pic_read(pic, spec)); ! i++; pic->lib = prev_lib) \
|
||||
|
||||
#define pic_deflibrary(spec) \
|
||||
PIC_DEFLIBRARY_HELPER1(GENSYM(pic_deflib_tmp1__), GENSYM(pic_deflib_tmp2__), spec)
|
||||
pic_deflibrary_helper__(GENSYM(pic_deflib_i__), GENSYM(pic_deflib_prev_lib__), spec)
|
||||
|
||||
void pic_import(pic_state *, pic_value);
|
||||
void pic_export(pic_state *, pic_sym);
|
||||
|
|
Loading…
Reference in New Issue