# File lib/ffi/pointer.rb, line 122 122: def read_array_of_int(length) 123: get_array_of_int32(0, length) 124: end
# File lib/ffi/pointer.rb, line 130 130: def read_array_of_long(length) 131: get_array_of_long(0, length) 132: end
# File lib/ffi/pointer.rb, line 138 138: def read_array_of_pointer(length) 139: read_array_of_type(:pointer, :read_pointer, length) 140: end
# File lib/ffi/pointer.rb, line 102 102: def read_array_of_type(type, reader, length) 103: ary = [] 104: size = FFI.type_size(type) 105: tmp = self 106: length.times { |j| 107: ary << tmp.send(reader) 108: tmp += size unless j == length-1 # avoid OOB 109: } 110: ary 111: end
# File lib/ffi/pointer.rb, line 74 74: def read_float 75: get_float32(0) 76: end
Read a C int from the memory pointed to.
# File lib/ffi/pointer.rb, line 44 44: def read_int 45: get_int32(0) 46: end
Read a C long from the memory pointed to.
# File lib/ffi/pointer.rb, line 54 54: def read_long 55: get_long(0) 56: end
Read a C long long from the memory pointed to.
# File lib/ffi/pointer.rb, line 63 63: def read_long_long 64: get_int64(0) 65: end
# File lib/ffi/pointer.rb, line 67 67: def read_pointer 68: get_pointer(0) 69: end
# File lib/ffi/pointer.rb, line 81 81: def read_string(len=nil) 82: if len 83: get_bytes(0, len) 84: else 85: get_string(0) 86: end 87: end
# File lib/ffi/pointer.rb, line 88 88: def read_string_length(len) 89: get_bytes(0, len) 90: end
# File lib/ffi/pointer.rb, line 91 91: def read_string_to_null 92: get_string(0) 93: end
# File lib/ffi/pointer.rb, line 126 126: def write_array_of_int(ary) 127: put_array_of_int32(0, ary) 128: end
# File lib/ffi/pointer.rb, line 134 134: def write_array_of_long(ary) 135: put_array_of_long(0, ary) 136: end
# File lib/ffi/pointer.rb, line 142 142: def write_array_of_pointer(ary) 143: write_array_of_type(:pointer, :write_pointer, ary) 144: end
# File lib/ffi/pointer.rb, line 113 113: def write_array_of_type(type, writer, ary) 114: size = FFI.type_size(type) 115: tmp = self 116: ary.each_with_index {|i, j| 117: tmp.send(writer, i) 118: tmp += size unless j == ary.length-1 # avoid OOB 119: } 120: self 121: end
# File lib/ffi/pointer.rb, line 77 77: def write_float(obj) 78: put_float32(0, obj) 79: end
Write obj as a C int at the memory pointed to.
# File lib/ffi/pointer.rb, line 39 39: def write_int(obj) 40: put_int32(0, obj) 41: end
Write obj as a C long at the memory pointed to.
# File lib/ffi/pointer.rb, line 49 49: def write_long(obj) 50: put_long(0, obj) 51: end
Write obj as a C long long at the memory pointed to.
# File lib/ffi/pointer.rb, line 58 58: def write_long_long(obj) 59: put_int64(0, obj) 60: end
# File lib/ffi/pointer.rb, line 70 70: def write_pointer(ptr) 71: put_pointer(0, ptr) 72: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.