gobject-introspection 2.2.5-x86-mingw32 → 3.0.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +3 -3
  3. data/ext/gobject-introspection/extconf.rb +1 -1
  4. data/ext/gobject-introspection/rb-gi-argument.c +2275 -708
  5. data/ext/gobject-introspection/rb-gi-constant-info.c +1 -1
  6. data/ext/gobject-introspection/rb-gi-constructor-info.c +2 -2
  7. data/ext/gobject-introspection/rb-gi-conversions.h +40 -36
  8. data/ext/gobject-introspection/rb-gi-field-info.c +32 -6
  9. data/ext/gobject-introspection/rb-gi-function-info.c +98 -63
  10. data/ext/gobject-introspection/rb-gi-loader.c +33 -1
  11. data/ext/gobject-introspection/rb-gi-method-info.c +3 -6
  12. data/ext/gobject-introspection/rb-gi-private.h +2 -1
  13. data/ext/gobject-introspection/rb-gi-repository.c +29 -29
  14. data/lib/2.0/gobject_introspection.so +0 -0
  15. data/lib/2.1/gobject_introspection.so +0 -0
  16. data/lib/2.2/gobject_introspection.so +0 -0
  17. data/lib/gobject-introspection/arg-info.rb +27 -0
  18. data/lib/gobject-introspection/callable-info.rb +3 -1
  19. data/lib/gobject-introspection/loader.rb +160 -31
  20. data/lib/gobject-introspection.rb +1 -0
  21. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  22. data/vendor/local/bin/g-ir-generate.exe +0 -0
  23. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  24. data/vendor/local/include/gobject-introspection-1.0/girepository.h +4 -0
  25. data/vendor/local/include/gobject-introspection-1.0/giversionmacros.h +15 -1
  26. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  27. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  28. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  29. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  30. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  32. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +6 -1
  35. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +3 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  47. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  50. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  53. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  56. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +19 -1
  61. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  62. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +7 -3
  70. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  74. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +1 -1
  75. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  77. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  80. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  81. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +8 -0
  82. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  83. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  84. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  85. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  86. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  87. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  88. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  89. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  90. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  91. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  92. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  93. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  94. data/vendor/local/lib/libgirepository-1.0.la +3 -3
  95. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
  96. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
  97. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +44 -7
  98. data/vendor/local/share/gir-1.0/GLib-2.0.gir +518 -131
  99. data/vendor/local/share/gir-1.0/GObject-2.0.gir +1248 -475
  100. data/vendor/local/share/gir-1.0/Gio-2.0.gir +1849 -80
  101. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +1 -1
  102. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +19 -16
  103. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +1 -1
  104. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +3 -0
  105. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +2 -2
  106. data/vendor/local/share/man/man1/g-ir-compiler.1 +1 -2
  107. data/vendor/local/share/man/man1/g-ir-generate.1 +2 -3
  108. metadata +5 -4
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2015 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -51,7 +51,7 @@ rg_s_default(G_GNUC_UNUSED VALUE klass)
51
51
  * loaded, this function will search for a ".typelib" file using the repository
52
52
  * search path. In addition, a version of namespace may be specified. If version
53
53
  * is not specified, the latest will be used.
54
- *
54
+ *
55
55
  * @param [String] namespace The namespace to load
56
56
  * @param [String, nil] version An optional version
57
57
  */
@@ -68,12 +68,12 @@ rg_require(int argc, VALUE *argv, VALUE self)
68
68
  namespace_ = RVAL2CSTR(rb_namespace);
69
69
  version = RVAL2CSTR_ACCEPT_NIL(rb_version);
70
70
  if (!NIL_P(rb_flags)) {
71
- flags = RVAL2GI_REPOSITORY_LOAD_FLAGS(rb_flags);
71
+ flags = RVAL2GI_REPOSITORY_LOAD_FLAGS(rb_flags);
72
72
  }
73
73
 
