380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
# File 'ext/ffi_c/AbstractMemory.c', line 380
static VALUE
memory_put(VALUE self, VALUE type_name, VALUE offset, VALUE value)
{
AbstractMemory* ptr;
VALUE nType;
Type *type;
MemoryOp *op;
nType = rbffi_Type_Lookup(type_name);
if(NIL_P(nType)) goto undefined_type;
TypedData_Get_Struct(self, AbstractMemory, &rbffi_abstract_memory_data_type, ptr);
TypedData_Get_Struct(nType, Type, &rbffi_type_data_type, type);
op = get_memory_op(type);
if(op == NULL) goto undefined_type;
op->put(ptr, NUM2LONG(offset), value);
return Qnil;
undefined_type: {
VALUE msg = rb_sprintf("unsupported type '%" PRIsVALUE "'", type_name);
rb_exc_raise(rb_exc_new3(rb_eArgError, msg));
return Qnil;
}
}
|