rbind 0.0.19 → 0.0.20
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.
- data/lib/rbind/clang/clang.rb +18 -2
- data/lib/rbind/generator_ruby.rb +9 -8
- data/lib/rbind/typelib.rb +4 -1
- data/rbind.gemspec +1 -1
- metadata +1 -1
data/lib/rbind/clang/clang.rb
CHANGED
@@ -4,8 +4,24 @@ require 'rbind/clang/clang_types'
|
|
4
4
|
module::Clang
|
5
5
|
module Rbind
|
6
6
|
extend FFI::Library
|
7
|
-
|
8
|
-
|
7
|
+
clang_names = ['clang']
|
8
|
+
%w{3.4 3.3 3.2}.each do |llvm_version|
|
9
|
+
clang_names << File.join("/", "usr", "lib", "llvm-#{llvm_version}", "lib", "libclang.so")
|
10
|
+
end
|
11
|
+
begin
|
12
|
+
actual_clang_name = clang_names.find do |name|
|
13
|
+
begin
|
14
|
+
ffi_lib name
|
15
|
+
true
|
16
|
+
rescue LoadError
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
if !actual_clang_name
|
21
|
+
raise LoadError, "cannot load the clang library, tried: #{clang_names.join(", ")}"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
9
25
|
# Provides the contents of a file that has not yet been saved to disk.
|
10
26
|
#
|
11
27
|
# Each CXUnsavedFile instance provides the name of a file on the
|
data/lib/rbind/generator_ruby.rb
CHANGED
@@ -60,7 +60,7 @@ module Rbind
|
|
60
60
|
normalize_type_name(parameter.default_value)
|
61
61
|
end
|
62
62
|
else
|
63
|
-
if(parameter.default_value =~ /([\w:<>]*) *\((.*)\)/)
|
63
|
+
if(parameter.default_value.gsub(/^new /,"") =~ /([ \w:<>]*) *\((.*)\)/)
|
64
64
|
value = $2
|
65
65
|
t = parameter.owner.owner.type($1,false)
|
66
66
|
ops = Array(parameter.owner.owner.operation($1,false)) if !t
|
@@ -78,14 +78,15 @@ module Rbind
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
s = if ops && !ops.empty?
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
81
|
+
if t
|
82
|
+
"#{normalize_type_name(t.full_name)}::#{normalize_method_name(ops.first.name)}(#{(value)})"
|
83
|
+
else
|
84
|
+
"#{normalize_method_name(ops.first.name)}(#{(value)})"
|
85
|
+
end
|
86
|
+
elsif t
|
87
|
+
t = t.to_ptr if parameter.type.ptr?
|
88
|
+
"#{normalize_type_name(t.full_name)}.new(#{(value)})"
|
85
89
|
end
|
86
|
-
elsif t
|
87
|
-
"#{normalize_type_name(t.full_name)}.new(#{(value)})"
|
88
|
-
end
|
89
90
|
else
|
90
91
|
parameter.default_value
|
91
92
|
end
|
data/lib/rbind/typelib.rb
CHANGED
@@ -26,7 +26,9 @@ module Rbind
|
|
26
26
|
if registry.include?(typename)
|
27
27
|
rbind[:bowner] = false
|
28
28
|
typelib_t = registry.get(typename)
|
29
|
-
::Typelib.to_ruby(typelib_t.from_address(rbind[:obj_ptr].address))
|
29
|
+
typelib_value = ::Typelib.to_ruby(typelib_t.from_address(rbind[:obj_ptr].address))
|
30
|
+
rbind.instance_variable_set :@__typelib_original_value__, typelib_value
|
31
|
+
typelib_value
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -59,6 +61,7 @@ module Rbind
|
|
59
61
|
s[:size] = 0 #obj.marshalling_size
|
60
62
|
s[:type_id] = nil
|
61
63
|
s[:version] = 1
|
64
|
+
s.instance_variable_set :@__typelib_original_value__, typelib_value
|
62
65
|
s
|
63
66
|
elsif obj.kind_of?(::Typelib::Type)
|
64
67
|
raise ArgumentError, "#{obj} is a typelib type, but I don't know how to convert it to #{klass}. Expected one of #{typenames.sort.join(", ")}"
|
data/rbind.gemspec
CHANGED