gobject-introspection 2.2.0-x86-mingw32 → 2.2.1-x86-mingw32

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.
Files changed (176) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -7
  3. data/ext/gobject-introspection/rb-gi-argument.c +28 -3
  4. data/ext/gobject-introspection/rb-gi-constructor-info.c +6 -1
  5. data/ext/gobject-introspection/rb-gi-function-info.c +29 -4
  6. data/ext/gobject-introspection/rb-gi-loader.c +19 -3
  7. data/ext/gobject-introspection/rb-gi-struct-info.c +28 -16
  8. data/lib/2.0/gobject_introspection.so +0 -0
  9. data/lib/gobject-introspection/callable-info.rb +16 -7
  10. data/lib/gobject-introspection/loader.rb +47 -19
  11. data/test/test-object-info.rb +1 -1
  12. data/test/test-signal-info.rb +2 -2
  13. data/test/test-struct-info.rb +1 -1
  14. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  15. data/vendor/local/bin/g-ir-generate.exe +0 -0
  16. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  17. data/vendor/local/include/gobject-introspection-1.0/giarginfo.h +30 -0
  18. data/vendor/local/include/gobject-introspection-1.0/gibaseinfo.h +31 -0
  19. data/vendor/local/include/gobject-introspection-1.0/gicallableinfo.h +36 -0
  20. data/vendor/local/include/gobject-introspection-1.0/giconstantinfo.h +12 -0
  21. data/vendor/local/include/gobject-introspection-1.0/gienuminfo.h +26 -0
  22. data/vendor/local/include/gobject-introspection-1.0/gifieldinfo.h +19 -0
  23. data/vendor/local/include/gobject-introspection-1.0/gifunctioninfo.h +23 -0
  24. data/vendor/local/include/gobject-introspection-1.0/giinterfaceinfo.h +38 -0
  25. data/vendor/local/include/gobject-introspection-1.0/giobjectinfo.h +72 -2
  26. data/vendor/local/include/gobject-introspection-1.0/gipropertyinfo.h +12 -0
  27. data/vendor/local/include/gobject-introspection-1.0/giregisteredtypeinfo.h +11 -0
  28. data/vendor/local/include/gobject-introspection-1.0/girepository.h +68 -8
  29. data/vendor/local/include/gobject-introspection-1.0/girffi.h +25 -1
  30. data/vendor/local/include/gobject-introspection-1.0/gisignalinfo.h +12 -0
  31. data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +24 -0
  32. data/vendor/local/include/gobject-introspection-1.0/gitypeinfo.h +31 -0
  33. data/vendor/local/include/gobject-introspection-1.0/gitypelib.h +25 -0
  34. data/vendor/local/include/gobject-introspection-1.0/gitypes.h +84 -13
  35. data/vendor/local/include/gobject-introspection-1.0/giunioninfo.h +27 -0
  36. data/vendor/local/include/gobject-introspection-1.0/giversionmacros.h +128 -0
  37. data/vendor/local/include/gobject-introspection-1.0/givfuncinfo.h +17 -0
  38. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  39. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  40. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  41. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  42. data/vendor/local/lib/girepository-1.0/libxml2-2.0.typelib +0 -0
  43. data/vendor/local/lib/girepository-1.0/win32-1.0.typelib +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +5 -4
  47. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +1865 -913
  50. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +49 -16
  53. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +10 -4
  56. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +202 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +32 -1
  62. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +1 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.py +305 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  74. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/callback.tmpl +4 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/field.tmpl +1 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/function.tmpl +8 -9
  77. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/interface.tmpl +2 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/callback.tmpl +27 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/class.tmpl +17 -5
  80. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/enum.tmpl +8 -0
  81. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/field.tmpl +9 -0
  82. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/function.tmpl +12 -13
  83. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/interface.tmpl +17 -0
  84. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/property.tmpl +3 -4
  85. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/signal.tmpl +10 -9
  86. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/vfunc.tmpl +7 -7
  87. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/callback.tmpl +27 -0
  88. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/class.tmpl +5 -4
  89. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/field.tmpl +1 -0
  90. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/function.tmpl +8 -14
  91. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/interface.tmpl +16 -0
  92. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/property.tmpl +2 -3
  93. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/signal.tmpl +6 -7
  94. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/vfunc.tmpl +7 -13
  95. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/base.tmpl +10 -19
  96. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/class.tmpl +24 -3
  97. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/namespace.tmpl +4 -7
  98. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +375 -61
  99. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  100. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  101. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +43 -75
  102. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  103. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  104. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +1 -20
  105. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  106. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  107. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +33 -15
  108. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  109. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  110. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +51 -22
  111. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  112. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  113. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  114. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  115. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  116. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  117. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +285 -254
  118. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  119. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  120. data/vendor/local/lib/gobject-introspection/giscanner/message.py +41 -25
  121. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  122. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  123. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +67 -15
  124. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  125. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  126. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  127. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  128. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +10 -6
  129. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  130. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  131. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +14 -8
  132. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  133. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  134. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +16 -2
  135. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  136. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  137. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +150 -169
  138. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  139. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  140. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +64 -3
  141. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  142. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  143. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +5 -44
  144. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  145. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  146. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  147. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  148. data/vendor/local/lib/libgirepository-1.0.la +1 -1
  149. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +4 -4
  150. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +5 -5
  151. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +352 -143
  152. data/vendor/local/share/gir-1.0/GLib-2.0.gir +6402 -3872
  153. data/vendor/local/share/gir-1.0/GModule-2.0.gir +42 -24
  154. data/vendor/local/share/gir-1.0/GObject-2.0.gir +1543 -887
  155. data/vendor/local/share/gir-1.0/Gio-2.0.gir +10859 -3705
  156. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +10 -14
  157. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +112 -9
  158. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.c +2 -0
  159. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.h +11 -0
  160. data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +106 -0
  161. data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +107 -0
  162. data/vendor/local/share/gobject-introspection-1.0/tests/foo.c +3 -3
  163. data/vendor/local/share/gobject-introspection-1.0/tests/foo.h +145 -0
  164. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +166 -10
  165. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +790 -0
  166. data/vendor/local/share/gobject-introspection-1.0/tests/gitestmacros.h +10 -0
  167. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +79 -28
  168. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +462 -0
  169. data/vendor/local/share/gobject-introspection-1.0/tests/utility.c +2 -0
  170. data/vendor/local/share/gobject-introspection-1.0/tests/utility.h +7 -0
  171. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.c +14 -0
  172. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.h +10 -0
  173. data/vendor/local/share/man/man1/g-ir-compiler.1 +1 -10
  174. metadata +38 -23
  175. data/lib/1.9/gobject_introspection.so +0 -0
  176. data/lib/2.1/gobject_introspection.so +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dc58d3a16683bfc549a15a04932160e7a03962f
