gobject-introspection 3.0.9-x86-mingw32 → 3.1.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/ext/gobject-introspection/rb-gi-argument.c +205 -47
  4. data/ext/gobject-introspection/rb-gi-constructor-info.c +9 -15
  5. data/ext/gobject-introspection/rb-gi-function-info.c +147 -46
  6. data/ext/gobject-introspection/rb-gi-method-info.c +5 -3
  7. data/ext/gobject-introspection/rb-gi-private.h +3 -1
  8. data/lib/2.2/gobject_introspection.so +0 -0
  9. data/lib/2.3/gobject_introspection.so +0 -0
  10. data/lib/gi.rb +19 -0
  11. data/lib/gobject-introspection.rb +10 -0
  12. data/lib/gobject-introspection/callable-info.rb +19 -5
  13. data/lib/gobject-introspection/loader.rb +113 -82
  14. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  15. data/vendor/local/bin/g-ir-generate.exe +0 -0
  16. data/vendor/local/bin/g-ir-inspect.exe +0 -0
  17. data/vendor/local/bin/libgirepository-1.0-1.dll +0 -0
  18. data/vendor/local/lib/girepository-1.0/GIRepository-2.0.typelib +0 -0
  19. data/vendor/local/lib/girepository-1.0/GLib-2.0.typelib +0 -0
  20. data/vendor/local/lib/girepository-1.0/Gio-2.0.typelib +0 -0
  21. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyc +0 -0
  22. data/vendor/local/lib/gobject-introspection/giscanner/__init__.pyo +0 -0
  23. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyc +0 -0
  24. data/vendor/local/lib/gobject-introspection/giscanner/annotationmain.pyo +0 -0
  25. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyc +0 -0
  26. data/vendor/local/lib/gobject-introspection/giscanner/annotationparser.pyo +0 -0
  27. data/vendor/local/lib/gobject-introspection/giscanner/ast.py +2 -1
  28. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyc +0 -0
  29. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  30. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  32. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyc +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/ccompiler.pyo +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  35. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyc +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/collections/counter.pyo +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  47. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  50. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  53. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  56. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  62. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyc +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/msvccompiler.pyo +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  73. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  74. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  75. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  76. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  77. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  78. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  79. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  80. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  81. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  82. data/vendor/local/lib/libgirepository-1.0.la +2 -2
  83. data/vendor/local/lib/pkgconfig/gobject-introspection-1.0.pc +1 -1
  84. data/vendor/local/lib/pkgconfig/gobject-introspection-no-export-1.0.pc +1 -1
  85. data/vendor/local/share/gir-1.0/GIRepository-2.0.gir +10 -4
  86. data/vendor/local/share/gir-1.0/GLib-2.0.gir +939 -162
  87. data/vendor/local/share/gir-1.0/GObject-2.0.gir +389 -565
  88. data/vendor/local/share/gir-1.0/Gio-2.0.gir +594 -173
  89. data/vendor/local/share/gobject-introspection-1.0/gdump.c +8 -1
  90. data/vendor/local/share/gobject-introspection-1.0/tests/regress.h +13 -0
  91. metadata +7 -5
@@ -59,6 +59,21 @@ gi_function_info_get_type(void)
59
59
  return type;
60
60
  }
61
61
 
62
+ static VALUE
63
+ rg_set_unlock_gvl(VALUE self, VALUE rb_boolean)
64
+ {
65
+ return rb_iv_set(self, "unlock_gvl", rb_boolean);
66
+ }
67
+
68
+ static VALUE
69
+ rg_unlock_gvl_p(VALUE self)
70
+ {
71
+ if (!RVAL2CBOOL(rb_ivar_defined(self, rb_intern("unlock_gvl")))) {
72
+ rb_iv_set(self, "unlock_gvl", Qfalse);
73
+ }
74
+ return rb_iv_get(self, "unlock_gvl");
75
+ }
76
+
62
77
  static VALUE
63
78
  rg_symbol(VALUE self)
