gobject-introspection 1.2.1 → 1.2.2
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/ext/gobject-introspection/depend +10 -0
- data/ext/gobject-introspection/rb-gi-arg-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-argument.c +30 -12
- data/ext/gobject-introspection/rb-gi-base-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-boxed-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-callable-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-callback-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constant-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constructor-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-enum-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-field-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-flags-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-function-info.c +122 -81
- data/ext/gobject-introspection/rb-gi-interface-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-loader.c +9 -1
- data/ext/gobject-introspection/rb-gi-method-info.c +6 -2
- data/ext/gobject-introspection/rb-gi-object-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-private.h +110 -0
- data/ext/gobject-introspection/rb-gi-property-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-registered-type-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-repository.c +1 -1
- data/ext/gobject-introspection/rb-gi-signal-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-struct-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-type-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-type-tag.c +1 -1
- data/ext/gobject-introspection/rb-gi-union-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-unresolved-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-value-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-vfunc-info.c +1 -1
- data/ext/gobject-introspection/rb-gobject-introspection.c +1 -1
- data/ext/gobject-introspection/rb-gobject-introspection.h +30 -81
- data/lib/gobject-introspection/callable-info.rb +38 -2
- data/lib/gobject-introspection/loader.rb +81 -15
- metadata +92 -108
@@ -50,6 +50,8 @@ module GObjectIntrospection
|
|
50
50
|
load_function_info(info)
|
51
51
|
when StructInfo
|
52
52
|
load_struct_info(info)
|
53
|
+
when FlagsInfo
|
54
|
+
load_flags_info(info)
|
53
55
|
when EnumInfo
|
54
56
|
load_enum_info(info)
|
55
57
|
when ObjectInfo
|
@@ -64,12 +66,17 @@ module GObjectIntrospection
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def load_function_info(info)
|
67
|
-
|
69
|
+
name = rubyish_method_name(info)
|
70
|
+
define_module_function(@base_module, name, info)
|
68
71
|
end
|
69
72
|
|
70
73
|
def define_module_function(target_module, name, function_info)
|
74
|
+
validate = lambda do |arguments|
|
75
|
+
validate_arguments(function_info, arguments)
|
76
|
+
end
|
71
77
|
target_module.module_eval do
|
72
78
|
define_method(name) do |*arguments, &block|
|
79
|
+
validate.call(arguments, &block)
|
73
80
|
function_info.invoke(*arguments, &block)
|
74
81
|
end
|
75
82
|
module_function(name)
|
@@ -82,7 +89,7 @@ module GObjectIntrospection
|
|
82
89
|
:parent => options[:parent])
|
83
90
|
else
|
84
91
|
klass = self.class.define_class(info.gtype, info.name, @base_module,
|
85
|
-
|
92
|
+
:parent => options[:parent])
|
86
93
|
end
|
87
94
|
load_fields(info, klass)
|
88
95
|
load_methods(info, klass)
|
@@ -94,8 +101,36 @@ module GObjectIntrospection
|
|
94
101
|
define_struct(info)
|
95
102
|
end
|
96
103
|
|
104
|
+
def load_enum_value(value_info, enum_module)
|
105
|
+
enum_module.const_set(value_info.name.upcase, value_info.value)
|
106
|
+
end
|
107
|
+
|
97
108
|
def load_enum_info(info)
|
98
|
-
|
109
|
+
if info.gtype == GLib::Type::NONE
|
110
|
+
enum_module = Module.new
|
111
|
+
info.values.each do |value_info|
|
112
|
+
load_enum_value(value_info, enum_module)
|
113
|
+
end
|
114
|
+
@base_module.const_set(info.name, enum_module)
|
115
|
+
else
|
116
|
+
self.class.define_class(info.gtype, info.name, @base_module)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def load_flag_value(value_info, flags_module)
|
121
|
+
flags_module.const_set(value_info.name.upcase, value_info.value)
|
122
|
+
end
|
123
|
+
|
124
|
+
def load_flags_info(info)
|
125
|
+
if info.gtype == GLib::Type::NONE
|
126
|
+
flags_module = Module.new
|
127
|
+
info.values.each do |value_info|
|
128
|
+
load_flag_value(value_info, flags_module)
|
129
|
+
end
|
130
|
+
@base_module.const_set(info.name, flags_module)
|
131
|
+
else
|
132
|
+
self.class.define_class(info.gtype, info.name, @base_module)
|
133
|
+
end
|
99
134
|
end
|
100
135
|
|
101
136
|
def load_object_info(info)
|
@@ -111,7 +146,7 @@ module GObjectIntrospection
|
|
111
146
|
flags = field_info.flags
|
112
147
|
|
113
148
|
if flags.readable?
|
114
|
-
klass.__send__(:define_method, name) do
|
149
|
+
klass.__send__(:define_method, name) do ||
|
115
150
|
info.get_field_value(self, i)
|
116
151
|
end
|
117
152
|
end
|
@@ -155,6 +190,7 @@ module GObjectIntrospection
|
|
155
190
|
validate.call(info, arguments, &block)
|
156
191
|
info.invoke(self, *arguments, &block)
|
157
192
|
end
|
193
|
+
klass.__send__(:private, name)
|
158
194
|
end
|
159
195
|
|
160
196
|
find_info = lambda do |arguments|
|
@@ -167,10 +203,17 @@ module GObjectIntrospection
|
|
167
203
|
end
|
168
204
|
|
169
205
|
def validate_arguments(info, arguments)
|
170
|
-
|
171
|
-
|
172
|
-
|
206
|
+
n_in_args = info.n_in_args
|
207
|
+
n_required_in_args = info.n_required_in_args
|
208
|
+
return if (n_required_in_args..n_in_args).cover?(arguments.size)
|
209
|
+
|
210
|
+
detail = "#{arguments.size} for "
|
211
|
+
if n_in_args == n_required_in_args
|
212
|
+
detail << "#{info.n_in_args}"
|
213
|
+
else
|
214
|
+
detail << "#{info.n_required_in_args}..#{info.n_in_args}"
|
173
215
|
end
|
216
|
+
raise ArgumentError, "wrong number of arguments (#{detail})"
|
174
217
|
end
|
175
218
|
|
176
219
|
def find_suitable_callable_info(infos, arguments)
|
@@ -191,9 +234,9 @@ module GObjectIntrospection
|
|
191
234
|
raise ArgumentError, "wrong number of arguments (#{detail})"
|
192
235
|
end
|
193
236
|
|
194
|
-
def rubyish_method_name(
|
195
|
-
name =
|
196
|
-
return_type =
|
237
|
+
def rubyish_method_name(function_info)
|
238
|
+
name = function_info.name
|
239
|
+
return_type = function_info.return_type
|
197
240
|
if return_type.tag == GObjectIntrospection::TypeTag::BOOLEAN
|
198
241
|
case name
|
199
242
|
when /\A(?:is|get_is|get)_/
|
@@ -203,10 +246,17 @@ module GObjectIntrospection
|
|
203
246
|
else
|
204
247
|
name
|
205
248
|
end
|
206
|
-
elsif /\Aget_/ =~ name and
|
249
|
+
elsif /\Aget_/ =~ name and function_info.n_in_args.zero?
|
207
250
|
$POSTMATCH
|
208
251
|
else
|
209
|
-
name
|
252
|
+
case name
|
253
|
+
when "to_string"
|
254
|
+
"to_s"
|
255
|
+
when "foreach"
|
256
|
+
"each"
|
257
|
+
else
|
258
|
+
name
|
259
|
+
end
|
210
260
|
end
|
211
261
|
end
|
212
262
|
|
@@ -221,19 +271,35 @@ module GObjectIntrospection
|
|
221
271
|
end
|
222
272
|
|
223
273
|
def load_method_info(info, klass, method_name)
|
274
|
+
validate = lambda do |arguments|
|
275
|
+
validate_arguments(info, arguments)
|
276
|
+
end
|
224
277
|
klass.__send__(:define_method, method_name) do |*arguments, &block|
|
225
|
-
|
278
|
+
validate.call(arguments, &block)
|
279
|
+
if block.nil? and info.require_callback?
|
280
|
+
Enumerator.new(self, method_name, *arguments)
|
281
|
+
else
|
282
|
+
info.invoke(self, *arguments, &block)
|
283
|
+
end
|
226
284
|
end
|
227
285
|
end
|
228
286
|
|
229
287
|
def load_function_infos(infos, klass)
|
230
288
|
infos.each do |info|
|
231
|
-
name = info
|
289
|
+
name = rubyish_method_name(info)
|
232
290
|
next if name == "new"
|
233
291
|
next if name == "alloc"
|
292
|
+
validate = lambda do |arguments|
|
293
|
+
validate_arguments(info, arguments)
|
294
|
+
end
|
234
295
|
singleton_class = (class << klass; self; end)
|
235
296
|
singleton_class.__send__(:define_method, name) do |*arguments, &block|
|
236
|
-
|
297
|
+
validate.call(arguments, &block)
|
298
|
+
if block.nil? and info.require_callback?
|
299
|
+
Enumerator.new(self, name, *arguments)
|
300
|
+
else
|
301
|
+
info.invoke(*arguments, &block)
|
302
|
+
end
|
237
303
|
end
|
238
304
|
end
|
239
305
|
end
|
metadata
CHANGED
@@ -1,163 +1,147 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gobject-introspection
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.2
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 2
|
9
|
-
- 1
|
10
|
-
version: 1.2.1
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- The Ruby-GNOME2 Project Team
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-03-11 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: glib2
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 2
|
32
|
-
- 1
|
33
|
-
version: 1.2.1
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.2.2
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: test-unit
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.2.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: test-unit
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
40
33
|
none: false
|
41
|
-
requirements:
|
42
|
-
- -
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 2
|
47
|
-
version: "2"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '2'
|
48
38
|
type: :development
|
49
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2'
|
50
46
|
description: Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection.
|
51
47
|
email: ruby-gnome2-devel-en@lists.sourceforge.net
|
52
48
|
executables: []
|
53
|
-
|
54
|
-
extensions:
|
49
|
+
extensions:
|
55
50
|
- ext/gobject-introspection/extconf.rb
|
56
51
|
extra_rdoc_files: []
|
57
|
-
|
58
|
-
files:
|
52
|
+
files:
|
59
53
|
- Rakefile
|
60
54
|
- extconf.rb
|
61
55
|
- lib/gobject-introspection.rb
|
56
|
+
- lib/gobject-introspection/callable-info.rb
|
57
|
+
- lib/gobject-introspection/collection-reader.rb
|
62
58
|
- lib/gobject-introspection/interface-info.rb
|
63
|
-
- lib/gobject-introspection/union-info.rb
|
64
|
-
- lib/gobject-introspection/object-info.rb
|
65
59
|
- lib/gobject-introspection/loader.rb
|
66
|
-
- lib/gobject-introspection/
|
60
|
+
- lib/gobject-introspection/object-info.rb
|
67
61
|
- lib/gobject-introspection/repository.rb
|
68
|
-
- lib/gobject-introspection/collection-reader.rb
|
69
62
|
- lib/gobject-introspection/struct-info.rb
|
70
|
-
-
|
63
|
+
- lib/gobject-introspection/union-info.rb
|
64
|
+
- ext/gobject-introspection/depend
|
65
|
+
- ext/gobject-introspection/extconf.rb
|
66
|
+
- ext/gobject-introspection/rb-gi-arg-info.c
|
71
67
|
- ext/gobject-introspection/rb-gi-argument.c
|
68
|
+
- ext/gobject-introspection/rb-gi-base-info.c
|
69
|
+
- ext/gobject-introspection/rb-gi-boxed-info.c
|
70
|
+
- ext/gobject-introspection/rb-gi-callable-info.c
|
72
71
|
- ext/gobject-introspection/rb-gi-callback-info.c
|
72
|
+
- ext/gobject-introspection/rb-gi-constant-info.c
|
73
|
+
- ext/gobject-introspection/rb-gi-constructor-info.c
|
74
|
+
- ext/gobject-introspection/rb-gi-conversions.h
|
75
|
+
- ext/gobject-introspection/rb-gi-enum-info.c
|
76
|
+
- ext/gobject-introspection/rb-gi-field-info.c
|
77
|
+
- ext/gobject-introspection/rb-gi-flags-info.c
|
78
|
+
- ext/gobject-introspection/rb-gi-function-info.c
|
79
|
+
- ext/gobject-introspection/rb-gi-interface-info.c
|
80
|
+
- ext/gobject-introspection/rb-gi-loader.c
|
73
81
|
- ext/gobject-introspection/rb-gi-method-info.c
|
82
|
+
- ext/gobject-introspection/rb-gi-object-info.c
|
83
|
+
- ext/gobject-introspection/rb-gi-private.h
|
84
|
+
- ext/gobject-introspection/rb-gi-property-info.c
|
74
85
|
- ext/gobject-introspection/rb-gi-registered-type-info.c
|
75
|
-
- ext/gobject-introspection/rb-gi-conversions.h
|
76
86
|
- ext/gobject-introspection/rb-gi-repository.c
|
77
|
-
- ext/gobject-introspection/rb-gi-struct-info.c
|
78
|
-
- ext/gobject-introspection/rb-gobject-introspection.h
|
79
87
|
- ext/gobject-introspection/rb-gi-signal-info.c
|
80
|
-
- ext/gobject-introspection/rb-gi-
|
81
|
-
- ext/gobject-introspection/rb-gi-
|
88
|
+
- ext/gobject-introspection/rb-gi-struct-info.c
|
89
|
+
- ext/gobject-introspection/rb-gi-type-info.c
|
90
|
+
- ext/gobject-introspection/rb-gi-type-tag.c
|
82
91
|
- ext/gobject-introspection/rb-gi-types.h
|
92
|
+
- ext/gobject-introspection/rb-gi-union-info.c
|
83
93
|
- ext/gobject-introspection/rb-gi-unresolved-info.c
|
84
|
-
- ext/gobject-introspection/rb-gi-boxed-info.c
|
85
94
|
- ext/gobject-introspection/rb-gi-value-info.c
|
86
|
-
- ext/gobject-introspection/extconf.rb
|
87
|
-
- ext/gobject-introspection/rb-gobject-introspection.c
|
88
|
-
- ext/gobject-introspection/rb-gi-function-info.c
|
89
|
-
- ext/gobject-introspection/rb-gi-field-info.c
|
90
|
-
- ext/gobject-introspection/rb-gi-object-info.c
|
91
|
-
- ext/gobject-introspection/rb-gi-constant-info.c
|
92
|
-
- ext/gobject-introspection/rb-gi-arg-info.c
|
93
|
-
- ext/gobject-introspection/rb-gi-type-info.c
|
94
|
-
- ext/gobject-introspection/rb-gi-constructor-info.c
|
95
|
-
- ext/gobject-introspection/rb-gi-base-info.c
|
96
|
-
- ext/gobject-introspection/rb-gi-loader.c
|
97
|
-
- ext/gobject-introspection/rb-gi-callable-info.c
|
98
|
-
- ext/gobject-introspection/rb-gi-interface-info.c
|
99
|
-
- ext/gobject-introspection/rb-gi-enum-info.c
|
100
95
|
- ext/gobject-introspection/rb-gi-vfunc-info.c
|
101
|
-
- ext/gobject-introspection/rb-
|
102
|
-
-
|
103
|
-
- test/test-
|
104
|
-
- test/test-interface-info.rb
|
105
|
-
- test/test-enum-info.rb
|
106
|
-
- test/test-arg-info.rb
|
107
|
-
- test/test-repository.rb
|
108
|
-
- test/test-type-tag.rb
|
109
|
-
- test/test-loader.rb
|
110
|
-
- test/test-struct-info.rb
|
111
|
-
- test/test-flags-info.rb
|
112
|
-
- test/test-registered-type-info.rb
|
113
|
-
- test/test-property-info.rb
|
114
|
-
- test/test-constant-info.rb
|
96
|
+
- ext/gobject-introspection/rb-gobject-introspection.c
|
97
|
+
- ext/gobject-introspection/rb-gobject-introspection.h
|
98
|
+
- test/gobject-introspection-test-utils.rb
|
115
99
|
- test/run-test.rb
|
116
|
-
- test/test-
|
117
|
-
- test/test-callable-info.rb
|
100
|
+
- test/test-arg-info.rb
|
118
101
|
- test/test-base-info.rb
|
102
|
+
- test/test-boxed-info.rb
|
103
|
+
- test/test-callable-info.rb
|
119
104
|
- test/test-callback-info.rb
|
120
|
-
- test/
|
105
|
+
- test/test-constant-info.rb
|
106
|
+
- test/test-enum-info.rb
|
121
107
|
- test/test-field-type.rb
|
122
|
-
- test/test-
|
123
|
-
- test/test-
|
108
|
+
- test/test-flags-info.rb
|
109
|
+
- test/test-function-info.rb
|
110
|
+
- test/test-interface-info.rb
|
111
|
+
- test/test-loader.rb
|
124
112
|
- test/test-object-info.rb
|
125
|
-
- test/test-
|
113
|
+
- test/test-property-info.rb
|
114
|
+
- test/test-registered-type-info.rb
|
115
|
+
- test/test-repository.rb
|
116
|
+
- test/test-signal-info.rb
|
117
|
+
- test/test-struct-info.rb
|
118
|
+
- test/test-type-info.rb
|
119
|
+
- test/test-type-tag.rb
|
120
|
+
- test/test-union-info.rb
|
126
121
|
- test/test-value-info.rb
|
122
|
+
- test/test-vfunc-info.rb
|
127
123
|
homepage: http://ruby-gnome2.sourceforge.jp/
|
128
124
|
licenses: []
|
129
|
-
|
130
125
|
post_install_message:
|
131
126
|
rdoc_options: []
|
132
|
-
|
133
|
-
require_paths:
|
127
|
+
require_paths:
|
134
128
|
- lib
|
135
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
136
130
|
none: false
|
137
|
-
requirements:
|
138
|
-
- -
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
hash: 61
|
141
|
-
segments:
|
142
|
-
- 1
|
143
|
-
- 8
|
144
|
-
- 5
|
131
|
+
requirements:
|
132
|
+
- - ! '>='
|
133
|
+
- !ruby/object:Gem::Version
|
145
134
|
version: 1.8.5
|
146
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
136
|
none: false
|
148
|
-
requirements:
|
149
|
-
- -
|
150
|
-
- !ruby/object:Gem::Version
|
151
|
-
|
152
|
-
segments:
|
153
|
-
- 0
|
154
|
-
version: "0"
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
155
141
|
requirements: []
|
156
|
-
|
157
142
|
rubyforge_project:
|
158
|
-
rubygems_version: 1.8.
|
143
|
+
rubygems_version: 1.8.23
|
159
144
|
signing_key:
|
160
145
|
specification_version: 3
|
161
146
|
summary: Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection.
|
162
147
|
test_files: []
|
163
|
-
|