4
- data.tar.gz: e33422fa5a785789df80009cd998fbc45614083e
3
+ metadata.gz: 203283bdb8829a6d146912b5cb50aab9ead33fe9
4
+ data.tar.gz: 12f46768a57b200f3bce153626141a0a89a10e76
5
5
  SHA512:
6
- metadata.gz: 5f6b837f2f656efd261f96196ed1d83ecaaca0e1c074281d762b71471374db75afedc353f89940e7af929d297f7e306900d6773997db29ac0dafa636b61da7f9
7
- data.tar.gz: 94af97fd8d5d02188929b2e0ad560eed9d47add513364772c7e3b46d8efc7dc4539b7b52577f5bf13f935323b61762c2d99a6dcb60624831c2ba1e176f2369b0
6
+ metadata.gz: 86e63fb30f134a068addd7311fd19978580e850a5953e73c5d483051842bbe72d7541753300e15eb777f4a397a2f75857b364f04b1490804137a3fd324c57c5a
7
+ data.tar.gz: 4400ba2f3114334b3019b73e4ccecebf28e4679af9707e108297572ba2235941311f2c8f4c4215228c6f50b65124e878a02897edefbf5a4d31793184acefa4e8
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- ruby -*-
2
2
  #
3
- # Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
3
+ # Copyright (C) 2012-2014 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
@@ -32,7 +32,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
32
32
  :name => "glib",
33
33
  :download_site => :gnome,
34
34
  :label => "GLib",
35
- :version => "2.38.2",
35
+ :version => "2.42.0",
36
36
  :compression_method => "xz",