74
74
  g_irepository_require(SELF(self), namespace_, version, flags, &error);
75
75
  if (error) {
76
- RG_RAISE_ERROR(error);
76
+ RG_RAISE_ERROR(error);
77
77
  }
78
78
 
79
79
  return Qnil;
@@ -84,9 +84,9 @@ rg_require(int argc, VALUE *argv, VALUE self)
84
84
  * Returned strings are of the form "namespace-version".
85
85
  * Note: namespace must have already been loaded using a function such as
86
86
  * GObjectIntrospection::Repository.require() before calling this method.
87
- *
87
+ *
88
88
  * @param [String] namespace The namespace to get the dependencies for.
89
- *
89
+ *
90
90
  * @return [Array<String>] The dependencies.
91
91
  */
92
92
  static VALUE
@@ -112,7 +112,7 @@ rg_get_dependencies(VALUE self, VALUE rb_namespace)
112
112
 
113
113
 
114
114
  /* Return the list of currently loaded namespaces.
115
- *
115
+ *
116
116
  * @return [Array<String>] The loaded namespaces.
117
117
  */
118
118
  static VALUE
@@ -137,9 +137,9 @@ rg_loaded_namespaces(VALUE self)
137
137
 
138
138
  /* This method returns the number of metadata entries in given namespace. The
139
139
  * namespace must have already been loaded before calling this function.
140
- *
140
+ *
141
141
  * @param [String] namespace The namespace to fetch the entries from.
142
- *
142
+ *
143
143
  * @return [Integer] The number of metadata entries.
144
144
  */
145
145
  static VALUE
@@ -159,10 +159,10 @@ rg_get_n_infos(VALUE self, VALUE rb_namespace)
159
159
  * namespace must have already been loaded before calling this function. See
160
160
  * GObjectIntrospection::Repository#get_n_infos() to find the maximum number
161
161
  * of entries.
162
- *
162
+ *
163
163
  * @param [String] namespace The namespace to fetch the metadata entry from.
164
164
  * @param [Fixnum] index The index of the entry.
165
- *
165
+ *
166
166
  * @return [GObjectIntrospection::BaseInfo] The metadata entry.
167
167
  */
168
168
  static VALUE
@@ -185,20 +185,20 @@ rg_get_info(VALUE self, VALUE rb_namespace, VALUE rb_n)
185
185
  * given, it is interpreted as a gtype and all loaded namespaces are searched
186
186
  * for it. If two arguments are given the first is a particular namespace and
187
187
  * the second the name of an entry to search for.
188
- *
188
+ *
189
189
  * @overload find(type)
190
190
  *
191
191
  * @param [String] type The type to search for.
192
- *
192
+ *
193
193
  * @return [GObjectIntrospection::BaseInfo] The metadata entry.
194
- *
195
- *
194
+ *
195
+ *
196
196
  * @overload find(namespace, type)
197
- *
197
+ *
198
198
  * @param [String] namespace The namespace to search in.
199
- *
199
+ *
200
200
  * @param [String] type The type to search for.
201
- *
201
+ *
202
202
  * @return [GObjectIntrospection::BaseInfo] The metadata entry.
203
203
  */
204
204
 
@@ -208,19 +208,19 @@ rg_find(int argc, VALUE *argv, VALUE self)
208
208
  GIBaseInfo *info;
209
209
 
