From 9172dc9f311870b1408068457809014d76220c1d Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Fri, 31 Jan 2014 03:03:36 +0900 Subject: [PATCH] remove old pic_symbol_p macro --- include/picrin/value.h | 3 --- src/codegen.c | 10 +++++----- src/macro.c | 26 +++++++++++++------------- src/symbol.c | 4 ++-- src/vm.c | 2 +- 5 files changed, 21 insertions(+), 24 deletions(-) diff --git a/include/picrin/value.h b/include/picrin/value.h index 6963f21f..ffec8ac9 100644 --- a/include/picrin/value.h +++ b/include/picrin/value.h @@ -172,9 +172,6 @@ static inline pic_value pic_none_value(); #define pic_str_p(v) (pic_type(v) == PIC_TT_STRING) #define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR) -/* obsoleted macro(s) */ -#define pic_symbol_p pic_sym_p - static inline bool pic_eq_p(pic_value, pic_value); static inline bool pic_eqv_p(pic_value, pic_value); diff --git a/src/codegen.c b/src/codegen.c index 74d5f8d8..ec1596d3 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -47,7 +47,7 @@ analyze_args(pic_state *pic, pic_value args, bool *varg, int *argc, int *localc) pic_value sym; sym = pic_car(pic, v); - if (! pic_symbol_p(sym)) { + if (! pic_sym_p(sym)) { pic_free(pic, syms); return NULL; } @@ -58,7 +58,7 @@ analyze_args(pic_state *pic, pic_value args, bool *varg, int *argc, int *localc) if (pic_nil_p(v)) { /* pass */ } - else if (pic_symbol_p(v)) { + else if (pic_sym_p(v)) { *varg = true; syms = (pic_sym *)pic_realloc(pic, syms, sizeof(pic_sym) * (i + 1)); syms[i] = pic_sym(v); @@ -304,7 +304,7 @@ analyze_node(analyze_state *state, pic_value obj, bool tailpos) } proc = pic_list_ref(pic, obj, 0); - if (pic_symbol_p(proc)) { + if (pic_sym_p(proc)) { pic_sym sym = pic_sym(proc); if (sym == pic->sDEFINE) { @@ -327,7 +327,7 @@ analyze_node(analyze_state *state, pic_value obj, bool tailpos) } val = pic_list_ref(pic, obj, 2); } - if (! pic_symbol_p(var)) { + if (! pic_sym_p(var)) { pic_error(pic, "syntax error"); } @@ -391,7 +391,7 @@ analyze_node(analyze_state *state, pic_value obj, bool tailpos) } var = pic_list_ref(pic, obj, 1); - if (! pic_symbol_p(var)) { + if (! pic_sym_p(var)) { pic_error(pic, "syntax error"); } diff --git a/src/macro.c b/src/macro.c index af011343..1fcd71e8 100644 --- a/src/macro.c +++ b/src/macro.c @@ -91,19 +91,19 @@ new_local_senv(pic_state *pic, pic_value formals, struct pic_senv *up) for (a = formals; pic_pair_p(a); a = pic_cdr(pic, a)) { pic_value v = pic_car(pic, a); - if (! pic_symbol_p(v)) { + if (! pic_sym_p(v)) { v = macroexpand(pic, v, up); } - if (! pic_symbol_p(v)) { + if (! pic_sym_p(v)) { pic_error(pic, "syntax error"); } sym = pic_sym(v); xh_put(senv->tbl, pic_symbol_name(pic, sym), (int)pic_gensym(pic, sym)); } - if (! pic_symbol_p(a)) { + if (! pic_sym_p(a)) { a = macroexpand(pic, a, up); } - if (pic_symbol_p(a)) { + if (pic_sym_p(a)) { sym = pic_sym(a); xh_put(senv->tbl, pic_symbol_name(pic, sym), (int)pic_gensym(pic, sym)); } @@ -153,7 +153,7 @@ sc_new(pic_state *pic, pic_value expr, struct pic_senv *senv) static bool pic_identifier_p(pic_value obj) { - if (pic_symbol_p(obj)) { + if (pic_sym_p(obj)) { return true; } if (pic_sc_p(obj)) { @@ -340,7 +340,7 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv) case PIC_STX_EXPORT: { for (v = pic_cdr(pic, expr); ! pic_nil_p(v); v = pic_cdr(pic, v)) { pic_value spec = pic_car(pic, v); - if (! pic_symbol_p(spec)) { + if (! pic_sym_p(spec)) { pic_error(pic, "syntax error"); } /* TODO: warn if symbol is shadowed by local variable */ @@ -357,7 +357,7 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv) } var = strip(pic, pic_cadr(pic, expr)); - if (! pic_symbol_p(var)) { + if (! pic_sym_p(var)) { pic_error(pic, "syntax error"); } @@ -400,7 +400,7 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv) } val = pic_car(pic, pic_cdr(pic, pic_cdr(pic, expr))); } - if (! pic_symbol_p(var)) { + if (! pic_sym_p(var)) { pic_error(pic, "syntax error"); } @@ -474,10 +474,10 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv) /* defined symbol */ a = pic_car(pic, var); - if (! pic_symbol_p(a)) { + if (! pic_sym_p(a)) { a = macroexpand(pic, a, senv); } - if (! pic_symbol_p(a)) { + if (! pic_sym_p(a)) { pic_error(pic, "binding to non-symbol object"); } sym = pic_sym(a); @@ -494,10 +494,10 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv) return v; } - if (! pic_symbol_p(var)) { + if (! pic_sym_p(var)) { var = macroexpand(pic, var, senv); } - if (! pic_symbol_p(var)) { + if (! pic_sym_p(var)) { pic_error(pic, "binding to non-symbol object"); } uniq = pic_gensym(pic, pic_sym(var)); @@ -672,7 +672,7 @@ er_macro_compare(pic_state *pic) pic_get_args(pic, "oo", &a, &b); - if (! pic_symbol_p(a) || ! pic_symbol_p(b)) + if (! pic_sym_p(a) || ! pic_sym_p(b)) return pic_false_value(); /* should be an error? */ use_env = pic_senv_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0)); diff --git a/src/symbol.c b/src/symbol.c index a7a76160..de3847bc 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -78,7 +78,7 @@ pic_symbol_symbol_p(pic_state *pic) pic_get_args(pic, "o", &v); - return pic_bool_value(pic_symbol_p(v)); + return pic_bool_value(pic_sym_p(v)); } static pic_value @@ -88,7 +88,7 @@ pic_symbol_symbol_to_string(pic_state *pic) pic_get_args(pic, "o", &v); - if (! pic_symbol_p(v)) { + if (! pic_sym_p(v)) { pic_error(pic, "symbol->string: expected symbol"); } diff --git a/src/vm.c b/src/vm.c index b1160196..966586dc 100644 --- a/src/vm.c +++ b/src/vm.c @@ -193,7 +193,7 @@ pic_get_args(pic_state *pic, const char *format, ...) m = va_arg(ap, pic_sym *); if (i < argc) { v = GET_OPERAND(pic,i); - if (pic_symbol_p(v)) { + if (pic_sym_p(v)) { *m = pic_sym(v); } else {