gobject-introspection 2.2.4-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (294) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +129 -0
  3. data/ext/gobject-introspection/depend +10 -0
  4. data/ext/gobject-introspection/extconf.rb +94 -0
  5. data/ext/gobject-introspection/gobject_introspection.def +5 -0
  6. data/ext/gobject-introspection/rb-gi-arg-info.c +151 -0
  7. data/ext/gobject-introspection/rb-gi-argument.c +2053 -0
  8. data/ext/gobject-introspection/rb-gi-base-info.c +218 -0
  9. data/ext/gobject-introspection/rb-gi-boxed-info.c +48 -0
  10. data/ext/gobject-introspection/rb-gi-callable-info.c +104 -0
  11. data/ext/gobject-introspection/rb-gi-callback-info.c +48 -0
  12. data/ext/gobject-introspection/rb-gi-constant-info.c +77 -0
  13. data/ext/gobject-introspection/rb-gi-constructor-info.c +133 -0
  14. data/ext/gobject-introspection/rb-gi-conversions.h +145 -0
  15. data/ext/gobject-introspection/rb-gi-enum-info.c +155 -0
  16. data/ext/gobject-introspection/rb-gi-field-info.c +153 -0
  17. data/ext/gobject-introspection/rb-gi-flags-info.c +48 -0
  18. data/ext/gobject-introspection/rb-gi-function-info.c +841 -0
  19. data/ext/gobject-introspection/rb-gi-interface-info.c +222 -0
  20. data/ext/gobject-introspection/rb-gi-loader.c +224 -0
  21. data/ext/gobject-introspection/rb-gi-method-info.c +83 -0
  22. data/ext/gobject-introspection/rb-gi-object-info.c +345 -0
  23. data/ext/gobject-introspection/rb-gi-private.h +105 -0
  24. data/ext/gobject-introspection/rb-gi-property-info.c +77 -0
  25. data/ext/gobject-introspection/rb-gi-registered-type-info.c +86 -0
  26. data/ext/gobject-introspection/rb-gi-repository.c +246 -0
  27. data/ext/gobject-introspection/rb-gi-signal-info.c +77 -0
  28. data/ext/gobject-introspection/rb-gi-struct-info.c +202 -0
  29. data/ext/gobject-introspection/rb-gi-type-info.c +143 -0
  30. data/ext/gobject-introspection/rb-gi-type-tag.c +43 -0
  31. data/ext/gobject-introspection/rb-gi-types.h +71 -0
  32. data/ext/gobject-introspection/rb-gi-union-info.c +206 -0
  33. data/ext/gobject-introspection/rb-gi-unresolved-info.c +48 -0
  34. data/ext/gobject-introspection/rb-gi-value-info.c +57 -0
  35. data/ext/gobject-introspection/rb-gi-vfunc-info.c +91 -0
  36. data/ext/gobject-introspection/rb-gobject-introspection.c +44 -0
  37. data/ext/gobject-introspection/rb-gobject-introspection.h +60 -0
  38. data/extconf.rb +71 -0
  39. data/lib/2.0/gobject_introspection.so +0 -0
  40. data/lib/2.1/gobject_introspection.so +0 -0
  41. data/lib/2.2/gobject_introspection.so +0 -0
  42. data/lib/gobject-introspection.rb +53 -0
  43. data/lib/gobject-introspection/boxed-info.rb +28 -0
  44. data/lib/gobject-introspection/callable-info.rb +100 -0
  45. data/lib/gobject-introspection/collection-reader.rb +34 -0
  46. data/lib/gobject-introspection/interface-info.rb +32 -0
  47. data/lib/gobject-introspection/loader.rb +465 -0
  48. data/lib/gobject-introspection/object-info.rb +33 -0
  49. data/lib/gobject-introspection/repository.rb +32 -0
  50. data/lib/gobject-introspection/struct-info.rb +28 -0
  51. data/lib/gobject-introspection/union-info.rb +28 -0
  52. data/test/gobject-introspection-test-utils.rb +26 -0
  53. data/test/run-test.rb +45 -0
  54. data/test/test-arg-info.rb +68 -0
  55. data/test/test-base-info.rb +31 -0
  56. data/test/test-boxed-info.rb +21 -0
  57. data/test/test-callable-info.rb +49 -0
  58. data/test/test-callback-info.rb +29 -0
  59. data/test/test-constant-info.rb +24 -0
  60. data/test/test-enum-info.rb +61 -0
  61. data/test/test-field-type.rb +42 -0
  62. data/test/test-flags-info.rb +27 -0
  63. data/test/test-function-info.rb +39 -0
  64. data/test/test-interface-info.rb +97 -0
  65. data/test/test-loader.rb +30 -0
  66. data/test/test-object-info.rb +131 -0
  67. data/test/test-property-info.rb +38 -0
  68. data/test/test-registered-type-info.rb +35 -0
  69. data/test/test-repository.rb +62 -0
  70. data/test/test-signal-info.rb +40 -0
  71. data/test/test-struct-info.rb +57 -0
  72. data/test/test-type-info.rb +62 -0
  73. data/test/test-type-tag.rb +29 -0
  74. data/test/test-union-info.rb +21 -0
  75. data/test/test-value-info.rb +28 -0
  76. data/test/test-vfunc-info.rb +42 -0
  77. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  78. data/vendor/local/bin/g-ir-generate.exe +0 -0
  79. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  80. data/vendor/local/include/gobject-introspection-1.0/giarginfo.h +82 -0
  81. data/vendor/local/include/gobject-introspection-1.0/gibaseinfo.h +120 -0
  82. data/vendor/local/include/gobject-introspection-1.0/gicallableinfo.h +110 -0
  83. data/vendor/local/include/gobject-introspection-1.0/giconstantinfo.h +58 -0
  84. data/vendor/local/include/gobject-introspection-1.0/gienuminfo.h +82 -0
  85. data/vendor/local/include/gobject-introspection-1.0/gifieldinfo.h +71 -0
  86. data/vendor/local/include/gobject-introspection-1.0/gifunctioninfo.h +100 -0
  87. data/vendor/local/include/gobject-introspection-1.0/giinterfaceinfo.h +106 -0
  88. data/vendor/local/include/gobject-introspection-1.0/giobjectinfo.h +207 -0
  89. data/vendor/local/include/gobject-introspection-1.0/gipropertyinfo.h +56 -0
  90. data/vendor/local/include/gobject-introspection-1.0/giregisteredtypeinfo.h +64 -0
  91. data/vendor/local/include/gobject-introspection-1.0/girepository.h +239 -0
  92. data/vendor/local/include/gobject-introspection-1.0/girffi.h +104 -0
  93. data/vendor/local/include/gobject-introspection-1.0/gisignalinfo.h +57 -0
  94. data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +77 -0
  95. data/vendor/local/include/gobject-introspection-1.0/gitypeinfo.h +87 -0
  96. data/vendor/local/include/gobject-introspection-1.0/gitypelib.h +80 -0
  97. data/vendor/local/include/gobject-introspection-1.0/gitypes.h +524 -0
  98. data/vendor/local/include/gobject-introspection-1.0/giunioninfo.h +84 -0
  99. data/vendor/local/include/gobject-introspection-1.0/giversionmacros.h +128 -0
  100. data/vendor/local/include/gobject-introspection-1.0/givfuncinfo.h +73 -0
  101. data/vendor/local/lib/girepository-1.0/DBus-1.0.typelib +0 -0
  102. data/vendor/local/lib/girepository-1.0/DBusGLib-1.0.typelib +0 -0
  103. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  104. data/vendor/local/lib/girepository-1.0/GL-1.0.typelib +0 -0
  105. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  106. data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
  107. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  108. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  109. data/vendor/local/lib/girepository-1.0/cairo-1.0.typelib +0 -0
  110. data/vendor/local/lib/girepository-1.0/fontconfig-2.0.typelib +0 -0
  111. data/vendor/local/lib/girepository-1.0/freetype2-2.0.typelib +0 -0
  112. data/vendor/local/lib/girepository-1.0/libxml2-2.0.typelib +0 -0
  113. data/vendor/local/lib/girepository-1.0/win32-1.0.typelib +0 -0
  114. data/vendor/local/lib/girepository-1.0/xfixes-4.0.typelib +0 -0
  115. data/vendor/local/lib/girepository-1.0/xft-2.0.typelib +0 -0
  116. data/vendor/local/lib/girepository-1.0/xlib-2.0.typelib +0 -0
  117. data/vendor/local/lib/girepository-1.0/xrandr-1.3.typelib +0 -0
  118. data/vendor/local/lib/gobject-introspection/giscanner/__init__.py +24 -0
  119. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  120. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  121. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +76 -0
  122. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  123. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  124. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +2161 -0
  125. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  126. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  127. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +1139 -0
  128. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  129. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  130. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +203 -0
  131. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  132. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  133. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.py +202 -0
  134. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  135. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  136. data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +173 -0
  137. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  138. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  139. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.py +23 -0
  140. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  141. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  142. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.py +305 -0
  143. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  144. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  145. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.py +120 -0
  146. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  147. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  148. data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +72 -0
  149. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  150. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  151. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/callback.tmpl +4 -0
  152. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/class.tmpl +2 -0
  153. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/constructor.tmpl +1 -0
  154. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/default.tmpl +1 -0
  155. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/enum.tmpl +2 -0
  156. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/field.tmpl +1 -0
  157. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/function.tmpl +60 -0
  158. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/interface.tmpl +2 -0
  159. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/method.tmpl +1 -0
  160. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/namespace.tmpl +1 -0
  161. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/property.tmpl +5 -0
  162. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/record.tmpl +1 -0
  163. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/signal.tmpl +5 -0
  164. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/vfunc.tmpl +4 -0
  165. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/callback.tmpl +27 -0
  166. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/class.tmpl +30 -0
  167. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/constructor.tmpl +1 -0
  168. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/default.tmpl +1 -0
  169. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/enum.tmpl +21 -0
  170. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/field.tmpl +9 -0
  171. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/function.tmpl +47 -0
  172. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/interface.tmpl +17 -0
  173. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/method.tmpl +1 -0
  174. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/namespace.tmpl +2 -0
  175. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/property.tmpl +9 -0
  176. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/record.tmpl +2 -0
  177. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/signal.tmpl +38 -0
  178. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/vfunc.tmpl +27 -0
  179. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/callback.tmpl +27 -0
  180. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/class.tmpl +18 -0
  181. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/constructor.tmpl +1 -0
  182. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/default.tmpl +1 -0
  183. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/enum.tmpl +13 -0
  184. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/field.tmpl +1 -0
  185. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/function.tmpl +47 -0
  186. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/interface.tmpl +16 -0
  187. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/method.tmpl +1 -0
  188. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/namespace.tmpl +2 -0
  189. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/property.tmpl +9 -0
  190. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/record.tmpl +2 -0
  191. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/signal.tmpl +41 -0
  192. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/vfunc.tmpl +27 -0
  193. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/base.tmpl +20 -0
  194. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/class.tmpl +61 -0
  195. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/namespace.tmpl +16 -0
  196. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +958 -0
  197. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  198. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  199. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +338 -0
  200. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  201. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  202. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +529 -0
  203. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  204. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  205. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +593 -0
  206. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  207. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  208. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +612 -0
  209. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  210. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  211. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.py +240 -0
  212. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  213. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  214. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.py +76 -0
  215. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  216. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  217. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +1366 -0
  218. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  219. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  220. data/vendor/local/lib/gobject-introspection/giscanner/message.py +203 -0
  221. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  222. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  223. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +561 -0
  224. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  225. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  226. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.py +152 -0
  227. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  228. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  229. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +140 -0
  230. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  231. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  232. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +329 -0
  233. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  234. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  235. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +136 -0
  236. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  237. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  238. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +971 -0
  239. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  240. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  241. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +211 -0
  242. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  243. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  244. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +156 -0
  245. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  246. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  247. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  248. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  249. data/vendor/local/lib/libgirepository-1.0.la +41 -0
  250. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +26 -0
  251. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +23 -0
  252. data/vendor/local/lib/pkgconfig/patched +0 -0
  253. data/vendor/local/share/aclocal/introspection.m4 +96 -0
  254. data/vendor/local/share/gir-1.0/DBus-1.0.gir +32 -0
  255. data/vendor/local/share/gir-1.0/DBusGLib-1.0.gir +18 -0
  256. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +4042 -0
  257. data/vendor/local/share/gir-1.0/GL-1.0.gir +31 -0
  258. data/vendor/local/share/gir-1.0/GLib-2.0.gir +47221 -0
  259. data/vendor/local/share/gir-1.0/GModule-2.0.gir +301 -0
  260. data/vendor/local/share/gir-1.0/GObject-2.0.gir +14733 -0
  261. data/vendor/local/share/gir-1.0/Gio-2.0.gir +82459 -0
  262. data/vendor/local/share/gir-1.0/cairo-1.0.gir +70 -0
  263. data/vendor/local/share/gir-1.0/fontconfig-2.0.gir +18 -0
  264. data/vendor/local/share/gir-1.0/freetype2-2.0.gir +22 -0
  265. data/vendor/local/share/gir-1.0/libxml2-2.0.gir +25 -0
  266. data/vendor/local/share/gir-1.0/win32-1.0.gir +19 -0
  267. data/vendor/local/share/gir-1.0/xfixes-4.0.gir +10 -0
  268. data/vendor/local/share/gir-1.0/xft-2.0.gir +23 -0
  269. data/vendor/local/share/gir-1.0/xlib-2.0.gir +67 -0
  270. data/vendor/local/share/gir-1.0/xrandr-1.3.gir +16 -0
  271. data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +166 -0
  272. data/vendor/local/share/gobject-introspection-1.0/gdump.c +569 -0
  273. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +831 -0
  274. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +301 -0
  275. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.c +57 -0
  276. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.h +44 -0
  277. data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +1579 -0
  278. data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +535 -0
  279. data/vendor/local/share/gobject-introspection-1.0/tests/foo.c +790 -0
  280. data/vendor/local/share/gobject-introspection-1.0/tests/foo.h +582 -0
  281. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +5426 -0
  282. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +1948 -0
  283. data/vendor/local/share/gobject-introspection-1.0/tests/gitestmacros.h +10 -0
  284. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +4068 -0
  285. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +1415 -0
  286. data/vendor/local/share/gobject-introspection-1.0/tests/utility.c +47 -0
  287. data/vendor/local/share/gobject-introspection-1.0/tests/utility.h +102 -0
  288. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.c +47 -0
  289. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.h +46 -0
  290. data/vendor/local/share/license/gobject-introspection/AUTHORS +9 -0
  291. data/vendor/local/share/license/gobject-introspection/COPYING +12 -0
  292. data/vendor/local/share/man/man1/g-ir-compiler.1 +42 -0
  293. data/vendor/local/share/man/man1/g-ir-generate.1 +29 -0
  294. metadata +363 -0
