add opcodes

This commit is contained in:
e.gavrin 2014-07-03 18:37:57 +04:00
parent b05eb83966
commit 7f878fd8a7
2 changed files with 70 additions and 13 deletions

View File

@ -30,7 +30,7 @@ opfunc_op_call_1 (OPCODE opdata)
{
printf ("op_call_1:idx:%d:%d\n",
opdata.data.call_1.name_literal_idx,
opdata.data.call_1.arg_literal_idx);
opdata.data.call_1.arg1_literal_idx);
}
void
@ -67,7 +67,7 @@ save_op_call_1 (FILE *file, OPCODE opdata, int arg1, int arg2)
opdata.opfunc_ptr = opfunc_op_call_1;
opdata.data.call_1.name_literal_idx = arg1;
opdata.data.call_1.arg_literal_idx = arg2;
opdata.data.call_1.arg1_literal_idx = arg2;
fwrite (&opdata, sizeof (OPCODE), 1, file);
}

View File

@ -26,23 +26,80 @@ OPCODE;
typedef void (*opfunc)(OPCODE);
OP_DEF (loop_inf)
{
int opcode_idx;
};
/** Call with 1 argument */
OP_DEF (call_1)
{
int name_literal_idx;
int arg_literal_idx;
};
OP_DEF (nop) { };
OP_DEF (jmp)
{
int opcode_idx;
};
OP_DEF (decl) { };
OP_DEF (named_func_decl) { };
OP_DEF (anon_func_decl) { };
OP_DEF (decl_var_global) { };
OP_DEF (decl_var_local) { };
/** Call with 1 argument */
OP_DEF (call_1)
{
int name_literal_idx;
int arg1_literal_idx;
};
OP_DEF (call_2)
{
int name_literal_idx;
int arg1_literal_idx;
int arg2_literal_idx;
};
OP_DEF (call_3)
{
int name_literal_idx;
int arg1_literal_idx;
int arg2_literal_idx;
int arg3_literal_idx;
};
OP_DEF (call_n) { };
OP_DEF (list_header) { };
OP_DEF (list_element) { };
OP_DEF (list_tail) { };
OP_DEF (try_begin) { };
OP_DEF (try_end) { };
OP_DEF (catch_begin) { };
OP_DEF (catch_end) { };
OP_DEF (finally_begin) { };
OP_DEF (finally_end) { };
OP_DEF (with_begin) { };
OP_DEF (with_end) { };
OP_DEF (loop_inf)
{
int opcode_idx;
};
OP_DEF (loop_cond_pre) { };
OP_DEF (loop_cond_post) { };
OP_DEF (swtch) { };
OPCODE{
opfunc opfunc_ptr;