From b4218a7a03c9ed6bbed5b4afc8e6bfa16c91c957 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Wed, 27 Nov 2013 14:00:23 +0900 Subject: [PATCH] cosmetic changes --- src/macro.c | 76 ++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/macro.c b/src/macro.c index 175eeca5..b294d66c 100644 --- a/src/macro.c +++ b/src/macro.c @@ -11,20 +11,6 @@ #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 new_uniq_sym(pic_state *pic, pic_sym base) { @@ -40,6 +26,44 @@ new_uniq_sym(pic_state *pic, pic_sym base) 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 @@ -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)); } -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_macroexpand(pic_state *pic, pic_value expr) {