64
79
  {
@@ -665,10 +680,12 @@ out_argument_to_raw_data_interface(GICallableInfo *callable_info,
665
680
  GIArgument *argument,
666
681
  gpointer result,
667
682
  GITypeInfo *type_info,
668
- G_GNUC_UNUSED GITransfer transfer /* TODO */)
683
+ G_GNUC_UNUSED GITransfer transfer /* TODO */,
684
+ gboolean is_return_value)
669
685
  {
670
686
  GIBaseInfo *interface_info;
671
687
  GIInfoType interface_type;
688
+ GIFFIReturnValue *ffi_return_value = result;
672
689
 
673
690
  interface_info = g_type_info_get_interface(type_info);
674
691
  interface_type = g_base_info_get_type(interface_info);
@@ -687,7 +704,11 @@ out_argument_to_raw_data_interface(GICallableInfo *callable_info,
687
704
  g_base_info_get_name(interface_info));
688
705
  break;
689
706
  case GI_INFO_TYPE_ENUM:
690
- *((gint *)result) = argument->v_int;
707
+ if (is_return_value) {
708
+ ffi_return_value->v_ulong = argument->v_int;
709
+ } else {
710
+ *((gint *)result) = argument->v_int;
711
+ }
691
712
  break;
692
713
  case GI_INFO_TYPE_FLAGS:
693
714
  case GI_INFO_TYPE_OBJECT:
@@ -725,15 +746,50 @@ out_argument_to_raw_data_interface(GICallableInfo *callable_info,
725
746
  g_base_info_unref(interface_info);
726
747
  }
727
748
 
749
+ /*
750
+ We need to cast from different type for return value. (We don't
751
+ need it for out arguments.) Because of libffi specification:
752
+
753
+ https://github.com/libffi/libffi/blob/master/doc/libffi.texi#L190
754
+
755
+ @var{rvalue} is a pointer to a chunk of memory that will hold the
756
+ result of the function call. This must be large enough to hold the
757
+ result, no smaller than the system register size (generally 32 or 64
758
+ bits), and must be suitably aligned; it is the caller's responsibility
759
+ to ensure this. If @var{cif} declares that the function returns
760
+ @code{void} (using @code{ffi_type_void}), then @var{rvalue} is
761
+ ignored.
762
+
763
+ https://github.com/libffi/libffi/blob/master/doc/libffi.texi#L198
764
+
765
+ In most situations, @samp{libffi} will handle promotion according to
766
+ the ABI. However, for historical reasons, there is a special case
767
+ with return values that must be handled by your code. In particular,
768
+ for integral (not @code{struct}) types that are narrower than the
769
+ system register size, the return value will be widened by
770
+ @samp{libffi}. @samp{libffi} provides a type, @code{ffi_arg}, that
771
+ can be used as the return type. For example, if the CIF was defined
772
+ with a return type of @code{char}, @samp{libffi} will try to store a
773
+ full @code{ffi_arg} into the return value.
774
+
775
+ See also:
776
+ * https://github.com/ruby-gnome2/ruby-gnome2/issues/758#issuecomment-243149237
777
+ * https://github.com/libffi/libffi/pull/216
778
+
779
+ This ffi_return_value case implementation is based on
780
+ gi_type_info_extract_ffi_return_value().
781
+ */
728
782
  static void
729
783
  out_argument_to_raw_data(GICallableInfo *callable_info,
730
784
  VALUE rb_result,
731
785
  gpointer result,
732
786
  GITypeInfo *type_info,
733
- GITransfer transfer)
787
+ GITransfer transfer,
788
+ gboolean is_return_value)
734
789
  {
735
790
  GIArgument argument;
736
791
  GITypeTag type_tag;
792
+ GIFFIReturnValue *ffi_return_value = result;
737
793
 
738
794
  rb_gi_value_argument_from_ruby(&argument,
739
795
  type_info,
@@ -745,25 +801,53 @@ out_argument_to_raw_data(GICallableInfo *callable_info,
745
801
  g_assert_not_reached();
746
802
  break;
747
803
  case GI_TYPE_TAG_BOOLEAN:
748
- *((gboolean *)result) = argument.v_boolean;
804
+ if (is_return_value) {
805
+ ffi_return_value->v_ulong = argument.v_boolean;
806
+ } else {
807
+ *((gboolean *)result) = argument.v_boolean;
808
+ }
749
809
  break;
750
810
  case GI_TYPE_TAG_INT8:
751
- *((gint8 *)result) = argument.v_int8;
811
+ if (is_return_value) {
812
+ ffi_return_value->v_long = argument.v_int8;
813
+ } else {
814
+ *((gint8 *)result) = argument.v_int8;
815
+ }
752
816
  break;
753
817
  case GI_TYPE_TAG_UINT8:
754
- *((guint8 *)result) = argument.v_uint8;
818
+ if (is_return_value) {
819
+ ffi_return_value->v_ulong = argument.v_uint8;
820
+ } else {
821
+ *((guint8 *)result) = argument.v_uint8;
822
+ }
755
823
  break;
756
824
  case GI_TYPE_TAG_INT16:
757
- *((gint16 *)result) = argument.v_int16;
825
+ if (is_return_value) {
826
+ ffi_return_value->v_long = argument.v_int16;
827
+ } else {
828
+ *((gint16 *)result) = argument.v_int16;
829
+ }
758
830
  break;
759
831
  case GI_TYPE_TAG_UINT16:
760
- *((guint16 *)result) = argument.v_uint16;
832
+ if (is_return_value) {
833
+ ffi_return_value->v_ulong = argument.v_uint16;
834
+ } else {
835
+ *((guint16 *)result) = argument.v_uint16;
836
+ }
761
837
  break;
762
838
  case GI_TYPE_TAG_INT32:
763
- *((gint32 *)result) = argument.v_int32;
839
+ if (is_return_value) {
840
+ ffi_return_value->v_long = argument.v_int32;
841
+ } else {
842
+ *((gint32 *)result) = argument.v_int32;
843
+ }
764
844
  break;
765
845
  case GI_TYPE_TAG_UINT32:
766
- *((guint32 *)result) = argument.v_uint32;
846
+ if (is_return_value) {
847
+ ffi_return_value->v_ulong = argument.v_uint32;
848
+ } else {
849
+ *((guint32 *)result) = argument.v_uint32;
850
+ }
767
851
  break;
768
852
  case GI_TYPE_TAG_INT64:
769
853
  *((gint64 *)result) = argument.v_int64;
@@ -778,32 +862,57 @@ out_argument_to_raw_data(GICallableInfo *callable_info,
778
862
  *((gdouble *)result) = argument.v_double;
779
863
  break;
780
864
  case GI_TYPE_TAG_GTYPE:
781
- *((gsize *)result) = argument.v_size;
865
+ if (is_return_value) {
866
+ ffi_return_value->v_ulong = argument.v_size;
867
+ } else {
868
+ *((gsize *)result) = argument.v_size;
869
+ }
782
870
  break;
783
871
  case GI_TYPE_TAG_UTF8:
784
872
  case GI_TYPE_TAG_FILENAME:
785
- *((gchar **)result) = argument.v_string;
873
+ if (is_return_value) {
874
+ ffi_return_value->v_ulong = (gulong)(argument.v_string);
875
+ } else {
876
+ *((gchar **)result) = argument.v_string;
877
+ }
786
878
  break;
787
879
  case GI_TYPE_TAG_ARRAY:
788
- *((gpointer *)result) = argument.v_pointer;
880
+ if (is_return_value) {
881
+ ffi_return_value->v_ulong = (gulong)(argument.v_pointer);
882
+ } else {
883
+ *((gpointer *)result) = argument.v_pointer;
884
+ }
789
885
  break;
790
886
  case GI_TYPE_TAG_INTERFACE:
791
887
  out_argument_to_raw_data_interface(callable_info,
792
888
  &argument,
793
889
  result,
794
890
  type_info,
795
- transfer);
891
+ transfer,
892
+ is_return_value);
796
893
  break;
797
894
  case GI_TYPE_TAG_GLIST:
798
895
  case GI_TYPE_TAG_GSLIST:
799
896
  case GI_TYPE_TAG_GHASH:
800
- *((gpointer *)result) = argument.v_pointer;
897
+ if (is_return_value) {
898
+ ffi_return_value->v_ulong = (gulong)(argument.v_pointer);
899
+ } else {
900
+ *((gpointer *)result) = argument.v_pointer;
901
+ }
801
902
  break;
802
903
  case GI_TYPE_TAG_ERROR:
803
- *((GError **)result) = argument.v_pointer;
904
+ if (is_return_value) {
905
+ ffi_return_value->v_ulong = (gulong)(argument.v_pointer);
906
+ } else {
907
+ *((GError **)result) = argument.v_pointer;
908
+ }
804
909
  break;
805
910
  case GI_TYPE_TAG_UNICHAR:
806
- *((gunichar *)result) = argument.v_uint32;
911
+ if (is_return_value) {
912
+ ffi_return_value->v_ulong = argument.v_uint32;
913
+ } else {
914
+ *((gunichar *)result) = argument.v_uint32;
915
+ }
807
916
  break;
808
917
  default:
809
918
  g_assert_not_reached();
@@ -834,13 +943,15 @@ out_arguments_to_raw_data(GICallableInfo *callable_info,
834
943
  rb_return_value,
835
944
  result,
836
945
  return_type_info,
837
- transfer);
946
+ transfer,
947
+ TRUE);
838
948
  } else {
839
949
  out_argument_to_raw_data(callable_info,
840
950
  RARRAY_AREF(rb_results, i_rb_result),
841
951
  result,
842
952
  return_type_info,
843
- transfer);
953
+ transfer,
954
+ TRUE);
844
955
  i_rb_result++;
845
956
  }