37
37
  :windows => {
38
38
  :build => false,
@@ -47,7 +47,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
47
47
  :name => "gobject-introspection",
48
48
  :download_site => :gnome,
49
49
  :label => "gobject-introspection",
50
- :version => "1.38.0",
50
+ :version => "1.42.0",
51
51
  :compression_method => "xz",
52
52
  :windows => {
53
53
  :configure_args => [
@@ -55,7 +55,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
55
55
  "--disable-tests",
56
56
  ],
57
57
  :patches => [
58
- "0001-Support-external-g-ir-scanner.patch",
58
+ "support-external-g-ir-scanner.diff",
59
59
  ],
60
60
  :need_autoreconf => true,
61
61
  :built_file => "bin/libgirepository-1.0-1.dll",
@@ -87,7 +87,7 @@ namespace :native do
87
87
  end
88
88
 
89
89
  namespace :builder do
90
- task :after => "native:gobject-introspection:cross"
90
+ # task :after => "native:gobject-introspection:cross"
91
91
  end
92
92
  end
93
93
 
@@ -104,7 +104,7 @@ namespace :win32 do
104
104
  original_pc.each_line do |line|
105
105
  case line
106
106
  when /\Ag_ir_(scanner|compiler)=/
107
- new_pc << line.gsub(/\${bindir}/, "${native_bindir}")
107
+ new_pc << line.gsub(/\${bindir}/, "${native_bindir}").gsub(/\.exe/, "")
108
108
  else
109
109
  new_pc << line
110
110
  end
@@ -116,6 +116,6 @@ namespace :win32 do
116
116
  end
117
117
 
118
118
  namespace :builder do
119
- task :after => "win32:gobject-introspection:cross"
119
+ # task :after => "win32:gobject-introspection:cross"
120
120
  end
121
121
  end
@@ -953,7 +953,9 @@ rb_gi_argument_from_ruby_interface(GIArgument *argument, GITypeInfo *type_info,
953
953
  g_base_info_get_name(interface_info));
954
954
  break;
955
955
  case GI_INFO_TYPE_STRUCT:
956
- if (gtype == G_TYPE_VALUE) {
956
+ if (gtype == G_TYPE_NONE) {
957
+ argument->v_pointer = DATA_PTR(rb_argument);
958
+ } else if (gtype == G_TYPE_VALUE) {
957
959
  GValue *gvalue;
958
960
  gvalue = ALLOC(GValue);
959
961
  memset(gvalue, 0, sizeof(GValue));
@@ -1419,6 +1421,22 @@ set_in_array_length_argument(GIArgument *argument,
1419
1421
  }
1420
1422
  }
1421
1423
 
1424
+ static void
1425
+ set_in_array_gtype_arguments_from_ruby(GIArgument *array_argument,
1426
+ VALUE rb_class_array)
1427
+ {
1428
+ GType *types;
1429
+ gint i, n_args;
1430
+
1431
+ n_args = RARRAY_LEN(rb_class_array);
1432
+ types = ALLOC_N(GType, n_args);
1433
+ for (i = 0; i < n_args; i++) {
1434
+ types[i] = CLASS2GTYPE(RARRAY_PTR(rb_class_array)[i]);
1435
+ }
1436
+
1437
+ array_argument->v_pointer = types;
1438
+ }
1439
+
1422
1440
  static void
1423
1441
  in_array_c_argument_from_ruby(GIArgument *array_argument,
1424
1442
  GIArgument *length_argument,
@@ -1451,11 +1469,16 @@ in_array_c_argument_from_ruby(GIArgument *array_argument,
1451
1469
  case GI_TYPE_TAG_UINT64:
1452
1470
  case GI_TYPE_TAG_FLOAT:
1453
1471
  case GI_TYPE_TAG_DOUBLE:
1454
- case GI_TYPE_TAG_GTYPE:
1455
1472
  rb_raise(rb_eNotImpError,
1456
1473
  "TODO: Ruby -> GIArgument(array)[%s]",
1457
1474
  g_type_tag_to_string(element_type_tag));
1458
1475
  break;
1476
+ case GI_TYPE_TAG_GTYPE:
1477
+ set_in_array_gtype_arguments_from_ruby(array_argument,
1478
+ rb_argument);
1479
+ set_in_array_length_argument(length_argument, length_type_info,
1480
+ RARRAY_LEN(rb_argument));
1481
+ break;
1459
1482
  case GI_TYPE_TAG_UTF8:
1460
1483
  case GI_TYPE_TAG_FILENAME:
1461
1484
  array_argument->v_pointer = RVAL2STRV(rb_argument);
@@ -1685,11 +1708,13 @@ rb_gi_value_argument_free_array_c(GIArgument *argument,
1685
1708
  case GI_TYPE_TAG_UINT64:
1686
1709
  case GI_TYPE_TAG_FLOAT:
1687
1710
  case GI_TYPE_TAG_DOUBLE:
1688
- case GI_TYPE_TAG_GTYPE:
1689
1711
  rb_raise(rb_eNotImpError,
1690
1712
  "TODO: free GIArgument(array)[%s]",
1691
1713
  g_type_tag_to_string(element_type_tag));
1692
1714
  break;
1715
+ case GI_TYPE_TAG_GTYPE:
1716
+ xfree(argument->v_pointer);
1717
+ break;
1693
1718
  case GI_TYPE_TAG_UTF8:
1694
1719
  case GI_TYPE_TAG_FILENAME:
1695
1720
  g_free(argument->v_pointer);
@@ -65,7 +65,12 @@ initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
65
65
  case GI_INFO_TYPE_INTERFACE:
66
66
  case GI_INFO_TYPE_CONSTANT:
67
67
  case GI_INFO_TYPE_INVALID_0:
68
+ rb_raise(rb_eRuntimeError,
69
+ "TODO: returned value isn't object, struct or union");
70
+ break;
68
71
  case GI_INFO_TYPE_UNION:
72
+ G_INITIALIZE(receiver, value->v_pointer);
73
+ break;
69
74
  case GI_INFO_TYPE_VALUE:
70
75
  case GI_INFO_TYPE_SIGNAL:
71
76
  case GI_INFO_TYPE_VFUNC:
@@ -76,7 +81,7 @@ initialize_receiver(VALUE receiver, GITypeInfo *info, GIArgument *value)
76
81
  case GI_INFO_TYPE_UNRESOLVED:
77
82
  default:
78
83
  rb_raise(rb_eRuntimeError,
79
- "TODO: returned value isn't object or struct");
84
+ "TODO: returned value isn't object, struct or union");
80
85
  break;
81
86
  }
82
87
  }
@@ -93,7 +93,6 @@ allocate_arguments(GICallableInfo *info,
93
93
  GPtrArray *args_metadata)
94
94
  {
95
95
  gint i, n_args;
96
- gint rb_arg_index = 0;
97
96
 
98
97
  n_args = g_callable_info_get_n_args(info);
99
98
  for (i = 0; i < n_args; i++) {
@@ -127,7 +126,6 @@ allocate_arguments(GICallableInfo *info,
127
126
  if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
128
127
  metadata->in_arg_index = in_args->len;
129
128
  g_array_append_val(in_args, argument);
130
- metadata->rb_arg_index = rb_arg_index++;
131
129
  }
132
130
  if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
133
131
  metadata->out_arg_index = out_args->len;
@@ -161,7 +159,6 @@ fill_metadata_callback(GPtrArray *args_metadata)
161
159
  closure_metadata = g_ptr_array_index(args_metadata, closure_index);
162
160
  closure_metadata->closure_p = TRUE;
163
161
  metadata->closure_in_arg_index = closure_metadata->in_arg_index;
164
- closure_metadata->rb_arg_index = -1;
165
162
  }
166
163
 
167
164
  destroy_index = g_arg_info_get_destroy(arg_info);
@@ -170,7 +167,6 @@ fill_metadata_callback(GPtrArray *args_metadata)
170
167
  destroy_metadata = g_ptr_array_index(args_metadata, destroy_index);
171
168
  destroy_metadata->destroy_p = TRUE;
172
169
  metadata->destroy_in_arg_index = destroy_metadata->in_arg_index;
173
- destroy_metadata->rb_arg_index = -1;
174
170
  }
175
171
  }
176
172
  }
@@ -213,11 +209,40 @@ fill_metadata_array(GPtrArray *args_metadata)
213
209
  }
