add xlen/xcapa member to pic_senv

This commit is contained in:
Yuichi Nishiwaki 2013-11-26 08:36:58 -08:00
parent a32473ae92
commit f6bc51d16d
3 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@ struct pic_senv {
struct pic_senv *up;
struct xhash *tbl;
struct pic_syntax **stx;
size_t xlen, xcapa;
};
struct pic_syntax {

View File

@ -287,7 +287,7 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
if (senv->stx) {
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]);
}
}

View File

@ -292,6 +292,8 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
in->up = senv;
in->tbl = xh_new();
in->stx = NULL;
in->xlen = 0;
in->xcapa = 0;
for (a = var; pic_pair_p(a); a = pic_cdr(pic, a)) {
pic_sym gen, orig;
@ -395,6 +397,8 @@ pic_macroexpand_2(pic_state *pic, pic_value expr)
senv->up = NULL;
senv->tbl = pic->var_tbl;
senv->stx = pic->stx;
senv->xlen = pic->xlen;
senv->xcapa = pic->xcapa;
return macroexpand(pic, expr, senv);
}