narray_ffi 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/narray_ffi_c/extconf.rb +0 -19
- data/ext/narray_ffi_c/narray_ffi.c +5 -4
- data/lib/narray_ffi.rb +6 -0
- data/narray_ffi.gemspec +1 -1
- metadata +2 -2
data/ext/narray_ffi_c/extconf.rb
CHANGED
@@ -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
|
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
|
-
|
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
|
-
|
20
|
+
rb_define_private_method(klass, "address", na_address, 0);
|
20
21
|
}
|
21
22
|
|
data/lib/narray_ffi.rb
CHANGED
data/narray_ffi.gemspec
CHANGED
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.
|
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-
|
12
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: narray
|