private void putPointer(ThreadContext context, long offset, Pointer value) { MemoryIO ptr = value.getMemoryIO(); if (ptr.isDirect()) { getMemoryIO().putMemoryIO(offset, ptr); } else if (ptr.isNull()) { getMemoryIO().putAddress(offset, 0L); } else { throw context.runtime.newArgumentError("Cannot convert argument to pointer"); } }
private void putPointer(ThreadContext context, long offset, Pointer value) { MemoryIO ptr = value.getMemoryIO(); if (ptr.isDirect()) { getMemoryIO().putMemoryIO(offset, ptr); } else if (ptr.isNull()) { getMemoryIO().putAddress(offset, 0L); } else { throw context.runtime.newArgumentError("Cannot convert argument to pointer"); } }
private void putPointer(ThreadContext context, long offset, Pointer value) { MemoryIO ptr = value.getMemoryIO(); if (ptr.isDirect()) { getMemoryIO().putMemoryIO(offset, ptr); } else if (ptr.isNull()) { getMemoryIO().putAddress(offset, 0L); } else { throw context.runtime.newArgumentError("Cannot convert argument to pointer"); } }
private void putPointer(ThreadContext context, long offset, Pointer value) { MemoryIO ptr = value.getMemoryIO(); if (ptr.isDirect()) { getMemoryIO().putMemoryIO(offset, ptr); } else if (ptr.isNull()) { getMemoryIO().putAddress(offset, 0L); } else { throw context.runtime.newArgumentError("Cannot convert argument to pointer"); } }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
private void putPointer(ThreadContext context, long offset, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { putPointer(context, offset, (Pointer) value); } else if (value.isNil()) { getMemoryIO().putAddress(offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { putPointer(context, offset, conversionMethod.call(context, value, value.getMetaClass(), "to_ptr")); } else { throw context.runtime.newTypeError(value, context.runtime.getFFI().pointerClass); } }
public void put(ThreadContext context, Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { if (value.isNil()) { ptr.getMemoryIO().putAddress(m.getOffset(ptr), 0L); cache.putReference(m, value); } else { Pointer cb = Factory.getInstance().getCallbackManager().getCallback(context.runtime, (CallbackInfo) m.type, value); ptr.getMemoryIO().putMemoryIO(m.getOffset(ptr), cb.getMemoryIO()); cache.putReference(m, cb); } }
public void put(ThreadContext context, Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { if (value.isNil()) { ptr.getMemoryIO().putAddress(m.getOffset(ptr), 0L); cache.putReference(m, value); } else { Pointer cb = Factory.getInstance().getCallbackManager().getCallback(context.runtime, (CallbackInfo) m.type, value); ptr.getMemoryIO().putMemoryIO(m.getOffset(ptr), cb.getMemoryIO()); cache.putReference(m, cb); } }
public void put(ThreadContext context, Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { if (value.isNil()) { ptr.getMemoryIO().putAddress(m.getOffset(ptr), 0L); cache.putReference(m, value); } else { Pointer cb = Factory.getInstance().getCallbackManager().getCallback(context.runtime, (CallbackInfo) m.type, value); ptr.getMemoryIO().putMemoryIO(m.getOffset(ptr), cb.getMemoryIO()); cache.putReference(m, cb); } }
public void put(ThreadContext context, Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { if (value.isNil()) { ptr.getMemoryIO().putAddress(m.getOffset(ptr), 0L); cache.putReference(m, value); } else { Pointer cb = Factory.getInstance().getCallbackManager().getCallback(context.runtime, (CallbackInfo) m.type, value); ptr.getMemoryIO().putMemoryIO(m.getOffset(ptr), cb.getMemoryIO()); cache.putReference(m, cb); } }
public void put(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) value).getMemoryIO()); } else if (value instanceof Struct) { MemoryIO mem = ((Struct) value).getMemoryIO(); if (!mem.isDirect()) { throw context.runtime.newArgumentError("Struct memory not backed by a native pointer"); } ptr.getMemoryIO().putMemoryIO(m.offset, mem); } else if (value instanceof RubyInteger) { ptr.getMemoryIO().putAddress(m.offset, Util.int64Value(ptr)); } else if (value.isNil()) { ptr.getMemoryIO().putAddress(m.offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { IRubyObject addr = conversionMethod.call(context, value, value.getMetaClass(), "to_ptr"); if (addr instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) addr).getMemoryIO()); } else { throw context.runtime.newArgumentError("Invalid pointer value"); } } else { throw context.runtime.newArgumentError("Invalid pointer value"); } cache.putReference(m, value); }
public void put(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) value).getMemoryIO()); } else if (value instanceof Struct) { MemoryIO mem = ((Struct) value).getMemoryIO(); if (!mem.isDirect()) { throw context.runtime.newArgumentError("Struct memory not backed by a native pointer"); } ptr.getMemoryIO().putMemoryIO(m.offset, mem); } else if (value instanceof RubyInteger) { ptr.getMemoryIO().putAddress(m.offset, Util.int64Value(value)); } else if (value.isNil()) { ptr.getMemoryIO().putAddress(m.offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { IRubyObject addr = conversionMethod.call(context, value, value.getMetaClass(), "to_ptr"); if (addr instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) addr).getMemoryIO()); } else { throw context.runtime.newArgumentError("Invalid pointer value"); } } else { throw context.runtime.newArgumentError("Invalid pointer value"); } cache.putReference(m, value); }
public void put(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) value).getMemoryIO()); } else if (value instanceof Struct) { MemoryIO mem = ((Struct) value).getMemoryIO(); if (!mem.isDirect()) { throw context.runtime.newArgumentError("Struct memory not backed by a native pointer"); } ptr.getMemoryIO().putMemoryIO(m.offset, mem); } else if (value instanceof RubyInteger) { ptr.getMemoryIO().putAddress(m.offset, Util.int64Value(ptr)); } else if (value.isNil()) { ptr.getMemoryIO().putAddress(m.offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { IRubyObject addr = conversionMethod.call(context, value, value.getMetaClass(), "to_ptr"); if (addr instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) addr).getMemoryIO()); } else { throw context.runtime.newArgumentError("Invalid pointer value"); } } else { throw context.runtime.newArgumentError("Invalid pointer value"); } cache.putReference(m, value); }
public void put(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr, IRubyObject value) { DynamicMethod conversionMethod; if (value instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) value).getMemoryIO()); } else if (value instanceof Struct) { MemoryIO mem = ((Struct) value).getMemoryIO(); if (!mem.isDirect()) { throw context.runtime.newArgumentError("Struct memory not backed by a native pointer"); } ptr.getMemoryIO().putMemoryIO(m.offset, mem); } else if (value instanceof RubyInteger) { ptr.getMemoryIO().putAddress(m.offset, Util.int64Value(value)); } else if (value.isNil()) { ptr.getMemoryIO().putAddress(m.offset, 0L); } else if (!(conversionMethod = value.getMetaClass().searchMethod("to_ptr")).isUndefined()) { IRubyObject addr = conversionMethod.call(context, value, value.getMetaClass(), "to_ptr"); if (addr instanceof Pointer) { ptr.getMemoryIO().putMemoryIO(m.offset, ((Pointer) addr).getMemoryIO()); } else { throw context.runtime.newArgumentError("Invalid pointer value"); } } else { throw context.runtime.newArgumentError("Invalid pointer value"); } cache.putReference(m, value); }