214
210
  }
215
211
 
212
+ static void
213
+ fill_metadata_rb_arg_index(GPtrArray *args_metadata)
214
+ {
215
+ guint i;
216
+ gint rb_arg_index = 0;
217
+
218
+ for (i = 0; i < args_metadata->len; i++) {
219
+ RBGIArgMetadata *metadata;
220
+
221
+ metadata = g_ptr_array_index(args_metadata, i);
222
+
223
+ if (metadata->closure_p) {
224
+ continue;
225
+ }
226
+
227
+ if (metadata->destroy_p) {
228
+ continue;
229
+ }
230
+
231
+ if (metadata->array_length_p) {
232
+ continue;
233
+ }
234
+
235
+ metadata->rb_arg_index = rb_arg_index;
236
+ rb_arg_index++;
237
+ }
238
+ }
239
+
216
240
  static void
217
241
  fill_metadata(GPtrArray *args_metadata)
218
242
  {
219
243
  fill_metadata_callback(args_metadata);
220
244
  fill_metadata_array(args_metadata);
245
+ fill_metadata_rb_arg_index(args_metadata);
221
246
  }
222
247
 
223
248
  static void
@@ -27,18 +27,24 @@ static const gchar *boxed_class_converters_name = "@@boxed_class_converters";
27
27
  static VALUE
