gobject-introspection 2.0.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (268) hide show
  1. data/Rakefile +118 -0
  2. data/ext/gobject-introspection/depend +10 -0
  3. data/ext/gobject-introspection/extconf.rb +97 -0
  4. data/ext/gobject-introspection/gobject_introspection.def +5 -0
  5. data/ext/gobject-introspection/rb-gi-arg-info.c +151 -0
  6. data/ext/gobject-introspection/rb-gi-argument.c +1015 -0
  7. data/ext/gobject-introspection/rb-gi-base-info.c +218 -0
  8. data/ext/gobject-introspection/rb-gi-boxed-info.c +48 -0
  9. data/ext/gobject-introspection/rb-gi-callable-info.c +104 -0
  10. data/ext/gobject-introspection/rb-gi-callback-info.c +48 -0
  11. data/ext/gobject-introspection/rb-gi-constant-info.c +77 -0
  12. data/ext/gobject-introspection/rb-gi-constructor-info.c +120 -0
  13. data/ext/gobject-introspection/rb-gi-conversions.h +116 -0
  14. data/ext/gobject-introspection/rb-gi-enum-info.c +145 -0
  15. data/ext/gobject-introspection/rb-gi-field-info.c +153 -0
  16. data/ext/gobject-introspection/rb-gi-flags-info.c +48 -0
  17. data/ext/gobject-introspection/rb-gi-function-info.c +658 -0
  18. data/ext/gobject-introspection/rb-gi-interface-info.c +222 -0
  19. data/ext/gobject-introspection/rb-gi-loader.c +162 -0
  20. data/ext/gobject-introspection/rb-gi-method-info.c +109 -0
  21. data/ext/gobject-introspection/rb-gi-object-info.c +345 -0
  22. data/ext/gobject-introspection/rb-gi-private.h +110 -0
  23. data/ext/gobject-introspection/rb-gi-property-info.c +77 -0
  24. data/ext/gobject-introspection/rb-gi-registered-type-info.c +86 -0
  25. data/ext/gobject-introspection/rb-gi-repository.c +164 -0
  26. data/ext/gobject-introspection/rb-gi-signal-info.c +77 -0
  27. data/ext/gobject-introspection/rb-gi-struct-info.c +190 -0
  28. data/ext/gobject-introspection/rb-gi-type-info.c +143 -0
  29. data/ext/gobject-introspection/rb-gi-type-tag.c +43 -0
  30. data/ext/gobject-introspection/rb-gi-types.h +71 -0
  31. data/ext/gobject-introspection/rb-gi-union-info.c +206 -0
  32. data/ext/gobject-introspection/rb-gi-unresolved-info.c +48 -0
  33. data/ext/gobject-introspection/rb-gi-value-info.c +57 -0
  34. data/ext/gobject-introspection/rb-gi-vfunc-info.c +91 -0
  35. data/ext/gobject-introspection/rb-gobject-introspection.c +44 -0
  36. data/ext/gobject-introspection/rb-gobject-introspection.h +57 -0
  37. data/extconf.rb +71 -0
  38. data/lib/1.9/gobject_introspection.so +0 -0
  39. data/lib/2.0/gobject_introspection.so +0 -0
  40. data/lib/gobject-introspection.rb +52 -0
  41. data/lib/gobject-introspection/callable-info.rb +91 -0
  42. data/lib/gobject-introspection/collection-reader.rb +34 -0
  43. data/lib/gobject-introspection/interface-info.rb +32 -0
  44. data/lib/gobject-introspection/loader.rb +328 -0
  45. data/lib/gobject-introspection/object-info.rb +33 -0
  46. data/lib/gobject-introspection/repository.rb +32 -0
  47. data/lib/gobject-introspection/struct-info.rb +28 -0
  48. data/lib/gobject-introspection/union-info.rb +28 -0
  49. data/test/gobject-introspection-test-utils.rb +26 -0
  50. data/test/run-test.rb +45 -0
  51. data/test/test-arg-info.rb +68 -0
  52. data/test/test-base-info.rb +31 -0
  53. data/test/test-boxed-info.rb +21 -0
  54. data/test/test-callable-info.rb +49 -0
  55. data/test/test-callback-info.rb +29 -0
  56. data/test/test-constant-info.rb +24 -0
  57. data/test/test-enum-info.rb +56 -0
  58. data/test/test-field-type.rb +42 -0
  59. data/test/test-flags-info.rb +27 -0
  60. data/test/test-function-info.rb +37 -0
  61. data/test/test-interface-info.rb +97 -0
  62. data/test/test-loader.rb +30 -0
  63. data/test/test-object-info.rb +131 -0
  64. data/test/test-property-info.rb +38 -0
  65. data/test/test-registered-type-info.rb +35 -0
  66. data/test/test-repository.rb +59 -0
  67. data/test/test-signal-info.rb +37 -0
  68. data/test/test-struct-info.rb +57 -0
  69. data/test/test-type-info.rb +62 -0
  70. data/test/test-type-tag.rb +29 -0
  71. data/test/test-union-info.rb +21 -0
  72. data/test/test-value-info.rb +28 -0
  73. data/test/test-vfunc-info.rb +42 -0
  74. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  75. data/vendor/local/bin/g-ir-generate.exe +0 -0
  76. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  77. data/vendor/local/include/gobject-introspection-1.0/giarginfo.h +52 -0
  78. data/vendor/local/include/gobject-introspection-1.0/gibaseinfo.h +89 -0
  79. data/vendor/local/include/gobject-introspection-1.0/gicallableinfo.h +74 -0
  80. data/vendor/local/include/gobject-introspection-1.0/giconstantinfo.h +46 -0
  81. data/vendor/local/include/gobject-introspection-1.0/gienuminfo.h +56 -0
  82. data/vendor/local/include/gobject-introspection-1.0/gifieldinfo.h +52 -0
  83. data/vendor/local/include/gobject-introspection-1.0/gifunctioninfo.h +77 -0
  84. data/vendor/local/include/gobject-introspection-1.0/giinterfaceinfo.h +68 -0
  85. data/vendor/local/include/gobject-introspection-1.0/giobjectinfo.h +137 -0
  86. data/vendor/local/include/gobject-introspection-1.0/gipropertyinfo.h +44 -0
  87. data/vendor/local/include/gobject-introspection-1.0/giregisteredtypeinfo.h +53 -0
  88. data/vendor/local/include/gobject-introspection-1.0/girepository.h +179 -0
  89. data/vendor/local/include/gobject-introspection-1.0/girffi.h +80 -0
  90. data/vendor/local/include/gobject-introspection-1.0/gisignalinfo.h +45 -0
  91. data/vendor/local/include/gobject-introspection-1.0/gistructinfo.h +53 -0
  92. data/vendor/local/include/gobject-introspection-1.0/gitypeinfo.h +56 -0
  93. data/vendor/local/include/gobject-introspection-1.0/gitypelib.h +55 -0
  94. data/vendor/local/include/gobject-introspection-1.0/gitypes.h +453 -0
  95. data/vendor/local/include/gobject-introspection-1.0/giunioninfo.h +57 -0
  96. data/vendor/local/include/gobject-introspection-1.0/givfuncinfo.h +56 -0
  97. data/vendor/local/lib/girepository-1.0/DBus-1.0.typelib +0 -0
  98. data/vendor/local/lib/girepository-1.0/DBusGLib-1.0.typelib +0 -0
  99. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  100. data/vendor/local/lib/girepository-1.0/GL-1.0.typelib +0 -0
  101. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  102. data/vendor/local/lib/girepository-1.0/GModule-2.0.typelib +0 -0
  103. data/vendor/local/lib/girepository-1.0/GObject-2.0.typelib +0 -0
  104. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  105. data/vendor/local/lib/girepository-1.0/cairo-1.0.typelib +0 -0
  106. data/vendor/local/lib/girepository-1.0/fontconfig-2.0.typelib +0 -0
  107. data/vendor/local/lib/girepository-1.0/freetype2-2.0.typelib +0 -0
  108. data/vendor/local/lib/girepository-1.0/libxml2-2.0.typelib +0 -0
  109. data/vendor/local/lib/girepository-1.0/xfixes-4.0.typelib +0 -0
  110. data/vendor/local/lib/girepository-1.0/xft-2.0.typelib +0 -0
  111. data/vendor/local/lib/girepository-1.0/xlib-2.0.typelib +0 -0
  112. data/vendor/local/lib/girepository-1.0/xrandr-1.3.typelib +0 -0
  113. data/vendor/local/lib/gobject-introspection/giscanner/__init__.py +24 -0
  114. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  115. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  116. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.py +74 -0
  117. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  118. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  119. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.py +1204 -0
  120. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  121. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  122. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +1100 -0
  123. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  124. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  125. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.py +196 -0
  126. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  127. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  128. data/vendor/local/lib/gobject-introspection/giscanner/codegen.py +140 -0
  129. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  130. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  131. data/vendor/local/lib/gobject-introspection/giscanner/docmain.py +60 -0
  132. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  133. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  134. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/class.tmpl +2 -0
  135. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/constructor.tmpl +1 -0
  136. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/default.tmpl +1 -0
  137. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/enum.tmpl +2 -0
  138. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/function.tmpl +61 -0
  139. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/method.tmpl +1 -0
  140. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/namespace.tmpl +1 -0
  141. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/property.tmpl +5 -0
  142. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/record.tmpl +1 -0
  143. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/signal.tmpl +5 -0
  144. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/C/vfunc.tmpl +4 -0
  145. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/class.tmpl +18 -0
  146. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/constructor.tmpl +1 -0
  147. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/default.tmpl +1 -0
  148. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/enum.tmpl +13 -0
  149. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/function.tmpl +48 -0
  150. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/method.tmpl +1 -0
  151. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/namespace.tmpl +2 -0
  152. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/property.tmpl +10 -0
  153. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/record.tmpl +2 -0
  154. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/signal.tmpl +37 -0
  155. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Gjs/vfunc.tmpl +27 -0
  156. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/class.tmpl +17 -0
  157. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/constructor.tmpl +1 -0
  158. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/default.tmpl +1 -0
  159. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/enum.tmpl +13 -0
  160. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/function.tmpl +53 -0
  161. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/method.tmpl +1 -0
  162. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/namespace.tmpl +2 -0
  163. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/property.tmpl +10 -0
  164. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/record.tmpl +2 -0
  165. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/signal.tmpl +42 -0
  166. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/Python/vfunc.tmpl +33 -0
  167. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/base.tmpl +29 -0
  168. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/class.tmpl +40 -0
  169. data/vendor/local/lib/gobject-introspection/giscanner/doctemplates/namespace.tmpl +19 -0
  170. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.py +635 -0
  171. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  172. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  173. data/vendor/local/lib/gobject-introspection/giscanner/dumper.py +363 -0
  174. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  175. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  176. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.py +551 -0
  177. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  178. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  179. data/vendor/local/lib/gobject-introspection/giscanner/girparser.py +581 -0
  180. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  181. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  182. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.py +584 -0
  183. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  184. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  185. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.py +236 -0
  186. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  187. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  188. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.py +76 -0
  189. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  190. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  191. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.py +1337 -0
  192. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  193. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  194. data/vendor/local/lib/gobject-introspection/giscanner/message.py +185 -0
  195. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  196. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  197. data/vendor/local/lib/gobject-introspection/giscanner/odict.py +50 -0
  198. data/vendor/local/lib/gobject-introspection/giscanner/odict.pyc +0 -0
  199. data/vendor/local/lib/gobject-introspection/giscanner/odict.pyo +0 -0
  200. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.py +497 -0
  201. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  202. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  203. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.py +78 -0
  204. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  205. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  206. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.py +132 -0
  207. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  208. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  209. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.py +324 -0
  210. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  211. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  212. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.py +119 -0
  213. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  214. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  215. data/vendor/local/lib/gobject-introspection/giscanner/transformer.py +999 -0
  216. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  217. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  218. data/vendor/local/lib/gobject-introspection/giscanner/utils.py +141 -0
  219. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  220. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  221. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.py +197 -0
  222. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  223. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  224. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  225. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  226. data/vendor/local/lib/libgirepository-1.0.la +41 -0
  227. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +26 -0
  228. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +23 -0
  229. data/vendor/local/share/aclocal/introspection.m4 +96 -0
  230. data/vendor/local/share/gir-1.0/DBus-1.0.gir +32 -0
  231. data/vendor/local/share/gir-1.0/DBusGLib-1.0.gir +18 -0
  232. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +3833 -0
  233. data/vendor/local/share/gir-1.0/GL-1.0.gir +31 -0
  234. data/vendor/local/share/gir-1.0/GLib-2.0.gir +44304 -0
  235. data/vendor/local/share/gir-1.0/GModule-2.0.gir +184 -0
  236. data/vendor/local/share/gir-1.0/GObject-2.0.gir +13947 -0
  237. data/vendor/local/share/gir-1.0/Gio-2.0.gir +73619 -0
  238. data/vendor/local/share/gir-1.0/cairo-1.0.gir +70 -0
  239. data/vendor/local/share/gir-1.0/fontconfig-2.0.gir +18 -0
  240. data/vendor/local/share/gir-1.0/freetype2-2.0.gir +22 -0
  241. data/vendor/local/share/gir-1.0/libxml2-2.0.gir +25 -0
  242. data/vendor/local/share/gir-1.0/xfixes-4.0.gir +10 -0
  243. data/vendor/local/share/gir-1.0/xft-2.0.gir +23 -0
  244. data/vendor/local/share/gir-1.0/xlib-2.0.gir +67 -0
  245. data/vendor/local/share/gir-1.0/xrandr-1.3.gir +16 -0
  246. data/vendor/local/share/gobject-introspection-1.0/Makefile.introspection +166 -0
  247. data/vendor/local/share/gobject-introspection-1.0/gdump.c +564 -0
  248. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.c +835 -0
  249. data/vendor/local/share/gobject-introspection-1.0/tests/annotation.h +198 -0
  250. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.c +55 -0
  251. data/vendor/local/share/gobject-introspection-1.0/tests/drawable.h +33 -0
  252. data/vendor/local/share/gobject-introspection-1.0/tests/everything.c +1473 -0
  253. data/vendor/local/share/gobject-introspection-1.0/tests/everything.h +428 -0
  254. data/vendor/local/share/gobject-introspection-1.0/tests/foo.c +790 -0
  255. data/vendor/local/share/gobject-introspection-1.0/tests/foo.h +437 -0
  256. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.c +5256 -0
  257. data/vendor/local/share/gobject-introspection-1.0/tests/gimarshallingtests.h +1158 -0
  258. data/vendor/local/share/gobject-introspection-1.0/tests/regress.c +4009 -0
  259. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +944 -0
  260. data/vendor/local/share/gobject-introspection-1.0/tests/utility.c +45 -0
  261. data/vendor/local/share/gobject-introspection-1.0/tests/utility.h +95 -0
  262. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.c +33 -0
  263. data/vendor/local/share/gobject-introspection-1.0/tests/warnlib.h +36 -0
  264. data/vendor/local/share/license/gobject-introspection/AUTHORS +9 -0
  265. data/vendor/local/share/license/gobject-introspection/COPYING +12 -0
  266. data/vendor/local/share/man/man1/g-ir-compiler.1 +51 -0
  267. data/vendor/local/share/man/man1/g-ir-generate.1 +29 -0
  268. metadata +343 -0