846
957
  }
@@ -866,7 +977,8 @@ out_arguments_to_raw_data(GICallableInfo *callable_info,
866
977
  RARRAY_AREF(rb_results, i_rb_result),
867
978
  argument->v_pointer,
868
979
  type_info,
869
- transfer);
980
+ transfer,
981
+ FALSE);
870
982
  i_rb_result++;
871
983
  g_base_info_unref(type_info);
872
984
  }
@@ -1194,7 +1306,7 @@ arguments_free(VALUE rb_arguments,
1194
1306
  GIArgument *argument;
1195
1307
 
1196
1308
  rb_arg_index = metadata->rb_arg_index;
1197
- if (rb_arg_index > 0) {
1309
+ if (RARRAY_LEN(rb_arguments) > rb_arg_index) {
1198
1310
  rb_argument = RARRAY_PTR(rb_arguments)[rb_arg_index];
1199
1311
  }
1200
1312
  argument = &(g_array_index(in_args, GIArgument, in_arg_index));
@@ -1267,8 +1379,12 @@ gobject_based_p(GIBaseInfo *info)
1267
1379
  }
1268
1380
 
1269
1381
  VALUE
1270
- rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
1271
- GIArgument *return_value, VALUE *rb_return_value)
1382
+ rb_gi_function_info_invoke_raw(GIFunctionInfo *info,
1383
+ VALUE rb_info,
1384
+ VALUE rb_receiver,
1385
+ VALUE rb_arguments,
1386
+ GIArgument *return_value,
1387
+ VALUE *rb_return_value)
1272
1388
  {
1273
1389
  GICallableInfo *callable_info;
1274
1390
  GIArgument receiver;
@@ -1278,26 +1394,9 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
1278
1394
  gboolean succeeded;
1279
1395
  GError *error = NULL;
1280
1396
  gboolean unlock_gvl = FALSE;
1281
- VALUE rb_receiver, rb_arguments, rb_unlock_gvl;
1282
1397
  gboolean rb_receiver_is_class = FALSE;
1283
1398
 
1284
- if (RB_TYPE_P(rb_options, RUBY_T_ARRAY)) {
1285
- rb_receiver = Qnil;
1286
- rb_arguments = rb_options;
1287
- rb_unlock_gvl = Qnil;
1288
- } else if (NIL_P(rb_options)) {
1289
- rb_receiver = Qnil;
1290
- rb_arguments = rb_ary_new();
1291
- rb_unlock_gvl = Qnil;
1292
- } else {
1293
- rb_options = rbg_check_hash_type(rb_options);
1294
- rbg_scan_options(rb_options,
1295
- "receiver", &rb_receiver,
1296
- "arguments", &rb_arguments,
1297
- "unlock_gvl", &rb_unlock_gvl,
1298
- NULL);
1299
- }
1300
-
1399
+ unlock_gvl = RVAL2CBOOL(rb_funcall(rb_info, rb_intern("unlock_gvl?"), 0));
1301
1400
  if (NIL_P(rb_receiver)) {
1302
1401
  receiver.v_pointer = NULL;
1303
1402
  } else {
@@ -1314,9 +1413,6 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
1314
1413
  }
1315
1414
  }