28
28
  rg_s_define_class(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
29
29
  {
30
+ VALUE rb_class;
30
31
  VALUE rb_gtype, rb_name, rb_module;
31
- VALUE rb_options, rb_parent;
32
+ VALUE rb_options, rb_parent, rb_size;
32
33
  GType gtype;
33
34
 
34
35
  rb_scan_args(argc, argv, "31", &rb_gtype, &rb_name, &rb_module, &rb_options);
35
36
  rbg_scan_options(rb_options,
36
37
  "parent", &rb_parent,
38
+ "size", &rb_size,
37
39
  NULL);
38
40
 
39
41
  gtype = NUM2ULONG(rb_to_int(rb_gtype));
40
- return G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name),
41
- rb_module, rb_parent);
42
+ rb_class = G_DEF_CLASS_WITH_PARENT(gtype, RVAL2CSTR(rb_name),
43
+ rb_module, rb_parent);
44
+ if (!NIL_P(rb_size)) {
45
+ rb_iv_set(rb_class, "@size", rb_size);
46
+ }
47
+ return rb_class;
42
48
  }
43
49
 
44
50
  static VALUE
@@ -183,6 +189,15 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
183
189
  return Qnil;
184
190
  }
185
191
 
192
+ static VALUE
193
+ rg_s_register_constant_rename_map(G_GNUC_UNUSED VALUE klass,
194
+ VALUE rb_original,
195
+ VALUE rb_renamed)
196
+ {
197
+ G_RENAME_CONSTANT(RVAL2CSTR(rb_original), RVAL2CSTR(rb_renamed));
198
+ return Qnil;
199
+ }
200
+
186
201
  static VALUE
187
202
  rg_s_start_callback_dispatch_thread(G_GNUC_UNUSED VALUE klass)
188
203
  {
@@ -204,5 +219,6 @@ rb_gi_loader_init(VALUE rb_mGI)
204
219
  RG_DEF_SMETHOD(define_struct, -1);
205
220
  RG_DEF_SMETHOD(define_error, -1);
206
221
  RG_DEF_SMETHOD(register_boxed_class_converter, 1);
222
+ RG_DEF_SMETHOD(register_constant_rename_map, 2);
207
223
  RG_DEF_SMETHOD(start_callback_dispatch_thread, 0);
208
224
  }
@@ -55,28 +55,42 @@ rg_get_field(VALUE self, VALUE rb_n)
55
55
  return GI_BASE_INFO2RVAL_WITH_UNREF(g_struct_info_get_field(info, n));
56
56
  }
57
57
 
58
+ static gpointer
59
+ extract_raw_struct(VALUE rb_struct,
60
+ GIStructInfo *struct_info)
61
+ {
62
+ GType gtype;
63
+ gpointer raw_struct;
64
+
65
+ gtype = g_registered_type_info_get_g_type(struct_info);
66
+ if (gtype == G_TYPE_NONE && rb_respond_to(rb_struct, rb_intern("gtype"))) {
67
+ VALUE rb_gtype;
68
+ rb_gtype = rb_funcall(rb_struct, rb_intern("gtype"), 0);
69
+ gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
70
+ }
71
+ if (gtype == G_TYPE_NONE) {
72
+ raw_struct = DATA_PTR(rb_struct);
73
+ } else {
74
+ raw_struct = RVAL2BOXED(rb_struct, gtype);
75
+ }
76
+
77
+ return raw_struct;
78
+ }
79
+
58
80
  static VALUE
