Class: FFI::Pointer

Inherits:
Object
  • Object
show all
Defined in:
lib/jack.rb

Instance Method Summary collapse

Instance Method Details

#read_array_of_pointer_until_endObject



37
38
39
# File 'lib/jack.rb', line 37

def read_array_of_pointer_until_end
  read_array_of_type_until_end :pointer, :read_pointer
end

#read_array_of_string_until_endObject



41
42
43
# File 'lib/jack.rb', line 41

def read_array_of_string_until_end
  read_array_of_pointer_until_end.collect { |p| p.read_string }
end

#read_array_of_type_until_end(type, reader) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/jack.rb', line 24

def read_array_of_type_until_end(type, reader)
  ary = []
  size = FFI.type_size(type)
  tmp = self
  loop do
    last = tmp.send(reader)
    break if last.null?
    ary << last
    tmp += size 
  end
  ary
end