1316
1415
  rb_arguments = rbg_to_array(rb_arguments);
1317
- if (!NIL_P(rb_unlock_gvl) && RVAL2CBOOL(rb_unlock_gvl)) {
1318
- unlock_gvl = TRUE;
1319
- }
1320
1416
 
1321
1417
  callable_info = (GICallableInfo *)info;
1322
1418
  arguments_init(&in_args, &out_args, &args_metadata);
@@ -1382,7 +1478,7 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
1382
1478
  }
1383
1479
 
1384
1480
  static VALUE
1385
- rg_invoke(VALUE self, VALUE rb_options)
1481
+ rg_invoke(VALUE self, VALUE rb_arguments)
1386
1482
  {
1387
1483
  GIFunctionInfo *info;
1388
1484
  VALUE rb_out_args;
@@ -1391,7 +1487,9 @@ rg_invoke(VALUE self, VALUE rb_options)
1391
1487
  info = SELF(self);
1392
1488
  /* TODO: use rb_protect() */
1393
1489
  rb_out_args = rb_gi_function_info_invoke_raw(info,
1394
- rb_options,
1490
+ self,
1491
+ Qnil,
1492
+ rb_arguments,
1395
1493
  NULL,
1396
1494
  &rb_return_value);
1397
1495
 
@@ -1426,6 +1524,9 @@ rb_gi_function_info_init(VALUE rb_mGI, VALUE rb_cGICallableInfo)
1426
1524
  callback_finders = g_ptr_array_new();
1427
1525
  rb_gi_callback_register_finder(source_func_callback_finder);
1428
1526
 
1527
+ RG_DEF_METHOD(set_unlock_gvl, 1);
1528
+ RG_DEF_METHOD_P(unlock_gvl, 0);
1529
+
1429
1530
  RG_DEF_METHOD(symbol, 0);
1430
1531
  RG_DEF_METHOD(flags, 0);
1431
1532
  RG_DEF_METHOD(property, 0);
@@ -36,7 +36,7 @@ gi_method_info_get_type(void)
36
36
  }