59
81
  rg_get_field_value(VALUE self, VALUE rb_struct, VALUE rb_n)
60
82
  {
61
83
  GIStructInfo *info;
84
+ gpointer raw_struct;
62
85
  gint n;
63
86
  GIFieldInfo *field_info;
64
87
  VALUE rb_value;
65
- gpointer instance;
66
88
 
67
89
  info = SELF(self);
90
+ raw_struct = extract_raw_struct(rb_struct, info);
68
91
  n = NUM2INT(rb_n);
69
92
  field_info = g_struct_info_get_field(info, n);
70
- if (rb_respond_to(rb_struct, rb_intern("gtype"))) {
71
- VALUE rb_gtype;
72
- GType gtype;
73
- rb_gtype = rb_funcall(rb_struct, rb_intern("gtype"), 0);
74
- gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
75
- instance = RVAL2BOXED(rb_struct, gtype);
76
- } else {
77
- Data_Get_Struct(rb_struct, void, instance);
78
- }
79
- rb_value = rb_gi_field_info_get_field_raw(field_info, instance);
93
+ rb_value = rb_gi_field_info_get_field_raw(field_info, raw_struct);
80
94
  g_base_info_unref(field_info);
81
95
 
82
96
  return rb_value;
@@ -86,17 +100,15 @@ static VALUE
86
100
  rg_set_field_value(VALUE self, VALUE rb_struct, VALUE rb_n, VALUE rb_value)
87
101
  {
88
102
  GIStructInfo *info;
103
+ gpointer raw_struct;
89
104
  gint n;
90
105
  GIFieldInfo *field_info;
91
- GType gtype;
92
106
 
93
107
  info = SELF(self);
108
+ raw_struct = extract_raw_struct(rb_struct, info);
94
109
  n = NUM2INT(rb_n);
95
110
  field_info = g_struct_info_get_field(info, n);
96
- gtype = g_registered_type_info_get_g_type(info);
97
- rb_gi_field_info_set_field_raw(field_info,
98
- RVAL2BOXED(rb_struct, gtype),
99
- rb_value);
111
+ rb_gi_field_info_set_field_raw(field_info, raw_struct, rb_value);
100
112
  /* TODO: use rb_ensure() to unref field_info. */
101
113
  g_base_info_unref(field_info);
102
114
 
Binary file
@@ -23,22 +23,31 @@ module GObjectIntrospection
23
23
  collection_reader("args")
24
24
 
25
25
  def in_args
26
+ array_length_indexes = []
26
27
  callback_indexes = []
27
28
  closure_indexes = []
28
29
  destroy_indexes = []
29
30
  args.each_with_index do |arg, i|
30
- next if arg.scope == ScopeType::INVALID
31
- callback_indexes << i
32
- closure_index = arg.closure
33
- closure_indexes << closure_index if closure_index != -1
34
- destroy_index = arg.destroy
35
- destroy_indexes << destroy_index if destroy_index != -1
31
+ if arg.type.tag == TypeTag::ARRAY
32
+ array_length = arg.type.array_length
33
+ array_length_indexes << array_length if array_length != -1
34
+ end
35
+
36
+ unless arg.scope == ScopeType::INVALID
37
+ callback_indexes << i
38
+ closure_index = arg.closure
39
+ closure_indexes << closure_index if closure_index != -1
40
+ destroy_index = arg.destroy
41
+ destroy_indexes << destroy_index if destroy_index != -1
42
+ end
36
43
  end
37
44
 
38
45
  args.find_all.with_index do |arg, i|
39
46
  case arg.direction
40
47
  when Direction::IN, Direction::INOUT
41
- if callback_indexes.include?(i)
48
+ if array_length_indexes.include?(i)
49
+ false
50
+ elsif callback_indexes.include?(i)
42
51
  false
43
52
  elsif closure_indexes.include?(i)
44
53
  false
@@ -120,7 +120,8 @@ module GObjectIntrospection
120
120
  :parent => options[:parent])
121
121
  else
122
122
  klass = self.class.define_class(info.gtype, info.name, @base_module,
123
- :parent => options[:parent])
123
+ :parent => options[:parent],
124
+ :size => info.size)
124
125
  end
125
126
  load_fields(info, klass)
126
127
  load_methods(info, klass)
@@ -134,6 +135,7 @@ module GObjectIntrospection
134
135
 
