fixed dump opcode struct
This commit is contained in:
+20
-43
@@ -19,92 +19,69 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
void
|
||||
opfunc_loop_inf (union __opcodes opdata)
|
||||
opfunc_loop_inf (OPCODE opdata)
|
||||
{
|
||||
printf ("loop_inf:idx:%d\n",
|
||||
opdata.op_loop_inf.opcode_idx);
|
||||
opdata.data.loop_inf.opcode_idx);
|
||||
}
|
||||
|
||||
void
|
||||
opfunc_op_call_1 (union __opcodes opdata)
|
||||
opfunc_op_call_1 (OPCODE opdata)
|
||||
{
|
||||
printf ("op_call_1:idx:%d:%d\n",
|
||||
opdata.op_call_1.name_literal_idx,
|
||||
opdata.op_call_1.arg_literal_idx);
|
||||
opdata.data.call_1.name_literal_idx,
|
||||
opdata.data.call_1.arg_literal_idx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
opfunc_op_jmp (union __opcodes opdata)
|
||||
opfunc_op_jmp (OPCODE opdata)
|
||||
{
|
||||
printf ("op_jmp:idx:%d\n",
|
||||
opdata.op_jmp.opcode_idx);
|
||||
opdata.data.jmp.opcode_idx);
|
||||
}
|
||||
|
||||
void proxy_loop_inf (union __opcodes opdata)
|
||||
{
|
||||
opdata.op_loop_inf.opfunc_ptr (opdata);
|
||||
}
|
||||
|
||||
|
||||
void proxy_op_call_1 (union __opcodes opdata)
|
||||
{
|
||||
opdata.op_call_1.opfunc_ptr (opdata);
|
||||
}
|
||||
|
||||
void proxy_op_jmp (union __opcodes opdata)
|
||||
{
|
||||
opdata.op_jmp.opfunc_ptr (opdata);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
save_op_jmp (FILE *file, union __opcodes opdata, int arg1)
|
||||
save_op_jmp (FILE *file, OPCODE opdata, int arg1)
|
||||
{
|
||||
if (file == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
opdata.opfunc_ptr = proxy_op_jmp;
|
||||
|
||||
opdata.op_jmp.opfunc_ptr = opfunc_op_jmp;
|
||||
opdata.op_jmp.opcode_idx = arg1;
|
||||
opdata.opfunc_ptr = opfunc_op_jmp;
|
||||
opdata.data.jmp.opcode_idx = arg1;
|
||||
|
||||
fwrite (&opdata, sizeof (union __opcodes), 1, file);
|
||||
fwrite (&opdata, sizeof (OPCODE), 1, file);
|
||||
}
|
||||
|
||||
void
|
||||
save_op_call_1 (FILE *file, union __opcodes opdata, int arg1, int arg2)
|
||||
save_op_call_1 (FILE *file, OPCODE opdata, int arg1, int arg2)
|
||||
{
|
||||
if (file == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
opdata.opfunc_ptr = proxy_op_call_1;
|
||||
|
||||
opdata.op_call_1.opfunc_ptr = opfunc_op_call_1;
|
||||
opdata.op_call_1.name_literal_idx = arg1;
|
||||
opdata.op_call_1.arg_literal_idx = arg2;
|
||||
opdata.opfunc_ptr = opfunc_op_call_1;
|
||||
opdata.data.call_1.name_literal_idx = arg1;
|
||||
opdata.data.call_1.arg_literal_idx = arg2;
|
||||
|
||||
fwrite (&opdata, sizeof (union __opcodes), 1, file);
|
||||
fwrite (&opdata, sizeof (OPCODE), 1, file);
|
||||
}
|
||||
|
||||
void
|
||||
save_op_loop_inf (FILE *file, union __opcodes opdata, int arg1)
|
||||
save_op_loop_inf (FILE *file, OPCODE opdata, int arg1)
|
||||
{
|
||||
if (file == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
opdata.opfunc_ptr = proxy_loop_inf;
|
||||
opdata.opfunc_ptr = opfunc_loop_inf;
|
||||
opdata.data.loop_inf.opcode_idx = arg1;
|
||||
|
||||
opdata.op_loop_inf.opfunc_ptr = opfunc_loop_inf;
|
||||
opdata.op_loop_inf.opcode_idx = arg1;
|
||||
|
||||
fwrite (&opdata, sizeof (union __opcodes), 1, file);
|
||||
fwrite (&opdata, sizeof (OPCODE), 1, file);
|
||||
}
|
||||
Reference in New Issue
Block a user