remove old pic_symbol_p macro
This commit is contained in:
parent
52fc58b55e
commit
9172dc9f31
|
@ -172,9 +172,6 @@ static inline pic_value pic_none_value();
|
||||||
#define pic_str_p(v) (pic_type(v) == PIC_TT_STRING)
|
#define pic_str_p(v) (pic_type(v) == PIC_TT_STRING)
|
||||||
#define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR)
|
#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_eq_p(pic_value, pic_value);
|
||||||
static inline bool pic_eqv_p(pic_value, pic_value);
|
static inline bool pic_eqv_p(pic_value, pic_value);
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ analyze_args(pic_state *pic, pic_value args, bool *varg, int *argc, int *localc)
|
||||||
pic_value sym;
|
pic_value sym;
|
||||||
|
|
||||||
sym = pic_car(pic, v);
|
sym = pic_car(pic, v);
|
||||||
if (! pic_symbol_p(sym)) {
|
if (! pic_sym_p(sym)) {
|
||||||
pic_free(pic, syms);
|
pic_free(pic, syms);
|
||||||
return NULL;
|
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)) {
|
if (pic_nil_p(v)) {
|
||||||
/* pass */
|
/* pass */
|
||||||
}
|
}
|
||||||
else if (pic_symbol_p(v)) {
|
else if (pic_sym_p(v)) {
|
||||||
*varg = true;
|
*varg = true;
|
||||||
syms = (pic_sym *)pic_realloc(pic, syms, sizeof(pic_sym) * (i + 1));
|
syms = (pic_sym *)pic_realloc(pic, syms, sizeof(pic_sym) * (i + 1));
|
||||||
syms[i] = pic_sym(v);
|
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);
|
proc = pic_list_ref(pic, obj, 0);
|
||||||
if (pic_symbol_p(proc)) {
|
if (pic_sym_p(proc)) {
|
||||||
pic_sym sym = pic_sym(proc);
|
pic_sym sym = pic_sym(proc);
|
||||||
|
|
||||||
if (sym == pic->sDEFINE) {
|
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);
|
val = pic_list_ref(pic, obj, 2);
|
||||||
}
|
}
|
||||||
if (! pic_symbol_p(var)) {
|
if (! pic_sym_p(var)) {
|
||||||
pic_error(pic, "syntax error");
|
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);
|
var = pic_list_ref(pic, obj, 1);
|
||||||
if (! pic_symbol_p(var)) {
|
if (! pic_sym_p(var)) {
|
||||||
pic_error(pic, "syntax error");
|
pic_error(pic, "syntax error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
26
src/macro.c
26
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)) {
|
for (a = formals; pic_pair_p(a); a = pic_cdr(pic, a)) {
|
||||||
pic_value v = pic_car(pic, a);
|
pic_value v = pic_car(pic, a);
|
||||||
|
|
||||||
if (! pic_symbol_p(v)) {
|
if (! pic_sym_p(v)) {
|
||||||
v = macroexpand(pic, v, up);
|
v = macroexpand(pic, v, up);
|
||||||
}
|
}
|
||||||
if (! pic_symbol_p(v)) {
|
if (! pic_sym_p(v)) {
|
||||||
pic_error(pic, "syntax error");
|
pic_error(pic, "syntax error");
|
||||||
}
|
}
|
||||||
sym = pic_sym(v);
|
sym = pic_sym(v);
|
||||||
xh_put(senv->tbl, pic_symbol_name(pic, sym), (int)pic_gensym(pic, sym));
|
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);
|
a = macroexpand(pic, a, up);
|
||||||
}
|
}
|
||||||
if (pic_symbol_p(a)) {
|
if (pic_sym_p(a)) {
|
||||||
sym = pic_sym(a);
|
sym = pic_sym(a);
|
||||||
xh_put(senv->tbl, pic_symbol_name(pic, sym), (int)pic_gensym(pic, sym));
|
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
|
static bool
|
||||||
pic_identifier_p(pic_value obj)
|
pic_identifier_p(pic_value obj)
|
||||||
{
|
{
|
||||||
if (pic_symbol_p(obj)) {
|
if (pic_sym_p(obj)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pic_sc_p(obj)) {
|
if (pic_sc_p(obj)) {
|
||||||
|
@ -340,7 +340,7 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
||||||
case PIC_STX_EXPORT: {
|
case PIC_STX_EXPORT: {
|
||||||
for (v = pic_cdr(pic, expr); ! pic_nil_p(v); v = pic_cdr(pic, v)) {
|
for (v = pic_cdr(pic, expr); ! pic_nil_p(v); v = pic_cdr(pic, v)) {
|
||||||
pic_value spec = pic_car(pic, v);
|
pic_value spec = pic_car(pic, v);
|
||||||
if (! pic_symbol_p(spec)) {
|
if (! pic_sym_p(spec)) {
|
||||||
pic_error(pic, "syntax error");
|
pic_error(pic, "syntax error");
|
||||||
}
|
}
|
||||||
/* TODO: warn if symbol is shadowed by local variable */
|
/* 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));
|
var = strip(pic, pic_cadr(pic, expr));
|
||||||
if (! pic_symbol_p(var)) {
|
if (! pic_sym_p(var)) {
|
||||||
pic_error(pic, "syntax error");
|
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)));
|
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");
|
pic_error(pic, "syntax error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,10 +474,10 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
||||||
|
|
||||||
/* defined symbol */
|
/* defined symbol */
|
||||||
a = pic_car(pic, var);
|
a = pic_car(pic, var);
|
||||||
if (! pic_symbol_p(a)) {
|
if (! pic_sym_p(a)) {
|
||||||
a = macroexpand(pic, a, senv);
|
a = macroexpand(pic, a, senv);
|
||||||
}
|
}
|
||||||
if (! pic_symbol_p(a)) {
|
if (! pic_sym_p(a)) {
|
||||||
pic_error(pic, "binding to non-symbol object");
|
pic_error(pic, "binding to non-symbol object");
|
||||||
}
|
}
|
||||||
sym = pic_sym(a);
|
sym = pic_sym(a);
|
||||||
|
@ -494,10 +494,10 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! pic_symbol_p(var)) {
|
if (! pic_sym_p(var)) {
|
||||||
var = macroexpand(pic, var, senv);
|
var = macroexpand(pic, var, senv);
|
||||||
}
|
}
|
||||||
if (! pic_symbol_p(var)) {
|
if (! pic_sym_p(var)) {
|
||||||
pic_error(pic, "binding to non-symbol object");
|
pic_error(pic, "binding to non-symbol object");
|
||||||
}
|
}
|
||||||
uniq = pic_gensym(pic, pic_sym(var));
|
uniq = pic_gensym(pic, pic_sym(var));
|
||||||
|
@ -672,7 +672,7 @@ er_macro_compare(pic_state *pic)
|
||||||
|
|
||||||
pic_get_args(pic, "oo", &a, &b);
|
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? */
|
return pic_false_value(); /* should be an error? */
|
||||||
|
|
||||||
use_env = pic_senv_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0));
|
use_env = pic_senv_ptr(pic_proc_cv_ref(pic, pic_get_proc(pic), 0));
|
||||||
|
|
|
@ -78,7 +78,7 @@ pic_symbol_symbol_p(pic_state *pic)
|
||||||
|
|
||||||
pic_get_args(pic, "o", &v);
|
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
|
static pic_value
|
||||||
|
@ -88,7 +88,7 @@ pic_symbol_symbol_to_string(pic_state *pic)
|
||||||
|
|
||||||
pic_get_args(pic, "o", &v);
|
pic_get_args(pic, "o", &v);
|
||||||
|
|
||||||
if (! pic_symbol_p(v)) {
|
if (! pic_sym_p(v)) {
|
||||||
pic_error(pic, "symbol->string: expected symbol");
|
pic_error(pic, "symbol->string: expected symbol");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
src/vm.c
2
src/vm.c
|
@ -193,7 +193,7 @@ pic_get_args(pic_state *pic, const char *format, ...)
|
||||||
m = va_arg(ap, pic_sym *);
|
m = va_arg(ap, pic_sym *);
|
||||||
if (i < argc) {
|
if (i < argc) {
|
||||||
v = GET_OPERAND(pic,i);
|
v = GET_OPERAND(pic,i);
|
||||||
if (pic_symbol_p(v)) {
|
if (pic_sym_p(v)) {
|
||||||
*m = pic_sym(v);
|
*m = pic_sym(v);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue