add xlen/xcapa member to pic_senv
This commit is contained in:
parent
a32473ae92
commit
f6bc51d16d
|
@ -6,6 +6,7 @@ struct pic_senv {
|
||||||
struct pic_senv *up;
|
struct pic_senv *up;
|
||||||
struct xhash *tbl;
|
struct xhash *tbl;
|
||||||
struct pic_syntax **stx;
|
struct pic_syntax **stx;
|
||||||
|
size_t xlen, xcapa;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pic_syntax {
|
struct pic_syntax {
|
||||||
|
|
2
src/gc.c
2
src/gc.c
|
@ -287,7 +287,7 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
|
||||||
if (senv->stx) {
|
if (senv->stx) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 6; ++i) {
|
for (i = 0; i < senv->xlen; ++i) {
|
||||||
gc_mark_object(pic, (struct pic_object *)senv->stx[i]);
|
gc_mark_object(pic, (struct pic_object *)senv->stx[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -292,6 +292,8 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
||||||
in->up = senv;
|
in->up = senv;
|
||||||
in->tbl = xh_new();
|
in->tbl = xh_new();
|
||||||
in->stx = NULL;
|
in->stx = NULL;
|
||||||
|
in->xlen = 0;
|
||||||
|
in->xcapa = 0;
|
||||||
|
|
||||||
for (a = var; pic_pair_p(a); a = pic_cdr(pic, a)) {
|
for (a = var; pic_pair_p(a); a = pic_cdr(pic, a)) {
|
||||||
pic_sym gen, orig;
|
pic_sym gen, orig;
|
||||||
|
@ -395,6 +397,8 @@ pic_macroexpand_2(pic_state *pic, pic_value expr)
|
||||||
senv->up = NULL;
|
senv->up = NULL;
|
||||||
senv->tbl = pic->var_tbl;
|
senv->tbl = pic->var_tbl;
|
||||||
senv->stx = pic->stx;
|
senv->stx = pic->stx;
|
||||||
|
senv->xlen = pic->xlen;
|
||||||
|
senv->xcapa = pic->xcapa;
|
||||||
|
|
||||||
return macroexpand(pic, expr, senv);
|
return macroexpand(pic, expr, senv);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue