rbdasm/dasm.c
// 
// Creates and initializes an instance of the Instruction class based on the
// supplied INSTRUCTION instance passed from libdasm.
//
Creates and initializes an instance of the Instruction class based on the
supplied INSTRUCTION instance passed from libdasm.
Creates and initializes an instance of the Instruction class based on the supplied INSTRUCTION instance passed from libdasm .
static VALUE instruction_new(VALUE klass, VALUE dasm, INSTRUCTION *raw_inst, BYTE *raw)
{
	PINSTRUCTION_OBJECT inst;
	VALUE               obj = instruction_alloc(klass);
	rb_instruction_cast(obj, inst);
	inst->dasm = dasm;
	memcpy(&inst->inst, raw_inst, sizeof(INSTRUCTION));
	memcpy(inst->raw, raw, min(raw_inst->length, sizeof(inst->raw)));
	inst->op1 = (raw_inst->op1.type == OPERAND_TYPE_NONE) ? Qnil : operand_new(oper_klass, &inst->inst.op1);
	inst->op2 = (raw_inst->op2.type == OPERAND_TYPE_NONE) ? Qnil : operand_new(oper_klass, &inst->inst.op2);
	inst->op3 = (raw_inst->op3.type == OPERAND_TYPE_NONE) ? Qnil : operand_new(oper_klass, &inst->inst.op3);
	return obj;
}
static VALUE instruction_new ( VALUE klass , VALUE dasm , INSTRUCTION * raw_inst , BYTE * raw ) { PINSTRUCTION_OBJECT inst ; VALUE obj = instruction_alloc ( klass ) ; rb_instruction_cast ( obj , inst ) ; inst -> dasm = dasm ; memcpy ( & inst -> inst , raw_inst , sizeof ( INSTRUCTION ) ) ; memcpy ( inst -> raw , raw , min ( raw_inst -> length , sizeof ( inst -> raw ) ) ) ; inst -> op1 = ( raw_inst -> op1 . type == OPERAND_TYPE_NONE ) ? Qnil : operand_new ( oper_klass , & inst -> inst . op1 ) ; inst -> op2 = ( raw_inst -> op2 . type == OPERAND_TYPE_NONE ) ? Qnil : operand_new ( oper_klass , & inst -> inst . op2 ) ; inst -> op3 = ( raw_inst -> op3 . type == OPERAND_TYPE_NONE ) ? Qnil : operand_new ( oper_klass , & inst -> inst . op3 ) ; return obj ; }
Creates and initializes an instance of the Instruction class based on the
supplied INSTRUCTION instance passed from libdasm.
Creates and initializes an instance of the Instruction class based on the supplied INSTRUCTION instance passed from libdasm .