remove declare_vm_procedure macro

This commit is contained in:
Yuichi Nishiwaki 2016-03-03 18:43:57 +09:00
parent ce6dd55ea5
commit c27ce690a6
2 changed files with 17 additions and 40 deletions

View File

@ -961,7 +961,7 @@ codegen_quote(pic_state *pic, codegen_context *cxt, pic_value obj, bool tailpos)
static void
codegen_call(pic_state *pic, codegen_context *cxt, pic_value obj, bool tailpos)
{
int len = (int)pic_length(pic, obj);
int len = pic_length(pic, obj);
pic_value elt, it, functor;
pic_for_each (elt, pic_cdr(pic, obj), it) {
@ -974,22 +974,22 @@ codegen_call(pic_state *pic, codegen_context *cxt, pic_value obj, bool tailpos)
sym = pic_list_ref(pic, functor, 1);
VM("cons", OP_CONS)
VM("car", OP_CAR)
VM("cdr", OP_CDR)
VM("null?", OP_NILP)
VM("symbol?", OP_SYMBOLP)
VM("pair?", OP_PAIRP)
VM("not", OP_NOT)
VM("=", OP_EQ)
VM("<", OP_LT)
VM("<=", OP_LE)
VM(">", OP_GT)
VM(">=", OP_GE)
VM("+", OP_ADD)
VM("-", OP_SUB)
VM("*", OP_MUL)
VM("/", OP_DIV)
VM("picrin.base/cons", OP_CONS)
VM("picrin.base/car", OP_CAR)
VM("picrin.base/cdr", OP_CDR)
VM("picrin.base/null?", OP_NILP)
VM("picrin.base/symbol?", OP_SYMBOLP)
VM("picrin.base/pair?", OP_PAIRP)
VM("picrin.base/not", OP_NOT)
VM("picrin.base/=", OP_EQ)
VM("picrin.base/<", OP_LT)
VM("picrin.base/<=", OP_LE)
VM("picrin.base/>", OP_GT)
VM("picrin.base/>=", OP_GE)
VM("picrin.base/+", OP_ADD)
VM("picrin.base/-", OP_SUB)
VM("picrin.base/*", OP_MUL)
VM("picrin.base//", OP_DIV)
}
emit_i(pic, cxt, (tailpos ? OP_TAILCALL : OP_CALL), len - 1);

View File

@ -88,12 +88,6 @@ pic_add_feature(pic_state *pic, const char *feature)
pic_put_identifier(pic, nick, real, env); \
} while (0)
#define declare_vm_procedure(name) do { \
pic_value sym; \
sym = pic_intern_lit(pic, name); \
pic_put_identifier(pic, sym, sym, env); \
} while (0)
void pic_init_bool(pic_state *);
void pic_init_pair(pic_state *);
void pic_init_port(pic_state *);
@ -139,23 +133,6 @@ pic_init_core(pic_state *pic)
import_builtin_syntax("begin");
import_builtin_syntax("define-macro");
declare_vm_procedure("cons");
declare_vm_procedure("car");
declare_vm_procedure("cdr");
declare_vm_procedure("null?");
declare_vm_procedure("symbol?");
declare_vm_procedure("pair?");
declare_vm_procedure("+");
declare_vm_procedure("-");
declare_vm_procedure("*");
declare_vm_procedure("/");
declare_vm_procedure("=");
declare_vm_procedure("<");
declare_vm_procedure(">");
declare_vm_procedure("<=");
declare_vm_procedure(">=");
declare_vm_procedure("not");
DONE;
pic_init_bool(pic); DONE;