135
136
  def define_boxed(info)
136
137
  klass = self.class.define_class(info.gtype, info.name, @base_module)
138
+ _ = klass # TODO: Remove me. It is just for suppressing a warning.
137
139
  # TODO
138
140
  # load_fields(info, klass)
139
141
  # load_methods(info, klass)
@@ -223,7 +225,12 @@ module GObjectIntrospection
223
225
  flags = field_info.flags
224
226
 
225
227
  if flags.readable?
226
- klass.__send__(:define_method, name) do ||
228
+ if field_info.type.tag == TypeTag::BOOLEAN
229
+ reader_method_name = "#{name}?"
230
+ else
231
+ reader_method_name = name
232
+ end
233
+ klass.__send__(:define_method, reader_method_name) do ||
227
234
  info.get_field_value(self, i)
228
235
  end
229
236
  end
@@ -291,9 +298,9 @@ module GObjectIntrospection
291
298
 
292
299
  detail = "#{arguments.size} for "
293
300
  if n_in_args == n_required_in_args
294
- detail << "#{info.n_in_args}"
301
+ detail << "#{n_in_args}"
295
302
  else
296
- detail << "#{info.n_required_in_args}..#{info.n_in_args}"
303
+ detail << "#{n_required_in_args}..#{n_in_args}"
297
304
  end
298
305
  message = "#{method_name}: wrong number of arguments (#{detail})"
299
306
  raise ArgumentError, message
@@ -304,11 +311,12 @@ module GObjectIntrospection
304
311
  max_n_args = nil
305
312
  candidate_infos = []
306
313
  infos.each do |info|
307
- if arguments.size == info.n_in_args
314
+ n_in_args = info.n_in_args
315
+ n_required_in_args = info.n_required_in_args
316
+ if (n_required_in_args..n_in_args).cover?(arguments.size)
308
317
  candidate_infos << info
309
318
  end
310
- n_in_args = info.n_in_args
311
- min_n_args = [min_n_args || n_in_args, n_in_args].min
319
+ min_n_args = [min_n_args || n_required_in_args, n_required_in_args].min
312
320
  max_n_args = [max_n_args || n_in_args, n_in_args].max
313
321
  end
314
322
 
@@ -316,8 +324,9 @@ module GObjectIntrospection
316
324
  return candidate_infos.first
317
325
  elsif candidate_infos.size > 1
318
326
  candidate_info = candidate_infos.find do |info|
319
- info.in_args.each.with_index.all? do |arg_info, i|
320
- match_argument?(arg_info, arguments[i])
327
+ in_arg_infos = info.in_args
328
+ arguments.each.with_index.all? do |argument, i|
329
+ match_argument?(in_arg_infos[i], argument)
321
330
  end
322
331
  end
323
332
  return candidate_info || candidate_infos.first
@@ -374,29 +383,48 @@ module GObjectIntrospection
374
383
  infos.each do |info|
375
384
  method_name = rubyish_method_name(info)
376
385
  load_method_info(info, klass, method_name)
377
- if /\Aset_/ =~ method_name and info.n_args == 1
378
- klass.__send__(:alias_method, "#{$POSTMATCH}=", method_name)
379
- end
380
386
  end
381
387
  end
382
388
 
383
389
  def load_method_info(info, klass, method_name)
390
+ define_method(info, klass, method_name)
391
+ define_equal_style_setter(info, klass, method_name)
392
+ end
393
+
394
+ def define_method(info, klass, method_name)
384
395
  unlock_gvl = should_unlock_gvl?(info, klass)
385
396
  validate = lambda do |arguments|
386
397
  validate_arguments(info, "#{klass}\##{method_name}", arguments)
387
398
  end
399
+ if klass.method_defined?(method_name) and
400
+ klass.instance_method(method_name).owner == klass
401
+ klass.__send__(:remove_method, method_name)
402
+ end
403
+ function_info_p = (info.class == FunctionInfo)
388
404
  klass.__send__(:define_method, method_name) do |*arguments, &block|
405
+ arguments = [self] + arguments if function_info_p
389
406
  validate.call(arguments, &block)
390
407
  if block.nil? and info.require_callback?
391
- Enumerator.new(self, method_name, *arguments)
408
+ to_enum(method_name, *arguments)
392
409
  else
