cosmetic changes

This commit is contained in:
Yuichi Nishiwaki 2013-11-27 14:00:23 +09:00
parent 0f127917e8
commit b4218a7a03
1 changed files with 38 additions and 38 deletions

View File

@ -11,20 +11,6 @@
#define FALLTHROUGH ((void)0) #define FALLTHROUGH ((void)0)
void
pic_defmacro(pic_state *pic, const char *name, struct pic_proc *macro)
{
int idx;
idx = pic->xlen;
if (idx >= pic->xcapa) {
pic_abort(pic, "macro table overflow");
}
pic->stx[idx] = pic_syntax_new_macro(pic, pic_intern_cstr(pic, name), macro);
xh_put(pic->var_tbl, name, ~idx);
pic->xlen++;
}
static pic_sym static pic_sym
new_uniq_sym(pic_state *pic, pic_sym base) new_uniq_sym(pic_state *pic, pic_sym base)
{ {
@ -40,6 +26,44 @@ new_uniq_sym(pic_state *pic, pic_sym base)
return uniq; return uniq;
} }
struct pic_syntax *
pic_syntax_new(pic_state *pic, int kind, pic_sym sym)
{
struct pic_syntax *stx;
stx = (struct pic_syntax *)pic_obj_alloc(pic, sizeof(struct pic_syntax), PIC_TT_SYNTAX);
stx->kind = kind;
stx->sym = sym;
stx->macro = NULL;
return stx;
}
struct pic_syntax *
pic_syntax_new_macro(pic_state *pic, pic_sym sym, struct pic_proc *macro)
{
struct pic_syntax *stx;
stx = (struct pic_syntax *)pic_obj_alloc(pic, sizeof(struct pic_syntax), PIC_TT_SYNTAX);
stx->kind = PIC_STX_MACRO;
stx->sym = sym;
stx->macro = macro;
return stx;
}
void
pic_defmacro(pic_state *pic, const char *name, struct pic_proc *macro)
{
int idx;
idx = pic->xlen;
if (idx >= pic->xcapa) {
pic_abort(pic, "macro table overflow");
}
pic->stx[idx] = pic_syntax_new_macro(pic, pic_intern_cstr(pic, name), macro);
xh_put(pic->var_tbl, name, ~idx);
pic->xlen++;
}
static pic_value macroexpand_list(pic_state *, pic_value, struct pic_senv *); static pic_value macroexpand_list(pic_state *, pic_value, struct pic_senv *);
static pic_value static pic_value
@ -262,30 +286,6 @@ macroexpand_list(pic_state *pic, pic_value list, struct pic_senv *senv)
return pic_cons(pic, v, macroexpand_list(pic, pic_cdr(pic, list), senv)); return pic_cons(pic, v, macroexpand_list(pic, pic_cdr(pic, list), senv));
} }
struct pic_syntax *
pic_syntax_new(pic_state *pic, int kind, pic_sym sym)
{
struct pic_syntax *stx;
stx = (struct pic_syntax *)pic_obj_alloc(pic, sizeof(struct pic_syntax), PIC_TT_SYNTAX);
stx->kind = kind;
stx->sym = sym;
stx->macro = NULL;
return stx;
}
struct pic_syntax *
pic_syntax_new_macro(pic_state *pic, pic_sym sym, struct pic_proc *macro)
{
struct pic_syntax *stx;
stx = (struct pic_syntax *)pic_obj_alloc(pic, sizeof(struct pic_syntax), PIC_TT_SYNTAX);
stx->kind = PIC_STX_MACRO;
stx->sym = sym;
stx->macro = macro;
return stx;
}
pic_value pic_value
pic_macroexpand(pic_state *pic, pic_value expr) pic_macroexpand(pic_state *pic, pic_value expr)
{ {