210
210
  if (argc == 1) {
211
- VALUE rb_gtype;
212
- GType gtype;
213
- rb_gtype = argv[0];
214
- gtype = NUM2UINT(rb_gtype);
215
- info = g_irepository_find_by_gtype(SELF(self), gtype);
211
+ VALUE rb_gtype;
212
+ GType gtype;
213
+ rb_gtype = argv[0];
214
+ gtype = NUM2UINT(rb_gtype);
215
+ info = g_irepository_find_by_gtype(SELF(self), gtype);
216
216
  } else {
217
- VALUE rb_namespace, rb_name;
218
- const gchar *namespace_, *name;
217
+ VALUE rb_namespace, rb_name;
218
+ const gchar *namespace_, *name;
219
219
 
220
- rb_scan_args(argc, argv, "2", &rb_namespace, &rb_name);
221
- namespace_ = RVAL2CSTR(rb_namespace);
222
- name = RVAL2CSTR(rb_name);
223
- info = g_irepository_find_by_name(SELF(self), namespace_, name);
220
+ rb_scan_args(argc, argv, "2", &rb_namespace, &rb_name);
221
+ namespace_ = RVAL2CSTR(rb_namespace);
222
+ name = RVAL2CSTR(rb_name);
223
+ info = g_irepository_find_by_name(SELF(self), namespace_, name);
224
224
  }
225
225
 
226
226
  return GI_BASE_INFO2RVAL(info);
Binary file
Binary file
Binary file
@@ -0,0 +1,27 @@
1
+ # Copyright (C) 2015 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ module GObjectIntrospection
18
+ class ArgInfo
19
+ def gclosure?
20
+ type_info = type
21
+ return false if type_info.tag != TypeTag::INTERFACE
22
+
23
+ struct_info = type_info.interface
24
+ struct_info.gtype.name == "GClosure"
25
+ end
26
+ end
27
+ end
@@ -78,7 +78,9 @@ module GObjectIntrospection
78
78
 
79
79
  def require_callback?
80
80
  args.any? do |arg|
81
- arg.direction == Direction::IN and arg.scope != ScopeType::INVALID
81
+ arg.direction == Direction::IN and
82
+ arg.scope != ScopeType::INVALID and
83
+ !arg.may_be_null?
82
84
  end
83
85
  end
84
86
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2012-2015 Ruby-GNOME2 Project Team
2
2
  #
3
3
  # This library is free software; you can redistribute it and/or
4
4
  # modify it under the terms of the GNU Lesser General Public
@@ -14,6 +14,8 @@
14
14
  # License along with this library; if not, write to the Free Software
15
15
  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
+ require "English"
18
+
17
19
  module GObjectIntrospection
18
20
  class Loader
19
21
  class << self
@@ -72,18 +74,20 @@ module GObjectIntrospection
72
74
 
73
75
  def load_function_info(info)
74
76
  name = rubyish_method_name(info)
75
- define_module_function(@base_module, name, info)
77
+ define_singleton_method(@base_module, name, info)
76
78
  end
77
79
 
78
80
  def define_module_function(target_module, name, function_info)
79
81
  unlock_gvl = should_unlock_gvl?(function_info, target_module)
80
- validate = lambda do |arguments|
82
+ prepare = lambda do |arguments, &block|
83
+ arguments, block = build_arguments(function_info, arguments, &block)
81
84
  method_name = "#{target_module}\#.#{name}"
82
85
  validate_arguments(function_info, method_name, arguments)
86
+ [arguments, block]
83
87
  end
84
88
  target_module.module_eval do
85
89
  define_method(name) do |*arguments, &block|
