narray_ffi 0.3 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,23 +23,4 @@ unless have_header("narray.h")
23
23
  end
24
24
  end
25
25
 
26
- dir_config("ffi", conf["archdir"])
27
- unless have_header("Pointer.h")
28
- begin
29
- require "rubygems"
30
- if spec = Gem::Specification.find_all_by_name("ffi").last
31
- spec.require_paths.each { |path|
32
- $CPPFLAGS = "-I" << spec.full_gem_path << "/" << path << "/ " << $CPPFLAGS
33
- $CPPFLAGS = "-I" << spec.full_gem_path << "/" << path << "/" << "libffi-x86_64-linux/include/ " << $CPPFLAGS
34
- }
35
- end
36
- rescue LoadError
37
- end
38
- puts $CPPFLAGS
39
- unless have_header("Pointer.h")
40
- abort "missing ffi Pointer.h" unless have_header("Pointer.h")
41
- end
42
- end
43
-
44
-
45
26
  create_makefile("narray_ffi_c")
@@ -1,14 +1,15 @@
1
1
  #include "ruby.h"
2
2
  #include "narray.h"
3
- #include "Pointer.h"
4
3
 
5
- VALUE na_to_pointer(VALUE self) {
4
+ VALUE na_address(VALUE self) {
6
5
  struct NARRAY *ary;
7
6
  void * ptr;
7
+ VALUE ret;
8
8
 
9
9
  GetNArray(self,ary);
10
10
  ptr = ary->ptr;
11
- return rbffi_Pointer_NewInstance(ptr);
11
+ ret = ULL2NUM( (unsigned long long int) ptr);
12
+ return ret;
12
13
  }
13
14
 
14
15
  void Init_narray_ffi_c() {
@@ -16,6 +17,6 @@ void Init_narray_ffi_c() {
16
17
  VALUE klass;
17
18
  id = rb_intern("NArray");
18
19
  klass = rb_const_get(rb_cObject, id);
19
- rb_define_method(klass, "to_ptr", na_to_pointer, 0);
20
+ rb_define_private_method(klass, "address", na_address, 0);
20
21
  }
21
22
 
data/lib/narray_ffi.rb CHANGED
@@ -1,3 +1,9 @@
1
1
  require "narray"
2
2
  require "ffi"
3
3
  require "narray_ffi_c.so"
4
+
5
+ class NArray
6
+ def to_ptr
7
+ return FFI::Pointer::new( address() )
8
+ end
9
+ end
data/narray_ffi.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'narray_ffi'
3
- s.version = "0.3"
3
+ s.version = "0.4"
4
4
  s.author = "Brice Videau"
5
5
  s.email = "brice.videau@imag.fr"
6
6
  s.homepage = "https://forge.imag.fr/projects/opencl-ruby/"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: narray_ffi
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: '0.4'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-23 00:00:00.000000000 Z
12
+ date: 2014-03-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: narray