gobject-introspection 2.2.4-x64-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 (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,60 @@
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
+ #ifndef RB_GOBJECT_INTROSPECTION_H
22
+ #define RB_GOBJECT_INTROSPECTION_H
23
+
24
+ #include <ruby.h>
25
+ #include <rbgobject.h>
26
+
27
+ #include <girepository.h>
28
+
29
+ typedef gpointer (*RBGICallbackFinderFunc)(GIArgInfo *info);
30
+
31
+ typedef struct
32
+ {
33
+ GIArgInfo arg_info;
34
+ GIScopeType scope_type;
35
+ GIDirection direction;
36
+ gboolean callback_p;
37
+ gboolean closure_p;
38
+ gboolean destroy_p;
39
+ gboolean array_p;
40
+ gboolean array_length_p;
41
+ gint in_arg_index;
42
+ gint closure_in_arg_index;
43
+ gint destroy_in_arg_index;
44
+ gint array_in_arg_index;
45
+ gint array_length_in_arg_index;
46
+ gint array_length_arg_index;
47
+ gint rb_arg_index;
48
+ gint out_arg_index;
49
+ } RBGIArgMetadata;
50
+
51
+ typedef struct {
52
+ RBGIArgMetadata *metadata;
53
+ VALUE rb_gc_guard_key;
54
+ VALUE rb_callback;
55
+ } RBGICallbackData;
56
+
57
+ void rb_gi_callback_register_finder (RBGICallbackFinderFunc finder);
58
+ void rb_gi_callback_data_free (RBGICallbackData *callback_data);
59
+
60
+ #endif
data/extconf.rb ADDED
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby
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, MA 02110-1301 USA
18
+
19
+ require "pathname"
20
+ require "mkmf"
21
+ require "rbconfig"
22
+ require "fileutils"
23
+
24
+ module_name = "gobject_introspection"
25
+ package = "gobject-introspection"
26
+
27
+ base_dir = Pathname(__FILE__).dirname.expand_path
28
+ ext_dir = base_dir + "ext" + package
29
+ mkmf_gnome2_dir = base_dir + 'lib'
30
+
31
+ if RbConfig.respond_to?(:ruby)
32
+ ruby = RbConfig.ruby
33
+ else
34
+ ruby = File.join(RbConfig::CONFIG['bindir'],
35
+ RbConfig::CONFIG['ruby_install_name'] +
36
+ RbConfig::CONFIG["EXEEXT"])
37
+ end
38
+ build_dir = Pathname("ext") + package
39
+ FileUtils.mkdir_p(build_dir.to_s) unless build_dir.exist?
40
+ extconf_rb_path = ext_dir + "extconf.rb"
41
+ unless system(ruby, "-C", build_dir.to_s, extconf_rb_path.to_s, *ARGV)
42
+ exit(false)
43
+ end
44
+
45
+ create_makefile(module_name)
46
+ FileUtils.mv("Makefile", "Makefile.lib")
47
+
48
+ File.open("Makefile", "w") do |makefile|
49
+ makefile.puts(<<-EOM)
50
+ all:
51
+ (cd ext/#{package} && $(MAKE))
52
+ $(MAKE) -f Makefile.lib
53
+
54
+ install:
55
+ (cd ext/#{package} && $(MAKE) install)
56
+ $(MAKE) -f Makefile.lib install
57
+
58
+ site-install:
59
+ (cd ext/#{package} && $(MAKE) site-install)
60
+ $(MAKE) -f Makefile.lib site-install
61
+
62
+ clean:
63
+ (cd ext/#{package} && $(MAKE) clean)
64
+ $(MAKE) -f Makefile.lib clean
65
+
66
+ distclean:
67
+ (cd ext/#{package} && $(MAKE) distclean)
68
+ $(MAKE) -f Makefile.lib distclean
69
+ @rm -f Makefile.lib
70
+ EOM
71
+ end
Binary file
Binary file
Binary file
@@ -0,0 +1,53 @@
1
+ # Copyright (C) 2012-2013 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
+ require "glib2"
18
+
19
+ module GObjectIntrospection
20
+ class << self
21
+ def prepend_typelib_path(path)
22
+ GLib.prepend_path_to_environment_variable(path, "GI_TYPELIB_PATH")
23
+ end
24
+ end
25
+ end
26
+
27
+ base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
28
+ vendor_dir = base_dir + "vendor" + "local"
29
+ vendor_bin_dir = vendor_dir + "bin"
30
+ GLib.prepend_dll_path(vendor_bin_dir)
31
+ begin
32
+ major, minor, _ = RUBY_VERSION.split(/\./)
33
+ require "#{major}.#{minor}/gobject_introspection.so"
34
+ rescue LoadError
35
+ require "gobject_introspection.so"
36
+ end
37
+
38
+ vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
39
+ GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
40
+
41
+ module GObjectIntrospection
42
+ LOG_DOMAIN = "GObjectIntrospection"
43
+ end
44
+ GLib::Log.set_log_domain(GObjectIntrospection::LOG_DOMAIN)
45
+
46
+ require "gobject-introspection/repository"
47
+ require "gobject-introspection/callable-info"
48
+ require "gobject-introspection/object-info"
49
+ require "gobject-introspection/interface-info"
50
+ require "gobject-introspection/struct-info"
51
+ require "gobject-introspection/boxed-info"
52
+ require "gobject-introspection/union-info"
53
+ require "gobject-introspection/loader"
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2013 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
+ require "gobject-introspection/collection-reader"
18
+
19
+ module GObjectIntrospection
20
+ class BoxedInfo
21
+ extend CollectionReader
22
+
23
+ alias_method :__methods__, :methods
24
+
25
+ collection_reader("fields")
26
+ collection_reader("methods")
27
+ end
28
+ end
@@ -0,0 +1,100 @@
1
+ # Copyright (C) 2013 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
+ require "gobject-introspection/collection-reader"
18
+
19
+ module GObjectIntrospection
20
+ class CallableInfo
21
+ extend CollectionReader
22
+
23
+ collection_reader("args")
24
+
25
+ def in_args
26
+ array_length_indexes = []
27
+ callback_indexes = []
28
+ closure_indexes = []
29
+ destroy_indexes = []
30
+ args.each_with_index do |arg, i|
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
43
+ end
44
+
45
+ args.find_all.with_index do |arg, i|
46
+ case arg.direction
47
+ when Direction::IN, Direction::INOUT
48
+ if array_length_indexes.include?(i)
49
+ false
50
+ elsif callback_indexes.include?(i)
51
+ false
52
+ elsif closure_indexes.include?(i)
53
+ false
54
+ elsif destroy_indexes.include?(i)
55
+ false
56
+ else
57
+ true
58
+ end
59
+ else
60
+ false
61
+ end
62
+ end
63
+ end
64
+
65
+ def required_in_args
66
+ in_args.reject do |arg|
67
+ arg.may_be_null?
68
+ end
69
+ end
70
+
71
+ def n_in_args
72
+ in_args.size
73
+ end
74
+
75
+ def n_required_in_args
76
+ required_in_args.size
77
+ end
78
+
79
+ def require_callback?
80
+ args.any? do |arg|
81
+ arg.direction == Direction::IN and arg.scope != ScopeType::INVALID
82
+ end
83
+ end
84
+
85
+ def out_args
86
+ args.find_all do |arg|
87
+ case arg.direction
88
+ when Direction::OUT, Direction::INOUT
89
+ true
90
+ else
91
+ false
92
+ end
93
+ end
94
+ end
95
+
96
+ def n_out_args
97
+ out_args.size
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,34 @@
1
+ # Copyright (C) 2012 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
+ module CollectionReader
19
+ def collection_reader(name)
20
+ n_getter = "n_#{name}"
21
+ if name.end_with?("ies")
22
+ singular = name.sub(/ies\z/, "y")
23
+ else
24
+ singular = name.sub(/s\z/, "")
25
+ end
26
+ getter = "get_#{singular}"
27
+ define_method(name) do
28
+ send(n_getter).times.collect do |i|
29
+ send(getter, i)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,32 @@
1
+ # Copyright (C) 2013 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
+ require "gobject-introspection/collection-reader"
18
+
19
+ module GObjectIntrospection
20
+ class InterfaceInfo
21
+ extend CollectionReader
22
+
23
+ alias_method :__methods__, :methods
24
+
25
+ collection_reader("prerequisites")
26
+ collection_reader("properties")
27
+ collection_reader("methods")
28
+ collection_reader("signals")
29
+ collection_reader("vfuncs")
30
+ collection_reader("constants")
31
+ end
32
+ end
@@ -0,0 +1,465 @@
1
+ # Copyright (C) 2012-2013 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 Loader
19
+ class << self
20
+ def load(namespace, base_module, options={})
21
+ loader = new(base_module)
22
+ loader.version = options[:version]
23
+ loader.load(namespace)
24
+ end
25
+ end
26
+
27
+ attr_accessor :version
28
+ def initialize(base_module)
29
+ @base_module = base_module
30
+ @version = nil
31
+ end
32
+
33
+ def load(namespace)
34
+ repository = Repository.default
35
+ repository.require(namespace, @version)
36
+ pre_load(repository, namespace)
37
+ repository.each(namespace) do |info|
38
+ load_info(info)
39
+ end
40
+ post_load(repository, namespace)
41
+ end
42
+
43
+ private
44
+ def pre_load(repository, namespace)
45
+ end
46
+
47
+ def post_load(repository, namespace)
48
+ end
49
+
50
+ def load_info(info)
51
+ case info
52
+ when FunctionInfo
53
+ load_function_info(info)
54
+ when StructInfo
55
+ load_struct_info(info)
56
+ when BoxedInfo
57
+ load_boxed_info(info)
58
+ when FlagsInfo
59
+ load_flags_info(info)
60
+ when EnumInfo
61
+ load_enum_info(info)
62
+ when ObjectInfo
63
+ load_object_info(info)
64
+ when InterfaceInfo
65
+ load_interface_info(info)
66
+ when ConstantInfo
67
+ load_constant_info(info)
68
+ when UnionInfo
69
+ load_union_info(info)
70
+ end
71
+ end
72
+
73
+ def load_function_info(info)
74
+ name = rubyish_method_name(info)
75
+ define_module_function(@base_module, name, info)
76
+ end
77
+
78
+ def define_module_function(target_module, name, function_info)
79
+ unlock_gvl = should_unlock_gvl?(function_info, target_module)
80
+ validate = lambda do |arguments|
81
+ method_name = "#{target_module}\#.#{name}"
82
+ validate_arguments(function_info, method_name, arguments)
83
+ end
84
+ target_module.module_eval do
85
+ define_method(name) do |*arguments, &block|
86
+ validate.call(arguments, &block)
87
+ function_info.invoke({
88
+ :arguments => arguments,
89
+ :unlock_gvl => unlock_gvl,
90
+ },
91
+ &block)
92
+ end
93
+ module_function(name)
94
+ end
95
+ end
96
+
97
+ def define_singleton_method(klass, name, info)
98
+ unlock_gvl = should_unlock_gvl?(info, klass)
99
+ validate = lambda do |arguments|
100
+ validate_arguments(info, "#{klass}.#{name}", arguments)
101
+ end
102
+ singleton_class = (class << klass; self; end)
103
+ singleton_class.__send__(:define_method, name) do |*arguments, &block|
104
+ validate.call(arguments, &block)
105
+ if block.nil? and info.require_callback?
106
+ Enumerator.new(self, name, *arguments)
107
+ else
108
+ info.invoke({
109
+ :arguments => arguments,
110
+ :unlock_gvl => unlock_gvl,
111
+ },
112
+ &block)
113
+ end
114
+ end
115
+ end
116
+
117
+ def define_struct(info, options={})
118
+ if info.gtype == GLib::Type::NONE
119
+ klass = self.class.define_struct(info.size, info.name, @base_module,
120
+ :parent => options[:parent])
121
+ else
122
+ klass = self.class.define_class(info.gtype, info.name, @base_module,
123
+ :parent => options[:parent],
124
+ :size => info.size)
125
+ end
126
+ load_fields(info, klass)
127
+ load_methods(info, klass)
128
+ end
129
+
130
+ def load_struct_info(info)
131
+ return if info.gtype_struct?
132
+
133
+ define_struct(info)
134
+ end
135
+
136
+ def define_boxed(info)
137
+ klass = self.class.define_class(info.gtype, info.name, @base_module)
138
+ _ = klass # TODO: Remove me. It is just for suppressing a warning.
139
+ # TODO
140
+ # load_fields(info, klass)
141
+ # load_methods(info, klass)
142
+ end
143
+
144
+ def load_boxed_info(info)
145
+ define_boxed(info)
146
+ end
147
+
148
+ def load_enum_value(value_info, enum_module)
149
+ enum_module.const_set(value_info.name.upcase, value_info.value)
150
+ end
151
+
152
+ def define_enum(info)
153
+ self.class.define_class(info.gtype,
154
+ enum_class_name(info),
155
+ @base_module)
156
+ end
157
+
158
+ def enum_class_name(info)
159
+ info.name
160
+ end
161
+
162
+ def define_error(info)
163
+ self.class.define_error(info.error_domain,
164
+ error_class_name(info),
165
+ @base_module,
166
+ :parent => error_parent_class(info),
167
+ :gtype => info.gtype)
168
+ end
169
+
170
+ def error_class_name(info)
171
+ info.name
172
+ end
173
+
174
+ def error_parent_class(info)
175
+ nil
176
+ end
177
+
178
+ def load_enum_info(info)
179
+ if info.gtype == GLib::Type::NONE
180
+ enum_module = Module.new
181
+ info.values.each do |value_info|
182
+ load_enum_value(value_info, enum_module)
183
+ end
184
+ @base_module.const_set(info.name, enum_module)
185
+ else
186
+ if info.error_domain
187
+ define_error(info)
188
+ else
189
+ define_enum(info)
190
+ end
191
+ end
192
+ end
193
+
194
+ def load_flag_value(value_info, flags_module)
195
+ flags_module.const_set(value_info.name.upcase, value_info.value)
196
+ end
197
+
198
+ def load_flags_info(info)
199
+ if info.gtype == GLib::Type::NONE
200
+ flags_module = Module.new
201
+ info.values.each do |value_info|
202
+ load_flag_value(value_info, flags_module)
203
+ end
204
+ @base_module.const_set(info.name, flags_module)
205
+ else
206
+ self.class.define_class(info.gtype, info.name, @base_module)
207
+ end
208
+ end
209
+
210
+ def load_object_info(info)
211
+ klass = self.class.define_class(info.gtype, info.name, @base_module)
212
+ load_fields(info, klass)
213
+ load_methods(info, klass)
214
+ end
215
+
216
+ def load_fields(info, klass)
217
+ info.n_fields.times do |i|
218
+ field_info = info.get_field(i)
219
+ load_field(info, i, field_info, klass)
220
+ end
221
+ end
222
+
223
+ def load_field(info, i, field_info, klass)
224
+ name = field_info.name
225
+ flags = field_info.flags
226
+
227
+ if flags.readable?
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 ||
234
+ info.get_field_value(self, i)
235
+ end
236
+ end
237
+
238
+ if flags.writable?
239
+ klass.__send__(:define_method, "#{name}=") do |value|
240
+ info.set_field_value(self, i, value)
241
+ end
242
+ end
243
+ end
244
+
245
+ def load_methods(info, klass)
246
+ grouped_methods = info.methods.group_by do |method_info|
247
+ method_info.class
248
+ end
249
+ grouped_methods.each do |method_info_class, method_infos|
250
+ next if method_infos.empty?
251
+ case method_infos.first
252
+ when ConstructorInfo
253
+ load_constructor_infos(method_infos, klass)
254
+ when MethodInfo
255
+ load_method_infos(method_infos, klass)
256
+ when FunctionInfo
257
+ load_function_infos(method_infos, klass)
258
+ else
259
+ raise "TODO: #{method_info_class}"
260
+ end
261
+ end
262
+ end
263
+
264
+ def load_constructor_infos(infos, klass)
265
+ return if infos.empty?
266
+
267
+ validate = lambda do |info, method_name, arguments|
268
+ validate_arguments(info, "#{klass}\##{method_name}", arguments)
269
+ end
270
+ infos.each do |info|
271
+ name = "initialize_#{info.name}"
272
+ unlock_gvl = should_unlock_gvl?(info, klass)
273
+ klass.__send__(:define_method, name) do |*arguments, &block|
274
+ validate.call(info, name, arguments, &block)
275
+ info.invoke({
276
+ :receiver => self,
277
+ :arguments => arguments,
278
+ :unlock_gvl => unlock_gvl,
279
+ },
280
+ &block)
281
+ end
282
+ klass.__send__(:private, name)
283
+ end
284
+
285
+ find_info = lambda do |arguments|
286
+ find_suitable_callable_info(infos, arguments)
287
+ end
288
+ klass.__send__(:define_method, "initialize") do |*arguments, &block|
289
+ info = find_info.call(arguments, &block)
290
+ __send__("initialize_#{info.name}", *arguments, &block)
291
+ end
292
+ end
293
+
294
+ def validate_arguments(info, method_name, arguments)
295
+ n_in_args = info.n_in_args
296
+ n_required_in_args = info.n_required_in_args
297
+ return if (n_required_in_args..n_in_args).cover?(arguments.size)
298
+
299
+ detail = "#{arguments.size} for "
300
+ if n_in_args == n_required_in_args
301
+ detail << "#{n_in_args}"
302
+ else
303
+ detail << "#{n_required_in_args}..#{n_in_args}"
304
+ end
305
+ message = "#{method_name}: wrong number of arguments (#{detail})"
306
+ raise ArgumentError, message
307
+ end
308
+
309
+ def find_suitable_callable_info(infos, arguments)
310
+ min_n_args = nil
311
+ max_n_args = nil
312
+ candidate_infos = []
313
+ infos.each do |info|
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)
317
+ candidate_infos << info
318
+ end
319
+ min_n_args = [min_n_args || n_required_in_args, n_required_in_args].min
320
+ max_n_args = [max_n_args || n_in_args, n_in_args].max
321
+ end
322
+
323
+ if candidate_infos.size == 1
324
+ return candidate_infos.first
325
+ elsif candidate_infos.size > 1
326
+ candidate_info = candidate_infos.find do |info|
327
+ in_arg_infos = info.in_args
328
+ arguments.each.with_index.all? do |argument, i|
329
+ match_argument?(in_arg_infos[i], argument)
330
+ end
331
+ end
332
+ return candidate_info || candidate_infos.first
333
+ end
334
+
335
+ detail = "#{arguments.size} for #{min_n_args}"
336
+ if min_n_args < max_n_args
337
+ detail << "..#{max_n_args}"
338
+ end
339
+ raise ArgumentError, "wrong number of arguments (#{detail})"
340
+ end
341
+
342
+ def match_argument?(arg_info, argument)
343
+ case arg_info.type.tag
344
+ when TypeTag::UTF8
345
+ argument.is_a?(String)
346
+ else
347
+ # TODO
348
+ false
349
+ end
350
+ end
351
+
352
+ def rubyish_method_name(function_info, options={})
353
+ name = function_info.name
354
+ if options[:prefix]
355
+ name = name.gsub(/\A#{Regexp.escape(options[:prefix])}/, "")
356
+ end
357
+ return_type = function_info.return_type
358
+ if return_type.tag == GObjectIntrospection::TypeTag::BOOLEAN
359
+ case name
360
+ when /\A(?:is|get_is)_/
361
+ "#{$POSTMATCH}?"
362
+ when /\Aget_/
363
+ if function_info.n_in_args.zero?
364
+ "#{$POSTMATCH}?"
365
+ else
366
+ name
367
+ end
368
+ when /\A(?:has|use)_/
369
+ "#{name}?"
370
+ else
371
+ name
372
+ end
373
+ elsif /\Aget_/ =~ name and function_info.n_in_args.zero?
374
+ $POSTMATCH
375
+ else
376
+ case name
377
+ when "to_string"
378
+ "to_s"
379
+ when "foreach"
380
+ "each"
381
+ else
382
+ name
383
+ end
384
+ end
385
+ end
386
+
387
+ def should_unlock_gvl?(function_info, klass)
388
+ false
389
+ end
390
+
391
+ def load_method_infos(infos, klass)
392
+ infos.each do |info|
393
+ method_name = rubyish_method_name(info)
394
+ load_method_info(info, klass, method_name)
395
+ end
396
+ end
397
+
398
+ def load_method_info(info, klass, method_name)
399
+ define_method(info, klass, method_name)
400
+ define_equal_style_setter(info, klass, method_name)
401
+ end
402
+
403
+ def define_method(info, klass, method_name)
404
+ unlock_gvl = should_unlock_gvl?(info, klass)
405
+ validate = lambda do |arguments|
406
+ validate_arguments(info, "#{klass}\##{method_name}", arguments)
407
+ 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
+ klass.__send__(:define_method, method_name) do |*arguments, &block|
414
+ arguments = [self] + arguments if function_info_p
415
+ validate.call(arguments, &block)
416
+ if block.nil? and info.require_callback?
417
+ to_enum(method_name, *arguments)
418
+ else
419
+ options = {
420
+ :arguments => arguments,
421
+ :unlock_gvl => unlock_gvl,
422
+ }
423
+ options[:receiver] = self unless function_info_p
424
+ info.invoke(options, &block)
425
+ end
426
+ end
427
+ end
428
+
429
+ def define_equal_style_setter(info, klass, method_name)
430
+ if /\Aset_/ =~ method_name and info.n_args == 1
431
+ 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
436
+ klass.__send__(:alias_method, setter_method_name, method_name)
437
+ end
438
+ end
439
+
440
+ def load_function_infos(infos, klass)
441
+ infos.each do |info|
442
+ name = rubyish_method_name(info)
443
+ next if name == "new"
444
+ next if name == "alloc"
445
+ define_singleton_method(klass, name, info)
446
+ end
447
+ end
448
+
449
+ def load_interface_info(info)
450
+ interface_module =
451
+ self.class.define_interface(info.gtype, info.name, @base_module)
452
+ load_methods(info, interface_module)
453
+ end
454
+
455
+ def load_constant_info(info)
456
+ @base_module.const_set(info.name, info.value)
457
+ end
458
+
459
+ def load_union_info(info)
460
+ klass = self.class.define_class(info.gtype, info.name, @base_module)
461
+ load_fields(info, klass)
462
+ load_methods(info, klass)
463
+ end
464
+ end
465
+ end