86
- validate.call(arguments, &block)
90
+ arguments, block = prepare.call(arguments, &block)
87
91
  function_info.invoke({
88
92
  :arguments => arguments,
89
93
  :unlock_gvl => unlock_gvl,
@@ -96,14 +100,16 @@ module GObjectIntrospection
96
100
 
97
101
  def define_singleton_method(klass, name, info)
98
102
  unlock_gvl = should_unlock_gvl?(info, klass)
99
- validate = lambda do |arguments|
103
+ prepare = lambda do |arguments|
104
+ arguments, block = build_arguments(info, arguments, &block)
100
105
  validate_arguments(info, "#{klass}.#{name}", arguments)
106
+ [arguments, block]
101
107
  end
102
108
  singleton_class = (class << klass; self; end)
103
109
  singleton_class.__send__(:define_method, name) do |*arguments, &block|
104
- validate.call(arguments, &block)
110
+ arguments, block = prepare.call(arguments, &block)
105
111
  if block.nil? and info.require_callback?
106
- Enumerator.new(self, name, *arguments)
112
+ to_enum(name, *arguments)
107
113
  else
108
114
  info.invoke({
109
115
  :arguments => arguments,
@@ -128,9 +134,21 @@ module GObjectIntrospection
128
134
  end
129
135
 
130
136
  def load_struct_info(info)
131
- return if info.gtype_struct?
137
+ case info.name
138
+ when /Class\z/
139
+ base_class_name = $PREMATCH
140
+ method_infos = info.methods.find_all do |method_info|
141
+ method_info.is_a?(MethodInfo)
142
+ end
143
+ unless methods.empty?
144
+ base_class = @base_module.const_get(base_class_name)
145
+ load_method_infos(method_infos, base_class.singleton_class)
146
+ end
147
+ else
148
+ return if info.gtype_struct?
132
149
 
133
- define_struct(info)
150
+ define_struct(info)
151
+ end
134
152
  end
135
153
 
136
154
  def define_boxed(info)
@@ -203,10 +221,14 @@ module GObjectIntrospection
203
221
  end
204
222
  @base_module.const_set(info.name, flags_module)
205
223
  else
206
- self.class.define_class(info.gtype, info.name, @base_module)
224
+ self.class.define_class(info.gtype, flags_class_name(info), @base_module)
207
225
  end
208
226
  end
209
227
 
228
+ def flags_class_name(info)
229
+ info.name
230
+ end
231
+
210
232
  def load_object_info(info)
211
233
  klass = self.class.define_class(info.gtype, info.name, @base_module)
212
234
  load_fields(info, klass)
@@ -220,8 +242,12 @@ module GObjectIntrospection
220
242
  end
221
243
  end
222
244
 
245
+ def field_name(field_info, klass)
246
+ field_info.name
247
+ end
248
+
223
249
  def load_field(info, i, field_info, klass)
224
- name = field_info.name
250
+ name = field_name(field_info, klass)
225
251
  flags = field_info.flags
226
252
 
227
253
  if flags.readable?
@@ -230,6 +256,7 @@ module GObjectIntrospection
230
256
  else
231
257
  reader_method_name = name
232
258
  end
259
+ remove_existing_method(klass, reader_method_name)
233
260
  klass.__send__(:define_method, reader_method_name) do ||
234
261
  info.get_field_value(self, i)
235
262
  end
@@ -264,20 +291,26 @@ module GObjectIntrospection
264
291
  def load_constructor_infos(infos, klass)
265
292
  return if infos.empty?
266
293
 
267
- validate = lambda do |info, method_name, arguments|
294
+ prepare = lambda do |info, method_name, arguments, &block|
295
+ arguments, block = build_arguments(info, arguments, &block)
268
296
  validate_arguments(info, "#{klass}\##{method_name}", arguments)
297
+ [arguments, block]
298
+ end
299
+ call_initialize_post = lambda do |object|
300
+ initialize_post(object)
269
301
  end
270
302
  infos.each do |info|
271
303
  name = "initialize_#{info.name}"
272
304
  unlock_gvl = should_unlock_gvl?(info, klass)
273
305
  klass.__send__(:define_method, name) do |*arguments, &block|
274
- validate.call(info, name, arguments, &block)
306
+ arguments, block = prepare.call(info, name, arguments, &block)
275
307
  info.invoke({
276
308
  :receiver => self,
277
309
  :arguments => arguments,
278
310
  :unlock_gvl => unlock_gvl,
279
311
  },
280
312
  &block)
313
+ call_initialize_post.call(self)
281
314
  end
282
315
  klass.__send__(:private, name)
283
316
  end
@@ -291,6 +324,18 @@ module GObjectIntrospection
291
324
  end
292
325
  end
293
326
 
327
+ def initialize_post(object)
328
+ end
329
+
330
+ def build_arguments(info, arguments, &block)
331
+ last_in_arg = info.in_args.last
332
+ if block and last_in_arg and last_in_arg.gclosure?
333
+ [arguments + [block], nil]
334
+ else
335
+ [arguments, block]
336
+ end
337
+ end
338
+
294
339
  def validate_arguments(info, method_name, arguments)
295
340
  n_in_args = info.n_in_args
296
341
  n_required_in_args = info.n_required_in_args
@@ -340,40 +385,115 @@ module GObjectIntrospection
340
385
  end
341
386
 
342
387
  def match_argument?(arg_info, argument)
343
- case arg_info.type.tag
388
+ type = arg_info.type
389
+ case type.tag
390
+ when TypeTag::BOOLEAN
391
+ argument == true or argument == false
392
+ when TypeTag::INT8,
393
+ TypeTag::UINT8,
394
+ TypeTag::INT16,
395
+ TypeTag::UINT16,
396
+ TypeTag::INT32,
397
+ TypeTag::UINT32,
398
+ TypeTag::INT64,
399
+ TypeTag::UINT64,
400
+ TypeTag::FLOAT,
401
+ TypeTag::DOUBLE
402
+ argument.is_a?(Numeric)
403
+ when TypeTag::GTYPE
404
+ argument.is_a?(GLib::Type)
344
405
  when TypeTag::UTF8
345
406
  argument.is_a?(String)
407
+ when TypeTag::FILENAME
408
+ argument.is_a?(String)
409
+ when TypeTag::ARRAY
410
+ argument.is_a?(Array)
411
+ when TypeTag::INTERFACE
412
+ interface = type.interface
413
+ case interface.type
414
+ when InfoType::STRUCT
415
+ match_argument_interface_struct?(arg_info, interface, argument)
416
+ when InfoType::OBJECT,
417
+ InfoType::INTERFACE
418
+ argument.is_a?(interface.gtype.to_class)
419
+ else
420
+ # TODO
421
+ false
422
+ end
423
+ when TypeTag::GLIST,
424
+ TypeTag::GSLIST
425
+ argument.is_a?(Array)
346
426
  else
347
427
  # TODO
348
428
  false
349
429
  end
350
430
  end
351
431
 
432
+ def match_argument_interface_struct?(arg_info, interface, argument)
433
+ gtype = interface.gtype
434
+ case gtype.name
435
+ when "void"
436
+ # TODO
437
+ false
438
+ when "CairoSurface"
439
+ if Object.const_defined?(:Cairo)
440
+ argument.is_a?(Cairo::Surface)
441
+ else
442
+ false
443
+ end
444
+ else
445
+ argument.is_a?(gtype.to_class)
446
+ end
447
+ end
448
+
352
449
  def rubyish_method_name(function_info, options={})
353
450
  name = function_info.name
354
451
  if options[:prefix]
355
452
  name = name.gsub(/\A#{Regexp.escape(options[:prefix])}/, "")
356
453
  end
357
454
  return_type = function_info.return_type
358
- if return_type.tag == GObjectIntrospection::TypeTag::BOOLEAN
455
+ return_type_tag = return_type.tag
456
+ case return_type_tag
457
+ when TypeTag::BOOLEAN
359
458
  case name
360
459
  when /\A(?:is|get_is)_/
361
460
  "#{$POSTMATCH}?"
362
461
  when /\Aget_/
363
462
  if function_info.n_in_args.zero?
364
- "#{$POSTMATCH}?"
463
+ if function_info.n_out_args.zero?
464
+ "#{$POSTMATCH}?"
465
+ else
466
+ $POSTMATCH
467
+ end
365
468
  else
366
469
  name
367
470
  end
368
- when /\A(?:has|use)_/
471
+ when /\A(?:has|use|can|in|.*_is)_/
369
472
  "#{name}?"
473
+ when "exists"
474
+ "exist?"
475
+ else
476
+ name
477
+ end
478
+ when TypeTag::GLIST, TypeTag::GSLIST
479
+ case name
480
+ when /\A(?:list|get)_/
481
+ if function_info.n_in_args.zero?
482
+ $POSTMATCH
483
+ else
484
+ name
485
+ end
370
486
  else
371
487
  name
372
488
  end
373
- elsif /\Aget_/ =~ name and function_info.n_in_args.zero?
374
- $POSTMATCH
375
489
  else
376
490
  case name
491
+ when /\Aget_/
492
+ if function_info.n_in_args.zero?
493
+ $POSTMATCH
494
+ else
495
+ name
496
+ end
377
497
  when "to_string"
378
498
  "to_s"
379
499
  when "foreach"
@@ -400,19 +520,26 @@ module GObjectIntrospection
400
520
  define_equal_style_setter(info, klass, method_name)
401
521
  end
402
522
 
523
+ def remove_existing_method(klass, method_name)
524
+ return unless klass.method_defined?(method_name)
525
+ return unless klass.instance_method(method_name).owner == klass
526
+ klass.__send__(:remove_method, method_name)
527
+ end
528
+
403
529
  def define_method(info, klass, method_name)
404
530
  unlock_gvl = should_unlock_gvl?(info, klass)
405
- validate = lambda do |arguments|
531
+ remove_existing_method(klass, method_name)
532
+ function_info_p = (info.class == FunctionInfo)
533
+ no_return_value_p =
534
+ (info.return_type.tag == TypeTag::VOID and info.n_out_args.zero?)
535
+ prepare = lambda do |arguments, &block|
536
+ arguments, block = build_arguments(info, arguments, &block)
406
537
  validate_arguments(info, "#{klass}\##{method_name}", arguments)
538
+ [arguments, block]
407
539
  end
408
- if klass.method_defined?(method_name) and
409
- klass.instance_method(method_name).owner == klass
410
- klass.__send__(:remove_method, method_name)
411
- end
412
- function_info_p = (info.class == FunctionInfo)
413
540
  klass.__send__(:define_method, method_name) do |*arguments, &block|
414
541
  arguments = [self] + arguments if function_info_p
415
- validate.call(arguments, &block)
542
+ arguments, block = prepare.call(arguments, &block)
416
543
  if block.nil? and info.require_callback?
417
544
  to_enum(method_name, *arguments)
418
545
  else
@@ -421,7 +548,12 @@ module GObjectIntrospection
421
548
  :unlock_gvl => unlock_gvl,
422
549
  }
423
550
  options[:receiver] = self unless function_info_p
424
- info.invoke(options, &block)
551
+ return_value = info.invoke(options, &block)
552
+ if no_return_value_p
553
+ self
554
+ else
555
+ return_value
556
+ end
425
557
  end
426
558
  end
427
559
  end
@@ -429,10 +561,7 @@ module GObjectIntrospection
429
561
  def define_equal_style_setter(info, klass, method_name)
430
562
  if /\Aset_/ =~ method_name and info.n_args == 1
431
563
  setter_method_name = "#{$POSTMATCH}="
432
- if klass.method_defined?(setter_method_name) and
433
- klass.instance_method(setter_method_name).owner == klass
434
- klass.__send__(:remove_method, setter_method_name)
435
- end
564
+ remove_existing_method(klass, setter_method_name)
436
565
  klass.__send__(:alias_method, setter_method_name, method_name)
437
566
  end
438
567
  end
@@ -44,6 +44,7 @@ end
44
44
  GLib::Log.set_log_domain(GObjectIntrospection::LOG_DOMAIN)
45
45
 
46
46
  require "gobject-introspection/repository"
47
+ require "gobject-introspection/arg-info"
47
48
  require "gobject-introspection/callable-info"
48
49
  require "gobject-introspection/object-info"
49
50
  require "gobject-introspection/interface-info"
Binary file
Binary file
@@ -143,6 +143,10 @@ GITypelib * g_irepository_require_private (GIRepository *repository,
143
143
  GIRepositoryLoadFlags flags,
144
144
  GError **error);
145
145
 
146
+ GI_AVAILABLE_IN_1_44
147
+ gchar ** g_irepository_get_immediate_dependencies (GIRepository *repository,
148
+ const gchar *namespace_);
149
+
146
150
  GI_AVAILABLE_IN_ALL
147
151
  gchar ** g_irepository_get_dependencies (GIRepository *repository,
148
152
  const gchar *namespace_);
@@ -125,4 +125,18 @@
125
125
  # define GI_AVAILABLE_IN_1_42 _GI_EXTERN
126
126
  #endif
127
127
 
128
- #endif /* __GIVERSIONMACROS_H__ */
128
+ #if GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_44
129
+ # define GI_DEPRECATED_IN_1_44 GLIB_DEPRECATED
130
+ # define GI_DEPRECATED_IN_1_44_FOR(f) GLIB_DEPRECATED_FOR(f)
131
+ #else
132
+ # define GI_DEPRECATED_IN_1_44 _GI_EXTERN
133
+ # define GI_DEPRECATED_IN_1_44_FOR(f) _GI_EXTERN
134
+ #endif
135
+
136
+ #if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_44
137
+ # define GI_AVAILABLE_IN_1_44 GLIB_UNAVAILABLE(2, 44)
138
+ #else
139
+ # define GI_AVAILABLE_IN_1_44 _GI_EXTERN
140
+ #endif
141
+
142
+ #endif /* __GIVERSIONMACROS_H__ */
@@ -652,7 +652,7 @@ class GtkDocAnnotatable(object):
652
652
  return
653
653
 
654
654
  for option, value in options.items():
655
- if option in [OPT_ARRAY_ZERO_TERMINATED, OPT_ARRAY_FIXED_SIZE]:
655
+ if option == OPT_ARRAY_FIXED_SIZE:
656
656
  try:
657
657
  int(value)
658
658
  except (TypeError, ValueError):
@@ -663,6 +663,11 @@ class GtkDocAnnotatable(object):
663
663
  warn('invalid "%s" annotation option "%s" value "%s", must be an integer' %
664
664
  (ann_name, option, value),
665
665
  position)
666
+ elif option == OPT_ARRAY_ZERO_TERMINATED:
667
+ if value is not None and value not in ['0', '1']:
668
+ warn('invalid "%s" annotation option "%s" value "%s", must be 0 or 1' %
669
+ (ann_name, option, value),
670
+ position)
666
671
  elif option == OPT_ARRAY_LENGTH:
667
672
  if value is None:
668
673
  warn('"%s" annotation option "length" needs a value' % (ann_name, ),
@@ -284,6 +284,8 @@ type_names['int32_t'] = TYPE_INT32
284
284
  type_names['uint32_t'] = TYPE_UINT32
285
285
  type_names['int64_t'] = TYPE_INT64
286
286
  type_names['uint64_t'] = TYPE_UINT64
287
+ # C99 stdbool
288
+ type_names['bool'] = TYPE_BOOLEAN
287
289
 
288
290
  # A few additional GLib type aliases
289
291
  type_names['guchar'] = TYPE_UINT8
@@ -374,6 +376,7 @@ class Namespace(object):
374
376
  self.type_names = {} # Maps from GTName -> node
375
377
  self.ctypes = {} # Maps from CType -> node
376
378
  self.symbols = {} # Maps from function symbols -> Function
379
+ # Immediate includes only, not their transitive closure:
377
380
  self.includes = set() # Include
378
381
  self.shared_libraries = [] # str
379
382
  self.c_includes = [] # str