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,10 @@
1
+ #ifndef __GITESTMACROS_H__
2
+ #define __GITESTMACROS_H__
3
+
4
+ #ifndef _GI_EXTERN
5
+ #define _GI_EXTERN extern
6
+ #endif
7
+
8
+ #define _GI_TEST_EXTERN _GI_EXTERN
9
+
10
+ #endif
@@ -0,0 +1,4068 @@
1
+ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2
+ #include "config.h"
3
+
4
+ #include <string.h>
5
+ #include <stdlib.h>
6
+ #include <glib-object.h>
7
+ #include <gobject/gvaluecollector.h>
8
+
9
+ #include "regress.h"
10
+
11
+ static gboolean abort_on_error = TRUE;
12
+
13
+ #define ASSERT_VALUE(condition) \
14
+ if (abort_on_error) \
15
+ g_assert (condition); \
16
+ else \
17
+ g_warn_if_fail (condition); \
18
+
19
+ void
20
+ regress_set_abort_on_error (gboolean in)
21
+ {
22
+ abort_on_error = in;
23
+ }
24
+
25
+ /* basic types */
26
+ gboolean
27
+ regress_test_boolean (gboolean in)
28
+ {
29
+ return in;
30
+ }
31
+
32
+ gboolean
33
+ regress_test_boolean_true (gboolean in)
34
+ {
35
+ ASSERT_VALUE (in == TRUE);
36
+ return in;
37
+ }
38
+
39
+ gboolean
40
+ regress_test_boolean_false (gboolean in)
41
+ {
42
+ ASSERT_VALUE (in == FALSE);
43
+ return in;
44
+ }
45
+
46
+ gint8
47
+ regress_test_int8 (gint8 in)
48
+ {
49
+ return in;
50
+ }
51
+
52
+ guint8
53
+ regress_test_uint8 (guint8 in)
54
+ {
55
+ return in;
56
+ }
57
+
58
+ gint16
59
+ regress_test_int16 (gint16 in)
60
+ {
61
+ return in;
62
+ }
63
+
64
+ guint16
65
+ regress_test_uint16 (guint16 in)
66
+ {
67
+ return in;
68
+ }
69
+
70
+ gint32
71
+ regress_test_int32 (gint32 in)
72
+ {
73
+ return in;
74
+ }
75
+
76
+ guint32
77
+ regress_test_uint32 (guint32 in)
78
+ {
79
+ return in;
80
+ }
81
+
82
+ gint64
83
+ regress_test_int64 (gint64 in)
84
+ {
85
+ return in;
86
+ }
87
+
88
+ guint64
89
+ regress_test_uint64 (guint64 in)
90
+ {
91
+ return in;
92
+ }
93
+
94
+ gshort
95
+ regress_test_short (gshort in)
96
+ {
97
+ return in;
98
+ }
99
+
100
+ gushort
101
+ regress_test_ushort (gushort in)
102
+ {
103
+ return in;
104
+ }
105
+
106
+ gint
107
+ regress_test_int (gint in)
108
+ {
109
+ return in;
110
+ }
111
+
112
+ guint
113
+ regress_test_uint (guint in)
114
+ {
115
+ return in;
116
+ }
117
+
118
+ glong
119
+ regress_test_long (glong in)
120
+ {
121
+ return in;
122
+ }
123
+
124
+ gulong
125
+ regress_test_ulong (gulong in)
126
+ {
127
+ return in;
128
+ }
129
+
130
+ gssize
131
+ regress_test_ssize (gssize in)
132
+ {
133
+ return in;
134
+ }
135
+
136
+ gsize
137
+ regress_test_size (gsize in)
138
+ {
139
+ return in;
140
+ }
141
+
142
+ gfloat
143
+ regress_test_float (gfloat in)
144
+ {
145
+ return in;
146
+ }
147
+
148
+ gdouble
149
+ regress_test_double (gdouble in)
150
+ {
151
+ return in;
152
+ }
153
+
154
+ gunichar
155
+ regress_test_unichar (gunichar in)
156
+ {
157
+ return in;
158
+ }
159
+
160
+ time_t
161
+ regress_test_timet (time_t in)
162
+ {
163
+ return in;
164
+ }
165
+
166
+ GType
167
+ regress_test_gtype (GType in)
168
+ {
169
+ return in;
170
+ }
171
+
172
+ int
173
+ regress_test_closure (GClosure *closure)
174
+ {
175
+ GValue return_value = {0, };
176
+ int ret;
177
+
178
+ g_value_init (&return_value, G_TYPE_INT);
179
+
180
+ g_closure_invoke (closure,
181
+ &return_value,
182
+ 0, NULL,
183
+ NULL);
184
+
185
+ ret = g_value_get_int (&return_value);
186
+
187
+ g_value_unset(&return_value);
188
+
189
+ return ret;
190
+ }
191
+
192
+ int
193
+ regress_test_closure_one_arg (GClosure *closure, int arg)
194
+ {
195
+ GValue return_value = {0, };
196
+ GValue arguments[1];
197
+ int ret;
198
+
199
+ g_value_init (&return_value, G_TYPE_INT);
200
+
201
+ memset (&arguments[0], 0, sizeof (arguments));
202
+ g_value_init (&arguments[0], G_TYPE_INT);
203
+ g_value_set_int (&arguments[0], arg);
204
+
205
+ g_closure_invoke (closure,
206
+ &return_value,
207
+ 1, arguments,
208
+ NULL);
209
+
210
+ ret = g_value_get_int (&return_value);
211
+
212
+ g_value_unset(&return_value);
213
+ g_value_unset(&arguments[0]);
214
+
215
+ return ret;
216
+ }
217
+
218
+ /**
219
+ * regress_test_closure_variant:
220
+ * @closure: GClosure which takes one GVariant and returns a GVariant
221
+ * @arg: (allow-none) (transfer none): a GVariant passed as argument to @closure
222
+ *
223
+ * Return value: (transfer full): the return value of @closure
224
+ */
225
+ GVariant*
226
+ regress_test_closure_variant (GClosure *closure, GVariant* arg)
227
+ {
228
+ GValue return_value = {0, };
229
+ GValue arguments[1] = {{0,} };
230
+ GVariant *ret;
231
+
232
+ g_value_init (&return_value, G_TYPE_VARIANT);
233
+
234
+ g_value_init (&arguments[0], G_TYPE_VARIANT);
235
+ g_value_set_variant (&arguments[0], arg);
236
+
237
+ g_closure_invoke (closure,
238
+ &return_value,
239
+ 1, arguments,
240
+ NULL);
241
+
242
+ ret = g_value_get_variant (&return_value);
243
+ if (ret != NULL)
244
+ g_variant_ref (ret);
245
+
246
+ g_value_unset (&return_value);
247
+ g_value_unset (&arguments[0]);
248
+
249
+ return ret;
250
+ }
251
+
252
+ /**
253
+ * regress_test_value_arg:
254
+ * @v: (transfer none): a GValue expected to contain an int
255
+ *
256
+ * Return value: the int contained in the GValue.
257
+ */
258
+ int
259
+ regress_test_int_value_arg(const GValue *v)
260
+ {
261
+ int i;
262
+
263
+ i = g_value_get_int (v);
264
+
265
+ return i;
266
+ }
267
+
268
+ static GValue value;
269
+ /**
270
+ * regress_test_value_return:
271
+ * @i: an int
272
+ *
273
+ * Return value: (transfer none): the int wrapped in a GValue.
274
+ */
275
+ const GValue *
276
+ regress_test_value_return(int i)
277
+ {
278
+ memset(&value, '\0', sizeof(GValue));
279
+
280
+ g_value_init (&value, G_TYPE_INT);
281
+ g_value_set_int (&value, i);
282
+
283
+ return &value;
284
+ }
285
+
286
+ /************************************************************************/
287
+ /* foreign structs */
288
+
289
+ #ifndef _GI_DISABLE_CAIRO
290
+ /**
291
+ * regress_test_cairo_context_full_return:
292
+ *
293
+ * Returns: (transfer full):
294
+ */
295
+ cairo_t *
296
+ regress_test_cairo_context_full_return (void)
297
+ {
298
+ cairo_surface_t *surface;
299
+ cairo_t *cr;
300
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
301
+ cr = cairo_create (surface);
302
+ cairo_surface_destroy (surface);
303
+ return cr;
304
+ }
305
+
306
+ /**
307
+ * regress_test_cairo_context_none_in:
308
+ * @context: (transfer none):
309
+ */
310
+ void
311
+ regress_test_cairo_context_none_in (cairo_t *context)
312
+ {
313
+ cairo_surface_t *surface = cairo_get_target (context);
314
+
315
+ g_assert (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32);
316
+ g_assert (cairo_image_surface_get_width (surface) == 10);
317
+ g_assert (cairo_image_surface_get_height (surface) == 10);
318
+ }
319
+
320
+
321
+ /**
322
+ * regress_test_cairo_surface_none_return:
323
+ *
324
+ * Returns: (transfer none):
325
+ */
326
+ cairo_surface_t *
327
+ regress_test_cairo_surface_none_return (void)
328
+ {
329
+ static cairo_surface_t *surface;
330
+
331
+ if (surface == NULL) {
332
+ surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
333
+ }
334
+
335
+ return surface;
336
+ }
337
+
338
+ /**
339
+ * regress_test_cairo_surface_full_return:
340
+ *
341
+ * Returns: (transfer full):
342
+ */
343
+ cairo_surface_t *
344
+ regress_test_cairo_surface_full_return (void)
345
+ {
346
+ return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
347
+ }
348
+
349
+ /**
350
+ * regress_test_cairo_surface_none_in:
351
+ * @surface: (transfer none):
352
+ */
353
+ void
354
+ regress_test_cairo_surface_none_in (cairo_surface_t *surface)
355
+ {
356
+ g_assert (cairo_image_surface_get_format (surface) == CAIRO_FORMAT_ARGB32);
357
+ g_assert (cairo_image_surface_get_width (surface) == 10);
358
+ g_assert (cairo_image_surface_get_height (surface) == 10);
359
+ }
360
+
361
+ /**
362
+ * regress_test_cairo_surface_full_out:
363
+ * @surface: (out) (transfer full):
364
+ */
365
+ void
366
+ regress_test_cairo_surface_full_out (cairo_surface_t **surface)
367
+ {
368
+ *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 10, 10);
369
+ }
370
+ #endif
371
+
372
+ /**
373
+ * regress_test_gvariant_i:
374
+ *
375
+ * Returns: (transfer none): New variant
376
+ */
377
+ GVariant *
378
+ regress_test_gvariant_i (void)
379
+ {
380
+ return g_variant_new_int32 (1);
381
+ }
382
+
383
+ /**
384
+ * regress_test_gvariant_s:
385
+ *
386
+ * Returns: (transfer none): New variant
387
+ */
388
+ GVariant *
389
+ regress_test_gvariant_s (void)
390
+ {
391
+ return g_variant_new_string ("one");
392
+ }
393
+
394
+ /**
395
+ * regress_test_gvariant_asv:
396
+ *
397
+ * Returns: (transfer none): New variant
398
+ */
399
+ GVariant *
400
+ regress_test_gvariant_asv (void)
401
+ {
402
+ GVariantBuilder b;
403
+
404
+ g_variant_builder_init (&b, G_VARIANT_TYPE ("a{sv}"));
405
+
406
+ g_variant_builder_add (&b, "{sv}", "name", g_variant_new_string ("foo"));
407
+ g_variant_builder_add (&b, "{sv}", "timeout", g_variant_new_int32 (10));
408
+
409
+ return g_variant_builder_end (&b);
410
+ }
411
+
412
+ /**
413
+ * regress_test_gvariant_v:
414
+ *
415
+ * Returns: (transfer none): New variant
416
+ */
417
+ GVariant *
418
+ regress_test_gvariant_v (void)
419
+ {
420
+ return g_variant_new_variant (g_variant_new_string ("contents"));
421
+ }
422
+
423
+ /**
424
+ * regress_test_gvariant_as:
425
+ *
426
+ * Returns: (transfer none): New variant
427
+ */
428
+ GVariant *
429
+ regress_test_gvariant_as (void)
430
+ {
431
+ const char *as[] = { "one", "two", "three", NULL };
432
+
433
+ return g_variant_new_strv (as, -1);
434
+ }
435
+
436
+ /************************************************************************/
437
+ /* utf8 */
438
+ /* insert BLACK HEART SUIT to ensure UTF-8 doesn't get mangled */
439
+ static const char utf8_const[] = "const \xe2\x99\xa5 utf8";
440
+ static const char utf8_nonconst[] = "nonconst \xe2\x99\xa5 utf8";
441
+
442
+ /**
443
+ * regress_test_utf8_const_return:
444
+ *
445
+ * Return value: UTF-8 string
446
+ */
447
+ const char *
448
+ regress_test_utf8_const_return (void)
449
+ {
450
+ /* transfer mode none */
451
+ return utf8_const;
452
+ }
453
+
454
+ /**
455
+ * regress_test_utf8_nonconst_return:
456
+ *
457
+ * Return value: (transfer full): UTF-8 string
458
+ */
459
+ char *
460
+ regress_test_utf8_nonconst_return (void)
461
+ {
462
+ return g_strdup (utf8_nonconst);
463
+ }
464
+
465
+ /**
466
+ * regress_test_utf8_const_in:
467
+ *
468
+ */
469
+ void
470
+ regress_test_utf8_const_in (const char *in)
471
+ {
472
+ /* transfer mode none */
473
+ g_assert (strcmp (in, utf8_const) == 0);
474
+ }
475
+
476
+ /**
477
+ * regress_test_utf8_out:
478
+ * @out: (out) (transfer full):
479
+ */
480
+ void
481
+ regress_test_utf8_out (char **out)
482
+ {
483
+ /* out parameter, transfer mode full */
484
+ *out = g_strdup (utf8_nonconst);
485
+ }
486
+
487
+ /**
488
+ * regress_test_utf8_inout:
489
+ * @inout: (inout) (transfer full):
490
+ */
491
+ void
492
+ regress_test_utf8_inout (char **inout)
493
+ {
494
+ /* inout parameter, transfer mode full */
495
+ g_assert (strcmp (*inout, utf8_const) == 0);
496
+ *inout = g_strdup (utf8_nonconst);
497
+ }
498
+
499
+ /**
500
+ * regress_test_filename_return:
501
+ *
502
+ * Return value: (element-type filename) (transfer full): list of strings
503
+ */
504
+ GSList *
505
+ regress_test_filename_return (void)
506
+ {
507
+ GSList *filenames = NULL;
508
+ filenames = g_slist_prepend (filenames, g_filename_from_utf8("/etc/fstab", -1, NULL, NULL, NULL));
509
+ filenames = g_slist_prepend (filenames, g_filename_from_utf8("åäö", -1, NULL, NULL, NULL));
510
+ return filenames;
511
+ }
512
+
513
+ /* in arguments after out arguments */
514
+
515
+ /**
516
+ * regress_test_int_out_utf8:
517
+ * @length: (out):
518
+ * @in:
519
+ */
520
+ void
521
+ regress_test_int_out_utf8 (int *length, const char *in)
522
+ {
523
+ *length = g_utf8_strlen(in, -1);
524
+ }
525
+
526
+
527
+ /* multiple output arguments */
528
+
529
+ /**
530
+ * regress_test_multi_double_args:
531
+ * @in:
532
+ * @one: (out):
533
+ * @two: (out):
534
+ */
535
+ void
536
+ regress_test_multi_double_args (gdouble in, gdouble *one, gdouble *two)
537
+ {
538
+ *one = in * 2;
539
+ *two = in * 3;
540
+ }
541
+
542
+ /**
543
+ * regress_test_utf8_out_out:
544
+ * @out0: (out) (transfer full): a copy of "first"
545
+ * @out1: (out) (transfer full): a copy of "second"
546
+ */
547
+ void
548
+ regress_test_utf8_out_out (char **out0, char **out1)
549
+ {
550
+ *out0 = g_strdup ("first");
551
+ *out1 = g_strdup ("second");
552
+ }
553
+
554
+ /**
555
+ * regress_test_utf8_out_nonconst_return:
556
+ * @out: (out) (transfer full): a copy of "second"
557
+ *
558
+ * Returns: (transfer full): a copy of "first"
559
+ */
560
+ char *
561
+ regress_test_utf8_out_nonconst_return (char **out)
562
+ {
563
+ *out = g_strdup ("second");
564
+ return g_strdup ("first");
565
+ }
566
+
567
+ /**
568
+ * regress_test_utf8_null_in:
569
+ * @in: (allow-none):
570
+ */
571
+ void
572
+ regress_test_utf8_null_in (char *in)
573
+ {
574
+ g_assert (in == NULL);
575
+ }
576
+
577
+ /**
578
+ * regress_test_utf8_null_out:
579
+ * @char_out: (allow-none) (out):
580
+ */
581
+ void regress_test_utf8_null_out (char **char_out)
582
+ {
583
+ *char_out = NULL;
584
+ }
585
+
586
+
587
+ /* non-basic-types */
588
+
589
+ static const char *test_sequence[] = {"1", "2", "3"};
590
+
591
+ /* array */
592
+
593
+ /**
594
+ * regress_test_array_int_in:
595
+ * @n_ints:
596
+ * @ints: (array length=n_ints): List of ints
597
+ */
598
+ int
599
+ regress_test_array_int_in (int n_ints, int *ints)
600
+ {
601
+ int i, sum = 0;
602
+ for (i = 0; i < n_ints; i++)
603
+ sum += ints[i];
604
+ return sum;
605
+ }
606
+
607
+ /**
608
+ * regress_test_array_int_out:
609
+ * @n_ints: (out): the length of @ints
610
+ * @ints: (out) (array length=n_ints) (transfer full): a list of 5 integers, from 0 to 4 in consecutive order
611
+ */
612
+ void
613
+ regress_test_array_int_out (int *n_ints, int **ints)
614
+ {
615
+ int i;
616
+ *n_ints = 5;
617
+ *ints = g_malloc0(sizeof(**ints) * *n_ints);
618
+ for (i = 1; i < *n_ints; i++)
619
+ (*ints)[i] = (*ints)[i-1] + 1;
620
+ }
621
+
622
+ /**
623
+ * regress_test_array_int_inout:
624
+ * @n_ints: (inout): the length of @ints
625
+ * @ints: (inout) (array length=n_ints) (transfer full): a list of integers whose items will be increased by 1, except the first that will be dropped
626
+ */
627
+ void
628
+ regress_test_array_int_inout (int *n_ints, int **ints)
629
+ {
630
+ int i;
631
+ int *new_ints;
632
+
633
+ if (0 < *n_ints)
634
+ {
635
+ *n_ints -= 1;
636
+ new_ints = g_malloc(sizeof(**ints) * *n_ints);
637
+ for (i = 0; i < *n_ints; i++)
638
+ new_ints[i] = (*ints)[i + 1] + 1;
639
+ *ints = new_ints;
640
+ }
641
+ }
642
+
643
+ /**
644
+ * regress_test_array_gint8_in:
645
+ * @n_ints:
646
+ * @ints: (array length=n_ints): List of ints
647
+ */
648
+ int
649
+ regress_test_array_gint8_in (int n_ints, gint8 *ints)
650
+ {
651
+ int i, sum = 0;
652
+ for (i = 0; i < n_ints; i++)
653
+ sum += ints[i];
654
+ return sum;
655
+ }
656
+
657
+ /**
658
+ * regress_test_array_gint16_in:
659
+ * @n_ints:
660
+ * @ints: (array length=n_ints): List of ints
661
+ */
662
+ int
663
+ regress_test_array_gint16_in (int n_ints, gint16 *ints)
664
+ {
665
+ int i, sum = 0;
666
+ for (i = 0; i < n_ints; i++)
667
+ sum += ints[i];
668
+ return sum;
669
+ }
670
+
671
+ /**
672
+ * regress_test_array_gint32_in:
673
+ * @n_ints:
674
+ * @ints: (array length=n_ints): List of ints
675
+ */
676
+ gint32
677
+ regress_test_array_gint32_in (int n_ints, gint32 *ints)
678
+ {
679
+ int i;
680
+ gint32 sum = 0;
681
+ for (i = 0; i < n_ints; i++)
682
+ sum += ints[i];
683
+ return sum;
684
+ }
685
+
686
+ /**
687
+ * regress_test_array_gint64_in:
688
+ * @n_ints:
689
+ * @ints: (array length=n_ints): List of ints
690
+ */
691
+ gint64
692
+ regress_test_array_gint64_in (int n_ints, gint64 *ints)
693
+ {
694
+ int i;
695
+ gint64 sum = 0;
696
+ for (i = 0; i < n_ints; i++)
697
+ sum += ints[i];
698
+ return sum;
699
+ }
700
+
701
+ /**
702
+ * regress_test_strv_in:
703
+ * @arr: (array zero-terminated=1) (transfer none):
704
+ */
705
+ gboolean
706
+ regress_test_strv_in (char **arr)
707
+ {
708
+ if (g_strv_length (arr) != 3)
709
+ return FALSE;
710
+ if (strcmp (arr[0], "1") != 0)
711
+ return FALSE;
712
+ if (strcmp (arr[1], "2") != 0)
713
+ return FALSE;
714
+ if (strcmp (arr[2], "3") != 0)
715
+ return FALSE;
716
+ return TRUE;
717
+ }
718
+
719
+ /**
720
+ * regress_test_array_gtype_in:
721
+ * @n_types:
722
+ * @types: (array length=n_types): List of types
723
+ *
724
+ * Return value: (transfer full): string representation of provided types
725
+ */
726
+ char *
727
+ regress_test_array_gtype_in (int n_types, GType *types)
728
+ {
729
+ GString *string;
730
+ int i;
731
+
732
+ string = g_string_new ("[");
733
+ for (i = 0; i < n_types; i++)
734
+ {
735
+ g_string_append (string, g_type_name (types[i]));
736
+ g_string_append_c (string, ',');
737
+ }
738
+ g_string_append_c (string, ']');
739
+ return g_string_free (string, FALSE);
740
+ }
741
+
742
+ /**
743
+ * regress_test_strv_out:
744
+ *
745
+ * Returns: (transfer full):
746
+ */
747
+ char **
748
+ regress_test_strv_out (void)
749
+ {
750
+ int i = 0;
751
+ int n = 6;
752
+ char **ret = g_new (char *, n);
753
+ ret[i++] = g_strdup ("thanks");
754
+ ret[i++] = g_strdup ("for");
755
+ ret[i++] = g_strdup ("all");
756
+ ret[i++] = g_strdup ("the");
757
+ ret[i++] = g_strdup ("fish");
758
+ ret[i++] = NULL;
759
+ g_assert (i == n);
760
+ return ret;
761
+ }
762
+
763
+ /**
764
+ * regress_test_strv_out_container:
765
+ *
766
+ * Return value: (array zero-terminated=1) (transfer container):
767
+ */
768
+ char **
769
+ regress_test_strv_out_container (void)
770
+ {
771
+ char **ret = g_new (char *, 4);
772
+ ret[0] = "1";
773
+ ret[1] = "2";
774
+ ret[2] = "3";
775
+ ret[3] = NULL;
776
+ return ret;
777
+ }
778
+
779
+ /**
780
+ * regress_test_strv_outarg:
781
+ * @retp: (array zero-terminated=1) (out) (transfer container):
782
+ */
783
+ void
784
+ regress_test_strv_outarg (char ***retp)
785
+ {
786
+ char **ret = g_new (char *, 4);
787
+ ret[0] = "1";
788
+ ret[1] = "2";
789
+ ret[2] = "3";
790
+ ret[3] = NULL;
791
+ *retp = ret;
792
+ }
793
+
794
+ /**
795
+ * regress_test_array_fixed_size_int_in:
796
+ * @ints: (array fixed-size=5): a list of 5 integers
797
+ *
798
+ * Returns: the sum of the items in @ints
799
+ */
800
+ int
801
+ regress_test_array_fixed_size_int_in (int *ints)
802
+ {
803
+ int i, sum = 0;
804
+ for (i = 0; i < 5; i++)
805
+ sum += ints[i];
806
+ return sum;
807
+ }
808
+
809
+ /**
810
+ * regress_test_array_fixed_size_int_out:
811
+ * @ints: (out) (array fixed-size=5) (transfer full): a list of 5 integers ranging from 0 to 4
812
+ */
813
+ void
814
+ regress_test_array_fixed_size_int_out (int **ints)
815
+ {
816
+ int i;
817
+ *ints = g_malloc0(sizeof(**ints) * 5);
818
+ for (i = 1; i < 5; i++)
819
+ (*ints)[i] = (*ints)[i-1] + 1;
820
+ }
821
+
822
+ /**
823
+ * regress_test_array_fixed_size_int_return:
824
+ *
825
+ * Returns: (array fixed-size=5) (transfer full): a list of 5 integers ranging from 0 to 4
826
+ */
827
+ int *
828
+ regress_test_array_fixed_size_int_return (void)
829
+ {
830
+ int i, *ints;
831
+ ints = g_malloc0(sizeof(*ints) * 5);
832
+ for (i = 1; i < 5; i++)
833
+ ints[i] = ints[i-1] + 1;
834
+ return ints;
835
+ }
836
+
837
+ /**
838
+ * regress_test_strv_out_c:
839
+ *
840
+ * Returns: (transfer none):
841
+ */
842
+ const char * const*
843
+ regress_test_strv_out_c (void)
844
+ {
845
+ static char **ret = NULL;
846
+
847
+ if (ret == NULL)
848
+ ret = regress_test_strv_out ();
849
+
850
+ return (const char * const *) ret;
851
+ }
852
+
853
+ /**
854
+ * regress_test_array_int_full_out:
855
+ * @len: length of the returned array.
856
+ *
857
+ * Returns: (array length=len) (transfer full): a new array of integers.
858
+ */
859
+ int *
860
+ regress_test_array_int_full_out(int *len)
861
+ {
862
+ int *result, i;
863
+ *len = 5;
864
+ result = g_malloc0(sizeof(*result) * (*len));
865
+ for (i=1; i < (*len); i++)
866
+ result[i] = result[i-1] + 1;
867
+ return result;
868
+ }
869
+
870
+ /**
871
+ * regress_test_array_int_none_out:
872
+ * @len: length of the returned array.
873
+ *
874
+ * Returns: (array length=len) (transfer none): a static array of integers.
875
+ */
876
+ int *
877
+ regress_test_array_int_none_out(int *len)
878
+ {
879
+ static int result[5] = { 1, 2, 3, 4, 5 };
880
+ *len = 5;
881
+ return result;
882
+ }
883
+
884
+ /**
885
+ * regress_test_array_int_null_in:
886
+ * @arr: (array length=len) (allow-none):
887
+ * @len: length
888
+ */
889
+ void
890
+ regress_test_array_int_null_in (int *arr, int len)
891
+ {
892
+ g_assert (arr == NULL);
893
+ }
894
+
895
+ /**
896
+ * regress_test_array_int_null_out:
897
+ * @arr: (out) (array length=len) (allow-none):
898
+ * @len: (out) : length
899
+ */
900
+ void
901
+ regress_test_array_int_null_out (int **arr, int *len)
902
+ {
903
+ *arr = NULL;
904
+ *len = 0;
905
+ }
906
+
907
+ /* interface */
908
+
909
+ /************************************************************************/
910
+ /* GList */
911
+
912
+ static /*const*/ GList *
913
+ regress_test_sequence_list (void)
914
+ {
915
+ static GList *list = NULL;
916
+ if (!list) {
917
+ gsize i;
918
+ for (i = 0; i < G_N_ELEMENTS(test_sequence); ++i) {
919
+ list = g_list_prepend (list, (gpointer)test_sequence[i]);
920
+ }
921
+ list = g_list_reverse (list);
922
+ }
923
+ return list;
924
+ }
925
+
926
+ /**
927
+ * regress_test_glist_nothing_return:
928
+ *
929
+ * Return value: (element-type utf8) (transfer none):
930
+ */
931
+ const GList *
932
+ regress_test_glist_nothing_return (void)
933
+ {
934
+ return regress_test_sequence_list ();
935
+ }
936
+
937
+ /**
938
+ * regress_test_glist_nothing_return2:
939
+ *
940
+ * Return value: (element-type utf8) (transfer none):
941
+ */
942
+ GList *
943
+ regress_test_glist_nothing_return2 (void)
944
+ {
945
+ return regress_test_sequence_list ();
946
+ }
947
+
948
+ /**
949
+ * regress_test_glist_container_return:
950
+ *
951
+ * Return value: (element-type utf8) (transfer container):
952
+ */
953
+ GList *
954
+ regress_test_glist_container_return (void)
955
+ {
956
+ return g_list_copy (regress_test_sequence_list ());
957
+ }
958
+
959
+ /**
960
+ * regress_test_glist_everything_return:
961
+ *
962
+ * Return value: (element-type utf8) (transfer full):
963
+ */
964
+ GList *
965
+ regress_test_glist_everything_return (void)
966
+ {
967
+ GList *list;
968
+ GList *l;
969
+
970
+ list = g_list_copy (regress_test_sequence_list ());
971
+ for (l = list; l != NULL; l = l->next)
972
+ l->data = g_strdup (l->data);
973
+ return list;
974
+ }
975
+
976
+ static void
977
+ regress_assert_test_sequence_list (const GList *in)
978
+ {
979
+ const GList *l;
980
+ gsize i;
981
+
982
+ for (i = 0, l = in; l != NULL; ++i, l = l->next) {
983
+ g_assert (i < G_N_ELEMENTS(test_sequence));
984
+ g_assert (strcmp (l->data, test_sequence[i]) == 0);
985
+ }
986
+ g_assert (i == G_N_ELEMENTS(test_sequence));
987
+ }
988
+
989
+ /**
990
+ * regress_test_glist_nothing_in:
991
+ * @in: (element-type utf8):
992
+ */
993
+ void
994
+ regress_test_glist_nothing_in (const GList *in)
995
+ {
996
+ regress_assert_test_sequence_list (in);
997
+ }
998
+
999
+ /**
1000
+ * regress_test_glist_nothing_in2:
1001
+ * @in: (element-type utf8):
1002
+ */
1003
+ void
1004
+ regress_test_glist_nothing_in2 (GList *in)
1005
+ {
1006
+ regress_assert_test_sequence_list (in);
1007
+ }
1008
+
1009
+ /**
1010
+ * regress_test_glist_null_in:
1011
+ * @in: (element-type utf8) (allow-none):
1012
+ */
1013
+ void
1014
+ regress_test_glist_null_in (GSList *in)
1015
+ {
1016
+ g_assert (in == NULL);
1017
+ }
1018
+
1019
+ /**
1020
+ * regress_test_glist_null_out:
1021
+ * @out_list: (out) (element-type utf8) (allow-none):
1022
+ */
1023
+ void
1024
+ regress_test_glist_null_out (GSList **out_list)
1025
+ {
1026
+ *out_list = NULL;
1027
+ }
1028
+
1029
+
1030
+ /************************************************************************/
1031
+ /* GSList */
1032
+
1033
+ static /*const*/ GSList *
1034
+ regress_test_sequence_slist (void)
1035
+ {
1036
+ static GSList *list = NULL;
1037
+ if (!list) {
1038
+ gsize i;
1039
+ for (i = 0; i < G_N_ELEMENTS(test_sequence); ++i) {
1040
+ list = g_slist_prepend (list, (gpointer)test_sequence[i]);
1041
+ }
1042
+ list = g_slist_reverse (list);
1043
+ }
1044
+ return list;
1045
+ }
1046
+
1047
+ /**
1048
+ * regress_test_gslist_nothing_return:
1049
+ *
1050
+ * Return value: (element-type utf8) (transfer none):
1051
+ */
1052
+ const GSList *
1053
+ regress_test_gslist_nothing_return (void)
1054
+ {
1055
+ return regress_test_sequence_slist ();
1056
+ }
1057
+
1058
+ /**
1059
+ * regress_test_gslist_nothing_return2:
1060
+ *
1061
+ * Return value: (element-type utf8) (transfer none):
1062
+ */
1063
+ GSList *
1064
+ regress_test_gslist_nothing_return2 (void)
1065
+ {
1066
+ return regress_test_sequence_slist ();
1067
+ }
1068
+
1069
+ /**
1070
+ * regress_test_gslist_container_return:
1071
+ *
1072
+ * Return value: (element-type utf8) (transfer container):
1073
+ */
1074
+ GSList *
1075
+ regress_test_gslist_container_return (void)
1076
+ {
1077
+ return g_slist_copy (regress_test_sequence_slist ());
1078
+ }
1079
+
1080
+ /**
1081
+ * regress_test_gslist_everything_return:
1082
+ *
1083
+ * Return value: (element-type utf8) (transfer full):
1084
+ */
1085
+ GSList *
1086
+ regress_test_gslist_everything_return (void)
1087
+ {
1088
+ GSList *list;
1089
+ GSList *l;
1090
+
1091
+ list = g_slist_copy (regress_test_sequence_slist ());
1092
+ for (l = list; l != NULL; l = l->next)
1093
+ l->data = g_strdup (l->data);
1094
+ return list;
1095
+ }
1096
+
1097
+ static void
1098
+ regress_assert_test_sequence_slist (const GSList *in)
1099
+ {
1100
+ const GSList *l;
1101
+ gsize i;
1102
+
1103
+ for (i = 0, l = in; l != NULL; ++i, l = l->next) {
1104
+ g_assert (i < G_N_ELEMENTS(test_sequence));
1105
+ g_assert (strcmp (l->data, test_sequence[i]) == 0);
1106
+ }
1107
+ g_assert (i == G_N_ELEMENTS(test_sequence));
1108
+ }
1109
+
1110
+ /**
1111
+ * regress_test_gslist_nothing_in:
1112
+ * @in: (element-type utf8):
1113
+ */
1114
+ void
1115
+ regress_test_gslist_nothing_in (const GSList *in)
1116
+ {
1117
+ regress_assert_test_sequence_slist (in);
1118
+ }
1119
+
1120
+ /**
1121
+ * regress_test_gslist_nothing_in2:
1122
+ * @in: (element-type utf8):
1123
+ */
1124
+ void
1125
+ regress_test_gslist_nothing_in2 (GSList *in)
1126
+ {
1127
+ regress_assert_test_sequence_slist (in);
1128
+ }
1129
+
1130
+ /**
1131
+ * regress_test_gslist_null_in:
1132
+ * @in: (element-type utf8) (allow-none):
1133
+ */
1134
+ void
1135
+ regress_test_gslist_null_in (GSList *in)
1136
+ {
1137
+ g_assert (in == NULL);
1138
+ }
1139
+
1140
+ /**
1141
+ * regress_test_gslist_null_out:
1142
+ * @out_list: (out) (element-type utf8) (allow-none):
1143
+ */
1144
+ void
1145
+ regress_test_gslist_null_out (GSList **out_list)
1146
+ {
1147
+ *out_list = NULL;
1148
+ }
1149
+
1150
+ /************************************************************************/
1151
+ /* GHash */
1152
+
1153
+ static char *table_data[3][2] = {
1154
+ { "foo", "bar" }, { "baz", "bat" }, { "qux", "quux" }
1155
+ };
1156
+
1157
+ static GHashTable *
1158
+ regress_test_table_ghash_new_container (void)
1159
+ {
1160
+ GHashTable *hash;
1161
+ int i;
1162
+ hash = g_hash_table_new(g_str_hash, g_str_equal);
1163
+ for (i=0; i<3; i++)
1164
+ g_hash_table_insert(hash, table_data[i][0], table_data[i][1]);
1165
+ return hash;
1166
+ }
1167
+
1168
+ static GHashTable *
1169
+ regress_test_table_ghash_new_full (void)
1170
+ {
1171
+ GHashTable *hash;
1172
+ int i;
1173
+ hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
1174
+ for (i=0; i<3; i++)
1175
+ g_hash_table_insert(hash,
1176
+ g_strdup(table_data[i][0]),
1177
+ g_strdup(table_data[i][1]));
1178
+ return hash;
1179
+ }
1180
+
1181
+ static /*const*/ GHashTable *
1182
+ regress_test_table_ghash_const (void)
1183
+ {
1184
+ static GHashTable *hash = NULL;
1185
+ if (!hash) {
1186
+ hash = regress_test_table_ghash_new_container();
1187
+ }
1188
+ return hash;
1189
+ }
1190
+
1191
+ /**
1192
+ * regress_test_ghash_null_return:
1193
+ *
1194
+ * Return value: (element-type utf8 utf8) (transfer none) (allow-none):
1195
+ */
1196
+ const GHashTable *
1197
+ regress_test_ghash_null_return (void)
1198
+ {
1199
+ return NULL;
1200
+ }
1201
+
1202
+ /**
1203
+ * regress_test_ghash_nothing_return:
1204
+ *
1205
+ * Return value: (element-type utf8 utf8) (transfer none):
1206
+ */
1207
+ const GHashTable *
1208
+ regress_test_ghash_nothing_return (void)
1209
+ {
1210
+ return regress_test_table_ghash_const ();
1211
+ }
1212
+
1213
+ /**
1214
+ * regress_test_ghash_nothing_return2:
1215
+ *
1216
+ * Return value: (element-type utf8 utf8) (transfer none):
1217
+ */
1218
+ GHashTable *
1219
+ regress_test_ghash_nothing_return2 (void)
1220
+ {
1221
+ return regress_test_table_ghash_const ();
1222
+ }
1223
+
1224
+ static GValue *
1225
+ g_value_new (GType type)
1226
+ {
1227
+ GValue *value = g_slice_new0(GValue);
1228
+ g_value_init(value, type);
1229
+ return value;
1230
+ }
1231
+
1232
+ static void
1233
+ g_value_free (GValue *value)
1234
+ {
1235
+ g_value_unset(value);
1236
+ g_slice_free(GValue, value);
1237
+ }
1238
+
1239
+ static const gchar *string_array[] = {
1240
+ "first",
1241
+ "second",
1242
+ "third",
1243
+ NULL
1244
+ };
1245
+
1246
+ /**
1247
+ * regress_test_ghash_gvalue_return:
1248
+ *
1249
+ * Return value: (element-type utf8 GValue) (transfer none):
1250
+ */
1251
+ GHashTable *
1252
+ regress_test_ghash_gvalue_return (void)
1253
+ {
1254
+ GHashTable *hash;
1255
+ GValue *value;
1256
+ hash = g_hash_table_new_full(g_str_hash, g_str_equal,
1257
+ g_free, (GDestroyNotify)g_value_free);
1258
+
1259
+ value = g_value_new(G_TYPE_INT);
1260
+ g_value_set_int(value, 12);
1261
+ g_hash_table_insert(hash, g_strdup("integer"), value);
1262
+
1263
+ value = g_value_new(G_TYPE_BOOLEAN);
1264
+ g_value_set_boolean(value, TRUE);
1265
+ g_hash_table_insert(hash, g_strdup("boolean"), value);
1266
+
1267
+ value = g_value_new(G_TYPE_STRING);
1268
+ g_value_set_string(value, "some text");
1269
+ g_hash_table_insert(hash, g_strdup("string"), value);
1270
+
1271
+ value = g_value_new(G_TYPE_STRV);
1272
+ g_value_set_boxed(value, string_array);
1273
+ g_hash_table_insert(hash, g_strdup("strings"), value);
1274
+
1275
+ value = g_value_new(REGRESS_TEST_TYPE_FLAGS);
1276
+ g_value_set_flags(value, REGRESS_TEST_FLAG1 | REGRESS_TEST_FLAG3);
1277
+ g_hash_table_insert(hash, g_strdup("flags"), value);
1278
+
1279
+ value = g_value_new(regress_test_enum_get_type());
1280
+ g_value_set_enum(value, REGRESS_TEST_VALUE2);
1281
+ g_hash_table_insert(hash, g_strdup("enum"), value);
1282
+
1283
+ return hash;
1284
+ }
1285
+
1286
+ /**
1287
+ * regress_test_ghash_gvalue_in:
1288
+ * @hash: (element-type utf8 GValue): the hash table returned by
1289
+ * regress_test_ghash_gvalue_return().
1290
+ */
1291
+ void
1292
+ regress_test_ghash_gvalue_in (GHashTable *hash)
1293
+ {
1294
+ GValue *value;
1295
+ const gchar **strings;
1296
+ int i;
1297
+
1298
+ g_assert(hash != NULL);
1299
+
1300
+ value = g_hash_table_lookup(hash, "integer");
1301
+ g_assert(value != NULL);
1302
+ g_assert(G_VALUE_HOLDS_INT(value));
1303
+ g_assert(g_value_get_int(value) == 12);
1304
+
1305
+ value = g_hash_table_lookup(hash, "boolean");
1306
+ g_assert(value != NULL);
1307
+ g_assert(G_VALUE_HOLDS_BOOLEAN(value));
1308
+ g_assert(g_value_get_boolean(value) == TRUE);
1309
+
1310
+ value = g_hash_table_lookup(hash, "string");
1311
+ g_assert(value != NULL);
1312
+ g_assert(G_VALUE_HOLDS_STRING(value));
1313
+ g_assert(strcmp(g_value_get_string(value), "some text") == 0);
1314
+
1315
+ value = g_hash_table_lookup(hash, "strings");
1316
+ g_assert(value != NULL);
1317
+ g_assert(G_VALUE_HOLDS(value, G_TYPE_STRV));
1318
+ strings = g_value_get_boxed(value);
1319
+ g_assert(strings != NULL);
1320
+ for (i = 0; string_array[i] != NULL; i++)
1321
+ g_assert(strcmp(strings[i], string_array[i]) == 0);
1322
+
1323
+ value = g_hash_table_lookup(hash, "flags");
1324
+ g_assert(value != NULL);
1325
+ g_assert(G_VALUE_HOLDS_FLAGS(value));
1326
+ g_assert(g_value_get_flags(value) == (REGRESS_TEST_FLAG1 | REGRESS_TEST_FLAG3));
1327
+
1328
+ value = g_hash_table_lookup(hash, "enum");
1329
+ g_assert(value != NULL);
1330
+ g_assert(G_VALUE_HOLDS_ENUM(value));
1331
+ g_assert(g_value_get_enum(value) == REGRESS_TEST_VALUE2);
1332
+ }
1333
+
1334
+ /**
1335
+ * regress_test_ghash_container_return:
1336
+ *
1337
+ * Return value: (element-type utf8 utf8) (transfer container):
1338
+ */
1339
+ GHashTable *
1340
+ regress_test_ghash_container_return (void)
1341
+ {
1342
+ return regress_test_table_ghash_new_container ();
1343
+ }
1344
+
1345
+ /**
1346
+ * regress_test_ghash_everything_return:
1347
+ *
1348
+ * Return value: (element-type utf8 utf8) (transfer full):
1349
+ */
1350
+ GHashTable *
1351
+ regress_test_ghash_everything_return (void)
1352
+ {
1353
+ return regress_test_table_ghash_new_full ();
1354
+ }
1355
+
1356
+ static void
1357
+ assert_test_table_ghash (const GHashTable *in)
1358
+ {
1359
+ GHashTable *h = regress_test_table_ghash_const();
1360
+ GHashTableIter iter;
1361
+ gpointer key, value;
1362
+
1363
+ g_assert(g_hash_table_size(h) ==
1364
+ g_hash_table_size((GHashTable*)in));
1365
+
1366
+ g_hash_table_iter_init(&iter, (GHashTable*)in);
1367
+ while (g_hash_table_iter_next (&iter, &key, &value))
1368
+ g_assert( strcmp(g_hash_table_lookup(h, (char*)key), (char*)value) == 0);
1369
+ }
1370
+
1371
+ /**
1372
+ * regress_test_ghash_null_in:
1373
+ * @in: (element-type utf8 utf8) (allow-none):
1374
+ */
1375
+ void
1376
+ regress_test_ghash_null_in (const GHashTable *in)
1377
+ {
1378
+ g_assert (in == NULL);
1379
+ }
1380
+
1381
+ /**
1382
+ * regress_test_ghash_null_out:
1383
+ * @out: (element-type utf8 utf8) (allow-none) (out):
1384
+ */
1385
+ void
1386
+ regress_test_ghash_null_out (const GHashTable **out)
1387
+ {
1388
+ *out = NULL;
1389
+ }
1390
+
1391
+ /**
1392
+ * regress_test_ghash_nothing_in:
1393
+ * @in: (element-type utf8 utf8):
1394
+ */
1395
+ void
1396
+ regress_test_ghash_nothing_in (const GHashTable *in)
1397
+ {
1398
+ assert_test_table_ghash (in);
1399
+ }
1400
+
1401
+ /**
1402
+ * regress_test_ghash_nothing_in2:
1403
+ * @in: (element-type utf8 utf8):
1404
+ */
1405
+ void
1406
+ regress_test_ghash_nothing_in2 (GHashTable *in)
1407
+ {
1408
+ assert_test_table_ghash (in);
1409
+ }
1410
+
1411
+ /* Nested collection types */
1412
+
1413
+ /**
1414
+ * regress_test_ghash_nested_everything_return:
1415
+ *
1416
+ * Specify nested parameterized types directly with the (type ) annotation.
1417
+ *
1418
+ * Return value: (type GLib.HashTable<utf8,GLib.HashTable<utf8,utf8>>) (transfer full):
1419
+ */
1420
+ GHashTable *
1421
+ regress_test_ghash_nested_everything_return (void)
1422
+ {
1423
+ GHashTable *hash;
1424
+ hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
1425
+ (void (*) (gpointer)) g_hash_table_destroy);
1426
+ g_hash_table_insert(hash, g_strdup("wibble"), regress_test_table_ghash_new_full());
1427
+ return hash;
1428
+ }
1429
+
1430
+ /**
1431
+ * regress_test_ghash_nested_everything_return2:
1432
+ *
1433
+ * Another way of specifying nested parameterized types: using the
1434
+ * element-type annotation.
1435
+ *
1436
+ * Return value: (element-type utf8 GLib.HashTable<utf8,utf8>) (transfer full):
1437
+ */
1438
+ GHashTable *
1439
+ regress_test_ghash_nested_everything_return2 (void)
1440
+ {
1441
+ return regress_test_ghash_nested_everything_return();
1442
+ }
1443
+
1444
+ /************************************************************************/
1445
+
1446
+ /**
1447
+ * regress_test_garray_container_return:
1448
+ *
1449
+ * Returns: (transfer container) (type GLib.PtrArray) (element-type utf8):
1450
+ */
1451
+ GPtrArray *
1452
+ regress_test_garray_container_return (void)
1453
+ {
1454
+ GPtrArray *array;
1455
+
1456
+ array = g_ptr_array_new_with_free_func (g_free);
1457
+ g_ptr_array_add (array, g_strdup ("regress"));
1458
+
1459
+ return array;
1460
+ }
1461
+
1462
+ /**
1463
+ * regress_test_garray_full_return:
1464
+ *
1465
+ * Returns: (transfer full) (type GLib.PtrArray) (element-type utf8):
1466
+ */
1467
+ GPtrArray *
1468
+ regress_test_garray_full_return (void)
1469
+ {
1470
+ GPtrArray *array;
1471
+
1472
+ array = g_ptr_array_new ();
1473
+ g_ptr_array_add (array, g_strdup ("regress"));
1474
+
1475
+ return array;
1476
+ }
1477
+
1478
+ /************************************************************************/
1479
+
1480
+ /* error? */
1481
+
1482
+ /* enums / flags */
1483
+
1484
+ /**
1485
+ * NUM_REGRESS_FOO: (skip)
1486
+ *
1487
+ * num of elements in RegressFoo
1488
+ */
1489
+
1490
+ GType
1491
+ regress_test_enum_get_type (void)
1492
+ {
1493
+ static GType etype = 0;
1494
+ if (G_UNLIKELY(etype == 0)) {
1495
+ static const GEnumValue values[] = {
1496
+ { REGRESS_TEST_VALUE1, "REGRESS_TEST_VALUE1", "value1" },
1497
+ { REGRESS_TEST_VALUE2, "REGRESS_TEST_VALUE2", "value2" },
1498
+ { REGRESS_TEST_VALUE3, "REGRESS_TEST_VALUE3", "value3" },
1499
+ { REGRESS_TEST_VALUE4, "REGRESS_TEST_VALUE4", "value4" },
1500
+ { 0, NULL, NULL }
1501
+ };
1502
+ etype = g_enum_register_static (g_intern_static_string ("RegressTestEnum"), values);
1503
+ }
1504
+
1505
+ return etype;
1506
+ }
1507
+
1508
+ GType
1509
+ regress_test_enum_unsigned_get_type (void)
1510
+ {
1511
+ static GType etype = 0;
1512
+ if (G_UNLIKELY(etype == 0)) {
1513
+ static const GEnumValue values[] = {
1514
+ { REGRESS_TEST_UNSIGNED_VALUE1, "REGRESS_TEST_UNSIGNED_VALUE1", "value1" },
1515
+ { REGRESS_TEST_UNSIGNED_VALUE2, "REGRESS_TEST_UNSIGNED_VALUE2", "value2" },
1516
+ { 0, NULL, NULL }
1517
+ };
1518
+ etype = g_enum_register_static (g_intern_static_string ("RegressTestEnumUnsigned"), values);
1519
+ }
1520
+
1521
+ return etype;
1522
+ }
1523
+
1524
+ GType
1525
+ regress_test_flags_get_type (void)
1526
+ {
1527
+ static GType etype = 0;
1528
+ if (G_UNLIKELY(etype == 0)) {
1529
+ static const GFlagsValue values[] = {
1530
+ { REGRESS_TEST_FLAG1, "TEST_FLAG1", "flag1" },
1531
+ { REGRESS_TEST_FLAG2, "TEST_FLAG2", "flag2" },
1532
+ { REGRESS_TEST_FLAG3, "TEST_FLAG3", "flag3" },
1533
+ { 0, NULL, NULL }
1534
+ };
1535
+ etype = g_flags_register_static (g_intern_static_string ("RegressTestFlags"), values);
1536
+ }
1537
+
1538
+ return etype;
1539
+ }
1540
+
1541
+ const gchar *
1542
+ regress_test_enum_param(RegressTestEnum e)
1543
+ {
1544
+ GEnumValue *ev;
1545
+ GEnumClass *ec;
1546
+
1547
+ ec = g_type_class_ref (regress_test_enum_get_type ());
1548
+ ev = g_enum_get_value (ec, e);
1549
+ g_type_class_unref (ec);
1550
+
1551
+ return ev->value_nick;
1552
+ }
1553
+
1554
+ const gchar *
1555
+ regress_test_unsigned_enum_param(RegressTestEnumUnsigned e)
1556
+ {
1557
+ GEnumValue *ev;
1558
+ GEnumClass *ec;
1559
+
1560
+ ec = g_type_class_ref (regress_test_enum_unsigned_get_type ());
1561
+ ev = g_enum_get_value (ec, e);
1562
+ g_type_class_unref (ec);
1563
+
1564
+ return ev->value_nick;
1565
+ }
1566
+
1567
+ /**
1568
+ * regress_global_get_flags_out:
1569
+ * @v: (out): A flags value
1570
+ *
1571
+ */
1572
+ void
1573
+ regress_global_get_flags_out (RegressTestFlags *v)
1574
+ {
1575
+ *v = REGRESS_TEST_FLAG1 | REGRESS_TEST_FLAG3;
1576
+ }
1577
+
1578
+ /* error domains */
1579
+
1580
+ GType
1581
+ regress_test_error_get_type (void)
1582
+ {
1583
+ static GType etype = 0;
1584
+ if (G_UNLIKELY(etype == 0)) {
1585
+ static const GEnumValue values[] = {
1586
+ { REGRESS_TEST_ERROR_CODE1, "REGRESS_TEST_ERROR_CODE1", "code1" },
1587
+ { REGRESS_TEST_ERROR_CODE2, "REGRESS_TEST_ERROR_CODE2", "code2" },
1588
+ { REGRESS_TEST_ERROR_CODE3, "REGRESS_TEST_ERROR_CODE3", "code3" },
1589
+ { 0, NULL, NULL }
1590
+ };
1591
+ etype = g_enum_register_static (g_intern_static_string ("RegressTestError"), values);
1592
+ }
1593
+
1594
+ return etype;
1595
+ }
1596
+
1597
+ GQuark
1598
+ regress_test_error_quark (void)
1599
+ {
1600
+ return g_quark_from_static_string ("regress-test-error");
1601
+ }
1602
+
1603
+ GType
1604
+ regress_test_abc_error_get_type (void)
1605
+ {
1606
+ static GType etype = 0;
1607
+ if (G_UNLIKELY(etype == 0)) {
1608
+ static const GEnumValue values[] = {
1609
+ { REGRESS_TEST_ABC_ERROR_CODE1, "REGRESS_TEST_ABC_ERROR_CODE1", "code1" },
1610
+ { REGRESS_TEST_ABC_ERROR_CODE2, "REGRESS_TEST_ABC_ERROR_CODE2", "code2" },
1611
+ { REGRESS_TEST_ABC_ERROR_CODE3, "REGRESS_TEST_ABC_ERROR_CODE3", "code3" },
1612
+ { 0, NULL, NULL }
1613
+ };
1614
+ etype = g_enum_register_static (g_intern_static_string ("RegressTestABCError"), values);
1615
+ }
1616
+
1617
+ return etype;
1618
+ }
1619
+
1620
+ GQuark
1621
+ regress_test_abc_error_quark (void)
1622
+ {
1623
+ return g_quark_from_static_string ("regress-test-abc-error");
1624
+ }
1625
+
1626
+ GType
1627
+ regress_test_unconventional_error_get_type (void)
1628
+ {
1629
+ static GType etype = 0;
1630
+ if (G_UNLIKELY(etype == 0)) {
1631
+ static const GEnumValue values[] = {
1632
+ { REGRESS_TEST_OTHER_ERROR_CODE1, "REGRESS_TEST_OTHER_ERROR_CODE1", "code1" },
1633
+ { REGRESS_TEST_OTHER_ERROR_CODE2, "REGRESS_TEST_OTHER_ERROR_CODE2", "code2" },
1634
+ { REGRESS_TEST_OTHER_ERROR_CODE3, "REGRESS_TEST_OTHER_ERROR_CODE3", "code3" },
1635
+ { 0, NULL, NULL }
1636
+ };
1637
+ etype = g_enum_register_static (g_intern_static_string ("RegressTestOtherError"), values);
1638
+ }
1639
+
1640
+ return etype;
1641
+ }
1642
+
1643
+ GQuark
1644
+ regress_test_unconventional_error_quark (void)
1645
+ {
1646
+ return g_quark_from_static_string ("regress-test-other-error");
1647
+ }
1648
+
1649
+
1650
+ GQuark
1651
+ regress_test_def_error_quark (void)
1652
+ {
1653
+ return g_quark_from_static_string ("regress-test-def-error");
1654
+ }
1655
+
1656
+ GQuark
1657
+ regress_atest_error_quark (void)
1658
+ {
1659
+ return g_quark_from_static_string ("regress-atest-error");
1660
+ }
1661
+
1662
+ /* structures */
1663
+
1664
+ /**
1665
+ * regress_test_struct_a_clone:
1666
+ * @a: the structure
1667
+ * @a_out: (out caller-allocates): the cloned structure
1668
+ *
1669
+ * Make a copy of a RegressTestStructA
1670
+ */
1671
+ void
1672
+ regress_test_struct_a_clone (RegressTestStructA *a,
1673
+ RegressTestStructA *a_out)
1674
+ {
1675
+ *a_out = *a;
1676
+ }
1677
+
1678
+ /**
1679
+ * regress_test_struct_a_parse:
1680
+ * @a_out: (out caller-allocates): the structure that is to be filled
1681
+ * @string: ignored
1682
+ */
1683
+ void
1684
+ regress_test_struct_a_parse (RegressTestStructA *a_out,
1685
+ const gchar *string)
1686
+ {
1687
+ a_out->some_int = 23;
1688
+ }
1689
+
1690
+ /**
1691
+ * regress_test_struct_b_clone:
1692
+ * @b: the structure
1693
+ * @b_out: (out): the cloned structure
1694
+ *
1695
+ * Make a copy of a RegressTestStructB
1696
+ */
1697
+ void
1698
+ regress_test_struct_b_clone (RegressTestStructB *b,
1699
+ RegressTestStructB *b_out)
1700
+ {
1701
+ *b_out = *b;
1702
+ }
1703
+
1704
+ /* plain-old-data boxed types */
1705
+
1706
+ RegressTestSimpleBoxedA *
1707
+ regress_test_simple_boxed_a_copy (RegressTestSimpleBoxedA *a)
1708
+ {
1709
+ RegressTestSimpleBoxedA *new_a = g_slice_new (RegressTestSimpleBoxedA);
1710
+
1711
+ *new_a = *a;
1712
+
1713
+ return new_a;
1714
+ }
1715
+
1716
+ static void
1717
+ regress_test_simple_boxed_a_free (RegressTestSimpleBoxedA *a)
1718
+ {
1719
+ g_slice_free (RegressTestSimpleBoxedA, a);
1720
+ }
1721
+
1722
+ GType
1723
+ regress_test_simple_boxed_a_get_gtype (void)
1724
+ {
1725
+ static GType our_type = 0;
1726
+
1727
+ if (our_type == 0)
1728
+ our_type = g_boxed_type_register_static (g_intern_static_string ("RegressTestSimpleBoxedA"),
1729
+ (GBoxedCopyFunc)regress_test_simple_boxed_a_copy,
1730
+ (GBoxedFreeFunc)regress_test_simple_boxed_a_free);
1731
+ return our_type;
1732
+ }
1733
+
1734
+ RegressTestSimpleBoxedB *
1735
+ regress_test_simple_boxed_b_copy (RegressTestSimpleBoxedB *b)
1736
+ {
1737
+ RegressTestSimpleBoxedB *new_b = g_slice_new (RegressTestSimpleBoxedB);
1738
+
1739
+ *new_b = *b;
1740
+
1741
+ return new_b;
1742
+ }
1743
+
1744
+ gboolean
1745
+ regress_test_simple_boxed_a_equals (RegressTestSimpleBoxedA *a,
1746
+ RegressTestSimpleBoxedA *other_a)
1747
+ {
1748
+ return (a->some_int == other_a->some_int &&
1749
+ a->some_int8 == other_a->some_int8 &&
1750
+ a->some_double == other_a->some_double);
1751
+ }
1752
+
1753
+ const RegressTestSimpleBoxedA*
1754
+ regress_test_simple_boxed_a_const_return (void)
1755
+ {
1756
+ static RegressTestSimpleBoxedA simple_a = {
1757
+ 5, 6, 7.0
1758
+ };
1759
+
1760
+ return &simple_a;
1761
+ }
1762
+
1763
+ static void
1764
+ regress_test_simple_boxed_b_free (RegressTestSimpleBoxedB *a)
1765
+ {
1766
+ g_slice_free (RegressTestSimpleBoxedB, a);
1767
+ }
1768
+
1769
+ GType
1770
+ regress_test_simple_boxed_b_get_type (void)
1771
+ {
1772
+ static GType our_type = 0;
1773
+
1774
+ if (our_type == 0)
1775
+ our_type = g_boxed_type_register_static (g_intern_static_string ("RegressTestSimpleBoxedB"),
1776
+ (GBoxedCopyFunc)regress_test_simple_boxed_b_copy,
1777
+ (GBoxedFreeFunc)regress_test_simple_boxed_b_free);
1778
+ return our_type;
1779
+ }
1780
+
1781
+ /* opaque boxed */
1782
+
1783
+ struct _RegressTestBoxedPrivate
1784
+ {
1785
+ guint magic;
1786
+ };
1787
+
1788
+ /**
1789
+ * regress_test_boxed_new:
1790
+ *
1791
+ * Returns: (transfer full):
1792
+ */
1793
+ RegressTestBoxed *
1794
+ regress_test_boxed_new (void)
1795
+ {
1796
+ RegressTestBoxed *boxed = g_slice_new0(RegressTestBoxed);
1797
+ boxed->priv = g_slice_new0(RegressTestBoxedPrivate);
1798
+ boxed->priv->magic = 0xdeadbeef;
1799
+
1800
+ return boxed;
1801
+ }
1802
+
1803
+ /**
1804
+ * regress_test_boxed_new_alternative_constructor1:
1805
+ *
1806
+ * Returns: (transfer full):
1807
+ */
1808
+ RegressTestBoxed *
1809
+ regress_test_boxed_new_alternative_constructor1 (int i)
1810
+ {
1811
+ RegressTestBoxed *boxed = g_slice_new0(RegressTestBoxed);
1812
+ boxed->priv = g_slice_new0(RegressTestBoxedPrivate);
1813
+ boxed->priv->magic = 0xdeadbeef;
1814
+ boxed->some_int8 = i;
1815
+
1816
+ return boxed;
1817
+ }
1818
+
1819
+ /**
1820
+ * regress_test_boxed_new_alternative_constructor2:
1821
+ *
1822
+ * Returns: (transfer full):
1823
+ */
1824
+ RegressTestBoxed *
1825
+ regress_test_boxed_new_alternative_constructor2 (int i, int j)
1826
+ {
1827
+ RegressTestBoxed *boxed = g_slice_new0(RegressTestBoxed);
1828
+ boxed->priv = g_slice_new0(RegressTestBoxedPrivate);
1829
+ boxed->priv->magic = 0xdeadbeef;
1830
+ boxed->some_int8 = i + j;
1831
+
1832
+ return boxed;
1833
+ }
1834
+
1835
+ /**
1836
+ * regress_test_boxed_new_alternative_constructor3:
1837
+ *
1838
+ * Returns: (transfer full):
1839
+ */
1840
+ RegressTestBoxed *
1841
+ regress_test_boxed_new_alternative_constructor3 (char *s)
1842
+ {
1843
+ RegressTestBoxed *boxed = g_slice_new0(RegressTestBoxed);
1844
+ boxed->priv = g_slice_new0(RegressTestBoxedPrivate);
1845
+ boxed->priv->magic = 0xdeadbeef;
1846
+ boxed->some_int8 = atoi(s);
1847
+
1848
+ return boxed;
1849
+ }
1850
+
1851
+ /**
1852
+ * regress_test_boxed_copy:
1853
+ *
1854
+ * Returns: (transfer full):
1855
+ */
1856
+ RegressTestBoxed *
1857
+ regress_test_boxed_copy (RegressTestBoxed *boxed)
1858
+ {
1859
+ RegressTestBoxed *new_boxed = regress_test_boxed_new();
1860
+ RegressTestBoxedPrivate *save;
1861
+
1862
+ save = new_boxed->priv;
1863
+ *new_boxed = *boxed;
1864
+ new_boxed->priv = save;
1865
+
1866
+ return new_boxed;
1867
+ }
1868
+
1869
+ gboolean
1870
+ regress_test_boxed_equals (RegressTestBoxed *boxed,
1871
+ RegressTestBoxed *other)
1872
+ {
1873
+ return (other->some_int8 == boxed->some_int8 &&
1874
+ regress_test_simple_boxed_a_equals(&other->nested_a, &boxed->nested_a));
1875
+ }
1876
+
1877
+ void
1878
+ regress_test_boxeds_not_a_method (RegressTestBoxed *boxed)
1879
+ {
1880
+ }
1881
+
1882
+ void
1883
+ regress_test_boxeds_not_a_static (void)
1884
+ {
1885
+ }
1886
+
1887
+ static void
1888
+ regress_test_boxed_free (RegressTestBoxed *boxed)
1889
+ {
1890
+ g_assert (boxed->priv->magic == 0xdeadbeef);
1891
+
1892
+ g_slice_free (RegressTestBoxedPrivate, boxed->priv);
1893
+ g_slice_free (RegressTestBoxed, boxed);
1894
+ }
1895
+
1896
+ GType
1897
+ regress_test_boxed_get_type (void)
1898
+ {
1899
+ static GType our_type = 0;
1900
+
1901
+ if (our_type == 0)
1902
+ our_type = g_boxed_type_register_static (g_intern_static_string ("RegressTestBoxed"),
1903
+ (GBoxedCopyFunc)regress_test_boxed_copy,
1904
+ (GBoxedFreeFunc)regress_test_boxed_free);
1905
+ return our_type;
1906
+ }
1907
+
1908
+ RegressTestBoxedB *
1909
+ regress_test_boxed_b_new (gint8 some_int8, glong some_long)
1910
+ {
1911
+ RegressTestBoxedB *boxed;
1912
+
1913
+ boxed = g_slice_new (RegressTestBoxedB);
1914
+ boxed->some_int8 = some_int8;
1915
+ boxed->some_long = some_long;
1916
+
1917
+ return boxed;
1918
+ }
1919
+
1920
+ RegressTestBoxedB *
1921
+ regress_test_boxed_b_copy (RegressTestBoxedB *boxed)
1922
+ {
1923
+ return regress_test_boxed_b_new (boxed->some_int8, boxed->some_long);
1924
+ }
1925
+
1926
+ static void
1927
+ regress_test_boxed_b_free (RegressTestBoxedB *boxed)
1928
+ {
1929
+ g_slice_free (RegressTestBoxedB, boxed);
1930
+ }
1931
+
1932
+ G_DEFINE_BOXED_TYPE(RegressTestBoxedB,
1933
+ regress_test_boxed_b,
1934
+ regress_test_boxed_b_copy,
1935
+ regress_test_boxed_b_free);
1936
+
1937
+ RegressTestBoxedC *
1938
+ regress_test_boxed_c_new (void)
1939
+ {
1940
+ RegressTestBoxedC *boxed;
1941
+
1942
+ boxed = g_slice_new (RegressTestBoxedC);
1943
+ boxed->refcount = 1;
1944
+ boxed->another_thing = 42; /* what else */
1945
+
1946
+ return boxed;
1947
+ }
1948
+
1949
+ static RegressTestBoxedC *
1950
+ regress_test_boxed_c_ref (RegressTestBoxedC *boxed)
1951
+ {
1952
+ g_atomic_int_inc (&boxed->refcount);
1953
+ return boxed;
1954
+ }
1955
+
1956
+ static void
1957
+ regress_test_boxed_c_unref (RegressTestBoxedC *boxed)
1958
+ {
1959
+ if (g_atomic_int_dec_and_test (&boxed->refcount)) {
1960
+ g_slice_free (RegressTestBoxedC, boxed);
1961
+ }
1962
+ }
1963
+
1964
+ G_DEFINE_BOXED_TYPE(RegressTestBoxedC,
1965
+ regress_test_boxed_c,
1966
+ regress_test_boxed_c_ref,
1967
+ regress_test_boxed_c_unref);
1968
+
1969
+ struct _RegressTestBoxedD {
1970
+ char *a_string;
1971
+ gint a_int;
1972
+ };
1973
+
1974
+ RegressTestBoxedD *
1975
+ regress_test_boxed_d_new (const char *a_string, int a_int)
1976
+ {
1977
+ RegressTestBoxedD *boxed;
1978
+
1979
+ boxed = g_slice_new (RegressTestBoxedD);
1980
+ boxed->a_string = g_strdup (a_string);
1981
+ boxed->a_int = a_int;
1982
+
1983
+ return boxed;
1984
+ }
1985
+
1986
+ RegressTestBoxedD *
1987
+ regress_test_boxed_d_copy (RegressTestBoxedD *boxed)
1988
+ {
1989
+ RegressTestBoxedD *ret;
1990
+
1991
+ ret = g_slice_new (RegressTestBoxedD);
1992
+ ret->a_string = g_strdup (boxed->a_string);
1993
+ ret->a_int = boxed->a_int;
1994
+
1995
+ return ret;
1996
+ }
1997
+
1998
+ void
1999
+ regress_test_boxed_d_free (RegressTestBoxedD *boxed)
2000
+ {
2001
+ g_free (boxed->a_string);
2002
+ g_slice_free (RegressTestBoxedD, boxed);
2003
+ }
2004
+
2005
+ int
2006
+ regress_test_boxed_d_get_magic (RegressTestBoxedD *boxed)
2007
+ {
2008
+ return strlen (boxed->a_string) + boxed->a_int;
2009
+ }
2010
+
2011
+ G_DEFINE_BOXED_TYPE(RegressTestBoxedD,
2012
+ regress_test_boxed_d,
2013
+ regress_test_boxed_d_copy,
2014
+ regress_test_boxed_d_free);
2015
+
2016
+ G_DEFINE_TYPE(RegressTestObj, regress_test_obj, G_TYPE_OBJECT);
2017
+
2018
+ enum
2019
+ {
2020
+ PROP_TEST_OBJ_BARE = 1,
2021
+ PROP_TEST_OBJ_BOXED,
2022
+ PROP_TEST_OBJ_HASH_TABLE,
2023
+ PROP_TEST_OBJ_LIST,
2024
+ PROP_TEST_OBJ_PPTRARRAY,
2025
+ PROP_TEST_OBJ_HASH_TABLE_OLD,
2026
+ PROP_TEST_OBJ_LIST_OLD,
2027
+ PROP_TEST_OBJ_INT,
2028
+ PROP_TEST_OBJ_FLOAT,
2029
+ PROP_TEST_OBJ_DOUBLE,
2030
+ PROP_TEST_OBJ_STRING,
2031
+ PROP_TEST_OBJ_GTYPE
2032
+ };
2033
+
2034
+ static void
2035
+ regress_test_obj_set_property (GObject *object,
2036
+ guint property_id,
2037
+ const GValue *value,
2038
+ GParamSpec *pspec)
2039
+ {
2040
+ RegressTestObj *self = REGRESS_TEST_OBJECT (object);
2041
+ GList *list;
2042
+
2043
+ switch (property_id)
2044
+ {
2045
+ case PROP_TEST_OBJ_BARE:
2046
+ regress_test_obj_set_bare (self, g_value_get_object (value));
2047
+ break;
2048
+
2049
+ case PROP_TEST_OBJ_BOXED:
2050
+ if (self->boxed)
2051
+ regress_test_boxed_free (self->boxed);
2052
+ self->boxed = g_value_dup_boxed (value);
2053
+ break;
2054
+
2055
+ case PROP_TEST_OBJ_HASH_TABLE:
2056
+ case PROP_TEST_OBJ_HASH_TABLE_OLD:
2057
+ if (self->hash_table)
2058
+ g_hash_table_unref (self->hash_table);
2059
+ self->hash_table = g_hash_table_ref (g_value_get_boxed (value));
2060
+ break;
2061
+
2062
+ case PROP_TEST_OBJ_LIST:
2063
+ case PROP_TEST_OBJ_LIST_OLD:
2064
+ if (self->list != NULL)
2065
+ {
2066
+ for (list = self->list; list != NULL; list = g_list_next (list))
2067
+ g_free (list->data);
2068
+ g_list_free (self->list);
2069
+ }
2070
+ self->list = NULL;
2071
+ for (list = g_value_get_pointer (value); list != NULL; list = g_list_next (list))
2072
+ self->list = g_list_append (self->list, g_strdup (list->data));
2073
+ break;
2074
+
2075
+ case PROP_TEST_OBJ_INT:
2076
+ self->some_int8 = g_value_get_int (value);
2077
+ break;
2078
+
2079
+ case PROP_TEST_OBJ_FLOAT:
2080
+ self->some_float = g_value_get_float (value);
2081
+ break;
2082
+
2083
+ case PROP_TEST_OBJ_DOUBLE:
2084
+ self->some_double = g_value_get_double (value);
2085
+ break;
2086
+
2087
+ case PROP_TEST_OBJ_STRING:
2088
+ self->string = g_value_dup_string (value);
2089
+ break;
2090
+
2091
+ case PROP_TEST_OBJ_GTYPE:
2092
+ self->gtype = g_value_get_gtype (value);
2093
+ break;
2094
+
2095
+ default:
2096
+ /* We don't have any other property... */
2097
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2098
+ break;
2099
+ }
2100
+ }
2101
+
2102
+ static void
2103
+ regress_test_obj_get_property (GObject *object,
2104
+ guint property_id,
2105
+ GValue *value,
2106
+ GParamSpec *pspec)
2107
+ {
2108
+ RegressTestObj *self = REGRESS_TEST_OBJECT (object);
2109
+
2110
+ switch (property_id)
2111
+ {
2112
+ case PROP_TEST_OBJ_BARE:
2113
+ g_value_set_object (value, self->bare);
2114
+ break;
2115
+
2116
+ case PROP_TEST_OBJ_BOXED:
2117
+ g_value_set_boxed (value, self->boxed);
2118
+ break;
2119
+
2120
+ case PROP_TEST_OBJ_HASH_TABLE:
2121
+ case PROP_TEST_OBJ_HASH_TABLE_OLD:
2122
+ if (self->hash_table != NULL)
2123
+ g_hash_table_ref (self->hash_table);
2124
+ g_value_set_boxed (value, self->hash_table);
2125
+ break;
2126
+
2127
+ case PROP_TEST_OBJ_LIST:
2128
+ case PROP_TEST_OBJ_LIST_OLD:
2129
+ g_value_set_pointer (value, self->list);
2130
+ break;
2131
+
2132
+ case PROP_TEST_OBJ_INT:
2133
+ g_value_set_int (value, self->some_int8);
2134
+ break;
2135
+
2136
+ case PROP_TEST_OBJ_FLOAT:
2137
+ g_value_set_float (value, self->some_float);
2138
+ break;
2139
+
2140
+ case PROP_TEST_OBJ_DOUBLE:
2141
+ g_value_set_double (value, self->some_double);
2142
+ break;
2143
+
2144
+ case PROP_TEST_OBJ_STRING:
2145
+ g_value_set_string (value, self->string);
2146
+ break;
2147
+
2148
+ case PROP_TEST_OBJ_GTYPE:
2149
+ g_value_set_gtype (value, self->gtype);
2150
+ break;
2151
+
2152
+ default:
2153
+ /* We don't have any other property... */
2154
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2155
+ break;
2156
+ }
2157
+ }
2158
+
2159
+ static void
2160
+ regress_test_obj_dispose (GObject *gobject)
2161
+ {
2162
+ RegressTestObj *self = REGRESS_TEST_OBJECT (gobject);
2163
+
2164
+ if (self->bare)
2165
+ {
2166
+ g_object_unref (self->bare);
2167
+
2168
+ self->bare = NULL;
2169
+ }
2170
+
2171
+ if (self->boxed)
2172
+ {
2173
+ regress_test_boxed_free (self->boxed);
2174
+ self->boxed = NULL;
2175
+ }
2176
+
2177
+ /* Chain up to the parent class */
2178
+ G_OBJECT_CLASS (regress_test_obj_parent_class)->dispose (gobject);
2179
+ }
2180
+
2181
+ static int
2182
+ regress_test_obj_default_matrix (RegressTestObj *obj, const char *somestr)
2183
+ {
2184
+ return 42;
2185
+ }
2186
+
2187
+ enum {
2188
+ REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_PROP,
2189
+ REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_LEN_PROP,
2190
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP,
2191
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_STRV,
2192
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_OBJ,
2193
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_FOREIGN_STRUCT,
2194
+ REGRESS_TEST_OBJ_SIGNAL_FIRST,
2195
+ REGRESS_TEST_OBJ_SIGNAL_CLEANUP,
2196
+ REGRESS_TEST_OBJ_SIGNAL_ALL,
2197
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INT64_PROP,
2198
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_UINT64_PROP,
2199
+ REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INTARRAY_RET,
2200
+ N_REGRESS_TEST_OBJ_SIGNALS
2201
+ };
2202
+
2203
+ static guint regress_test_obj_signals[N_REGRESS_TEST_OBJ_SIGNALS] = { 0 };
2204
+
2205
+ static void
2206
+ regress_test_obj_class_init (RegressTestObjClass *klass)
2207
+ {
2208
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
2209
+ GParamSpec *pspec;
2210
+ GType param_types[1];
2211
+
2212
+ klass->test_signal =
2213
+ g_signal_newv ("test",
2214
+ G_TYPE_FROM_CLASS (gobject_class),
2215
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
2216
+ NULL /* closure */,
2217
+ NULL /* accumulator */,
2218
+ NULL /* accumulator data */,
2219
+ g_cclosure_marshal_VOID__VOID,
2220
+ G_TYPE_NONE /* return_type */,
2221
+ 0 /* n_params */,
2222
+ NULL /* param_types */);
2223
+
2224
+ param_types[0] = regress_test_simple_boxed_a_get_gtype() | G_SIGNAL_TYPE_STATIC_SCOPE;
2225
+ klass->test_signal_with_static_scope_arg =
2226
+ g_signal_newv ("test-with-static-scope-arg",
2227
+ G_TYPE_FROM_CLASS (gobject_class),
2228
+ G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS,
2229
+ NULL /* closure */,
2230
+ NULL /* accumulator */,
2231
+ NULL /* accumulator data */,
2232
+ g_cclosure_marshal_VOID__BOXED,
2233
+ G_TYPE_NONE /* return_type */,
2234
+ 1 /* n_params */,
2235
+ param_types);
2236
+
2237
+ /**
2238
+ * RegressTestObj::sig-with-array-prop:
2239
+ * @self: an object
2240
+ * @arr: (type GArray) (element-type uint): numbers
2241
+ *
2242
+ * This test signal is like TelepathyGlib's
2243
+ * TpChannel:: group-members-changed-detailed:
2244
+ */
2245
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_PROP] =
2246
+ g_signal_new ("sig-with-array-prop",
2247
+ G_TYPE_FROM_CLASS (gobject_class),
2248
+ G_SIGNAL_RUN_LAST,
2249
+ 0,
2250
+ NULL,
2251
+ NULL,
2252
+ g_cclosure_marshal_VOID__BOXED,
2253
+ G_TYPE_NONE,
2254
+ 1,
2255
+ G_TYPE_ARRAY);
2256
+
2257
+ /**
2258
+ * RegressTestObj::sig-with-array-len-prop:
2259
+ * @self: an object
2260
+ * @arr: (array length=len) (element-type uint) (allow-none): numbers, or %NULL
2261
+ * @len: length of @arr, or 0
2262
+ *
2263
+ * This test signal similar to GSettings::change-event
2264
+ */
2265
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_LEN_PROP] =
2266
+ g_signal_new ("sig-with-array-len-prop",
2267
+ G_TYPE_FROM_CLASS (gobject_class),
2268
+ G_SIGNAL_RUN_LAST,
2269
+ 0,
2270
+ NULL,
2271
+ NULL,
2272
+ NULL,
2273
+ G_TYPE_NONE,
2274
+ 2,
2275
+ G_TYPE_POINTER,
2276
+ G_TYPE_INT);
2277
+
2278
+ /**
2279
+ * RegressTestObj::sig-with-hash-prop:
2280
+ * @self: an object
2281
+ * @hash: (element-type utf8 GObject.Value):
2282
+ *
2283
+ * This test signal is like TelepathyGlib's
2284
+ * TpAccount::status-changed
2285
+ */
2286
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP] =
2287
+ g_signal_new ("sig-with-hash-prop",
2288
+ G_TYPE_FROM_CLASS (gobject_class),
2289
+ G_SIGNAL_RUN_LAST,
2290
+ 0,
2291
+ NULL,
2292
+ NULL,
2293
+ g_cclosure_marshal_VOID__BOXED,
2294
+ G_TYPE_NONE,
2295
+ 1,
2296
+ G_TYPE_HASH_TABLE);
2297
+
2298
+ /**
2299
+ * RegressTestObj::sig-with-strv:
2300
+ * @self: an object
2301
+ * @strs: strings
2302
+ *
2303
+ * Test GStrv as a param.
2304
+ */
2305
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_STRV] =
2306
+ g_signal_new ("sig-with-strv",
2307
+ G_TYPE_FROM_CLASS (gobject_class),
2308
+ G_SIGNAL_RUN_LAST,
2309
+ 0,
2310
+ NULL,
2311
+ NULL,
2312
+ g_cclosure_marshal_VOID__BOXED,
2313
+ G_TYPE_NONE,
2314
+ 1,
2315
+ G_TYPE_STRV);
2316
+
2317
+ /**
2318
+ * RegressTestObj::sig-with-obj:
2319
+ * @self: an object
2320
+ * @obj: (transfer none): A newly created RegressTestObj
2321
+ *
2322
+ * Test transfer none GObject as a param (tests refcounting).
2323
+ * Use with regress_test_obj_emit_sig_with_obj
2324
+ */
2325
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_OBJ] =
2326
+ g_signal_new ("sig-with-obj",
2327
+ G_TYPE_FROM_CLASS (gobject_class),
2328
+ G_SIGNAL_RUN_LAST,
2329
+ 0,
2330
+ NULL,
2331
+ NULL,
2332
+ g_cclosure_marshal_VOID__OBJECT,
2333
+ G_TYPE_NONE,
2334
+ 1,
2335
+ G_TYPE_OBJECT);
2336
+
2337
+ #ifndef _GI_DISABLE_CAIRO
2338
+ /**
2339
+ * RegressTestObj::sig-with-foreign-struct:
2340
+ * @self: an object
2341
+ * @cr: (transfer none): A cairo context.
2342
+ */
2343
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_FOREIGN_STRUCT] =
2344
+ g_signal_new ("sig-with-foreign-struct",
2345
+ G_TYPE_FROM_CLASS (gobject_class),
2346
+ G_SIGNAL_RUN_LAST,
2347
+ 0,
2348
+ NULL,
2349
+ NULL,
2350
+ NULL,
2351
+ G_TYPE_NONE,
2352
+ 1,
2353
+ CAIRO_GOBJECT_TYPE_CONTEXT);
2354
+ #endif
2355
+
2356
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_FIRST] =
2357
+ g_signal_new ("first",
2358
+ G_TYPE_FROM_CLASS (gobject_class),
2359
+ G_SIGNAL_RUN_FIRST,
2360
+ 0,
2361
+ NULL,
2362
+ NULL,
2363
+ g_cclosure_marshal_VOID__VOID,
2364
+ G_TYPE_NONE,
2365
+ 0);
2366
+
2367
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_CLEANUP] =
2368
+ g_signal_new ("cleanup",
2369
+ G_TYPE_FROM_CLASS (gobject_class),
2370
+ G_SIGNAL_RUN_CLEANUP,
2371
+ 0,
2372
+ NULL,
2373
+ NULL,
2374
+ g_cclosure_marshal_VOID__VOID,
2375
+ G_TYPE_NONE,
2376
+ 0);
2377
+
2378
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_ALL] =
2379
+ g_signal_new ("all",
2380
+ G_TYPE_FROM_CLASS (gobject_class),
2381
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE | G_SIGNAL_DETAILED | G_SIGNAL_ACTION | G_SIGNAL_NO_HOOKS,
2382
+ 0,
2383
+ NULL,
2384
+ NULL,
2385
+ g_cclosure_marshal_VOID__VOID,
2386
+ G_TYPE_NONE,
2387
+ 0);
2388
+
2389
+ /**
2390
+ * RegressTestObj::sig-with-int64-prop:
2391
+ * @self: an object
2392
+ * @i: an integer
2393
+ *
2394
+ * You can use this with regress_test_obj_emit_sig_with_int64, or raise from
2395
+ * the introspection client langage.
2396
+ */
2397
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INT64_PROP] =
2398
+ g_signal_new ("sig-with-int64-prop",
2399
+ G_TYPE_FROM_CLASS (gobject_class),
2400
+ G_SIGNAL_RUN_LAST,
2401
+ 0,
2402
+ NULL,
2403
+ NULL,
2404
+ g_cclosure_marshal_VOID__BOXED,
2405
+ G_TYPE_INT64,
2406
+ 1,
2407
+ G_TYPE_INT64);
2408
+
2409
+ /**
2410
+ * RegressTestObj::sig-with-uint64-prop:
2411
+ * @self: an object
2412
+ * @i: an integer
2413
+ *
2414
+ * You can use this with regress_test_obj_emit_sig_with_uint64, or raise from
2415
+ * the introspection client langage.
2416
+ */
2417
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_UINT64_PROP] =
2418
+ g_signal_new ("sig-with-uint64-prop",
2419
+ G_TYPE_FROM_CLASS (gobject_class),
2420
+ G_SIGNAL_RUN_LAST,
2421
+ 0,
2422
+ NULL,
2423
+ NULL,
2424
+ g_cclosure_marshal_VOID__BOXED,
2425
+ G_TYPE_UINT64,
2426
+ 1,
2427
+ G_TYPE_UINT64);
2428
+
2429
+ /**
2430
+ * RegressTestObj::sig-with-intarray-ret:
2431
+ * @self: an object
2432
+ * @i: an integer
2433
+ *
2434
+ * Returns: (array zero-terminated=1) (element-type gint) (transfer full):
2435
+ */
2436
+ regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INTARRAY_RET] =
2437
+ g_signal_new ("sig-with-intarray-ret",
2438
+ G_TYPE_FROM_CLASS (gobject_class),
2439
+ G_SIGNAL_RUN_LAST,
2440
+ 0,
2441
+ NULL,
2442
+ NULL,
2443
+ g_cclosure_marshal_VOID__BOXED,
2444
+ G_TYPE_ARRAY,
2445
+ 1,
2446
+ G_TYPE_INT);
2447
+
2448
+ gobject_class->set_property = regress_test_obj_set_property;
2449
+ gobject_class->get_property = regress_test_obj_get_property;
2450
+ gobject_class->dispose = regress_test_obj_dispose;
2451
+
2452
+ pspec = g_param_spec_object ("bare",
2453
+ "Bare property",
2454
+ "A contained object",
2455
+ G_TYPE_OBJECT,
2456
+ G_PARAM_READWRITE);
2457
+ g_object_class_install_property (gobject_class,
2458
+ PROP_TEST_OBJ_BARE,
2459
+ pspec);
2460
+
2461
+ pspec = g_param_spec_boxed ("boxed",
2462
+ "Boxed property",
2463
+ "A contained boxed struct",
2464
+ REGRESS_TEST_TYPE_BOXED,
2465
+ G_PARAM_READWRITE);
2466
+ g_object_class_install_property (gobject_class,
2467
+ PROP_TEST_OBJ_BOXED,
2468
+ pspec);
2469
+
2470
+ /**
2471
+ * RegressTestObj:hash-table: (type GLib.HashTable(utf8,gint8)) (transfer container)
2472
+ */
2473
+ pspec = g_param_spec_boxed ("hash-table",
2474
+ "GHashTable property",
2475
+ "A contained GHashTable",
2476
+ G_TYPE_HASH_TABLE,
2477
+ G_PARAM_READWRITE);
2478
+ g_object_class_install_property (gobject_class,
2479
+ PROP_TEST_OBJ_HASH_TABLE,
2480
+ pspec);
2481
+
2482
+ /**
2483
+ * RegressTestObj:list: (type GLib.List(utf8)) (transfer none)
2484
+ */
2485
+ pspec = g_param_spec_pointer ("list",
2486
+ "GList property",
2487
+ "A contained GList",
2488
+ G_PARAM_READWRITE);
2489
+ g_object_class_install_property (gobject_class,
2490
+ PROP_TEST_OBJ_LIST,
2491
+ pspec);
2492
+
2493
+ /**
2494
+ * RegressTestObj:pptrarray: (type GLib.PtrArray(utf8)) (transfer none)
2495
+ */
2496
+ pspec = g_param_spec_pointer ("pptrarray",
2497
+ "PtrArray property as a pointer",
2498
+ "Test annotating with GLib.PtrArray",
2499
+ G_PARAM_READWRITE);
2500
+ g_object_class_install_property (gobject_class,
2501
+ PROP_TEST_OBJ_PPTRARRAY,
2502
+ pspec);
2503
+
2504
+ /**
2505
+ * RegressTestObj:hash-table-old: (type GLib.HashTable<utf8,gint8>) (transfer container)
2506
+ */
2507
+ pspec = g_param_spec_boxed ("hash-table-old",
2508
+ "GHashTable property with <>",
2509
+ "A contained GHashTable with <>",
2510
+ G_TYPE_HASH_TABLE,
2511
+ G_PARAM_READWRITE);
2512
+ g_object_class_install_property (gobject_class,
2513
+ PROP_TEST_OBJ_HASH_TABLE_OLD,
2514
+ pspec);
2515
+
2516
+ /**
2517
+ * RegressTestObj:list-old: (type GLib.List<utf8>) (transfer none)
2518
+ */
2519
+ pspec = g_param_spec_pointer ("list-old",
2520
+ "GList property with ()",
2521
+ "A contained GList with <>",
2522
+ G_PARAM_READWRITE);
2523
+ g_object_class_install_property (gobject_class,
2524
+ PROP_TEST_OBJ_LIST_OLD,
2525
+ pspec);
2526
+
2527
+
2528
+
2529
+ /**
2530
+ * TestObj:int:
2531
+ */
2532
+ pspec = g_param_spec_int ("int",
2533
+ "int property",
2534
+ "A contained int",
2535
+ G_MININT,
2536
+ G_MAXINT,
2537
+ 0,
2538
+ G_PARAM_READWRITE);
2539
+ g_object_class_install_property (gobject_class,
2540
+ PROP_TEST_OBJ_INT,
2541
+ pspec);
2542
+
2543
+ /**
2544
+ * TestObj:float:
2545
+ */
2546
+ pspec = g_param_spec_float ("float",
2547
+ "float property",
2548
+ "A contained float",
2549
+ G_MINFLOAT,
2550
+ G_MAXFLOAT,
2551
+ 1.0f,
2552
+ G_PARAM_READWRITE);
2553
+ g_object_class_install_property (gobject_class,
2554
+ PROP_TEST_OBJ_FLOAT,
2555
+ pspec);
2556
+
2557
+ /**
2558
+ * TestObj:double:
2559
+ */
2560
+ pspec = g_param_spec_double ("double",
2561
+ "double property",
2562
+ "A contained double",
2563
+ G_MINDOUBLE,
2564
+ G_MAXDOUBLE,
2565
+ 1.0f,
2566
+ G_PARAM_READWRITE);
2567
+ g_object_class_install_property (gobject_class,
2568
+ PROP_TEST_OBJ_DOUBLE,
2569
+ pspec);
2570
+
2571
+ /**
2572
+ * TestObj:string:
2573
+ */
2574
+ pspec = g_param_spec_string ("string",
2575
+ "string property",
2576
+ "A contained string",
2577
+ NULL,
2578
+ G_PARAM_READWRITE);
2579
+ g_object_class_install_property (gobject_class,
2580
+ PROP_TEST_OBJ_STRING,
2581
+ pspec);
2582
+
2583
+
2584
+ /**
2585
+ * TestObj:gtype:
2586
+ */
2587
+ pspec = g_param_spec_gtype ("gtype",
2588
+ "GType property",
2589
+ "A GType property",
2590
+ G_TYPE_NONE,
2591
+ G_PARAM_READWRITE);
2592
+ g_object_class_install_property (gobject_class,
2593
+ PROP_TEST_OBJ_GTYPE,
2594
+ pspec);
2595
+
2596
+ klass->matrix = regress_test_obj_default_matrix;
2597
+ }
2598
+
2599
+ static void
2600
+ regress_test_obj_init (RegressTestObj *obj)
2601
+ {
2602
+ obj->bare = NULL;
2603
+ obj->boxed = NULL;
2604
+ obj->hash_table = NULL;
2605
+ obj->gtype = G_TYPE_INVALID;
2606
+ }
2607
+
2608
+ /**
2609
+ * regress_test_obj_new: (constructor)
2610
+ * @obj: A #RegressTestObj
2611
+ */
2612
+ RegressTestObj *
2613
+ regress_test_obj_new (RegressTestObj *obj)
2614
+ {
2615
+ return g_object_new (REGRESS_TEST_TYPE_OBJ, NULL);
2616
+ }
2617
+
2618
+ /**
2619
+ * regress_constructor: (constructor)
2620
+ *
2621
+ */
2622
+ RegressTestObj *
2623
+ regress_constructor (void)
2624
+ {
2625
+ return g_object_new (REGRESS_TEST_TYPE_OBJ, NULL);
2626
+ }
2627
+
2628
+ /**
2629
+ * regress_test_obj_new_from_file:
2630
+ */
2631
+ RegressTestObj *
2632
+ regress_test_obj_new_from_file (const char *x, GError **error)
2633
+ {
2634
+ return g_object_new (REGRESS_TEST_TYPE_OBJ, NULL);
2635
+ }
2636
+
2637
+ /**
2638
+ * regress_test_obj_set_bare:
2639
+ * @bare: (allow-none):
2640
+ */
2641
+ void
2642
+ regress_test_obj_set_bare (RegressTestObj *obj, GObject *bare)
2643
+ {
2644
+ if (obj->bare)
2645
+ g_object_unref (obj->bare);
2646
+ obj->bare = bare;
2647
+ if (obj->bare)
2648
+ g_object_ref (obj->bare);
2649
+ }
2650
+
2651
+ void
2652
+ regress_test_obj_emit_sig_with_obj (RegressTestObj *obj)
2653
+ {
2654
+ RegressTestObj *obj_param = regress_constructor ();
2655
+ g_object_set (obj_param, "int", 3, NULL);
2656
+ g_signal_emit_by_name (obj, "sig-with-obj", obj_param);
2657
+ g_object_unref (obj_param);
2658
+ }
2659
+
2660
+ #ifndef _GI_DISABLE_CAIRO
2661
+ void
2662
+ regress_test_obj_emit_sig_with_foreign_struct (RegressTestObj *obj)
2663
+ {
2664
+ cairo_t *cr = regress_test_cairo_context_full_return ();
2665
+ g_signal_emit_by_name (obj, "sig-with-foreign-struct", cr);
2666
+ cairo_destroy (cr);
2667
+ }
2668
+ #endif
2669
+
2670
+ void
2671
+ regress_test_obj_emit_sig_with_int64 (RegressTestObj *obj)
2672
+ {
2673
+ gint64 ret = 0;
2674
+ RegressTestObj *obj_param = regress_constructor ();
2675
+ g_signal_emit_by_name (obj, "sig-with-int64-prop", G_MAXINT64, &ret);
2676
+ g_object_unref (obj_param);
2677
+ g_assert (ret == G_MAXINT64);
2678
+ }
2679
+
2680
+ void
2681
+ regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj)
2682
+ {
2683
+ guint64 ret = 0;
2684
+ RegressTestObj *obj_param = regress_constructor ();
2685
+ g_signal_emit_by_name (obj, "sig-with-uint64-prop", G_MAXUINT64, &ret);
2686
+ g_object_unref (obj_param);
2687
+ g_assert (ret == G_MAXUINT64);
2688
+ }
2689
+
2690
+ int
2691
+ regress_test_obj_instance_method (RegressTestObj *obj)
2692
+ {
2693
+ return -1;
2694
+ }
2695
+
2696
+ /**
2697
+ * regress_test_obj_instance_method_full:
2698
+ * @obj: (transfer full):
2699
+ *
2700
+ */
2701
+ void
2702
+ regress_test_obj_instance_method_full (RegressTestObj *obj)
2703
+ {
2704
+ g_object_unref (obj);
2705
+ }
2706
+
2707
+ double
2708
+ regress_test_obj_static_method (int x)
2709
+ {
2710
+ return x;
2711
+ }
2712
+
2713
+ /**
2714
+ * regress_forced_method: (method)
2715
+ * @obj: A #RegressTestObj
2716
+ *
2717
+ */
2718
+ void
2719
+ regress_forced_method (RegressTestObj *obj)
2720
+ {
2721
+ }
2722
+
2723
+ /**
2724
+ * regress_test_obj_torture_signature_0:
2725
+ * @obj: A #RegressTestObj
2726
+ * @x:
2727
+ * @y: (out):
2728
+ * @z: (out):
2729
+ * @foo:
2730
+ * @q: (out):
2731
+ * @m:
2732
+ *
2733
+ */
2734
+ void
2735
+ regress_test_obj_torture_signature_0 (RegressTestObj *obj,
2736
+ int x,
2737
+ double *y,
2738
+ int *z,
2739
+ const char *foo,
2740
+ int *q,
2741
+ guint m)
2742
+ {
2743
+ *y = x;
2744
+ *z = x * 2;
2745
+ *q = g_utf8_strlen (foo, -1) + m;
2746
+ }
2747
+
2748
+ /**
2749
+ * regress_test_obj_torture_signature_1:
2750
+ * @obj: A #RegressTestObj
2751
+ * @x:
2752
+ * @y: (out):
2753
+ * @z: (out):
2754
+ * @foo:
2755
+ * @q: (out):
2756
+ * @m:
2757
+ * @error: A #GError
2758
+ *
2759
+ * This function throws an error if m is odd.
2760
+ */
2761
+ gboolean
2762
+ regress_test_obj_torture_signature_1 (RegressTestObj *obj,
2763
+ int x,
2764
+ double *y,
2765
+ int *z,
2766
+ const char *foo,
2767
+ int *q,
2768
+ guint m,
2769
+ GError **error)
2770
+ {
2771
+ *y = x;
2772
+ *z = x * 2;
2773
+ *q = g_utf8_strlen (foo, -1) + m;
2774
+ if (m % 2 == 0)
2775
+ return TRUE;
2776
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "m is odd");
2777
+ return FALSE;
2778
+ }
2779
+
2780
+ /**
2781
+ * regress_test_obj_skip_return_val:
2782
+ * @obj: a #RegressTestObj
2783
+ * @a: Parameter.
2784
+ * @out_b: (out): A return value.
2785
+ * @c: Other parameter.
2786
+ * @inout_d: (inout): Will be incremented.
2787
+ * @out_sum: (out): Return value.
2788
+ * @num1: Number.
2789
+ * @num2: Number.
2790
+ * @error: Return location for error.
2791
+ *
2792
+ * Check that the return value is skipped
2793
+ *
2794
+ * Returns: (skip): %TRUE if the call succeeds, %FALSE if @error is set.
2795
+ */
2796
+ gboolean
2797
+ regress_test_obj_skip_return_val (RegressTestObj *obj,
2798
+ gint a,
2799
+ gint *out_b,
2800
+ gdouble c,
2801
+ gint *inout_d,
2802
+ gint *out_sum,
2803
+ gint num1,
2804
+ gint num2,
2805
+ GError **error)
2806
+ {
2807
+ if (out_b != NULL)
2808
+ *out_b = a + 1;
2809
+ if (inout_d != NULL)
2810
+ *inout_d = *inout_d + 1;
2811
+ if (out_sum != NULL)
2812
+ *out_sum = num1 + 10*num2;
2813
+ return TRUE;
2814
+ }
2815
+
2816
+ /**
2817
+ * regress_test_obj_skip_return_val_no_out:
2818
+ * @obj: a #RegressTestObj
2819
+ * @a: Parameter.
2820
+ * @error: Return location for error.
2821
+ *
2822
+ * Check that the return value is skipped. Succeed if a is nonzero, otherwise
2823
+ * raise an error.
2824
+ *
2825
+ * Returns: (skip): %TRUE if the call succeeds, %FALSE if @error is set.
2826
+ */
2827
+ gboolean
2828
+ regress_test_obj_skip_return_val_no_out (RegressTestObj *obj,
2829
+ gint a,
2830
+ GError **error)
2831
+ {
2832
+ if (a == 0) {
2833
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "a is zero");
2834
+ return FALSE;
2835
+ } else {
2836
+ return TRUE;
2837
+ }
2838
+ }
2839
+
2840
+ /**
2841
+ * regress_test_obj_skip_param:
2842
+ * @obj: A #RegressTestObj.
2843
+ * @a: Parameter.
2844
+ * @out_b: (out): Return value.
2845
+ * @c: (skip): Other parameter.
2846
+ * @inout_d: (inout): Will be incremented.
2847
+ * @out_sum: (out): Return value.
2848
+ * @num1: Number.
2849
+ * @num2: Number.
2850
+ * @error: Return location for error.
2851
+ *
2852
+ * Check that a parameter is skipped
2853
+ *
2854
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
2855
+ */
2856
+ gboolean
2857
+ regress_test_obj_skip_param (RegressTestObj *obj,
2858
+ gint a,
2859
+ gint *out_b,
2860
+ gdouble c,
2861
+ gint *inout_d,
2862
+ gint *out_sum,
2863
+ gint num1,
2864
+ gint num2,
2865
+ GError **error)
2866
+ {
2867
+ if (out_b != NULL)
2868
+ *out_b = a + 1;
2869
+ if (inout_d != NULL)
2870
+ *inout_d = *inout_d + 1;
2871
+ if (out_sum != NULL)
2872
+ *out_sum = num1 + 10*num2;
2873
+ return TRUE;
2874
+ }
2875
+
2876
+ /**
2877
+ * regress_test_obj_skip_out_param:
2878
+ * @obj: A #RegressTestObj.
2879
+ * @a: Parameter.
2880
+ * @out_b: (out) (skip): Return value.
2881
+ * @c: Other parameter.
2882
+ * @inout_d: (inout): Will be incremented.
2883
+ * @out_sum: (out): Return value.
2884
+ * @num1: Number.
2885
+ * @num2: Number.
2886
+ * @error: Return location for error.
2887
+ *
2888
+ * Check that the out value is skipped
2889
+ *
2890
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
2891
+ */
2892
+ gboolean
2893
+ regress_test_obj_skip_out_param (RegressTestObj *obj,
2894
+ gint a,
2895
+ gint *out_b,
2896
+ gdouble c,
2897
+ gint *inout_d,
2898
+ gint *out_sum,
2899
+ gint num1,
2900
+ gint num2,
2901
+ GError **error)
2902
+ {
2903
+ if (out_b != NULL)
2904
+ *out_b = a + 1;
2905
+ if (inout_d != NULL)
2906
+ *inout_d = *inout_d + 1;
2907
+ if (out_sum != NULL)
2908
+ *out_sum = num1 + 10*num2;
2909
+ return TRUE;
2910
+ }
2911
+
2912
+ /**
2913
+ * regress_test_obj_skip_inout_param:
2914
+ * @obj: A #RegressTestObj.
2915
+ * @a: Parameter.
2916
+ * @out_b: (out): Return value.
2917
+ * @c: Other parameter.
2918
+ * @inout_d: (inout) (skip): Will be incremented.
2919
+ * @out_sum: (out): Return value.
2920
+ * @num1: Number.
2921
+ * @num2: Number.
2922
+ * @error: Return location for error.
2923
+ *
2924
+ * Check that the out value is skipped
2925
+ *
2926
+ * Returns: %TRUE if the call succeeds, %FALSE if @error is set.
2927
+ */
2928
+ gboolean
2929
+ regress_test_obj_skip_inout_param (RegressTestObj *obj,
2930
+ gint a,
2931
+ gint *out_b,
2932
+ gdouble c,
2933
+ gint *inout_d,
2934
+ gint *out_sum,
2935
+ gint num1,
2936
+ gint num2,
2937
+ GError **error)
2938
+ {
2939
+ if (out_b != NULL)
2940
+ *out_b = a + 1;
2941
+ if (inout_d != NULL)
2942
+ *inout_d = *inout_d + 1;
2943
+ if (out_sum != NULL)
2944
+ *out_sum = num1 + 10*num2;
2945
+ return TRUE;
2946
+ }
2947
+
2948
+ /**
2949
+ * regress_test_obj_do_matrix: (virtual matrix)
2950
+ * @obj: A #RegressTestObj
2951
+ * @somestr: Meaningless string
2952
+ *
2953
+ * This method is virtual. Notably its name differs from the virtual
2954
+ * slot name, which makes it useful for testing bindings handle this
2955
+ * case.
2956
+ */
2957
+ int
2958
+ regress_test_obj_do_matrix (RegressTestObj *obj, const char *somestr)
2959
+ {
2960
+ return REGRESS_TEST_OBJ_GET_CLASS (obj)->matrix (obj, somestr);
2961
+ }
2962
+
2963
+ /**
2964
+ * regress_func_obj_null_in:
2965
+ * @obj: (allow-none): A #RegressTestObj
2966
+ */
2967
+ void
2968
+ regress_func_obj_null_in (RegressTestObj *obj)
2969
+ {
2970
+ }
2971
+
2972
+ /**
2973
+ * regress_test_obj_null_out:
2974
+ * @obj: (allow-none) (out): A #RegressTestObj
2975
+ */
2976
+ void
2977
+ regress_test_obj_null_out (RegressTestObj **obj)
2978
+ {
2979
+ if (obj)
2980
+ *obj = NULL;
2981
+ }
2982
+
2983
+ /**
2984
+ * regress_test_array_fixed_out_objects:
2985
+ * @objs: (out) (array fixed-size=2) (transfer full): An array of #RegressTestObj
2986
+ */
2987
+ void
2988
+ regress_test_array_fixed_out_objects (RegressTestObj ***objs)
2989
+ {
2990
+ RegressTestObj **values = (RegressTestObj**)g_new(gpointer, 2);
2991
+
2992
+ values[0] = regress_constructor();
2993
+ values[1] = regress_constructor();
2994
+
2995
+ *objs = values;
2996
+ }
2997
+
2998
+ typedef struct _CallbackInfo CallbackInfo;
2999
+
3000
+ struct _CallbackInfo
3001
+ {
3002
+ RegressTestCallbackUserData callback;
3003
+ GDestroyNotify notify;
3004
+ gpointer user_data;
3005
+ };
3006
+
3007
+
3008
+ G_DEFINE_TYPE(RegressTestSubObj, regress_test_sub_obj, REGRESS_TEST_TYPE_OBJ);
3009
+
3010
+ static void
3011
+ regress_test_sub_obj_class_init (RegressTestSubObjClass *klass)
3012
+ {
3013
+ }
3014
+
3015
+ static void
3016
+ regress_test_sub_obj_init (RegressTestSubObj *obj)
3017
+ {
3018
+ }
3019
+
3020
+ RegressTestObj*
3021
+ regress_test_sub_obj_new ()
3022
+ {
3023
+ return g_object_new (REGRESS_TEST_TYPE_SUB_OBJ, NULL);
3024
+ }
3025
+
3026
+ int
3027
+ regress_test_sub_obj_instance_method (RegressTestSubObj *obj)
3028
+ {
3029
+ return 0;
3030
+ }
3031
+
3032
+ void
3033
+ regress_test_sub_obj_unset_bare (RegressTestSubObj *obj)
3034
+ {
3035
+ regress_test_obj_set_bare(REGRESS_TEST_OBJECT(obj), NULL);
3036
+ }
3037
+
3038
+ /* RegressTestFundamental */
3039
+
3040
+ /**
3041
+ * regress_test_fundamental_object_ref:
3042
+ *
3043
+ * Returns: (transfer full): A new #RegressTestFundamentalObject
3044
+ */
3045
+ RegressTestFundamentalObject *
3046
+ regress_test_fundamental_object_ref (RegressTestFundamentalObject * fundamental_object)
3047
+ {
3048
+ g_return_val_if_fail (fundamental_object != NULL, NULL);
3049
+ g_atomic_int_inc (&fundamental_object->refcount);
3050
+
3051
+ return fundamental_object;
3052
+ }
3053
+
3054
+ static void
3055
+ regress_test_fundamental_object_free (RegressTestFundamentalObject * fundamental_object)
3056
+ {
3057
+ RegressTestFundamentalObjectClass *mo_class;
3058
+ regress_test_fundamental_object_ref (fundamental_object);
3059
+
3060
+ mo_class = REGRESS_TEST_FUNDAMENTAL_OBJECT_GET_CLASS (fundamental_object);
3061
+ mo_class->finalize (fundamental_object);
3062
+
3063
+ if (G_LIKELY (g_atomic_int_dec_and_test (&fundamental_object->refcount))) {
3064
+ g_type_free_instance ((GTypeInstance *) fundamental_object);
3065
+ }
3066
+ }
3067
+
3068
+ void
3069
+ regress_test_fundamental_object_unref (RegressTestFundamentalObject * fundamental_object)
3070
+ {
3071
+ g_return_if_fail (fundamental_object != NULL);
3072
+ g_return_if_fail (fundamental_object->refcount > 0);
3073
+
3074
+ if (G_UNLIKELY (g_atomic_int_dec_and_test (&fundamental_object->refcount))) {
3075
+ regress_test_fundamental_object_free (fundamental_object);
3076
+ }
3077
+ }
3078
+
3079
+ static void
3080
+ regress_test_fundamental_object_replace (RegressTestFundamentalObject ** olddata, RegressTestFundamentalObject * newdata)
3081
+ {
3082
+ RegressTestFundamentalObject *olddata_val;
3083
+
3084
+ g_return_if_fail (olddata != NULL);
3085
+
3086
+ olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
3087
+
3088
+ if (olddata_val == newdata)
3089
+ return;
3090
+
3091
+ if (newdata)
3092
+ regress_test_fundamental_object_ref (newdata);
3093
+
3094
+ while (!g_atomic_pointer_compare_and_exchange ((gpointer *) olddata,
3095
+ olddata_val, newdata)) {
3096
+ olddata_val = g_atomic_pointer_get ((gpointer *) olddata);
3097
+ }
3098
+
3099
+ if (olddata_val)
3100
+ regress_test_fundamental_object_unref (olddata_val);
3101
+ }
3102
+
3103
+ static void
3104
+ regress_test_value_fundamental_object_init (GValue * value)
3105
+ {
3106
+ value->data[0].v_pointer = NULL;
3107
+ }
3108
+
3109
+ static void
3110
+ regress_test_value_fundamental_object_free (GValue * value)
3111
+ {
3112
+ if (value->data[0].v_pointer) {
3113
+ regress_test_fundamental_object_unref (REGRESS_TEST_FUNDAMENTAL_OBJECT_CAST (value->data[0].v_pointer));
3114
+ }
3115
+ }
3116
+
3117
+ static void
3118
+ regress_test_value_fundamental_object_copy (const GValue * src_value, GValue * dest_value)
3119
+ {
3120
+ if (src_value->data[0].v_pointer) {
3121
+ dest_value->data[0].v_pointer =
3122
+ regress_test_fundamental_object_ref (REGRESS_TEST_FUNDAMENTAL_OBJECT_CAST (src_value->data[0].
3123
+ v_pointer));
3124
+ } else {
3125
+ dest_value->data[0].v_pointer = NULL;
3126
+ }
3127
+ }
3128
+
3129
+ static gpointer
3130
+ regress_test_value_fundamental_object_peek_pointer (const GValue * value)
3131
+ {
3132
+ return value->data[0].v_pointer;
3133
+ }
3134
+
3135
+ static gchar *
3136
+ regress_test_value_fundamental_object_collect (GValue * value,
3137
+ guint n_collect_values,
3138
+ GTypeCValue * collect_values,
3139
+ guint collect_flags)
3140
+ {
3141
+ if (collect_values[0].v_pointer) {
3142
+ value->data[0].v_pointer =
3143
+ regress_test_fundamental_object_ref (collect_values[0].v_pointer);
3144
+ } else {
3145
+ value->data[0].v_pointer = NULL;
3146
+ }
3147
+
3148
+ return NULL;
3149
+ }
3150
+
3151
+ static gchar *
3152
+ regress_test_value_fundamental_object_lcopy (const GValue * value,
3153
+ guint n_collect_values,
3154
+ GTypeCValue * collect_values,
3155
+ guint collect_flags)
3156
+ {
3157
+ gpointer *fundamental_object_p = collect_values[0].v_pointer;
3158
+
3159
+ if (!fundamental_object_p) {
3160
+ return g_strdup_printf ("value location for '%s' passed as NULL",
3161
+ G_VALUE_TYPE_NAME (value));
3162
+ }
3163
+
3164
+ if (!value->data[0].v_pointer)
3165
+ *fundamental_object_p = NULL;
3166
+ else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
3167
+ *fundamental_object_p = value->data[0].v_pointer;
3168
+ else
3169
+ *fundamental_object_p = regress_test_fundamental_object_ref (value->data[0].v_pointer);
3170
+
3171
+ return NULL;
3172
+ }
3173
+
3174
+ static void
3175
+ regress_test_fundamental_object_finalize (RegressTestFundamentalObject * obj)
3176
+ {
3177
+
3178
+ }
3179
+
3180
+ static RegressTestFundamentalObject *
3181
+ regress_test_fundamental_object_copy_default (const RegressTestFundamentalObject * obj)
3182
+ {
3183
+ g_warning ("RegressTestFundamentalObject classes must implement RegressTestFundamentalObject::copy");
3184
+ return NULL;
3185
+ }
3186
+
3187
+ static void
3188
+ regress_test_fundamental_object_class_init (gpointer g_class, gpointer class_data)
3189
+ {
3190
+ RegressTestFundamentalObjectClass *mo_class = REGRESS_TEST_FUNDAMENTAL_OBJECT_CLASS (g_class);
3191
+
3192
+ mo_class->copy = regress_test_fundamental_object_copy_default;
3193
+ mo_class->finalize = regress_test_fundamental_object_finalize;
3194
+ }
3195
+
3196
+ static void
3197
+ regress_test_fundamental_object_init (GTypeInstance * instance, gpointer klass)
3198
+ {
3199
+ RegressTestFundamentalObject *fundamental_object = REGRESS_TEST_FUNDAMENTAL_OBJECT_CAST (instance);
3200
+
3201
+ fundamental_object->refcount = 1;
3202
+ }
3203
+
3204
+ /**
3205
+ * RegressTestFundamentalObject: (ref-func regress_test_fundamental_object_ref) (unref-func regress_test_fundamental_object_unref) (set-value-func regress_test_value_set_fundamental_object) (get-value-func regress_test_value_get_fundamental_object)
3206
+ */
3207
+
3208
+ GType
3209
+ regress_test_fundamental_object_get_type (void)
3210
+ {
3211
+ static GType _test_fundamental_object_type = 0;
3212
+
3213
+ if (G_UNLIKELY (_test_fundamental_object_type == 0)) {
3214
+ static const GTypeValueTable value_table = {
3215
+ regress_test_value_fundamental_object_init,
3216
+ regress_test_value_fundamental_object_free,
3217
+ regress_test_value_fundamental_object_copy,
3218
+ regress_test_value_fundamental_object_peek_pointer,
3219
+ (char *) "p",
3220
+ regress_test_value_fundamental_object_collect,
3221
+ (char *) "p",
3222
+ regress_test_value_fundamental_object_lcopy
3223
+ };
3224
+ static const GTypeInfo fundamental_object_info = {
3225
+ sizeof (RegressTestFundamentalObjectClass),
3226
+ NULL, NULL,
3227
+ regress_test_fundamental_object_class_init,
3228
+ NULL,
3229
+ NULL,
3230
+ sizeof (RegressTestFundamentalObject),
3231
+ 0,
3232
+ (GInstanceInitFunc) regress_test_fundamental_object_init,
3233
+ &value_table
3234
+ };
3235
+ static const GTypeFundamentalInfo fundamental_object_fundamental_info = {
3236
+ (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE |
3237
+ G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE)
3238
+ };
3239
+
3240
+ _test_fundamental_object_type = g_type_fundamental_next ();
3241
+ g_type_register_fundamental (_test_fundamental_object_type, "RegressTestFundamentalObject",
3242
+ &fundamental_object_info, &fundamental_object_fundamental_info, G_TYPE_FLAG_ABSTRACT);
3243
+
3244
+ }
3245
+
3246
+ return _test_fundamental_object_type;
3247
+ }
3248
+
3249
+ /**
3250
+ * regress_test_value_set_fundamental_object: (skip)
3251
+ * @value:
3252
+ * @fundamental_object:
3253
+ */
3254
+ void
3255
+ regress_test_value_set_fundamental_object (GValue * value, RegressTestFundamentalObject * fundamental_object)
3256
+ {
3257
+ gpointer *pointer_p;
3258
+
3259
+ g_return_if_fail (REGRESS_TEST_VALUE_HOLDS_FUNDAMENTAL_OBJECT (value));
3260
+ g_return_if_fail (fundamental_object == NULL || REGRESS_TEST_IS_FUNDAMENTAL_OBJECT (fundamental_object));
3261
+
3262
+ pointer_p = &value->data[0].v_pointer;
3263
+
3264
+ regress_test_fundamental_object_replace ((RegressTestFundamentalObject **) pointer_p, fundamental_object);
3265
+ }
3266
+
3267
+ /**
3268
+ * regress_test_value_get_fundamental_object: (skip)
3269
+ * @value:
3270
+ */
3271
+ RegressTestFundamentalObject *
3272
+ regress_test_value_get_fundamental_object (const GValue * value)
3273
+ {
3274
+ g_return_val_if_fail (REGRESS_TEST_VALUE_HOLDS_FUNDAMENTAL_OBJECT (value), NULL);
3275
+
3276
+ return value->data[0].v_pointer;
3277
+ }
3278
+
3279
+ static RegressTestFundamentalObjectClass *parent_class = NULL;
3280
+
3281
+ G_DEFINE_TYPE (RegressTestFundamentalSubObject, regress_test_fundamental_sub_object, REGRESS_TEST_TYPE_FUNDAMENTAL_OBJECT);
3282
+
3283
+ static RegressTestFundamentalSubObject *
3284
+ _regress_test_fundamental_sub_object_copy (RegressTestFundamentalSubObject * fundamental_sub_object)
3285
+ {
3286
+ RegressTestFundamentalSubObject *copy;
3287
+
3288
+ copy = regress_test_fundamental_sub_object_new(NULL);
3289
+ copy->data = g_strdup(fundamental_sub_object->data);
3290
+ return copy;
3291
+ }
3292
+
3293
+ static void
3294
+ regress_test_fundamental_sub_object_finalize (RegressTestFundamentalSubObject * fundamental_sub_object)
3295
+ {
3296
+ g_return_if_fail (fundamental_sub_object != NULL);
3297
+
3298
+ g_free(fundamental_sub_object->data);
3299
+ regress_test_fundamental_object_finalize (REGRESS_TEST_FUNDAMENTAL_OBJECT (fundamental_sub_object));
3300
+ }
3301
+
3302
+ static void
3303
+ regress_test_fundamental_sub_object_class_init (RegressTestFundamentalSubObjectClass * klass)
3304
+ {
3305
+ parent_class = g_type_class_peek_parent (klass);
3306
+
3307
+ klass->fundamental_object_class.copy = (RegressTestFundamentalObjectCopyFunction) _regress_test_fundamental_sub_object_copy;
3308
+ klass->fundamental_object_class.finalize =
3309
+ (RegressTestFundamentalObjectFinalizeFunction) regress_test_fundamental_sub_object_finalize;
3310
+ }
3311
+
3312
+ static void
3313
+ regress_test_fundamental_sub_object_init(RegressTestFundamentalSubObject *object)
3314
+ {
3315
+
3316
+ }
3317
+
3318
+ /**
3319
+ * regress_test_fundamental_sub_object_new:
3320
+ */
3321
+ RegressTestFundamentalSubObject *
3322
+ regress_test_fundamental_sub_object_new (const char * data)
3323
+ {
3324
+ RegressTestFundamentalSubObject *object;
3325
+
3326
+ object = (RegressTestFundamentalSubObject *) g_type_create_instance (regress_test_fundamental_sub_object_get_type());
3327
+ object->data = g_strdup(data);
3328
+ return object;
3329
+ }
3330
+
3331
+
3332
+ /**
3333
+ * regress_test_callback:
3334
+ * @callback: (scope call) (allow-none):
3335
+ *
3336
+ **/
3337
+ int
3338
+ regress_test_callback (RegressTestCallback callback)
3339
+ {
3340
+ if (callback != NULL)
3341
+ return callback();
3342
+ return 0;
3343
+ }
3344
+
3345
+ /**
3346
+ * regress_test_multi_callback:
3347
+ * @callback: (scope call) (allow-none):
3348
+ *
3349
+ **/
3350
+ int
3351
+ regress_test_multi_callback (RegressTestCallback callback)
3352
+ {
3353
+ int sum = 0;
3354
+ if (callback != NULL) {
3355
+ sum += callback();
3356
+ sum += callback();
3357
+ }
3358
+
3359
+ return sum;
3360
+ }
3361
+
3362
+ /**
3363
+ * regress_test_array_callback:
3364
+ * @callback: (scope call):
3365
+ *
3366
+ **/
3367
+ int regress_test_array_callback (RegressTestCallbackArray callback)
3368
+ {
3369
+ static const char *strings[] = { "one", "two", "three" };
3370
+ static int ints[] = { -1, 0, 1, 2 };
3371
+ int sum = 0;
3372
+
3373
+ sum += callback(ints, 4, strings, 3);
3374
+ sum += callback(ints, 4, strings, 3);
3375
+
3376
+ return sum;
3377
+ }
3378
+
3379
+ /**
3380
+ * regress_test_array_inout_callback:
3381
+ * @callback: (scope call):
3382
+ *
3383
+ */
3384
+ int
3385
+ regress_test_array_inout_callback (RegressTestCallbackArrayInOut callback)
3386
+ {
3387
+ int *ints;
3388
+ int length;
3389
+
3390
+ ints = g_new (int, 5);
3391
+ for (length = 0; length < 5; ++length)
3392
+ ints[length] = length - 2;
3393
+
3394
+ callback (&ints, &length);
3395
+
3396
+ g_assert_cmpint (length, ==, 4);
3397
+ for (length = 0; length < 4; ++length)
3398
+ g_assert_cmpint (ints[length], ==, length - 1);
3399
+
3400
+ callback (&ints, &length);
3401
+
3402
+ g_assert_cmpint (length, ==, 3);
3403
+ for (length = 0; length < 3; ++length)
3404
+ g_assert_cmpint (ints[length], ==, length);
3405
+
3406
+ g_free (ints);
3407
+ return length;
3408
+ }
3409
+
3410
+ /**
3411
+ * regress_test_simple_callback:
3412
+ * @callback: (scope call) (allow-none):
3413
+ *
3414
+ **/
3415
+ void
3416
+ regress_test_simple_callback (RegressTestSimpleCallback callback)
3417
+ {
3418
+ if (callback != NULL)
3419
+ callback();
3420
+
3421
+ return;
3422
+ }
3423
+
3424
+ /**
3425
+ * regress_test_callback_user_data:
3426
+ * @callback: (scope call):
3427
+ *
3428
+ * Call - callback parameter persists for the duration of the method
3429
+ * call and can be released on return.
3430
+ **/
3431
+ int
3432
+ regress_test_callback_user_data (RegressTestCallbackUserData callback,
3433
+ gpointer user_data)
3434
+ {
3435
+ return callback(user_data);
3436
+ }
3437
+
3438
+ static GSList *notified_callbacks = NULL;
3439
+
3440
+ /**
3441
+ * regress_test_callback_destroy_notify:
3442
+ * @callback: (scope notified):
3443
+ *
3444
+ * Notified - callback persists until a DestroyNotify delegate
3445
+ * is invoked.
3446
+ **/
3447
+ int
3448
+ regress_test_callback_destroy_notify (RegressTestCallbackUserData callback,
3449
+ gpointer user_data,
3450
+ GDestroyNotify notify)
3451
+ {
3452
+ int retval;
3453
+ CallbackInfo *info;
3454
+
3455
+ retval = callback(user_data);
3456
+
3457
+ info = g_slice_new(CallbackInfo);
3458
+ info->callback = callback;
3459
+ info->notify = notify;
3460
+ info->user_data = user_data;
3461
+
3462
+ notified_callbacks = g_slist_prepend(notified_callbacks, info);
3463
+
3464
+ return retval;
3465
+ }
3466
+
3467
+ /**
3468
+ * regress_test_callback_destroy_notify_no_user_data:
3469
+ * @callback: (scope notified):
3470
+ *
3471
+ * Adds a scope notified callback with no user data. This can invoke an error
3472
+ * condition in bindings which needs to be tested.
3473
+ **/
3474
+ int
3475
+ regress_test_callback_destroy_notify_no_user_data (RegressTestCallbackUserData callback,
3476
+ GDestroyNotify notify)
3477
+ {
3478
+ return regress_test_callback_destroy_notify(callback, NULL, notify);
3479
+ }
3480
+
3481
+ /**
3482
+ * regress_test_callback_thaw_notifications:
3483
+ *
3484
+ * Invokes all callbacks installed by #test_callback_destroy_notify(),
3485
+ * adding up their return values, and removes them, invoking the
3486
+ * corresponding destroy notfications.
3487
+ *
3488
+ * Return value: Sum of the return values of the invoked callbacks.
3489
+ */
3490
+ int
3491
+ regress_test_callback_thaw_notifications (void)
3492
+ {
3493
+ int retval = 0;
3494
+ GSList *node;
3495
+
3496
+ for (node = notified_callbacks; node != NULL; node = node->next)
3497
+ {
3498
+ CallbackInfo *info = node->data;
3499
+ retval += info->callback (info->user_data);
3500
+ if (info->notify)
3501
+ info->notify (info->user_data);
3502
+ g_slice_free (CallbackInfo, info);
3503
+ }
3504
+
3505
+ g_slist_free (notified_callbacks);
3506
+ notified_callbacks = NULL;
3507
+
3508
+ return retval;
3509
+ }
3510
+
3511
+ static GSList *async_callbacks = NULL;
3512
+
3513
+ /**
3514
+ * regress_test_callback_async:
3515
+ * @callback: (scope async):
3516
+ *
3517
+ **/
3518
+ void
3519
+ regress_test_callback_async (RegressTestCallbackUserData callback,
3520
+ gpointer user_data)
3521
+ {
3522
+ CallbackInfo *info;
3523
+
3524
+ info = g_slice_new(CallbackInfo);
3525
+ info->callback = callback;
3526
+ info->user_data = user_data;
3527
+
3528
+ async_callbacks = g_slist_prepend(async_callbacks, info);
3529
+ }
3530
+
3531
+ /**
3532
+ * regress_test_callback_thaw_async:
3533
+ */
3534
+ int
3535
+ regress_test_callback_thaw_async (void)
3536
+ {
3537
+ int retval = 0;
3538
+ GSList *node;
3539
+
3540
+ for (node = async_callbacks; node != NULL; node = node->next)
3541
+ {
3542
+ CallbackInfo *info = node->data;
3543
+ retval = info->callback (info->user_data);
3544
+ g_slice_free (CallbackInfo, info);
3545
+ }
3546
+
3547
+ g_slist_free (async_callbacks);
3548
+ async_callbacks = NULL;
3549
+ return retval;
3550
+ }
3551
+
3552
+ void
3553
+ regress_test_async_ready_callback (GAsyncReadyCallback callback)
3554
+ {
3555
+ GSimpleAsyncResult *result = g_simple_async_result_new (NULL, callback, NULL,
3556
+ regress_test_async_ready_callback);
3557
+ g_simple_async_result_complete_in_idle (result);
3558
+ }
3559
+
3560
+ /**
3561
+ * regress_test_obj_instance_method_callback:
3562
+ * @callback: (scope call) (allow-none):
3563
+ *
3564
+ **/
3565
+ void
3566
+ regress_test_obj_instance_method_callback (RegressTestObj *obj, RegressTestCallback callback)
3567
+ {
3568
+ if (callback != NULL)
3569
+ callback();
3570
+ }
3571
+
3572
+ /**
3573
+ * regress_test_obj_static_method_callback:
3574
+ * @callback: (scope call) (allow-none):
3575
+ *
3576
+ **/
3577
+ void
3578
+ regress_test_obj_static_method_callback (RegressTestCallback callback)
3579
+ {
3580
+ if (callback != NULL)
3581
+ callback();
3582
+ }
3583
+
3584
+ /**
3585
+ * regress_test_obj_new_callback:
3586
+ * @callback: (scope notified):
3587
+ **/
3588
+ RegressTestObj *
3589
+ regress_test_obj_new_callback (RegressTestCallbackUserData callback, gpointer user_data,
3590
+ GDestroyNotify notify)
3591
+ {
3592
+ CallbackInfo *info;
3593
+
3594
+ callback(user_data);
3595
+
3596
+ info = g_slice_new(CallbackInfo);
3597
+ info->callback = callback;
3598
+ info->notify = notify;
3599
+ info->user_data = user_data;
3600
+
3601
+ notified_callbacks = g_slist_prepend(notified_callbacks, info);
3602
+
3603
+ return g_object_new (REGRESS_TEST_TYPE_OBJ, NULL);
3604
+ }
3605
+
3606
+ /**
3607
+ * regress_test_hash_table_callback:
3608
+ * @data: (element-type utf8 gint): GHashTable that gets passed to callback
3609
+ * @callback: (scope call):
3610
+ **/
3611
+ void
3612
+ regress_test_hash_table_callback (GHashTable *data, RegressTestCallbackHashtable callback)
3613
+ {
3614
+ callback (data);
3615
+ }
3616
+
3617
+ /**
3618
+ * regress_test_gerror_callback:
3619
+ * @callback: (scope call):
3620
+ **/
3621
+ void
3622
+ regress_test_gerror_callback (RegressTestCallbackGError callback)
3623
+ {
3624
+ GError *error;
3625
+
3626
+ error = g_error_new_literal (G_IO_ERROR,
3627
+ G_IO_ERROR_NOT_SUPPORTED,
3628
+ "regression test error");
3629
+ callback (error);
3630
+ g_error_free (error);
3631
+ }
3632
+
3633
+ /**
3634
+ * regress_test_null_gerror_callback:
3635
+ * @callback: (scope call):
3636
+ **/
3637
+ void
3638
+ regress_test_null_gerror_callback (RegressTestCallbackGError callback)
3639
+ {
3640
+ callback (NULL);
3641
+ }
3642
+
3643
+ /**
3644
+ * regress_test_owned_gerror_callback:
3645
+ * @callback: (scope call):
3646
+ **/
3647
+ void
3648
+ regress_test_owned_gerror_callback (RegressTestCallbackOwnedGError callback)
3649
+ {
3650
+ GError *error;
3651
+
3652
+ error = g_error_new_literal (G_IO_ERROR,
3653
+ G_IO_ERROR_PERMISSION_DENIED,
3654
+ "regression test owned error");
3655
+ callback (error);
3656
+ }
3657
+
3658
+ /**
3659
+ * regress_test_skip_unannotated_callback: (skip)
3660
+ * @callback: No annotation here
3661
+ *
3662
+ * Should not emit a warning:
3663
+ * https://bugzilla.gnome.org/show_bug.cgi?id=685399
3664
+ */
3665
+ void
3666
+ regress_test_skip_unannotated_callback (RegressTestCallback callback)
3667
+ {
3668
+ }
3669
+
3670
+ /* interface */
3671
+
3672
+ static void
3673
+ regress_test_interface_default_init(RegressTestInterfaceIface *iface)
3674
+ {
3675
+ }
3676
+
3677
+ typedef RegressTestInterfaceIface RegressTestInterfaceInterface;
3678
+ G_DEFINE_INTERFACE (RegressTestInterface, regress_test_interface, G_TYPE_OBJECT)
3679
+
3680
+
3681
+ /* gobject with non-standard prefix */
3682
+ G_DEFINE_TYPE(RegressTestWi8021x, regress_test_wi_802_1x, G_TYPE_OBJECT);
3683
+
3684
+ enum
3685
+ {
3686
+ PROP_TEST_WI_802_1X_TESTBOOL = 1
3687
+ };
3688
+
3689
+ static void
3690
+ regress_test_wi_802_1x_set_property (GObject *object,
3691
+ guint property_id,
3692
+ const GValue *value,
3693
+ GParamSpec *pspec)
3694
+ {
3695
+ RegressTestWi8021x *self = REGRESS_TEST_WI_802_1X (object);
3696
+
3697
+ switch (property_id)
3698
+ {
3699
+ case PROP_TEST_WI_802_1X_TESTBOOL:
3700
+ regress_test_wi_802_1x_set_testbool (self, g_value_get_boolean (value));
3701
+ break;
3702
+
3703
+ default:
3704
+ /* We don't have any other property... */
3705
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
3706
+ break;
3707
+ }
3708
+ }
3709
+
3710
+ static void
3711
+ regress_test_wi_802_1x_get_property (GObject *object,
3712
+ guint property_id,
3713
+ GValue *value,
3714
+ GParamSpec *pspec)
3715
+ {
3716
+ RegressTestWi8021x *self = REGRESS_TEST_WI_802_1X (object);
3717
+
3718
+ switch (property_id)
3719
+ {
3720
+ case PROP_TEST_WI_802_1X_TESTBOOL:
3721
+ g_value_set_boolean (value, regress_test_wi_802_1x_get_testbool (self));
3722
+ break;
3723
+
3724
+ default:
3725
+ /* We don't have any other property... */
3726
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
3727
+ break;
3728
+ }
3729
+ }
3730
+
3731
+ static void
3732
+ regress_test_wi_802_1x_dispose (GObject *gobject)
3733
+ {
3734
+ /* Chain up to the parent class */
3735
+ G_OBJECT_CLASS (regress_test_wi_802_1x_parent_class)->dispose (gobject);
3736
+ }
3737
+
3738
+ static void
3739
+ regress_test_wi_802_1x_class_init (RegressTestWi8021xClass *klass)
3740
+ {
3741
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
3742
+ GParamSpec *pspec;
3743
+
3744
+ gobject_class->set_property = regress_test_wi_802_1x_set_property;
3745
+ gobject_class->get_property = regress_test_wi_802_1x_get_property;
3746
+ gobject_class->dispose = regress_test_wi_802_1x_dispose;
3747
+
3748
+ pspec = g_param_spec_boolean ("testbool",
3749
+ "Nick for testbool",
3750
+ "Blurb for testbool",
3751
+ TRUE,
3752
+ G_PARAM_READWRITE);
3753
+ g_object_class_install_property (gobject_class,
3754
+ PROP_TEST_WI_802_1X_TESTBOOL,
3755
+ pspec);
3756
+ }
3757
+
3758
+ static void
3759
+ regress_test_wi_802_1x_init (RegressTestWi8021x *obj)
3760
+ {
3761
+ obj->testbool = TRUE;
3762
+ }
3763
+
3764
+ RegressTestWi8021x *
3765
+ regress_test_wi_802_1x_new (void)
3766
+ {
3767
+ return g_object_new (REGRESS_TEST_TYPE_WI_802_1X, NULL);
3768
+ }
3769
+
3770
+ void
3771
+ regress_test_wi_802_1x_set_testbool (RegressTestWi8021x *obj, gboolean val)
3772
+ {
3773
+ obj->testbool = val;
3774
+ }
3775
+
3776
+ gboolean
3777
+ regress_test_wi_802_1x_get_testbool (RegressTestWi8021x *obj)
3778
+ {
3779
+ return obj->testbool;
3780
+ }
3781
+
3782
+ int
3783
+ regress_test_wi_802_1x_static_method (int x)
3784
+ {
3785
+ return 2*x;
3786
+ }
3787
+
3788
+ /* floating gobject */
3789
+ G_DEFINE_TYPE(RegressTestFloating, regress_test_floating, G_TYPE_INITIALLY_UNOWNED);
3790
+
3791
+ static void
3792
+ regress_test_floating_finalize(GObject *object)
3793
+ {
3794
+ g_assert(!g_object_is_floating (object));
3795
+
3796
+ G_OBJECT_CLASS(regress_test_floating_parent_class)->finalize(object);
3797
+ }
3798
+
3799
+ static void
3800
+ regress_test_floating_class_init (RegressTestFloatingClass *klass)
3801
+ {
3802
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
3803
+ gobject_class->finalize = regress_test_floating_finalize;
3804
+ }
3805
+
3806
+ static void
3807
+ regress_test_floating_init (RegressTestFloating *obj)
3808
+ {
3809
+ }
3810
+
3811
+ /**
3812
+ * regress_test_floating_new:
3813
+ *
3814
+ * Returns:: A new floating #RegressTestFloating
3815
+ */
3816
+ RegressTestFloating *
3817
+ regress_test_floating_new (void)
3818
+ {
3819
+ return g_object_new (REGRESS_TEST_TYPE_FLOATING, NULL);
3820
+ }
3821
+
3822
+
3823
+ /**
3824
+ * regress_test_torture_signature_0:
3825
+ * @x:
3826
+ * @y: (out):
3827
+ * @z: (out):
3828
+ * @foo:
3829
+ * @q: (out):
3830
+ * @m:
3831
+ *
3832
+ */
3833
+ void
3834
+ regress_test_torture_signature_0 (int x,
3835
+ double *y,
3836
+ int *z,
3837
+ const char *foo,
3838
+ int *q,
3839
+ guint m)
3840
+ {
3841
+ *y = x;
3842
+ *z = x * 2;
3843
+ *q = g_utf8_strlen (foo, -1) + m;
3844
+ }
3845
+
3846
+ /**
3847
+ * regress_test_torture_signature_1:
3848
+ * @x:
3849
+ * @y: (out):
3850
+ * @z: (out):
3851
+ * @foo:
3852
+ * @q: (out):
3853
+ * @m:
3854
+ * @error: A #GError
3855
+ *
3856
+ * This function throws an error if m is odd.
3857
+ */
3858
+ gboolean
3859
+ regress_test_torture_signature_1 (int x,
3860
+ double *y,
3861
+ int *z,
3862
+ const char *foo,
3863
+ int *q,
3864
+ guint m,
3865
+ GError **error)
3866
+ {
3867
+ *y = x;
3868
+ *z = x * 2;
3869
+ *q = g_utf8_strlen (foo, -1) + m;
3870
+ if (m % 2 == 0)
3871
+ return TRUE;
3872
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "m is odd");
3873
+ return FALSE;
3874
+ }
3875
+
3876
+ /**
3877
+ * regress_test_torture_signature_2:
3878
+ * @x:
3879
+ * @callback:
3880
+ * @user_data:
3881
+ * @notify:
3882
+ * @y: (out):
3883
+ * @z: (out):
3884
+ * @foo:
3885
+ * @q: (out):
3886
+ * @m:
3887
+ *
3888
+ */
3889
+ void
3890
+ regress_test_torture_signature_2 (int x,
3891
+ RegressTestCallbackUserData callback,
3892
+ gpointer user_data,
3893
+ GDestroyNotify notify,
3894
+ double *y,
3895
+ int *z,
3896
+ const char *foo,
3897
+ int *q,
3898
+ guint m)
3899
+ {
3900
+ *y = x;
3901
+ *z = x * 2;
3902
+ *q = g_utf8_strlen (foo, -1) + m;
3903
+ callback(user_data);
3904
+ notify (user_data);
3905
+ }
3906
+
3907
+ /**
3908
+ * regress_test_date_in_gvalue:
3909
+ *
3910
+ * Returns: (transfer full):
3911
+ */
3912
+ GValue *
3913
+ regress_test_date_in_gvalue (void)
3914
+ {
3915
+ GValue *value = g_new0 (GValue, 1);
3916
+ GDate *date = g_date_new_dmy (5, 12, 1984);
3917
+
3918
+ g_value_init (value, G_TYPE_DATE);
3919
+ g_value_take_boxed (value, date);
3920
+
3921
+ return value;
3922
+ }
3923
+
3924
+ /**
3925
+ * regress_test_strv_in_gvalue:
3926
+ *
3927
+ * Returns: (transfer full):
3928
+ */
3929
+ GValue *
3930
+ regress_test_strv_in_gvalue (void)
3931
+ {
3932
+ GValue *value = g_new0 (GValue, 1);
3933
+ const char *strv[] = { "one", "two", "three", NULL };
3934
+
3935
+ g_value_init (value, G_TYPE_STRV);
3936
+ g_value_set_boxed (value, strv);
3937
+
3938
+ return value;
3939
+ }
3940
+
3941
+ /**
3942
+ * regress_test_multiline_doc_comments:
3943
+ *
3944
+ * This is a function.
3945
+ *
3946
+ * It has multiple lines in the documentation.
3947
+ *
3948
+ * The sky is blue.
3949
+ *
3950
+ * You will give me your credit card number.
3951
+ */
3952
+ void
3953
+ regress_test_multiline_doc_comments (void)
3954
+ {
3955
+ }
3956
+
3957
+ /**
3958
+ * regress_test_nested_parameter:
3959
+ * @a: An integer
3960
+ *
3961
+ * <informaltable>
3962
+ * <tgroup cols="3">
3963
+ * <thead>
3964
+ * <row>
3965
+ * <entry>Syntax</entry>
3966
+ * <entry>Explanation</entry>
3967
+ * <entry>Examples</entry>
3968
+ * </row>
3969
+ * </thead>
3970
+ * <tbody>
3971
+ * <row>
3972
+ * <entry>rgb(@r, @g, @b)</entry>
3973
+ * <entry>An opaque color; @r, @g, @b can be either integers between
3974
+ * 0 and 255 or percentages</entry>
3975
+ * <entry><literallayout>rgb(128, 10, 54)
3976
+ * rgb(20%, 30%, 0%)</literallayout></entry>
3977
+ * </row>
3978
+ * <row>
3979
+ * <entry>rgba(@r, @g, @b, @a)</entry>
3980
+ * <entry>A translucent color; @r, @g, @b are as in the previous row,
3981
+ * @a is a floating point number between 0 and 1</entry>
3982
+ * <entry><literallayout>rgba(255, 255, 0, 0.5)</literallayout></entry>
3983
+ * </row>
3984
+ * </tbody>
3985
+ * </tgroup>
3986
+ * </informaltable>
3987
+ *
3988
+ * What we're testing here is that the scanner ignores the @a nested inside XML.
3989
+ */
3990
+ void
3991
+ regress_test_nested_parameter (int a)
3992
+ {
3993
+ }
3994
+
3995
+ /**
3996
+ * regress_introspectable_via_alias:
3997
+ *
3998
+ */
3999
+ void
4000
+ regress_introspectable_via_alias (RegressPtrArrayAlias *data)
4001
+ {
4002
+ }
4003
+
4004
+ /**
4005
+ * regress_not_introspectable_via_alias:
4006
+ *
4007
+ */
4008
+ void
4009
+ regress_not_introspectable_via_alias (RegressVaListAlias ok)
4010
+ {
4011
+ }
4012
+
4013
+ /**
4014
+ * regress_aliased_caller_alloc:
4015
+ * @boxed: (out):
4016
+ */
4017
+ void regress_aliased_caller_alloc (RegressAliasedTestBoxed *boxed)
4018
+ {
4019
+ boxed->priv = g_slice_new0 (RegressTestBoxedPrivate);
4020
+ boxed->priv->magic = 0xdeadbeef;
4021
+ }
4022
+
4023
+ void
4024
+ regress_test_struct_fixed_array_frob (RegressTestStructFixedArray *str)
4025
+ {
4026
+ guint i;
4027
+ str->just_int = 7;
4028
+
4029
+ for (i = 0; i < G_N_ELEMENTS(str->array); i++)
4030
+ str->array[i] = 42 + i;
4031
+ }
4032
+
4033
+ /**
4034
+ * regress_has_parameter_named_attrs:
4035
+ * @foo: some int
4036
+ * @attributes: (type guint32) (array fixed-size=32): list of attributes
4037
+ *
4038
+ * This test case mirrors GnomeKeyringPasswordSchema from
4039
+ * libgnome-keyring.
4040
+ */
4041
+ void
4042
+ regress_has_parameter_named_attrs (int foo,
4043
+ gpointer attributes)
4044
+ {
4045
+ }
4046
+
4047
+ /**
4048
+ * regress_test_versioning:
4049
+ *
4050
+ * Since: 1.32.1: Actually, this function was introduced earlier
4051
+ * than this, but it didn't do anything before this version.
4052
+ * Deprecated: 1.33.3: This function has been deprecated,
4053
+ * because it sucks. Use foobar instead.
4054
+ * Stability: Unstable: Maybe someday we will find the time
4055
+ * to stabilize this function. Who knows?
4056
+ */
4057
+ void
4058
+ regress_test_versioning (void)
4059
+ {
4060
+ }
4061
+
4062
+ void
4063
+ regress_like_xkl_config_item_set_name (RegressLikeXklConfigItem *self,
4064
+ const char *name)
4065
+ {
4066
+ strncpy (self->name, name, sizeof (self->name) - 1);
4067
+ self->name[sizeof(self->name)-1] = '\0';
4068
+ }