@@ -0,0 +1,48 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gi-private.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIFlagsInfo
24
+
25
+ GType
26
+ gi_flags_info_get_type(void)
27
+ {
28
+ static GType type = 0;
29
+ if (type == 0) {
30
+ type = g_boxed_type_register_static("GIFlagsInfo",
31
+ (GBoxedCopyFunc)g_base_info_ref,
32
+ (GBoxedFreeFunc)g_base_info_unref);
33
+ }
34
+ return type;
35
+ }
36
+
37
+ void
38
+ rb_gi_flags_info_init(VALUE rb_mGI, VALUE rb_cGIEnumInfo)
39
+ {
40
+ VALUE RG_TARGET_NAMESPACE;
41
+
42
+ RG_TARGET_NAMESPACE =
43
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_FLAGS_INFO, "FlagsInfo", rb_mGI,
44
+ rb_cGIEnumInfo);
45
+
46
+ /* Suppress a warning. */
47
+ (void)RG_TARGET_NAMESPACE;
48
+ }
@@ -0,0 +1,841 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
4
+ *
5
+ * This library is free software; you can redistribute it and/or
6
+ * modify it under the terms of the GNU Lesser General Public
7
+ * License as published by the Free Software Foundation; either
8
+ * version 2.1 of the License, or (at your option) any later version.
9
+ *
10
+ * This library is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this library; if not, write to the Free Software
17
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
+ * MA 02110-1301 USA
19
+ */
20
+
21
+ #include "rb-gi-private.h"
22
+
23
+ #ifdef HAVE_RUBY_THREAD_H
24
+ # include <ruby/thread.h>
25
+ # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE void *
26
+ # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE NULL
27
+ #else
28
+ # define rb_thread_call_without_gvl(func, func_data, ubf, ubf_data) \
29
+ rb_thread_blocking_region(func, func_data, ubf, ubf_data)
30
+ # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE VALUE
31
+ # define RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE Qnil
32
+ #endif
33
+
34
+ #define RG_TARGET_NAMESPACE rb_cGIFunctionInfo
35
+ #define SELF(self) RVAL2GI_FUNCTION_INFO(self)
36
+
37
+ static VALUE RG_TARGET_NAMESPACE;
38
+ static VALUE rb_cGLibError;
39
+ static const char *callbacks_key = "gi_callbacks";
40
+ static GPtrArray *callback_finders;
41
+
42
+ GType
43
+ gi_function_info_get_type(void)
44
+ {
45
+ static GType type = 0;
46
+ if (type == 0) {
47
+ type = g_boxed_type_register_static("GIFunctionInfo",
48
+ (GBoxedCopyFunc)g_base_info_ref,
49
+ (GBoxedFreeFunc)g_base_info_unref);
50
+ }
51
+ return type;
52
+ }
53
+
54
+ static VALUE
55
+ rg_symbol(VALUE self)
56
+ {
57
+ GIFunctionInfo *info;
58
+
59
+ info = SELF(self);
60
+ return CSTR2RVAL(g_function_info_get_symbol(info));
61
+ }
62
+
63
+ static VALUE
64
+ rg_flags(VALUE self)
65
+ {
66
+ GIFunctionInfo *info;
67
+
68
+ info = SELF(self);
69
+ return GI_FUNCTION_INFO_FLAGS2RVAL(g_function_info_get_flags(info));
70
+ }
71
+
72
+ static VALUE
73
+ rg_property(VALUE self)
74
+ {
75
+ GIFunctionInfo *info;
76
+
77
+ info = SELF(self);
78
+ return GI_BASE_INFO2RVAL(g_function_info_get_property(info));
79
+ }
80
+
81
+ static VALUE
82
+ rg_vfunc(VALUE self)
83
+ {
84
+ GIFunctionInfo *info;
85
+
86
+ info = SELF(self);
87
+ return GI_BASE_INFO2RVAL(g_function_info_get_vfunc(info));
88
+ }
89
+
90
+ static void
91
+ allocate_arguments(GICallableInfo *info,
92
+ GArray *in_args, GArray *out_args,
93
+ GPtrArray *args_metadata)
94
+ {
95
+ gint i, n_args;
96
+
97
+ n_args = g_callable_info_get_n_args(info);
98
+ for (i = 0; i < n_args; i++) {
99
+ GIArgument argument;
100
+ RBGIArgMetadata *metadata;
101
+ GIArgInfo *arg_info;
102
+ GIDirection direction;
103
+
104
+ memset(&argument, 0, sizeof(GIArgument));
105
+
106
+ metadata = ALLOC(RBGIArgMetadata);
107
+ arg_info = &(metadata->arg_info);
108
+ g_callable_info_load_arg(info, i, arg_info);
109
+ metadata->scope_type = g_arg_info_get_scope(arg_info);
110
+ metadata->direction = g_arg_info_get_direction(arg_info);
111
+ metadata->callback_p = (metadata->scope_type != GI_SCOPE_TYPE_INVALID);
112
+ metadata->closure_p = FALSE;
113
+ metadata->destroy_p = FALSE;
114
+ metadata->array_p = FALSE;
115
+ metadata->array_length_p = FALSE;
116
+ metadata->in_arg_index = -1;
117
+ metadata->closure_in_arg_index = -1;
118
+ metadata->destroy_in_arg_index = -1;
119
+ metadata->array_in_arg_index = -1;
120
+ metadata->array_length_in_arg_index = -1;
121
+ metadata->array_length_arg_index = -1;
122
+ metadata->rb_arg_index = -1;
123
+ metadata->out_arg_index = -1;
124
+
125
+ direction = metadata->direction;
126
+ if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
127
+ metadata->in_arg_index = in_args->len;
128
+ g_array_append_val(in_args, argument);
129
+ }
130
+ if (direction == GI_DIRECTION_OUT || direction == GI_DIRECTION_INOUT) {
131
+ metadata->out_arg_index = out_args->len;
132
+ g_array_append_val(out_args, argument);
133
+ }
134
+
135
+ g_ptr_array_add(args_metadata, metadata);
136
+ }
137
+ }
138
+
139
+ static void
140
+ fill_metadata_callback(GPtrArray *args_metadata)
141
+ {
142
+ guint i;
143
+
144
+ for (i = 0; i < args_metadata->len; i++) {
145
+ RBGIArgMetadata *metadata;
146
+ GIArgInfo *arg_info;
147
+ gint closure_index;
148
+ gint destroy_index;
149
+
150
+ metadata = g_ptr_array_index(args_metadata, i);
151
+ if (!metadata->callback_p) {
152
+ continue;
153
+ }
154
+
155
+ arg_info = &(metadata->arg_info);
156
+ closure_index = g_arg_info_get_closure(arg_info);
157
+ if (closure_index != -1) {
158
+ RBGIArgMetadata *closure_metadata;
159
+ closure_metadata = g_ptr_array_index(args_metadata, closure_index);
160
+ closure_metadata->closure_p = TRUE;
161
+ metadata->closure_in_arg_index = closure_metadata->in_arg_index;
162
+ }
163
+
164
+ destroy_index = g_arg_info_get_destroy(arg_info);
165
+ if (destroy_index != -1) {
166
+ RBGIArgMetadata *destroy_metadata;
167
+ destroy_metadata = g_ptr_array_index(args_metadata, destroy_index);
168
+ destroy_metadata->destroy_p = TRUE;
169
+ metadata->destroy_in_arg_index = destroy_metadata->in_arg_index;
170
+ }
171
+ }
172
+ }
173
+
174
+ static void
175
+ fill_metadata_array(GPtrArray *args_metadata)
176
+ {
177
+ guint i;
178
+
179
+ for (i = 0; i < args_metadata->len; i++) {
180
+ RBGIArgMetadata *metadata;
181
+ RBGIArgMetadata *array_length_metadata;
182
+ GIArgInfo *arg_info;
183
+ GITypeInfo type_info;
184
+ gint array_length_index = -1;
185
+
186
+ metadata = g_ptr_array_index(args_metadata, i);
187
+ arg_info = &(metadata->arg_info);
188
+
189
+ g_arg_info_load_type(arg_info, &type_info);
190
+ if (g_type_info_get_tag(&type_info) != GI_TYPE_TAG_ARRAY) {
191
+ continue;
192
+ }
193
+ metadata->array_p = TRUE;
194
+
195
+ array_length_index = g_type_info_get_array_length(&type_info);
196
+ if (array_length_index == -1) {
197
+ continue;
198
+ }
199
+
200
+ array_length_metadata = g_ptr_array_index(args_metadata,
201
+ array_length_index);
202
+ array_length_metadata->array_length_p = TRUE;
203
+ array_length_metadata->rb_arg_index = -1;
204
+ array_length_metadata->array_in_arg_index =
205
+ metadata->in_arg_index;
206
+ metadata->array_length_in_arg_index =
207
+ array_length_metadata->in_arg_index;
208
+ metadata->array_length_arg_index = array_length_index;
209
+ }
210
+ }
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
+ if (metadata->in_arg_index == -1) {
236
+ continue;
237
+ }
238
+
239
+ metadata->rb_arg_index = rb_arg_index;
240
+ rb_arg_index++;
241
+ }
242
+ }
243
+
244
+ static void
245
+ fill_metadata(GPtrArray *args_metadata)
246
+ {
247
+ fill_metadata_callback(args_metadata);
248
+ fill_metadata_array(args_metadata);
249
+ fill_metadata_rb_arg_index(args_metadata);
250
+ }
251
+
252
+ static void
253
+ callback_data_guard_from_gc(RBGICallbackData *callback_data)
254
+ {
255
+ VALUE rb_callbacks;
256
+
257
+ rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key);
258
+ callback_data->rb_gc_guard_key = rb_class_new_instance(0, NULL, rb_cObject);
259
+ rb_hash_aset(rb_callbacks,
260
+ callback_data->rb_gc_guard_key,
261
+ callback_data->rb_callback);
262
+ }
263
+
264
+ static void
265
+ callback_data_unguard_from_gc(RBGICallbackData *callback_data)
266
+ {
267
+ VALUE rb_callbacks;
268
+
269
+ rb_callbacks = rb_iv_get(RG_TARGET_NAMESPACE, callbacks_key);
270
+ rb_hash_delete(rb_callbacks, callback_data->rb_gc_guard_key);
271
+ }
272
+
273
+ void
274
+ rb_gi_callback_data_free(RBGICallbackData *callback_data)
275
+ {
276
+ callback_data_unguard_from_gc(callback_data);
277
+ xfree(callback_data->metadata);
278
+ xfree(callback_data);
279
+ }
280
+
281
+ static void
282
+ destroy_notify(gpointer data)
283
+ {
284
+ RBGICallbackData *callback_data = data;
285
+ rb_gi_callback_data_free(callback_data);
286
+ }
287
+
288
+ static gpointer
289
+ find_callback_function(GIArgInfo *info)
290
+ {
291
+ guint i;
292
+ gpointer callback = NULL;
293
+
294
+ for (i = 0; i < callback_finders->len; i++) {
295
+ RBGICallbackFinderFunc finder = g_ptr_array_index(callback_finders, i);
296
+ callback = finder(info);
297
+ if (callback) {
298
+ break;
299
+ }
300
+ }
301
+
302
+ return callback;
303
+ }
304
+
305
+ void
306
+ rb_gi_callback_register_finder(RBGICallbackFinderFunc finder)
307
+ {
308
+ g_ptr_array_add(callback_finders, finder);
309
+ }
310
+
311
+ static gboolean
312
+ source_func_p(GIArgInfo *info)
313
+ {
314
+ GITypeInfo type_info;
315
+ GIBaseInfo *interface_info;
316
+ GICallableInfo *callback_info;
317
+ GITypeInfo return_type_info;
318
+ GIArgInfo first_arg_info;
319
+ GITypeInfo first_arg_type_info;
320
+
321
+ g_arg_info_load_type(info, &type_info);
322
+ if (g_type_info_get_tag(&type_info) != GI_TYPE_TAG_INTERFACE) {
323
+ return FALSE;
324
+ }
325
+
326
+ interface_info = g_type_info_get_interface(&type_info);
327
+ if (g_base_info_get_type(interface_info) != GI_INFO_TYPE_CALLBACK) {
328
+ g_base_info_unref(interface_info);
329
+ return FALSE;
330
+ }
331
+
332
+ callback_info = (GICallableInfo *)interface_info;
333
+ g_callable_info_load_return_type(callback_info, &return_type_info);
334
+ if (g_type_info_get_tag(&return_type_info) != GI_TYPE_TAG_BOOLEAN) {
335
+ g_base_info_unref(interface_info);
336
+ return FALSE;
337
+ }
338
+
339
+ if (g_callable_info_get_n_args(interface_info) != 1) {
340
+ g_base_info_unref(interface_info);
341
+ return FALSE;
342
+ }
343
+
344
+ g_callable_info_load_arg(interface_info, 0, &first_arg_info);
345
+ g_arg_info_load_type(&first_arg_info, &first_arg_type_info);
346
+ if (g_type_info_get_tag(&first_arg_type_info) != GI_TYPE_TAG_VOID) {
347
+ g_base_info_unref(interface_info);
348
+ return FALSE;
349
+ }
350
+
351
+ g_base_info_unref(interface_info);
352
+ return TRUE;
353
+ }
354
+
355
+ static gboolean
356
+ source_func_callback(gpointer user_data)
357
+ {
358
+ RBGICallbackData *callback_data = user_data;
359
+ VALUE rb_keep;
360
+ ID id_call;
361
+
362
+ CONST_ID(id_call, "call");
363
+ rb_keep = rb_funcall(callback_data->rb_callback, id_call, 0);
364
+ if (callback_data->metadata->scope_type == GI_SCOPE_TYPE_ASYNC) {
365
+ rb_gi_callback_data_free(callback_data);
366
+ }
367
+ return RVAL2CBOOL(rb_keep);
368
+ }
369
+
370
+ static gpointer
371
+ source_func_callback_finder(GIArgInfo *arg_info)
372
+ {
373
+ if (!source_func_p(arg_info)) {
374
+ return NULL;
375
+ }
376
+ return source_func_callback;
377
+ }
378
+
379
+ static void
380
+ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
381
+ {
382
+ gpointer callback;
383
+ GIArgInfo *arg_info;
384
+ GIArgument *callback_argument;
385
+
386
+ arg_info = &(metadata->arg_info);
387
+ callback = find_callback_function(arg_info);
388
+ if (!callback) {
389
+ GITypeInfo type_info;
390
+ GIBaseInfo *interface_info;
391
+ VALUE rb_type_name;
392
+ g_arg_info_load_type(arg_info, &type_info);
393
+ interface_info = g_type_info_get_interface(&type_info);
394
+ rb_type_name = CSTR2RVAL(g_base_info_get_name(interface_info));
395
+ g_base_info_unref(interface_info);
396
+ rb_raise(rb_eNotImpError,
397
+ "TODO: <%s>(%s) callback is not supported yet.",
398
+ RVAL2CSTR(rb_type_name),
399
+ g_base_info_get_name(arg_info));
400
+ }
401
+
402
+ callback_argument = &(g_array_index(in_args,
403
+ GIArgument,
404
+ metadata->in_arg_index));
405
+ callback_argument->v_pointer = callback;
406
+
407
+ if (metadata->closure_in_arg_index != -1) {
408
+ RBGICallbackData *callback_data;
409
+ GIArgument *closure_argument;
410
+
411
+ callback_data = ALLOC(RBGICallbackData);
412
+ callback_data->metadata = metadata;
413
+ callback_data->rb_callback = rb_block_proc();
414
+ callback_data_guard_from_gc(callback_data);
415
+ closure_argument = &(g_array_index(in_args,
416
+ GIArgument,
417
+ metadata->closure_in_arg_index));
418
+ closure_argument->v_pointer = callback_data;
419
+ }
420
+
421
+ if (metadata->destroy_in_arg_index != -1) {
422
+ GIArgument *destroy_argument;
423
+ destroy_argument = &(g_array_index(in_args,
424
+ GIArgument,
425
+ metadata->destroy_in_arg_index));
426
+ destroy_argument->v_pointer = destroy_notify;
427
+ }
428
+ }
429
+
430
+ static void
431
+ in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments,
432
+ GArray *in_args, GPtrArray *args_metadata)
433
+ {
434
+ if (metadata->rb_arg_index == -1) {
435
+ return;
436
+ }
437
+
438
+ if (metadata->callback_p) {
439
+ in_callback_argument_from_ruby(metadata, in_args);
440
+ } else if (metadata->array_p) {
441
+ GIArgument *array_argument;
442
+ GIArgument *length_argument = NULL;
443
+ GIArgInfo *length_arg_info = NULL;
444
+ VALUE rb_argument = Qnil;
445
+
446
+ if (RARRAY_LEN(rb_arguments) > metadata->rb_arg_index) {
447
+ rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index];
448
+ }
449
+ array_argument = &(g_array_index(in_args,
450
+ GIArgument,
451
+ metadata->in_arg_index));
452
+ if (metadata->array_length_in_arg_index != -1) {
453
+ RBGIArgMetadata *length_metadata;
454
+ length_argument =
455
+ &(g_array_index(in_args,
456
+ GIArgument,
457
+ metadata->array_length_in_arg_index));
458
+ length_metadata =
459
+ g_ptr_array_index(args_metadata,
460
+ metadata->array_length_arg_index);
461
+ length_arg_info = &(length_metadata->arg_info);
462
+ }
463
+ RVAL2GI_IN_ARRAY_ARGUMENT(array_argument,
464
+ length_argument,
465
+ &(metadata->arg_info),
466
+ length_arg_info,
467
+ rb_argument);
468
+ } else {
469
+ GIArgument *argument;
470
+ VALUE rb_argument = Qnil;
471
+
472
+ if (RARRAY_LEN(rb_arguments) > metadata->rb_arg_index) {
473
+ rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index];
474
+ }
475
+ argument = &(g_array_index(in_args, GIArgument, metadata->in_arg_index));
476
+ RVAL2GI_IN_ARGUMENT(argument,
477
+ &(metadata->arg_info),
478
+ rb_argument);
479
+ }
480
+ }
481
+
482
+ static void
483
+ out_argument_from_ruby(RBGIArgMetadata *metadata, GArray *out_args)
484
+ {
485
+ GIArgument *argument;
486
+
487
+ argument = &(g_array_index(out_args, GIArgument, metadata->out_arg_index));
488
+ rb_gi_out_argument_init(argument, &(metadata->arg_info));
489
+ }
490
+
491
+ static void
492
+ arg_metadata_free(gpointer data)
493
+ {
494
+ RBGIArgMetadata *metadata = data;
495
+ if (metadata->scope_type == GI_SCOPE_TYPE_ASYNC ||
496
+ metadata->scope_type == GI_SCOPE_TYPE_NOTIFIED) {
497
+ return;
498
+ }
499
+ xfree(metadata);
500
+ }
501
+
502
+ static void
503
+ arguments_from_ruby(GICallableInfo *info, VALUE rb_arguments,
504
+ GArray *in_args, GArray *out_args,
505
+ GPtrArray *args_metadata)
506
+ {
507
+ gint i, n_args;
508
+
509
+ allocate_arguments(info, in_args, out_args, args_metadata);
510
+ fill_metadata(args_metadata);
511
+
512
+ n_args = g_callable_info_get_n_args(info);
513
+ for (i = 0; i < n_args; i++) {
514
+ RBGIArgMetadata *metadata;
515
+
516
+ metadata = g_ptr_array_index(args_metadata, i);
517
+ if (metadata->in_arg_index != -1) {
518
+ in_argument_from_ruby(metadata, rb_arguments,
519
+ in_args, args_metadata);
520
+ } else {
521
+ out_argument_from_ruby(metadata, out_args);
522
+ }
523
+ }
524
+ }
525
+
526
+ static VALUE
527
+ out_arguments_to_ruby(GICallableInfo *callable_info,
528
+ GArray *in_args, GArray *out_args,
529
+ GPtrArray *args_metadata)
530
+ {
531
+ gint i, n_args;
532
+ VALUE rb_out_args;
533
+
534
+ rb_out_args = rb_ary_new();
535
+ n_args = g_callable_info_get_n_args(callable_info);
536
+ for (i = 0; i < n_args; i++) {
537
+ RBGIArgMetadata *metadata;
538
+ GIArgument *argument = NULL;
539
+ VALUE rb_argument;
540
+
541
+ metadata = g_ptr_array_index(args_metadata, i);
542
+ if (metadata->array_length_p) {
543
+ continue;
544
+ }
545
+
546
+ switch (metadata->direction) {
547
+ case GI_DIRECTION_IN:
548
+ break;
549
+ case GI_DIRECTION_OUT:
550
+ argument = &g_array_index(out_args, GIArgument,
551
+ metadata->out_arg_index);
552
+ break;
553
+ case GI_DIRECTION_INOUT:
554
+ argument = &g_array_index(in_args, GIArgument,
555
+ metadata->in_arg_index);
556
+ break;
557
+ default:
558
+ g_assert_not_reached();
559
+ break;
560
+ }
561
+
562
+ if (!argument) {
563
+ continue;
564
+ }
565
+
566
+ if (metadata->array_p) {
567
+ GIArgument *length_argument = NULL;
568
+ GIArgInfo *length_arg_info = NULL;
569
+
570
+ if (metadata->array_length_in_arg_index != -1) {
571
+ RBGIArgMetadata *length_metadata;
572
+ length_metadata =
573
+ g_ptr_array_index(args_metadata,
574
+ metadata->array_length_arg_index);
575
+ if (length_metadata->direction == GI_DIRECTION_OUT) {
576
+ length_argument =
577
+ &g_array_index(in_args, GIArgument,
578
+ length_metadata->out_arg_index);
579
+ } else {
580
+ length_argument =
581
+ &g_array_index(in_args, GIArgument,
582
+ length_metadata->in_arg_index);
583
+ }
584
+ length_arg_info = &(length_metadata->arg_info);
585
+ }
586
+ rb_argument = GI_OUT_ARRAY_ARGUMENT2RVAL(argument,
587
+ length_argument,
588
+ &(metadata->arg_info),
589
+ length_arg_info);
590
+ } else {
591
+ rb_argument = GI_OUT_ARGUMENT2RVAL(argument, &(metadata->arg_info));
592
+ }
593
+ rb_ary_push(rb_out_args, rb_argument);
594
+ }
595
+
596
+ if (RARRAY_LEN(rb_out_args) == 0) {
597
+ return Qnil;
598
+ } else {
599
+ return rb_out_args;
600
+ }
601
+ }
602
+
603
+ static void
604
+ arguments_init(GArray **in_args, GArray **out_args, GPtrArray **args_metadata)
605
+ {
606
+ *in_args = g_array_new(FALSE, FALSE, sizeof(GIArgument));
607
+ *out_args = g_array_new(FALSE, FALSE, sizeof(GIArgument));
608
+ *args_metadata = g_ptr_array_new_with_free_func(arg_metadata_free);
609
+ }
610
+
611
+ static void
612
+ arguments_free(GArray *in_args, GArray *out_args, GPtrArray *args_metadata)
613
+ {
614
+ guint i;
615
+
616
+ for (i = 0; i < args_metadata->len; i++) {
617
+ RBGIArgMetadata *metadata;
618
+ gint in_arg_index;
619
+
620
+ metadata = g_ptr_array_index(args_metadata, i);
621
+ if (metadata->direction == GI_DIRECTION_IN ||
622
+ metadata->direction == GI_DIRECTION_INOUT) {
623
+ in_arg_index = metadata->in_arg_index;
624
+ if (in_arg_index != -1) {
625
+ GIArgument *argument;
626
+ argument = &(g_array_index(in_args, GIArgument, in_arg_index));
627
+ rb_gi_in_argument_free(argument, &(metadata->arg_info));
628
+ }
629
+ } else {
630
+ GIArgument *argument;
631
+ argument = &(g_array_index(out_args, GIArgument,
632
+ metadata->out_arg_index));
633
+ rb_gi_out_argument_fin(argument, &(metadata->arg_info));
634
+ }
635
+ }
636
+
637
+ g_array_unref(in_args);
638
+ g_array_unref(out_args);
639
+ g_ptr_array_unref(args_metadata);
640
+ }
641
+
642
+ typedef struct {
643
+ GIFunctionInfo *info;
644
+ GArray *in_args;
645
+ GArray *out_args;
646
+ GIArgument *return_value;
647
+ GError **error;
648
+ gboolean succeeded;
649
+ } InvokeData;
650
+
651
+ static void
652
+ rb_gi_function_info_invoke_raw_call(InvokeData *data)
653
+ {
654
+ data->succeeded =
655
+ g_function_info_invoke(data->info,
656
+ (GIArgument *)((void *)(data->in_args->data)),
657
+ data->in_args->len,
658
+ (GIArgument *)((void *)(data->out_args->data)),
659
+ data->out_args->len,
660
+ data->return_value,
661
+ data->error);
662
+ }
663
+
664
+ static RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_TYPE
665
+ rb_gi_function_info_invoke_raw_call_without_gvl_body(void *user_data)
666
+ {
667
+ InvokeData *data = (InvokeData *)user_data;
668
+
669
+ rb_gi_function_info_invoke_raw_call(data);
670
+
671
+ return RB_THREAD_CALL_WITHOUT_GVL_FUNC_RETURN_VALUE;
672
+ }
673
+
674
+ static gboolean
675
+ gobject_based_p(GIBaseInfo *info)
676
+ {
677
+ GIBaseInfo *container_info;
678
+ GIRegisteredTypeInfo *registered_type_info;
679
+
680
+ container_info = g_base_info_get_container(info);
681
+ if (g_base_info_get_type(container_info) != GI_INFO_TYPE_STRUCT) {
682
+ return TRUE;
683
+ }
684
+
685
+ registered_type_info = (GIRegisteredTypeInfo *)container_info;
686
+ if (g_registered_type_info_get_type_init(registered_type_info)) {
687
+ return TRUE;
688
+ }
689
+
690
+ return FALSE;
691
+ }
692
+
693
+ VALUE
694
+ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
695
+ GIArgument *return_value)
696
+ {
697
+ GICallableInfo *callable_info;
698
+ GIArgument receiver;
699
+ GArray *in_args, *out_args;
700
+ GPtrArray *args_metadata;
701
+ VALUE rb_out_args = Qnil;
702
+ gboolean succeeded;
703
+ GError *error = NULL;
704
+ gboolean unlock_gvl = FALSE;
705
+ VALUE rb_receiver, rb_arguments, rb_unlock_gvl;
706
+
707
+ if (RB_TYPE_P(rb_options, RUBY_T_ARRAY)) {
708
+ rb_receiver = Qnil;
709
+ rb_arguments = rb_options;
710
+ rb_unlock_gvl = Qnil;
711
+ } else if (NIL_P(rb_options)) {
712
+ rb_receiver = Qnil;
713
+ rb_arguments = rb_ary_new();
714
+ rb_unlock_gvl = Qnil;
715
+ } else {
716
+ rb_options = rbg_check_hash_type(rb_options);
717
+ rbg_scan_options(rb_options,
718
+ "receiver", &rb_receiver,
719
+ "arguments", &rb_arguments,
720
+ "unlock_gvl", &rb_unlock_gvl,
721
+ NULL);
722
+ }
723
+
724
+ if (NIL_P(rb_receiver)) {
725
+ receiver.v_pointer = NULL;
726
+ } else {
727
+ if (gobject_based_p((GIBaseInfo *)info)) {
728
+ receiver.v_pointer = RVAL2GOBJ(rb_receiver);
729
+ } else {
730
+ receiver.v_pointer = DATA_PTR(rb_receiver);
731
+ }
732
+ }
733
+ rb_arguments = rbg_to_array(rb_arguments);
734
+ if (!NIL_P(rb_unlock_gvl) && RVAL2CBOOL(rb_unlock_gvl)) {
735
+ unlock_gvl = TRUE;
736
+ }
737
+
738
+ callable_info = (GICallableInfo *)info;
739
+ arguments_init(&in_args, &out_args, &args_metadata);
740
+ if (receiver.v_pointer) {
741
+ g_array_append_val(in_args, receiver);
742
+ }
743
+ arguments_from_ruby(callable_info, rb_arguments,
744
+ in_args, out_args, args_metadata);
745
+ {
746
+ InvokeData data;
747
+ data.info = info;
748
+ data.in_args = in_args;
749
+ data.out_args = out_args;
750
+ data.return_value = return_value;
751
+ data.error = &error;
752
+ if (unlock_gvl) {
753
+ rb_thread_call_without_gvl(
754
+ rb_gi_function_info_invoke_raw_call_without_gvl_body, &data,
755
+ NULL, NULL);
756
+ } else {
757
+ rb_gi_function_info_invoke_raw_call(&data);
758
+ }
759
+ succeeded = data.succeeded;
760
+ }
761
+
762
+ if (succeeded) {
763
+ rb_out_args = out_arguments_to_ruby(callable_info,
764
+ in_args, out_args,
765
+ args_metadata);
766
+ }
767
+ arguments_free(in_args, out_args, args_metadata);
768
+ if (!succeeded) {
769
+ RG_RAISE_ERROR(error);
770
+ }
771
+
772
+ if (!NIL_P(rb_out_args) && RARRAY_LEN(rb_out_args) == 1) {
773
+ VALUE rb_out_arg;
774
+ rb_out_arg = RARRAY_PTR(rb_out_args)[0];
775
+ if (rb_obj_is_kind_of(rb_out_arg, rb_eException)) {
776
+ rb_exc_raise(rb_out_arg);
777
+ }
778
+ }
779
+
780
+ return rb_out_args;
781
+ }
782
+
783
+ static VALUE
784
+ rg_invoke(VALUE self, VALUE rb_options)
785
+ {
786
+ GIFunctionInfo *info;
787
+ GICallableInfo *callable_info;
788
+ GIArgument return_value;
789
+ VALUE rb_out_args;
790
+ VALUE rb_return_value;
791
+
792
+ info = SELF(self);
793
+ /* TODO: use rb_protect() */
794
+ rb_out_args = rb_gi_function_info_invoke_raw(info,
795
+ rb_options,
796
+ &return_value);
797
+
798
+ callable_info = (GICallableInfo *)info;
799
+ rb_return_value = GI_RETURN_ARGUMENT2RVAL(&return_value, callable_info);
800
+
801
+ if (NIL_P(rb_out_args)) {
802
+ return rb_return_value;
803
+ } else {
804
+ GITypeInfo return_value_info;
805
+ g_callable_info_load_return_type(callable_info, &return_value_info);
806
+ if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
807
+ rb_ary_unshift(rb_out_args, rb_return_value);
808
+ }
809
+ if (RARRAY_LEN(rb_out_args) == 1) {
810
+ return RARRAY_PTR(rb_out_args)[0];
811
+ } else {
812
+ return rb_out_args;
813
+ }
814
+ }
815
+ }
816
+
817
+ void
818
+ rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
819
+ {
820
+ rb_cGLibError = rb_const_get(mGLib, rb_intern("Error"));
821
+
822
+ RG_TARGET_NAMESPACE =
823
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_FUNCTION_INFO, "FunctionInfo", rb_mGI,
824
+ rb_cGICallableInfo);
825
+
826
+ rb_iv_set(RG_TARGET_NAMESPACE, callbacks_key, rb_hash_new());
827
+
828
+ callback_finders = g_ptr_array_new();
829
+ rb_gi_callback_register_finder(source_func_callback_finder);
830
+
831
+ RG_DEF_METHOD(symbol, 0);
832
+ RG_DEF_METHOD(flags, 0);
833
+ RG_DEF_METHOD(property, 0);
834
+ RG_DEF_METHOD(vfunc, 0);
835
+ RG_DEF_METHOD(invoke, 1);
836
+
837
+ G_DEF_CLASS(G_TYPE_I_FUNCTION_INFO_FLAGS, "FunctionInfoFlags", rb_mGI);
838
+
839
+ rb_gi_method_info_init(rb_mGI, RG_TARGET_NAMESPACE);
840
+ rb_gi_constructor_info_init(rb_mGI, RG_TARGET_NAMESPACE);
841
+ }