class RubyVM::MJIT::CPointer::Pointer
Attributes
type[R]
Public Class Methods
new(addr, type)
click to toggle source
@param addr [Integer] @param type [Class] RubyVM::MJIT::CType::*
# File mjit/c_pointer.rb, line 220 def initialize(addr, type) @addr = addr @type = type end
Public Instance Methods
*()
click to toggle source
Dereference
# File mjit/c_pointer.rb, line 232 def * return nil if dest_addr == 0 @type.new(dest_addr) end
+(index)
click to toggle source
Move addr to addess this pointer like an array
# File mjit/c_pointer.rb, line 226 def +(index) raise ArgumentError unless index.is_a?(Integer) Pointer.new(@addr + index * Fiddle::SIZEOF_VOIDP, @type) end
[](index)
click to toggle source
Array access
# File mjit/c_pointer.rb, line 238 def [](index) (self + index).* end
[]=(index, value)
click to toggle source
Array set @param index [Integer] @param value [Integer, RubyVM::MJIT::CPointer::Struct
] an address itself or an object that return an address with to_i
# File mjit/c_pointer.rb, line 245 def []=(index, value) Fiddle::Pointer.new(@addr + index * Fiddle::SIZEOF_VOIDP)[0, Fiddle::SIZEOF_VOIDP] = [value.to_i].pack(Fiddle::PackInfo::PACK_MAP[Fiddle::TYPE_VOIDP]) end