37
37
 
38
38
  static VALUE
39
- rg_invoke(VALUE self, VALUE rb_options)
39
+ rg_invoke(VALUE self, VALUE rb_receiver, VALUE rb_arguments)
40
40
  {
41
41
  GIFunctionInfo *info;
42
42
  VALUE rb_out_args;
@@ -46,7 +46,9 @@ rg_invoke(VALUE self, VALUE rb_options)
46
46
 
47
47
  /* TODO: use rb_protect */
48
48
  rb_out_args = rb_gi_function_info_invoke_raw(info,
49
- rb_options,
49
+ self,
50
+ rb_receiver,
51
+ rb_arguments,
50
52
  NULL,
51
53
  &rb_return_value);
52
54
 
@@ -76,5 +78,5 @@ rb_gi_method_info_init(VALUE rb_mGI, VALUE rb_cGIFunctionInfo)
76
78
  G_DEF_CLASS_WITH_PARENT(GI_TYPE_METHOD_INFO, "MethodInfo", rb_mGI,
77
79
  rb_cGIFunctionInfo);
78
80
 
79
- RG_DEF_METHOD(invoke, 1);
81
+ RG_DEF_METHOD(invoke, 2);
80
82
  }
@@ -93,7 +93,9 @@ void rb_gi_repository_init (VALUE rb_mGI);
93
93
  void rb_gi_loader_init (VALUE rb_mGI);
94
94
 
95
95
  VALUE rb_gi_function_info_invoke_raw (GIFunctionInfo *info,
96
- VALUE rb_options,
96
+ VALUE rb_info,
97
+ VALUE rb_receiver,
98
+ VALUE rb_arguments,
97
99
  GIArgument *return_value,
98
100
  VALUE *rb_return_value);
99
101
 
Binary file
Binary file
data/lib/gi.rb ADDED
@@ -0,0 +1,19 @@
1
+ # Copyright (C) 2016 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ require "gobject-introspection"
18
+
19
+ GI = GObjectIntrospection
@@ -47,6 +47,16 @@ GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
47
47
 
48
48
  module GObjectIntrospection
49
49
  LOG_DOMAIN = "GObjectIntrospection"
50
+
51
+ class << self
52
+ def load(namespace, options={})
53
+ base_module = Module.new
54
+ loader = Loader.new(base_module)
55
+ loader.version = options[:version]
56
+ loader.load(namespace)
57
+ base_module
58
+ end
59
+ end
50
60
  end
51
61
  GLib::Log.set_log_domain(GObjectIntrospection::LOG_DOMAIN)
52
62
 
@@ -41,11 +41,7 @@ module GObjectIntrospection
41
41
  end
42
42
 
43
43
  def require_callback?
44
- args.any? do |arg|
45
- arg.direction == Direction::IN and
46
- arg.scope != ScopeType::INVALID and
47
- !arg.may_be_null?
48
- end
44
+ (@require_callback ||= compute_require_callback) == :required
49
45
  end
50
46
 
51
47
  def out_args
@@ -63,6 +59,12 @@ module GObjectIntrospection
63
59
  out_args.size
64
60
  end
65
61
 
62
+ def have_return_value?
63
+ return true if return_type.tag != TypeTag::VOID
64
+ return true if return_type.pointer?
65
+ not n_out_args.zero?
66
+ end
67
+
66
68
  private
67
69
  def compute_in_args
68
70
  array_length_indexes = []
@@ -103,5 +105,17 @@ module GObjectIntrospection
103
105
  end
104
106
  end
105
107
  end
108
+
109
+ def compute_require_callback
110
+ args.each do |arg|
111
+ if arg.direction == Direction::IN and
112
+ arg.scope != ScopeType::INVALID and
113
+ !arg.may_be_null?
114
+ return :required
115
+ end
116
+ end
117
+
118
+ :not_required
119
+ end
106
120
  end
107
121
  end