@@ -0,0 +1,581 @@
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
+
23
+ from xml.etree.cElementTree import parse
24
+
25
+ from . import ast
26
+ from .girwriter import COMPATIBLE_GIR_VERSION
27
+
28
+ CORE_NS = "http://www.gtk.org/introspection/core/1.0"
29
+ C_NS = "http://www.gtk.org/introspection/c/1.0"
30
+ GLIB_NS = "http://www.gtk.org/introspection/glib/1.0"
31
+
32
+
33
+ def _corens(tag):
34
+ return '{%s}%s' % (CORE_NS, tag)
35
+
36
+
37
+ def _glibns(tag):
38
+ return '{%s}%s' % (GLIB_NS, tag)
39
+
40
+
41
+ def _cns(tag):
42
+ return '{%s}%s' % (C_NS, tag)
43
+
44
+
45
+ class GIRParser(object):
46
+
47
+ def __init__(self, types_only=False):
48
+ self._types_only = types_only
49
+ self._namespace = None
50
+ self._filename_stack = []
51
+
52
+ # Public API
53
+
54
+ def parse(self, filename):
55
+ filename = os.path.abspath(filename)
56
+ self._filename_stack.append(filename)
57
+ tree = parse(filename)
58
+ self.parse_tree(tree)
59
+ self._filename_stack.pop()
60
+
61
+ def parse_tree(self, tree):
62
+ self._namespace = None
63
+ self._pkgconfig_packages = set()
64
+ self._includes = set()
65
+ self._c_includes = set()
66
+ self._c_prefix = None
67
+ self._parse_api(tree.getroot())
68
+
69
+ def get_namespace(self):
70
+ return self._namespace
71
+
72
+ def get_c_prefix(self):
73
+ return self._c_prefix
74
+
75
+ # Private
76
+
77
+ def _find_first_child(self, node, name_or_names):
78
+ if isinstance(name_or_names, str):
79
+ for child in node.getchildren():
80
+ if child.tag == name_or_names:
81
+ return child
82
+ else:
83
+ for child in node.getchildren():
84
+ if child.tag in name_or_names:
85
+ return child
86
+ return None
87
+
88
+ def _find_children(self, node, name):
89
+ return [child for child in node.getchildren() if child.tag == name]
90
+
91
+ def _get_current_file(self):
92
+ if not self._filename_stack:
93
+ return None
94
+ cwd = os.getcwd() + os.sep
95
+ curfile = self._filename_stack[-1]
96
+ if curfile.startswith(cwd):
97
+ return curfile[len(cwd):]
98
+ return curfile
99
+
100
+ def _parse_api(self, root):
101
+ assert root.tag == _corens('repository')
102
+ version = root.attrib['version']
103
+ if version != COMPATIBLE_GIR_VERSION:
104
+ raise SystemExit("%s: Incompatible version %s (supported: %s)" \
105
+ % (self._get_current_file(),
106
+ version, COMPATIBLE_GIR_VERSION))
107
+
108
+ for node in root.getchildren():
109
+ if node.tag == _corens('include'):
110
+ self._parse_include(node)
111
+ elif node.tag == _corens('package'):
112
+ self._parse_pkgconfig_package(node)
113
+ elif node.tag == _cns('include'):
114
+ self._parse_c_include(node)
115
+
116
+ ns = root.find(_corens('namespace'))
117
+ assert ns is not None
118
+ identifier_prefixes = ns.attrib.get(_cns('identifier-prefixes'))
119
+ if identifier_prefixes:
120
+ identifier_prefixes = identifier_prefixes.split(',')
121
+ symbol_prefixes = ns.attrib.get(_cns('symbol-prefixes'))
122
+ if symbol_prefixes:
123
+ symbol_prefixes = symbol_prefixes.split(',')
124
+ self._namespace = ast.Namespace(ns.attrib['name'],
125
+ ns.attrib['version'],
126
+ identifier_prefixes=identifier_prefixes,
127
+ symbol_prefixes=symbol_prefixes)
128
+ if 'shared-library' in ns.attrib:
129
+ self._namespace.shared_libraries = ns.attrib['shared-library'].split(',')
130
+ self._namespace.includes = self._includes
131
+ self._namespace.c_includes = self._c_includes
132
+ self._namespace.exported_packages = self._pkgconfig_packages
133
+
134
+ parser_methods = {
135
+ _corens('alias'): self._parse_alias,
136
+ _corens('bitfield'): self._parse_enumeration_bitfield,
137
+ _corens('callback'): self._parse_callback,
138
+ _corens('class'): self._parse_object_interface,
139
+ _corens('enumeration'): self._parse_enumeration_bitfield,
140
+ _corens('interface'): self._parse_object_interface,
141
+ _corens('record'): self._parse_record,
142
+ _corens('union'): self._parse_union,
143
+ _glibns('boxed'): self._parse_boxed,
144
+ }
145
+
146
+ if not self._types_only:
147
+ parser_methods[_corens('constant')] = self._parse_constant
148
+ parser_methods[_corens('function')] = self._parse_function
149
+
150
+ for node in ns.getchildren():
151
+ method = parser_methods.get(node.tag)
152
+ if method is not None:
153
+ method(node)
154
+
155
+ def _parse_include(self, node):
156
+ include = ast.Include(node.attrib['name'],
157
+ node.attrib['version'])
158
+ self._includes.add(include)
159
+
160
+ def _parse_pkgconfig_package(self, node):
161
+ self._pkgconfig_packages.add(node.attrib['name'])
162
+
163
+ def _parse_c_include(self, node):
164
+ self._c_includes.add(node.attrib['name'])
165
+
166
+ def _parse_alias(self, node):
167
+ typeval = self._parse_type(node)
168
+ alias = ast.Alias(node.attrib['name'],
169
+ typeval,
170
+ node.attrib.get(_cns('type')))
171
+ self._parse_generic_attribs(node, alias)
172
+ self._namespace.append(alias)
173
+
174
+ def _parse_generic_attribs(self, node, obj):
175
+ assert isinstance(obj, ast.Annotated)
176
+ introspectable = node.attrib.get('introspectable')
177
+ if introspectable:
178
+ obj.introspectable = int(introspectable) > 0
179
+ if self._types_only:
180
+ return
181
+ doc = node.find(_corens('doc'))
182
+ if doc is not None:
183
+ if doc.text:
184
+ obj.doc = doc.text
185
+ version = node.attrib.get('version')
186
+ if version:
187
+ obj.version = version
188
+ deprecated = node.attrib.get('deprecated')
189
+ if deprecated:
190
+ obj.deprecated = deprecated
191
+ deprecated_version = node.attrib.get('deprecated-version')
192
+ if deprecated_version:
193
+ obj.deprecated_version = deprecated_version
194
+
195
+ def _parse_object_interface(self, node):
196
+ parent = node.attrib.get('parent')
197
+ if parent:
198
+ parent_type = self._namespace.type_from_name(parent)
199
+ else:
200
+ parent_type = None
201
+
202
+ ctor_kwargs = {'name': node.attrib['name'],
203
+ 'parent_type': parent_type,
204
+ 'gtype_name': node.attrib[_glibns('type-name')],
205
+ 'get_type': node.attrib[_glibns('get-type')],
206
+ 'c_symbol_prefix': node.attrib.get(_cns('symbol-prefix')),
207
+ 'ctype': node.attrib.get(_cns('type'))}
208
+ if node.tag == _corens('interface'):
209
+ klass = ast.Interface
210
+ elif node.tag == _corens('class'):
211
+ klass = ast.Class
212
+ is_abstract = node.attrib.get('abstract')
213
+ is_abstract = is_abstract and is_abstract != '0'
214
+ ctor_kwargs['is_abstract'] = is_abstract
215
+ else:
216
+ raise AssertionError(node)
217
+
218
+ obj = klass(**ctor_kwargs)
219
+ self._parse_generic_attribs(node, obj)
220
+ type_struct = node.attrib.get(_glibns('type-struct'))
221
+ if type_struct:
222
+ obj.glib_type_struct = self._namespace.type_from_name(type_struct)
223
+ if klass == ast.Class:
224
+ is_fundamental = node.attrib.get(_glibns('fundamental'))
225
+ if is_fundamental and is_fundamental != '0':
226
+ obj.fundamental = True
227
+ for func_id in ['ref-func', 'unref-func',
228
+ 'set-value-func', 'get-value-func']:
229
+ func_name = node.attrib.get(_glibns(func_id))
230
+ obj.__dict__[func_id.replace('-', '_')] = func_name
231
+
232
+ if self._types_only:
233
+ self._namespace.append(obj)
234
+ return
235
+
236
+ for iface in self._find_children(node, _corens('implements')):
237
+ obj.interfaces.append(self._namespace.type_from_name(iface.attrib['name']))
238
+ for iface in self._find_children(node, _corens('prerequisite')):
239
+ obj.prerequisites.append(self._namespace.type_from_name(iface.attrib['name']))
240
+ for func_node in self._find_children(node, _corens('function')):
241
+ func = self._parse_function_common(func_node, ast.Function, obj)
242
+ obj.static_methods.append(func)
243
+ for method in self._find_children(node, _corens('method')):
244
+ func = self._parse_function_common(method, ast.Function, obj)
245
+ func.is_method = True
246
+ obj.methods.append(func)
247
+ for method in self._find_children(node, _corens('virtual-method')):
248
+ func = self._parse_function_common(method, ast.VFunction, obj)
249
+ self._parse_generic_attribs(method, func)
250
+ func.is_method = True
251
+ func.invoker = method.get('invoker')
252
+ obj.virtual_methods.append(func)
253
+ for ctor in self._find_children(node, _corens('constructor')):
254
+ func = self._parse_function_common(ctor, ast.Function, obj)
255
+ func.is_constructor = True
256
+ obj.constructors.append(func)
257
+ obj.fields.extend(self._parse_fields(node, obj))
258
+ for prop in self._find_children(node, _corens('property')):
259
+ obj.properties.append(self._parse_property(prop, obj))
260
+ for signal in self._find_children(node, _glibns('signal')):
261
+ obj.signals.append(self._parse_function_common(signal, ast.Signal, obj))
262
+
263
+ self._namespace.append(obj)
264
+
265
+ def _parse_callback(self, node):
266
+ callback = self._parse_function_common(node, ast.Callback)
267
+ self._namespace.append(callback)
268
+
269
+ def _parse_function(self, node):
270
+ function = self._parse_function_common(node, ast.Function)
271
+ self._namespace.append(function)
272
+
273
+ def _parse_parameter(self, node):
274
+ typeval = self._parse_type(node)
275
+ param = ast.Parameter(node.attrib.get('name'),
276
+ typeval,
277
+ node.attrib.get('direction') or ast.PARAM_DIRECTION_IN,
278
+ node.attrib.get('transfer-ownership'),
279
+ node.attrib.get('allow-none') == '1',
280
+ node.attrib.get('scope'),
281
+ node.attrib.get('caller-allocates') == '1')
282
+ self._parse_generic_attribs(node, param)
283
+ return param
284
+
285
+ def _parse_function_common(self, node, klass, parent=None):
286
+ name = node.attrib['name']
287
+ returnnode = node.find(_corens('return-value'))
288
+ if not returnnode:
289
+ raise ValueError('node %r has no return-value' % (name, ))
290
+ transfer = returnnode.attrib.get('transfer-ownership')
291
+ retval = ast.Return(self._parse_type(returnnode), transfer)
292
+ self._parse_generic_attribs(returnnode, retval)
293
+ parameters = []
294
+
295
+ throws = (node.attrib.get('throws') == '1')
296
+
297
+ if klass is ast.Callback:
298
+ func = klass(name, retval, parameters, throws,
299
+ node.attrib.get(_cns('type')))
300
+ elif klass is ast.Function:
301
+ identifier = node.attrib.get(_cns('identifier'))
302
+ func = klass(name, retval, parameters, throws, identifier)
303
+ elif klass is ast.VFunction:
304
+ func = klass(name, retval, parameters, throws)
305
+ elif klass is ast.Signal:
306
+ func = klass(name, retval, parameters,
307
+ when=node.attrib.get('when'),
308
+ no_recurse=node.attrib.get('no-recurse', '0') == '1',
309
+ detailed=node.attrib.get('detailed', '0') == '1',
310
+ action=node.attrib.get('action', '0') == '1',
311
+ no_hooks=node.attrib.get('no-hooks', '0') == '1')
312
+ else:
313
+ assert False
314
+
315
+ func.shadows = node.attrib.get('shadows', None)
316
+ func.shadowed_by = node.attrib.get('shadowed-by', None)
317
+ func.moved_to = node.attrib.get('moved-to', None)
318
+ func.parent = parent
319
+
320
+ parameters_node = node.find(_corens('parameters'))
321
+ if (parameters_node is not None):
322
+ paramnode = self._find_first_child(parameters_node, _corens('instance-parameter'))
323
+ if paramnode:
324
+ func.instance_parameter = self._parse_parameter(paramnode)
325
+ for paramnode in self._find_children(parameters_node, _corens('parameter')):
326
+ parameters.append(self._parse_parameter(paramnode))
327
+ for i, paramnode in enumerate(self._find_children(parameters_node,
328
+ _corens('parameter'))):
329
+ param = parameters[i]
330
+ self._parse_type_second_pass(func, paramnode, param.type)
331
+ closure = paramnode.attrib.get('closure')
332
+ if closure:
333
+ idx = int(closure)
334
+ assert idx < len(parameters), "%d >= %d" % (idx, len(parameters))
335
+ param.closure_name = parameters[idx].argname
336
+ destroy = paramnode.attrib.get('destroy')
337
+ if destroy:
338
+ idx = int(destroy)
339
+ assert idx < len(parameters), "%d >= %d" % (idx, len(parameters))
340
+ param.destroy_name = parameters[idx].argname
341
+
342
+ self._parse_type_second_pass(func, returnnode, retval.type)
343
+
344
+ self._parse_generic_attribs(node, func)
345
+
346
+ self._namespace.track(func)
347
+ return func
348
+
349
+ def _parse_fields(self, node, obj):
350
+ res = []
351
+ names = (_corens('field'), _corens('record'), _corens('union'), _corens('callback'))
352
+ for child in node.getchildren():
353
+ if child.tag in names:
354
+ fieldobj = self._parse_field(child, obj)
355
+ res.append(fieldobj)
356
+ return res
357
+
358
+ def _parse_compound(self, cls, node):
359
+ compound = cls(node.attrib.get('name'),
360
+ ctype=node.attrib.get(_cns('type')),
361
+ disguised=node.attrib.get('disguised') == '1',
362
+ gtype_name=node.attrib.get(_glibns('type-name')),
363
+ get_type=node.attrib.get(_glibns('get-type')),
364
+ c_symbol_prefix=node.attrib.get(_cns('symbol-prefix')))
365
+ if node.attrib.get('foreign') == '1':
366
+ compound.foreign = True
367
+ self._parse_generic_attribs(node, compound)
368
+ if not self._types_only:
369
+ compound.fields.extend(self._parse_fields(node, compound))
370
+ for method in self._find_children(node, _corens('method')):
371
+ func = self._parse_function_common(method, ast.Function, compound)
372
+ func.is_method = True
373
+ compound.methods.append(func)
374
+ for func in self._find_children(node, _corens('function')):
375
+ compound.static_methods.append(
376
+ self._parse_function_common(func, ast.Function, compound))
377
+ for ctor in self._find_children(node, _corens('constructor')):
378
+ func = self._parse_function_common(ctor, ast.Function, compound)
379
+ func.is_constructor = True
380
+ compound.constructors.append(func)
381
+ return compound
382
+
383
+ def _parse_record(self, node, anonymous=False):
384
+ struct = self._parse_compound(ast.Record, node)
385
+ is_gtype_struct_for = node.attrib.get(_glibns('is-gtype-struct-for'))
386
+ if is_gtype_struct_for is not None:
387
+ struct.is_gtype_struct_for = self._namespace.type_from_name(is_gtype_struct_for)
388
+ if not anonymous:
389
+ self._namespace.append(struct)
390
+ return struct
391
+
392
+ def _parse_union(self, node, anonymous=False):
393
+ union = self._parse_compound(ast.Union, node)
394
+ if not anonymous:
395
+ self._namespace.append(union)
396
+ return union
397
+
398
+ def _parse_type_simple(self, typenode):
399
+ # ast.Fields can contain inline callbacks
400
+ if typenode.tag == _corens('callback'):
401
+ typeval = self._namespace.type_from_name(typenode.attrib['name'])
402
+ typeval.ctype = typenode.attrib.get(_cns('type'))
403
+ return typeval
404
+ # ast.Arrays have their own toplevel XML
405
+ elif typenode.tag == _corens('array'):
406
+ array_type = typenode.attrib.get('name')
407
+ element_type = self._parse_type(typenode)
408
+ array_ctype = typenode.attrib.get(_cns('type'))
409
+ ret = ast.Array(array_type, element_type, ctype=array_ctype)
410
+ # zero-terminated defaults to true...
411
+ zero = typenode.attrib.get('zero-terminated')
412
+ if zero and zero == '0':
413
+ ret.zeroterminated = False
414
+ fixed_size = typenode.attrib.get('fixed-size')
415
+ if fixed_size:
416
+ ret.size = int(fixed_size)
417
+
418
+ return ret
419
+ elif typenode.tag == _corens('varargs'):
420
+ return ast.Varargs()
421
+ elif typenode.tag == _corens('type'):
422
+ name = typenode.attrib.get('name')
423
+ ctype = typenode.attrib.get(_cns('type'))
424
+ if name is None:
425
+ if ctype is None:
426
+ return ast.TypeUnknown()
427
+ return ast.Type(ctype=ctype)
428
+ elif name in ['GLib.List', 'GLib.SList']:
429
+ subchild = self._find_first_child(typenode,
430
+ map(_corens, ('callback', 'array', 'varargs', 'type')))
431
+ if subchild is not None:
432
+ element_type = self._parse_type(typenode)
433
+ else:
434
+ element_type = ast.TYPE_ANY
435
+ return ast.List(name, element_type, ctype=ctype)
436
+ elif name == 'GLib.HashTable':
437
+ subchildren = self._find_children(typenode, _corens('type'))
438
+ subchildren_types = map(self._parse_type_simple, subchildren)
439
+ while len(subchildren_types) < 2:
440
+ subchildren_types.append(ast.TYPE_ANY)
441
+ return ast.Map(subchildren_types[0],
442
+ subchildren_types[1],
443
+ ctype=ctype)
444
+ else:
445
+ return self._namespace.type_from_name(name, ctype)
446
+ else:
447
+ assert False, "Failed to parse inner type"
448
+
449
+ def _parse_type(self, node):
450
+ for name in map(_corens, ('callback', 'array', 'varargs', 'type')):
451
+ typenode = node.find(name)
452
+ if typenode is not None:
453
+ return self._parse_type_simple(typenode)
454
+ assert False, "Failed to parse toplevel type"
455
+
456
+ def _parse_type_second_pass(self, parent, node, typeval):
457
+ """A hack necessary to handle the integer parameter indexes on
458
+ array types."""
459
+ typenode = node.find(_corens('array'))
460
+ if typenode is None:
461
+ return
462
+ lenidx = typenode.attrib.get('length')
463
+ if lenidx is not None:
464
+ idx = int(lenidx)
465
+ assert idx < len(parent.parameters), "%r %d >= %d" \
466
+ % (parent, idx, len(parent.parameters))
467
+ typeval.length_param_name = parent.parameters[idx].argname
468
+
469
+ def _parse_boxed(self, node):
470
+ obj = ast.Boxed(node.attrib[_glibns('name')],
471
+ gtype_name=node.attrib[_glibns('type-name')],
472
+ get_type=node.attrib[_glibns('get-type')],
473
+ c_symbol_prefix=node.attrib.get(_cns('symbol-prefix')))
474
+ self._parse_generic_attribs(node, obj)
475
+
476
+ if self._types_only:
477
+ self._namespace.append(obj)
478
+ return
479
+
480
+ for method in self._find_children(node, _corens('method')):
481
+ func = self._parse_function_common(method, ast.Function, obj)
482
+ func.is_method = True
483
+ obj.methods.append(func)
484
+ for ctor in self._find_children(node, _corens('constructor')):
485
+ obj.constructors.append(
486
+ self._parse_function_common(ctor, ast.Function, obj))
487
+ for callback in self._find_children(node, _corens('callback')):
488
+ obj.fields.append(
489
+ self._parse_function_common(callback, ast.Callback, obj))
490
+ self._namespace.append(obj)
491
+
492
+ def _parse_field(self, node, parent):
493
+ type_node = None
494
+ anonymous_node = None
495
+ if node.tag in map(_corens, ('record', 'union')):
496
+ anonymous_elt = node
497
+ else:
498
+ anonymous_elt = self._find_first_child(node, _corens('callback'))
499
+ if anonymous_elt is not None:
500
+ if anonymous_elt.tag == _corens('callback'):
501
+ anonymous_node = self._parse_function_common(anonymous_elt, ast.Callback)
502
+ elif anonymous_elt.tag == _corens('record'):
503
+ anonymous_node = self._parse_record(anonymous_elt, anonymous=True)
504
+ elif anonymous_elt.tag == _corens('union'):
505
+ anonymous_node = self._parse_union(anonymous_elt, anonymous=True)
506
+ else:
507
+ assert False, anonymous_elt.tag
508
+ else:
509
+ assert node.tag == _corens('field'), node.tag
510
+ type_node = self._parse_type(node)
511
+ field = ast.Field(node.attrib.get('name'),
512
+ type_node,
513
+ node.attrib.get('readable') != '0',
514
+ node.attrib.get('writable') == '1',
515
+ node.attrib.get('bits'),
516
+ anonymous_node=anonymous_node)
517
+ field.private = node.attrib.get('private') == '1'
518
+ field.parent = parent
519
+ self._parse_generic_attribs(node, field)
520
+ return field
521
+
522
+ def _parse_property(self, node, parent):
523
+ prop = ast.Property(node.attrib['name'],
524
+ self._parse_type(node),
525
+ node.attrib.get('readable') != '0',
526
+ node.attrib.get('writable') == '1',
527
+ node.attrib.get('construct') == '1',
528
+ node.attrib.get('construct-only') == '1',
529
+ node.attrib.get('transfer-ownership'))
530
+ self._parse_generic_attribs(node, prop)
531
+ prop.parent = parent
532
+ return prop
533
+
534
+ def _parse_member(self, node):
535
+ member = ast.Member(node.attrib['name'],
536
+ node.attrib['value'],
537
+ node.attrib.get(_cns('identifier')),
538
+ node.attrib.get(_glibns('nick')))
539
+ self._parse_generic_attribs(node, member)
540
+ return member
541
+
542
+ def _parse_constant(self, node):
543
+ type_node = self._parse_type(node)
544
+ constant = ast.Constant(node.attrib['name'],
545
+ type_node,
546
+ node.attrib['value'],
547
+ node.attrib.get(_cns('type')))
548
+ self._parse_generic_attribs(node, constant)
549
+ self._namespace.append(constant)
550
+
551
+ def _parse_enumeration_bitfield(self, node):
552
+ name = node.attrib.get('name')
553
+ ctype = node.attrib.get(_cns('type'))
554
+ get_type = node.attrib.get(_glibns('get-type'))
555
+ type_name = node.attrib.get(_glibns('type-name'))
556
+ glib_error_domain = node.attrib.get(_glibns('error-domain'))
557
+ if node.tag == _corens('bitfield'):
558
+ klass = ast.Bitfield
559
+ else:
560
+ klass = ast.Enum
561
+ members = []
562
+ obj = klass(name, ctype,
563
+ members=members,
564
+ gtype_name=type_name,
565
+ get_type=get_type)
566
+ obj.error_domain = glib_error_domain
567
+ obj.ctype = ctype
568
+ self._parse_generic_attribs(node, obj)
569
+
570
+ if self._types_only:
571
+ self._namespace.append(obj)
572
+ return
573
+
574
+ for member_node in self._find_children(node, _corens('member')):
575
+ member = self._parse_member(member_node)
576
+ member.parent = obj
577
+ members.append(member)
578
+ for func_node in self._find_children(node, _corens('function')):
579
+ func = self._parse_function_common(func_node, ast.Function)
580
+ obj.static_methods.append(func)
581
+ self._namespace.append(obj)