393
- info.invoke({
394
- :receiver => self,
395
- :arguments => arguments,
396
- :unlock_gvl => unlock_gvl,
397
- },
398
- &block)
410
+ options = {
411
+ :arguments => arguments,
412
+ :unlock_gvl => unlock_gvl,
413
+ }
414
+ options[:receiver] = self unless function_info_p
415
+ info.invoke(options, &block)
416
+ end
417
+ end
418
+ end
419
+
420
+ def define_equal_style_setter(info, klass, method_name)
421
+ if /\Aset_/ =~ method_name and info.n_args == 1
422
+ setter_method_name = "#{$POSTMATCH}="
423
+ if klass.method_defined?(setter_method_name) and
424
+ klass.instance_method(setter_method_name).owner == klass
425
+ klass.__send__(:remove_method, setter_method_name)
399
426
  end
427
+ klass.__send__(:alias_method, setter_method_name, method_name)
400
428
  end
401
429
  end
402
430
 
@@ -86,7 +86,7 @@ class TestObjectInfo < Test::Unit::TestCase
86
86
 
87
87
  def test_n_signals
88
88
  info = @repository.find("Gio", "Application")
89
- assert_equal(5, info.n_signals)
89
+ assert_operator(5, :<=, info.n_signals)
90
90
  end
91
91
 
92
92
  def test_get_signal
@@ -25,8 +25,8 @@ class TestSignalInfo < Test::Unit::TestCase
25
25
  end
26
26
 
27
27
  def test_flags
28
- require_version(1, 39, 0)
29
- assert_equal(GLib::SignalFlags::RUN_LAST,
28
+ require_version(1, 40, 0)
29
+ assert_equal(GLib::SignalFlags::RUN_FIRST,
30
30
  @info.flags)
31
31
  end
32
32
 
@@ -31,7 +31,7 @@ class TestStructInfo < Test::Unit::TestCase
31
31
  end
32
32
 
33
33
  def test_n_methods
34
- assert_equal(62, @info.n_methods)
34
+ assert_operator(@info.n_methods, :>=, 62)
35
35
  end
36
36
 
37
37
  def test_get_method
Binary file
Binary file
@@ -31,20 +31,50 @@
31
31
 
32
32
  G_BEGIN_DECLS
33
33
 
34
+ /**
35
+ * GI_IS_ARG_INFO
36
+ * @info: an info structure
37
+ *
38
+ * Checks if @info is a GIArgInfo.
39
+ */
34
40
  #define GI_IS_ARG_INFO(info) \
35
41
  (g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ARG)
36
42
 
43
+
44
+ GI_AVAILABLE_IN_ALL
37
45
  GIDirection g_arg_info_get_direction (GIArgInfo *info);
46
+
47
+ GI_AVAILABLE_IN_ALL
38
48
  gboolean g_arg_info_is_return_value (GIArgInfo *info);
49
+
50
+ GI_AVAILABLE_IN_ALL
39
51
  gboolean g_arg_info_is_optional (GIArgInfo *info);
52
+
53
+ GI_AVAILABLE_IN_ALL
40
54
  gboolean g_arg_info_is_caller_allocates (GIArgInfo *info);
55
+
56
+ GI_AVAILABLE_IN_ALL
41
57
  gboolean g_arg_info_may_be_null (GIArgInfo *info);
58
+
59
+ GI_AVAILABLE_IN_ALL
42
60
  gboolean g_arg_info_is_skip (GIArgInfo *info);
61
+
62
+ GI_AVAILABLE_IN_ALL
43
63
  GITransfer g_arg_info_get_ownership_transfer (GIArgInfo *info);
64
+
65
+ GI_AVAILABLE_IN_ALL
44
66
  GIScopeType g_arg_info_get_scope (GIArgInfo *info);
67
+
68
+ GI_AVAILABLE_IN_ALL
45
69
  gint g_arg_info_get_closure (GIArgInfo *info);
70
+
71
+ GI_AVAILABLE_IN_ALL
46
72
  gint g_arg_info_get_destroy (GIArgInfo *info);
73
+
74
+ GI_AVAILABLE_IN_ALL
47
75
  GITypeInfo * g_arg_info_get_type (GIArgInfo *info);
76
+
77
+ GI_AVAILABLE_IN_ALL
48
78
  void g_arg_info_load_type (GIArgInfo *info,
49
79
  GITypeInfo *type);
50
80
  G_END_DECLS