/** * Tests if this <tt>Pointer</tt> represents the C <tt>NULL</tt> value. * * @return true if the address is NULL. */ @JRubyMethod(name = "null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemoryIO().isNull()); }
/** * Tests if this <tt>Pointer</tt> represents the C <tt>NULL</tt> value. * * @return true if the address is NULL. */ @JRubyMethod(name = "null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemoryIO().isNull()); }
/** * Tests if this <tt>Pointer</tt> represents the C <tt>NULL</tt> value. * * @return true if the address is NULL. */ @JRubyMethod(name = "null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemoryIO().isNull()); }
/** * Tests if this <tt>Pointer</tt> represents the C <tt>NULL</tt> value. * * @return true if the address is NULL. */ @JRubyMethod(name = "null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemoryIO().isNull()); }
@JRubyMethod(name="null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemory().getMemoryIO().isNull()); }
@JRubyMethod(name="null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemory().getMemoryIO().isNull()); }
@JRubyMethod(name="null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemory().getMemoryIO().isNull()); }
@JRubyMethod(name="null?") public IRubyObject null_p(ThreadContext context) { return context.runtime.newBoolean(getMemory().getMemoryIO().isNull()); }
public IRubyObject get(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr) { MemoryIO io = ptr.getMemoryIO().getMemoryIO(m.getOffset(ptr)); if (io == null || io.isNull()) { return context.nil; } return RubyString.newStringNoCopy(context.runtime, io.getZeroTerminatedByteArray(0)); }
public IRubyObject get(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr) { MemoryIO io = ptr.getMemoryIO().getMemoryIO(m.getOffset(ptr)); if (io == null || io.isNull()) { return context.nil; } return RubyString.newStringNoCopy(context.runtime, io.getZeroTerminatedByteArray(0)); }
public IRubyObject get(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr) { MemoryIO io = ptr.getMemoryIO().getMemoryIO(m.getOffset(ptr)); if (io == null || io.isNull()) { return context.runtime.getNil(); } return RubyString.newStringNoCopy(context.runtime, io.getZeroTerminatedByteArray(0)); }
public IRubyObject get(ThreadContext context, StructLayout.Storage cache, Member m, AbstractMemory ptr) { MemoryIO io = ptr.getMemoryIO().getMemoryIO(m.getOffset(ptr)); if (io == null || io.isNull()) { return context.runtime.getNil(); } return RubyString.newStringNoCopy(context.runtime, io.getZeroTerminatedByteArray(0)); }
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"); } }
@JRubyMethod(name = { "get_array_of_string" }, required = 1) public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset) { final int POINTER_SIZE = (Platform.getPlatform().addressSize() / 8); final Ruby runtime = context.runtime; final RubyArray arr = RubyArray.newArray(runtime); for (long off = getOffset(rbOffset); off <= size - POINTER_SIZE; off += POINTER_SIZE) { final MemoryIO mem = getMemoryIO().getMemoryIO(off); if (mem == null || mem.isNull()) { break; } arr.add(MemoryUtil.getTaintedString(runtime, mem, 0)); } return arr; }
@JRubyMethod(name = { "get_array_of_string" }, required = 1) public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset) { final int POINTER_SIZE = (Platform.getPlatform().addressSize() / 8); final Ruby runtime = context.runtime; final RubyArray arr = RubyArray.newArray(runtime); for (long off = getOffset(rbOffset); off <= size - POINTER_SIZE; off += POINTER_SIZE) { final MemoryIO mem = getMemoryIO().getMemoryIO(off); if (mem == null || mem.isNull()) { break; } arr.add(MemoryUtil.getTaintedString(runtime, mem, 0)); } return arr; }
@JRubyMethod(name = { "get_array_of_string" }, required = 1) public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset) { final int POINTER_SIZE = (Platform.getPlatform().addressSize() / 8); final Ruby runtime = context.runtime; final RubyArray arr = RubyArray.newArray(runtime); for (long off = getOffset(rbOffset); off <= size - POINTER_SIZE; off += POINTER_SIZE) { final MemoryIO mem = getMemoryIO().getMemoryIO(off); if (mem == null || mem.isNull()) { break; } arr.add(MemoryUtil.getTaintedString(runtime, mem, 0)); } return arr; }
@JRubyMethod(name = { "get_array_of_string" }, required = 2) public IRubyObject get_array_of_string(ThreadContext context, IRubyObject rbOffset, IRubyObject rbCount) { final int POINTER_SIZE = (Platform.getPlatform().addressSize() / 8); final long off = getOffset(rbOffset); final int count = Util.int32Value(rbCount); final Ruby runtime = context.runtime; final RubyArray arr = RubyArray.newArray(runtime, count); for (int i = 0; i < count; ++i) { final MemoryIO mem = getMemoryIO().getMemoryIO(off + (i * POINTER_SIZE)); arr.add(mem != null && !mem.isNull() ? MemoryUtil.getTaintedString(runtime, mem, 0) : runtime.getNil()); } return arr; }