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,338 @@
1
+ # -*- Mode: Python -*-
2
+ # GObject-Introspection - a framework for introspecting GObject libraries
3
+ # Copyright (C) 2008 Colin Walters
4
+ # Copyright (C) 2008 Johan Dahlin
5
+ #
6
+ # This library is free software; you can redistribute it and/or
7
+ # modify it under the terms of the GNU Lesser General Public
8
+ # License as published by the Free Software Foundation; either
9
+ # version 2 of the License, or (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
+ # Lesser General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Lesser General Public
17
+ # License along with this library; if not, write to the
18
+ # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19
+ # Boston, MA 02111-1307, USA.
20
+ #
21
+
22
+ import os
23
+ import sys
24
+ import subprocess
25
+ import shutil
26
+ import tempfile
27
+
28
+ from .gdumpparser import IntrospectionBinary
29
+ from . import utils
30
+ from .ccompiler import CCompiler
31
+
32
+ # bugzilla.gnome.org/558436
33
+ # Compile a binary program which is then linked to a library
34
+ # we want to introspect, in order to call its get_type functions.
35
+
36
+ _PROGRAM_TEMPLATE = """/* This file is generated, do not edit */
37
+ #include <glib.h>
38
+ #include <string.h>
39
+ #include <stdlib.h>
40
+
41
+ %(gdump_include)s
42
+
43
+ int
44
+ main(int argc, char **argv)
45
+ {
46
+ GError *error = NULL;
47
+ const char *introspect_dump_prefix = "--introspect-dump=";
48
+
49
+ #if !GLIB_CHECK_VERSION(2,35,0)
50
+ g_type_init ();
51
+ #endif
52
+
53
+ %(init_sections)s
54
+
55
+ if (argc != 2 || !g_str_has_prefix (argv[1], introspect_dump_prefix))
56
+ {
57
+ g_printerr ("Usage: %%s --introspect-dump=input,output", argv[0]);
58
+ exit (1);
59
+ }
60
+
61
+ if (!dump_irepository (argv[1] + strlen(introspect_dump_prefix), &error))
62
+ {
63
+ g_printerr ("%%s\\n", error->message);
64
+ exit (1);
65
+ }
66
+ exit (0);
67
+ }
68
+ """
69
+
70
+
71
+ class CompilerError(Exception):
72
+ pass
73
+
74
+
75
+ class LinkerError(Exception):
76
+ pass
77
+
78
+
79
+ class DumpCompiler(object):
80
+
81
+ def __init__(self, options, get_type_functions, error_quark_functions):
82
+ self._options = options
83
+ self._get_type_functions = get_type_functions
84
+ self._error_quark_functions = error_quark_functions
85
+
86
+ self._compiler_cmd = os.environ.get('CC', 'cc')
87
+ self._linker_cmd = os.environ.get('CC', self._compiler_cmd)
88
+ self._pkgconfig_cmd = os.environ.get('PKG_CONFIG', 'pkg-config')
89
+ self._pkgconfig_msvc_flags = ''
90
+ # Enable the --msvc-syntax pkg-config flag when
91
+ # the Microsoft compiler is used
92
+ # (This is the other way to check whether Visual C++ is used subsequently)
93
+ args = self._compiler_cmd.split()
94
+ if 'cl.exe' in args or 'cl' in args:
95
+ self._pkgconfig_msvc_flags = '--msvc-syntax'
96
+ self._uninst_srcdir = os.environ.get(
97
+ 'UNINSTALLED_INTROSPECTION_SRCDIR')
98
+ self._packages = ['gio-2.0 gmodule-2.0']
99
+ self._packages.extend(options.packages)
100
+
101
+ # Public API
102
+
103
+ def run(self):
104
+ # We have to use the current directory to work around Unix
105
+ # sysadmins who mount /tmp noexec
106
+ tmpdir = tempfile.mkdtemp('', 'tmp-introspect', dir=os.getcwd())
107
+ os.mkdir(os.path.join(tmpdir, '.libs'))
108
+
109
+ tpl_args = {}
110
+ if self._uninst_srcdir is not None:
111
+ gdump_path = os.path.join(self._uninst_srcdir, 'girepository', 'gdump.c')
112
+ else:
113
+ gdump_path = os.path.join(os.path.join(DATADIR), 'gobject-introspection-1.0',
114
+ 'gdump.c')
115
+ if not os.path.isfile(gdump_path):
116
+ raise SystemExit("Couldn't find %r" % (gdump_path, ))
117
+ gdump_file = open(gdump_path)
118
+ gdump_contents = gdump_file.read()
119
+ gdump_file.close()
120
+ tpl_args['gdump_include'] = gdump_contents
121
+ tpl_args['init_sections'] = "\n".join(self._options.init_sections)
122
+
123
+ c_path = self._generate_tempfile(tmpdir, '.c')
124
+ f = open(c_path, 'w')
125
+ f.write(_PROGRAM_TEMPLATE % tpl_args)
126
+
127
+ # We need to reference our get_type and error_quark functions
128
+ # to make sure they are pulled in at the linking stage if the
129
+ # library is a static library rather than a shared library.
130
+ if len(self._get_type_functions) > 0:
131
+ for func in self._get_type_functions:
132
+ f.write("extern GType " + func + "(void);\n")
133
+ f.write("GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n")
134
+ first = True
135
+ for func in self._get_type_functions:
136
+ if first:
137
+ first = False
138
+ else:
139
+ f.write(",\n")
140
+ f.write(" " + func)
141
+ f.write("\n};\n")
142
+ if len(self._error_quark_functions) > 0:
143
+ for func in self._error_quark_functions:
144
+ f.write("extern GQuark " + func + "(void);\n")
145
+ f.write("GQuark (*GI_ERROR_QUARK_FUNCS_[])(void) = {\n")
146
+ first = True
147
+ for func in self._error_quark_functions:
148
+ if first:
149
+ first = False
150
+ else:
151
+ f.write(",\n")
152
+ f.write(" " + func)
153
+ f.write("\n};\n")
154
+ f.close()
155
+
156
+ # Microsoft compilers generate intermediate .obj files
157
+ # during compilation, unlike .o files like GCC and others
158
+ if self._pkgconfig_msvc_flags:
159
+ o_path = self._generate_tempfile(tmpdir, '.obj')
160
+ else:
161
+ o_path = self._generate_tempfile(tmpdir, '.o')
162
+
163
+ if os.name == 'nt':
164
+ ext = '.exe'
165
+ else:
166
+ ext = ''
167
+
168
+ bin_path = self._generate_tempfile(tmpdir, ext)
169
+
170
+ try:
171
+ self._compile(o_path, c_path)
172
+ except CompilerError as e:
173
+ if not utils.have_debug_flag('save-temps'):
174
+ shutil.rmtree(tmpdir)
175
+ raise SystemExit('compilation of temporary binary failed:' + str(e))
176
+
177
+ try:
178
+ self._link(bin_path, o_path)
179
+ except LinkerError as e:
180
+ if not utils.have_debug_flag('save-temps'):
181
+ shutil.rmtree(tmpdir)
182
+ raise SystemExit('linking of temporary binary failed: ' + str(e))
183
+
184
+ return IntrospectionBinary([bin_path], tmpdir)
185
+
186
+ # Private API
187
+
188
+ def _generate_tempfile(self, tmpdir, suffix=''):
189
+ tmpl = '%s-%s%s' % (self._options.namespace_name,
190
+ self._options.namespace_version, suffix)
191
+ return os.path.join(tmpdir, tmpl)
192
+
193
+ def _run_pkgconfig(self, flag):
194
+ # Enable the --msvc-syntax pkg-config flag when
195
+ # the Microsoft compiler is used
196
+ if self._pkgconfig_msvc_flags:
197
+ cmd = [self._pkgconfig_cmd, self._pkgconfig_msvc_flags, flag]
198
+ else:
199
+ cmd = [self._pkgconfig_cmd, flag]
200
+ proc = subprocess.Popen(
201
+ cmd + self._packages,
202
+ stdout=subprocess.PIPE)
203
+ return proc.communicate()[0].split()
204
+
205
+ def _compile(self, output, *sources):
206
+ # Not strictly speaking correct, but easier than parsing shell
207
+ args = self._compiler_cmd.split()
208
+ # Do not add -Wall when using init code as we do not include any
209
+ # header of the library being introspected
210
+ if self._compiler_cmd == 'gcc' and not self._options.init_sections:
211
+ args.append('-Wall')
212
+ # The Microsoft compiler uses different option flags for
213
+ # silencing warnings on deprecated function usage
214
+ if self._pkgconfig_msvc_flags:
215
+ args.append("-wd4996")
216
+ else:
217
+ args.append("-Wno-deprecated-declarations")
218
+ pkgconfig_flags = self._run_pkgconfig('--cflags')
219
+ args.extend([utils.cflag_real_include_path(f) for f in pkgconfig_flags])
220
+ cppflags = os.environ.get('CPPFLAGS', '')
221
+ for cppflag in cppflags.split():
222
+ args.append(cppflag)
223
+ cflags = os.environ.get('CFLAGS', '')
224
+ for cflag in cflags.split():
225
+ args.append(cflag)
226
+ for include in self._options.cpp_includes:
227
+ args.append('-I' + include)
228
+ # The Microsoft compiler uses different option flags for
229
+ # compilation result output
230
+ if self._pkgconfig_msvc_flags:
231
+ args.extend(['-c', '-Fe' + output, '-Fo' + output])
232
+ else:
233
+ args.extend(['-c', '-o', output])
234
+ for source in sources:
235
+ if not os.path.exists(source):
236
+ raise CompilerError(
237
+ "Could not find c source file: %s" % (source, ))
238
+ args.extend(list(sources))
239
+ if not self._options.quiet:
240
+ print "g-ir-scanner: compile: %s" % (
241
+ subprocess.list2cmdline(args), )
242
+ sys.stdout.flush()
243
+ try:
244
+ subprocess.check_call(args)
245
+ except subprocess.CalledProcessError as e:
246
+ raise CompilerError(e)
247
+
248
+ def _link(self, output, *sources):
249
+ args = []
250
+ libtool = utils.get_libtool_command(self._options)
251
+ if libtool:
252
+ args.extend(libtool)
253
+ args.append('--mode=link')
254
+ args.append('--tag=CC')
255
+ if self._options.quiet:
256
+ args.append('--silent')
257
+
258
+ args.extend(self._linker_cmd.split())
259
+ # We can use -o for the Microsoft compiler/linker,
260
+ # but it is considered deprecated usage with that
261
+ if self._pkgconfig_msvc_flags:
262
+ args.extend(['-Fe' + output])
263
+ else:
264
+ args.extend(['-o', output])
265
+ if libtool:
266
+ if os.name == 'nt':
267
+ args.append('-Wl,--export-all-symbols')
268
+ else:
269
+ args.append('-export-dynamic')
270
+
271
+ cppflags = os.environ.get('CPPFLAGS', '')
272
+ for cppflag in cppflags.split():
273
+ args.append(cppflag)
274
+ cflags = os.environ.get('CFLAGS', '')
275
+ for cflag in cflags.split():
276
+ args.append(cflag)
277
+ ldflags = os.environ.get('LDFLAGS', '')
278
+ for ldflag in ldflags.split():
279
+ args.append(ldflag)
280
+
281
+ # Make sure to list the library to be introspected first since it's
282
+ # likely to be uninstalled yet and we want the uninstalled RPATHs have
283
+ # priority (or we might run with installed library that is older)
284
+
285
+ for source in sources:
286
+ if not os.path.exists(source):
287
+ raise CompilerError(
288
+ "Could not find object file: %s" % (source, ))
289
+ args.extend(list(sources))
290
+
291
+ cc = CCompiler()
292
+
293
+ if not self._options.external_library:
294
+ cc.get_internal_link_flags(args,
295
+ libtool,
296
+ self._options.libraries,
297
+ self._options.library_paths,
298
+ self._pkgconfig_msvc_flags,
299
+ self._options.namespace_name,
300
+ self._options.namespace_version)
301
+ args.extend(self._run_pkgconfig('--libs'))
302
+
303
+ else:
304
+ args.extend(self._run_pkgconfig('--libs'))
305
+ cc.get_external_link_flags(args,
306
+ self._options.libraries,
307
+ self._pkgconfig_msvc_flags)
308
+
309
+ if not self._options.quiet:
310
+ print "g-ir-scanner: link: %s" % (
311
+ subprocess.list2cmdline(args), )
312
+ sys.stdout.flush()
313
+ msys = os.environ.get('MSYSTEM', None)
314
+ if msys:
315
+ shell = os.environ.get('SHELL', 'sh.exe')
316
+ # Create a temporary script file that
317
+ # runs the command we want
318
+ tf, tf_name = tempfile.mkstemp()
319
+ f = os.fdopen(tf, 'wb')
320
+ shellcontents = ' '.join([x.replace('\\', '/') for x in args])
321
+ fcontents = '#!/bin/sh\nunset PWD\n{}\n'.format(shellcontents)
322
+ f.write(fcontents)
323
+ f.close()
324
+ shell = utils.which(shell)
325
+ args = [shell, tf_name.replace('\\', '/')]
326
+ try:
327
+ subprocess.check_call(args)
328
+ except subprocess.CalledProcessError as e:
329
+ raise LinkerError(e)
330
+ finally:
331
+ if msys:
332
+ os.remove(tf_name)
333
+
334
+
335
+ def compile_introspection_binary(options, get_type_functions,
336
+ error_quark_functions):
337
+ dc = DumpCompiler(options, get_type_functions, error_quark_functions)
338
+ return dc.run()
@@ -0,0 +1,529 @@
1
+ # -*- Mode: Python -*-
2
+ # GObject-Introspection - a framework for introspecting GObject libraries
3
+ # Copyright (C) 2008 Johan Dahlin
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 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
17
+ # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
+ # Boston, MA 02111-1307, USA.
19
+ #
20
+
21
+ import os
22
+ import sys
23
+ import tempfile
24
+ import shutil
25
+ import subprocess
26
+ from xml.etree.cElementTree import parse
27
+
28
+ from . import ast
29
+ from . import message
30
+ from . import utils
31
+ from .transformer import TransformerException
32
+ from .utils import to_underscores
33
+
34
+ # GParamFlags
35
+ G_PARAM_READABLE = 1 << 0
36
+ G_PARAM_WRITABLE = 1 << 1
37
+ G_PARAM_CONSTRUCT = 1 << 2
38
+ G_PARAM_CONSTRUCT_ONLY = 1 << 3
39
+ G_PARAM_LAX_VALIDATION = 1 << 4
40
+ G_PARAM_STATIC_NAME = 1 << 5
41
+ G_PARAM_STATIC_NICK = 1 << 6
42
+ G_PARAM_STATIC_BLURB = 1 << 7
43
+
44
+
45
+ class IntrospectionBinary(object):
46
+
47
+ def __init__(self, args, tmpdir=None):
48
+ self.args = args
49
+ if tmpdir is None:
50
+ self.tmpdir = tempfile.mkdtemp('', 'tmp-introspect')
51
+ else:
52
+ self.tmpdir = tmpdir
53
+
54
+
55
+ class Unresolved(object):
56
+
57
+ def __init__(self, target):
58
+ self.target = target
59
+
60
+
61
+ class UnknownTypeError(Exception):
62
+ pass
63
+
64
+
65
+ class GDumpParser(object):
66
+
67
+ def __init__(self, transformer):
68
+ self._transformer = transformer
69
+ self._namespace = transformer.namespace
70
+ self._binary = None
71
+ self._get_type_functions = []
72
+ self._error_quark_functions = []
73
+ self._error_domains = {}
74
+ self._boxed_types = {}
75
+ self._private_internal_types = {}
76
+
77
+ # Public API
78
+
79
+ def init_parse(self):
80
+ """Do parsing steps that don't involve the introspection binary
81
+
82
+ This does enough work that get_type_functions() can be called.
83
+
84
+ """
85
+
86
+ # First pass: parsing
87
+ for node in self._namespace.itervalues():
88
+ if isinstance(node, ast.Function):
89
+ self._initparse_function(node)
90
+
91
+ if self._namespace.name == 'GObject' or self._namespace.name == 'GLib':
92
+ for node in self._namespace.itervalues():
93
+ if isinstance(node, ast.Record):
94
+ self._initparse_gobject_record(node)
95
+
96
+ def get_get_type_functions(self):
97
+ return self._get_type_functions
98
+
99
+ def get_error_quark_functions(self):
100
+ return self._error_quark_functions
101
+
102
+ def set_introspection_binary(self, binary):
103
+ self._binary = binary
104
+
105
+ def parse(self):
106
+ """Do remaining parsing steps requiring introspection binary"""
107
+
108
+ # Get all the GObject data by passing our list of get_type
109
+ # functions to the compiled binary, returning an XML blob.
110
+ tree = self._execute_binary_get_tree()
111
+ root = tree.getroot()
112
+ for child in root:
113
+ if child.tag == 'error-quark':
114
+ self._introspect_error_quark(child)
115
+ else:
116
+ self._introspect_type(child)
117
+
118
+ # Pair up boxed types and class records
119
+ for name, boxed in self._boxed_types.iteritems():
120
+ self._pair_boxed_type(boxed)
121
+ for node in self._namespace.itervalues():
122
+ if isinstance(node, (ast.Class, ast.Interface)):
123
+ self._find_class_record(node)
124
+
125
+ # Clear the _get_type functions out of the namespace;
126
+ # Anyone who wants them can get them from the ast.Class/Interface/Boxed
127
+ to_remove = []
128
+ for name, node in self._namespace.iteritems():
129
+ if isinstance(node, ast.Registered) and node.get_type is not None:
130
+ get_type_name = node.get_type
131
+ if get_type_name == 'intern':
132
+ continue
133
+ assert get_type_name, node
134
+ (ns, name) = self._transformer.split_csymbol(get_type_name)
135
+ assert ns is self._namespace
136
+ get_type_func = self._namespace.get(name)
137
+ assert get_type_func, name
138
+ to_remove.append(get_type_func)
139
+ for node in to_remove:
140
+ self._namespace.remove(node)
141
+
142
+ # Helper functions
143
+
144
+ def _execute_binary_get_tree(self):
145
+ """Load the library (or executable), returning an XML
146
+ blob containing data gleaned from GObject's primitive introspection."""
147
+ in_path = os.path.join(self._binary.tmpdir, 'functions.txt')
148
+ f = open(in_path, 'w')
149
+ for func in self._get_type_functions:
150
+ f.write('get-type:')
151
+ f.write(func)
152
+ f.write('\n')
153
+ for func in self._error_quark_functions:
154
+ f.write('error-quark:')
155
+ f.write(func)
156
+ f.write('\n')
157
+ f.close()
158
+ out_path = os.path.join(self._binary.tmpdir, 'dump.xml')
159
+
160
+ args = []
161
+ args.extend(self._binary.args)
162
+ args.append('--introspect-dump=%s,%s' % (in_path, out_path))
163
+
164
+ # Invoke the binary, having written our get_type functions to types.txt
165
+ try:
166
+ try:
167
+ subprocess.check_call(args, stdout=sys.stdout, stderr=sys.stderr)
168
+ except subprocess.CalledProcessError as e:
169
+ # Clean up temporaries
170
+ raise SystemExit(e)
171
+ return parse(out_path)
172
+ finally:
173
+ if not utils.have_debug_flag('save-temps'):
174
+ shutil.rmtree(self._binary.tmpdir)
175
+
176
+ # Parser
177
+
178
+ def _initparse_function(self, func):
179
+ symbol = func.symbol
180
+ if symbol.startswith('_'):
181
+ return
182
+ elif (symbol.endswith('_get_type') or symbol.endswith('_get_gtype')):
183
+ self._initparse_get_type_function(func)
184
+ elif symbol.endswith('_error_quark'):
185
+ self._initparse_error_quark_function(func)
186
+
187
+ def _initparse_get_type_function(self, func):
188
+ if func.symbol == 'g_variant_get_gtype':
189
+ # We handle variants internally, see _initparse_gobject_record
190
+ return True
191
+
192
+ if func.is_type_meta_function():
193
+ self._get_type_functions.append(func.symbol)
194
+ return True
195
+
196
+ return False
197
+
198
+ def _initparse_error_quark_function(self, func):
199
+ if (func.retval.type.ctype != 'GQuark'):
200
+ return False
201
+ self._error_quark_functions.append(func.symbol)
202
+ return True
203
+
204
+ def _initparse_gobject_record(self, record):
205
+ if (record.name.startswith('ParamSpec')
206
+ and not record.name in ('ParamSpecPool', 'ParamSpecClass', 'ParamSpecTypeInfo')):
207
+ parent = None
208
+ if record.name != 'ParamSpec':
209
+ parent = ast.Type(target_giname='GObject.ParamSpec')
210
+ prefix = to_underscores(record.name).lower()
211
+ node = ast.Class(record.name, parent,
212
+ ctype=record.ctype,
213
+ # GParamSpecXxx has g_type_name 'GParamXxx'
214
+ gtype_name=record.ctype.replace('Spec', ''),
215
+ get_type='intern',
216
+ c_symbol_prefix=prefix)
217
+ node.fundamental = True
218
+ if record.name == 'ParamSpec':
219
+ node.is_abstract = True
220
+ self._add_record_fields(node)
221
+ self._namespace.append(node, replace=True)
222
+ elif record.name == 'Variant':
223
+ self._boxed_types['GVariant'] = ast.Boxed('Variant',
224
+ gtype_name='GVariant',
225
+ get_type='intern',
226
+ c_symbol_prefix='variant')
227
+ elif record.name == 'InitiallyUnownedClass':
228
+ record.fields = self._namespace.get('ObjectClass').fields
229
+ record.disguised = False
230
+
231
+ # Introspection over the data we get from the dynamic
232
+ # GObject/GType system out of the binary
233
+
234
+ def _introspect_type(self, xmlnode):
235
+ if xmlnode.tag in ('enum', 'flags'):
236
+ self._introspect_enum(xmlnode)
237
+ elif xmlnode.tag == 'class':
238
+ self._introspect_object(xmlnode)
239
+ elif xmlnode.tag == 'interface':
240
+ self._introspect_interface(xmlnode)
241
+ elif xmlnode.tag == 'boxed':
242
+ self._introspect_boxed(xmlnode)
243
+ elif xmlnode.tag == 'fundamental':
244
+ self._introspect_fundamental(xmlnode)
245
+ else:
246
+ raise ValueError("Unhandled introspection XML tag %s", xmlnode.tag)
247
+
248
+ def _introspect_enum(self, xmlnode):
249
+ type_name = xmlnode.attrib['name']
250
+ (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
251
+ try:
252
+ enum_name = self._transformer.strip_identifier(type_name)
253
+ except TransformerException as e:
254
+ message.fatal(e)
255
+
256
+ # The scanned member values are more accurate than the values that the
257
+ # we dumped from GEnumValue.value because GEnumValue.value has the
258
+ # values as a 32-bit signed integer, even if they were unsigned
259
+ # in the source code.
260
+ previous_values = {}
261
+ previous = self._namespace.get(enum_name)
262
+ if isinstance(previous, (ast.Enum, ast.Bitfield)):
263
+ for member in previous.members:
264
+ previous_values[member.name] = member.value
265
+
266
+ members = []
267
+ for member in xmlnode.findall('member'):
268
+ # Keep the name closer to what we'd take from C by default;
269
+ # see http://bugzilla.gnome.org/show_bug.cgi?id=575613
270
+ name = member.attrib['nick'].replace('-', '_')
271
+
272
+ if name in previous_values:
273
+ value = previous_values[name]
274
+ else:
275
+ value = member.attrib['value']
276
+
277
+ members.append(ast.Member(name,
278
+ value,
279
+ member.attrib['name'],
280
+ member.attrib['nick']))
281
+
282
+ if xmlnode.tag == 'flags':
283
+ klass = ast.Bitfield
284
+ else:
285
+ klass = ast.Enum
286
+
287
+ node = klass(enum_name, type_name,
288
+ gtype_name=type_name,
289
+ c_symbol_prefix=c_symbol_prefix,
290
+ members=members,
291
+ get_type=xmlnode.attrib['get-type'])
292
+ self._namespace.append(node, replace=True)
293
+
294
+ def _split_type_and_symbol_prefix(self, xmlnode):
295
+ """Infer the C symbol prefix from the _get_type function."""
296
+ get_type = xmlnode.attrib['get-type']
297
+ (ns, name) = self._transformer.split_csymbol(get_type)
298
+ assert ns is self._namespace
299
+ if name in ('get_type', '_get_gtype'):
300
+ message.fatal("""The GObject name %r isn't compatible
301
+ with the configured identifier prefixes:
302
+ %r
303
+ The class would have no name. Most likely you want to specify a
304
+ different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.identifier_prefixes))
305
+ if name.endswith('_get_type'):
306
+ type_suffix = '_get_type'
307
+ else:
308
+ type_suffix = '_get_gtype'
309
+ return (get_type, name[:-len(type_suffix)])
310
+
311
+ def _introspect_object(self, xmlnode):
312
+ type_name = xmlnode.attrib['name']
313
+ is_abstract = bool(xmlnode.attrib.get('abstract', False))
314
+ (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
315
+ try:
316
+ object_name = self._transformer.strip_identifier(type_name)
317
+ except TransformerException as e:
318
+ message.fatal(e)
319
+ node = ast.Class(object_name, None,
320
+ gtype_name=type_name,
321
+ get_type=get_type,
322
+ c_symbol_prefix=c_symbol_prefix,
323
+ is_abstract=is_abstract)
324
+ self._parse_parents(xmlnode, node)
325
+ self._introspect_properties(node, xmlnode)
326
+ self._introspect_signals(node, xmlnode)
327
+ self._introspect_implemented_interfaces(node, xmlnode)
328
+ self._add_record_fields(node)
329
+ self._namespace.append(node, replace=True)
330
+
331
+ def _introspect_interface(self, xmlnode):
332
+ type_name = xmlnode.attrib['name']
333
+ (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
334
+ try:
335
+ interface_name = self._transformer.strip_identifier(type_name)
336
+ except TransformerException as e:
337
+ message.fatal(e)
338
+ node = ast.Interface(interface_name, None,
339
+ gtype_name=type_name,
340
+ get_type=get_type,
341
+ c_symbol_prefix=c_symbol_prefix)
342
+ self._introspect_properties(node, xmlnode)
343
+ self._introspect_signals(node, xmlnode)
344
+ for child in xmlnode.findall('prerequisite'):
345
+ name = child.attrib['name']
346
+ prereq = ast.Type.create_from_gtype_name(name)
347
+ node.prerequisites.append(prereq)
348
+
349
+ record = self._namespace.get(node.name)
350
+ if isinstance(record, ast.Record):
351
+ node.ctype = record.ctype
352
+ else:
353
+ message.warn_node(node, "Couldn't find associated structure for '%r'" % (node.name, ))
354
+
355
+ # GtkFileChooserEmbed is an example of a private interface, we
356
+ # just filter them out
357
+ if xmlnode.attrib['get-type'].startswith('_'):
358
+ self._private_internal_types[type_name] = node
359
+ else:
360
+ self._namespace.append(node, replace=True)
361
+
362
+ ## WORKAROUND ##
363
+ # https://bugzilla.gnome.org/show_bug.cgi?id=550616
364
+ def _introspect_boxed_gstreamer_workaround(self, xmlnode):
365
+ node = ast.Boxed('ParamSpecMiniObject', gtype_name='GParamSpecMiniObject',
366
+ get_type='gst_param_spec_mini_object_get_type',
367
+ c_symbol_prefix='param_spec_mini_object')
368
+ self._boxed_types[node.gtype_name] = node
369
+
370
+ def _introspect_boxed(self, xmlnode):
371
+ type_name = xmlnode.attrib['name']
372
+
373
+ # Work around GStreamer legacy naming issue
374
+ # https://bugzilla.gnome.org/show_bug.cgi?id=550616
375
+ if type_name == 'GParamSpecMiniObject':
376
+ self._introspect_boxed_gstreamer_workaround(xmlnode)
377
+ return
378
+
379
+ try:
380
+ name = self._transformer.strip_identifier(type_name)
381
+ except TransformerException as e:
382
+ message.fatal(e)
383
+ # This one doesn't go in the main namespace; we associate it with
384
+ # the struct or union
385
+ (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
386
+ node = ast.Boxed(name, gtype_name=type_name,
387
+ get_type=get_type,
388
+ c_symbol_prefix=c_symbol_prefix)
389
+ self._boxed_types[node.gtype_name] = node
390
+
391
+ def _introspect_implemented_interfaces(self, node, xmlnode):
392
+ gt_interfaces = []
393
+ for interface in xmlnode.findall('implements'):
394
+ gitype = ast.Type.create_from_gtype_name(interface.attrib['name'])
395
+ gt_interfaces.append(gitype)
396
+ node.interfaces = gt_interfaces
397
+
398
+ def _introspect_properties(self, node, xmlnode):
399
+ for pspec in xmlnode.findall('property'):
400
+ ctype = pspec.attrib['type']
401
+ flags = int(pspec.attrib['flags'])
402
+ readable = (flags & G_PARAM_READABLE) != 0
403
+ writable = (flags & G_PARAM_WRITABLE) != 0
404
+ construct = (flags & G_PARAM_CONSTRUCT) != 0
405
+ construct_only = (flags & G_PARAM_CONSTRUCT_ONLY) != 0
406
+ node.properties.append(ast.Property(
407
+ pspec.attrib['name'],
408
+ ast.Type.create_from_gtype_name(ctype),
409
+ readable, writable, construct, construct_only))
410
+ node.properties = node.properties
411
+
412
+ def _introspect_signals(self, node, xmlnode):
413
+ for signal_info in xmlnode.findall('signal'):
414
+ rctype = signal_info.attrib['return']
415
+ rtype = ast.Type.create_from_gtype_name(rctype)
416
+ return_ = ast.Return(rtype)
417
+ parameters = []
418
+ when = signal_info.attrib.get('when')
419
+ no_recurse = signal_info.attrib.get('no-recurse', '0') == '1'
420
+ detailed = signal_info.attrib.get('detailed', '0') == '1'
421
+ action = signal_info.attrib.get('action', '0') == '1'
422
+ no_hooks = signal_info.attrib.get('no-hooks', '0') == '1'
423
+ for i, parameter in enumerate(signal_info.findall('param')):
424
+ if i == 0:
425
+ argname = 'object'
426
+ else:
427
+ argname = 'p%s' % (i - 1, )
428
+ pctype = parameter.attrib['type']
429
+ ptype = ast.Type.create_from_gtype_name(pctype)
430
+ param = ast.Parameter(argname, ptype)
431
+ param.transfer = ast.PARAM_TRANSFER_NONE
432
+ parameters.append(param)
433
+ signal = ast.Signal(signal_info.attrib['name'], return_, parameters,
434
+ when=when, no_recurse=no_recurse, detailed=detailed,
435
+ action=action, no_hooks=no_hooks)
436
+ node.signals.append(signal)
437
+ node.signals = node.signals
438
+
439
+ def _parse_parents(self, xmlnode, node):
440
+ parents_str = xmlnode.attrib.get('parents', '')
441
+ if parents_str != '':
442
+ parent_types = map(lambda s: ast.Type.create_from_gtype_name(s),
443
+ parents_str.split(','))
444
+ else:
445
+ parent_types = []
446
+ node.parent_chain = parent_types
447
+
448
+ def _introspect_fundamental(self, xmlnode):
449
+ type_name = xmlnode.attrib['name']
450
+
451
+ is_abstract = bool(xmlnode.attrib.get('abstract', False))
452
+ (get_type, c_symbol_prefix) = self._split_type_and_symbol_prefix(xmlnode)
453
+ try:
454
+ fundamental_name = self._transformer.strip_identifier(type_name)
455
+ except TransformerException as e:
456
+ message.warn(e)
457
+ return
458
+
459
+ node = ast.Class(fundamental_name, None,
460
+ gtype_name=type_name,
461
+ get_type=get_type,
462
+ c_symbol_prefix=c_symbol_prefix,
463
+ is_abstract=is_abstract)
464
+ self._parse_parents(xmlnode, node)
465
+ node.fundamental = True
466
+ self._introspect_implemented_interfaces(node, xmlnode)
467
+
468
+ self._add_record_fields(node)
469
+ self._namespace.append(node, replace=True)
470
+
471
+ def _add_record_fields(self, node):
472
+ # add record fields
473
+ record = self._namespace.get(node.name)
474
+ if not isinstance(record, ast.Record):
475
+ return
476
+ node.ctype = record.ctype
477
+ node.fields = record.fields
478
+ for field in node.fields:
479
+ if isinstance(field, ast.Field):
480
+ # Object instance fields are assumed to be read-only
481
+ # (see also _find_class_record and transformer.py)
482
+ field.writable = False
483
+
484
+ def _introspect_error_quark(self, xmlnode):
485
+ symbol = xmlnode.attrib['function']
486
+ error_domain = xmlnode.attrib['domain']
487
+ function = self._namespace.get_by_symbol(symbol)
488
+ if function is None:
489
+ return
490
+
491
+ node = ast.ErrorQuarkFunction(function.name, function.retval,
492
+ function.parameters, function.throws,
493
+ function.symbol, error_domain)
494
+ self._namespace.append(node, replace=True)
495
+
496
+ def _pair_boxed_type(self, boxed):
497
+ try:
498
+ name = self._transformer.strip_identifier(boxed.gtype_name)
499
+ except TransformerException as e:
500
+ message.fatal(e)
501
+ pair_node = self._namespace.get(name)
502
+ if not pair_node:
503
+ # Keep the "bare" boxed instance
504
+ self._namespace.append(boxed)
505
+ elif isinstance(pair_node, (ast.Record, ast.Union)):
506
+ pair_node.add_gtype(boxed.gtype_name, boxed.get_type)
507
+ assert boxed.c_symbol_prefix is not None
508
+ pair_node.c_symbol_prefix = boxed.c_symbol_prefix
509
+ # Quick hack - reset the disguised flag; we're setting it
510
+ # incorrectly in the scanner
511
+ pair_node.disguised = False
512
+ else:
513
+ return False
514
+
515
+ def _find_class_record(self, cls):
516
+ pair_record = None
517
+ if isinstance(cls, ast.Class):
518
+ pair_record = self._namespace.get(cls.name + 'Class')
519
+ else:
520
+ for suffix in ('Iface', 'Interface'):
521
+ pair_record = self._namespace.get(cls.name + suffix)
522
+ if pair_record:
523
+ break
524
+ if not (pair_record and isinstance(pair_record, ast.Record)):
525
+ return
526
+
527
+ cls.glib_type_struct = pair_record.create_type()
528
+ cls.inherit_file_positions(pair_record)
529
+ pair_record.is_gtype_struct_for = cls.create_type()