gobject-introspection 2.1.0-x86-mingw32 → 2.2.0-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -0
  3. data/ext/gobject-introspection/rb-gi-argument.c +599 -103
  4. data/ext/gobject-introspection/rb-gi-conversions.h +30 -1
  5. data/ext/gobject-introspection/rb-gi-enum-info.c +11 -1
  6. data/ext/gobject-introspection/rb-gi-function-info.c +108 -60
  7. data/ext/gobject-introspection/rb-gi-loader.c +42 -1
  8. data/ext/gobject-introspection/rb-gobject-introspection.h +6 -3
  9. data/lib/1.9/gobject_introspection.so +0 -0
  10. data/lib/2.0/gobject_introspection.so +0 -0
  11. data/lib/2.1/gobject_introspection.so +0 -0
  12. data/lib/gobject-introspection/loader.rb +76 -19
  13. data/test/test-enum-info.rb +6 -1
  14. data/test/test-interface-info.rb +3 -3
  15. data/test/test-repository.rb +5 -2
  16. data/test/test-signal-info.rb +6 -3
  17. data/test/test-struct-info.rb +3 -3
  18. data/vendor/local/bin/g-ir-compiler.exe +0 -0
  19. data/vendor/local/bin/g-ir-generate.exe +0 -0
  20. data/vendor/local/bin/libgirepository-1.0-1.dll +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.pyc +0 -0
  28. data/vendor/local/lib/gobject-introspection/giscanner/ast.pyo +0 -0
  29. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyc +0 -0
  30. data/vendor/local/lib/gobject-introspection/giscanner/cachestore.pyo +0 -0
  31. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyc +0 -0
  32. data/vendor/local/lib/gobject-introspection/giscanner/codegen.pyo +0 -0
  33. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyc +0 -0
  34. data/vendor/local/lib/gobject-introspection/giscanner/collections/__init__.pyo +0 -0
  35. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyc +0 -0
  36. data/vendor/local/lib/gobject-introspection/giscanner/collections/ordereddict.pyo +0 -0
  37. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyc +0 -0
  38. data/vendor/local/lib/gobject-introspection/giscanner/docmain.pyo +0 -0
  39. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyc +0 -0
  40. data/vendor/local/lib/gobject-introspection/giscanner/docwriter.pyo +0 -0
  41. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyc +0 -0
  42. data/vendor/local/lib/gobject-introspection/giscanner/dumper.pyo +0 -0
  43. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyc +0 -0
  44. data/vendor/local/lib/gobject-introspection/giscanner/gdumpparser.pyo +0 -0
  45. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyc +0 -0
  46. data/vendor/local/lib/gobject-introspection/giscanner/girparser.pyo +0 -0
  47. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyc +0 -0
  48. data/vendor/local/lib/gobject-introspection/giscanner/girwriter.pyo +0 -0
  49. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyc +0 -0
  50. data/vendor/local/lib/gobject-introspection/giscanner/introspectablepass.pyo +0 -0
  51. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyc +0 -0
  52. data/vendor/local/lib/gobject-introspection/giscanner/libtoolimporter.pyo +0 -0
  53. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyc +0 -0
  54. data/vendor/local/lib/gobject-introspection/giscanner/maintransformer.pyo +0 -0
  55. data/vendor/local/lib/gobject-introspection/giscanner/message.pyc +0 -0
  56. data/vendor/local/lib/gobject-introspection/giscanner/message.pyo +0 -0
  57. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyc +0 -0
  58. data/vendor/local/lib/gobject-introspection/giscanner/scannermain.pyo +0 -0
  59. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyc +0 -0
  60. data/vendor/local/lib/gobject-introspection/giscanner/sectionparser.pyo +0 -0
  61. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyc +0 -0
  62. data/vendor/local/lib/gobject-introspection/giscanner/shlibs.pyo +0 -0
  63. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyc +0 -0
  64. data/vendor/local/lib/gobject-introspection/giscanner/sourcescanner.pyo +0 -0
  65. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyc +0 -0
  66. data/vendor/local/lib/gobject-introspection/giscanner/testcodegen.pyo +0 -0
  67. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyc +0 -0
  68. data/vendor/local/lib/gobject-introspection/giscanner/transformer.pyo +0 -0
  69. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyc +0 -0
  70. data/vendor/local/lib/gobject-introspection/giscanner/utils.pyo +0 -0
  71. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyc +0 -0
  72. data/vendor/local/lib/gobject-introspection/giscanner/xmlwriter.pyo +0 -0
  73. data/vendor/local/lib/libgirepository-1.0.a +0 -0
  74. data/vendor/local/lib/libgirepository-1.0.dll.a +0 -0
  75. metadata +4 -4
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -33,14 +33,30 @@
33
33
 
34
34
  #define GI_ARGUMENT2RVAL(argument, type_info) \
35
35
  (rb_gi_argument_to_ruby((argument), (type_info)))
36
+ #define GI_ARRAY_ARGUMENT2RVAL(array_argument, length_argument, \
37
+ array_type_info, length_type_info) \
38
+ (rb_gi_array_argument_to_ruby((array_argument), \
39
+ (length_argument), \
40
+ (array_type_info), \
41
+ (length_type_info)))
36
42
  #define GI_OUT_ARGUMENT2RVAL(argument, arg_info) \
37
43
  (rb_gi_out_argument_to_ruby((argument), (arg_info)))
44
+ #define GI_OUT_ARRAY_ARGUMENT2RVAL(array_argument, length_argument, \
45
+ array_arg_info, length_arg_info) \
46
+ (rb_gi_out_array_argument_to_ruby((array_argument), (length_argument), \
47
+ (array_arg_info), (length_arg_info)))
38
48
  #define GI_RETURN_ARGUMENT2RVAL(argument, callable_info) \
39
49
  (rb_gi_return_argument_to_ruby((argument), (callable_info)))
40
50
  #define RVAL2GI_VALUE_ARGUMENT(argument, type_info, rb_argument) \
41
51
  (rb_gi_value_argument_from_ruby((argument), (type_info), (rb_argument)))
42
52
  #define RVAL2GI_IN_ARGUMENT(argument, arg_info, rb_argument) \
43
53
  (rb_gi_in_argument_from_ruby((argument), (arg_info), (rb_argument)))
54
+ #define RVAL2GI_IN_ARRAY_ARGUMENT(array_argument, length_argument, \
55
+ array_arg_info, length_arg_info, \
56
+ rb_argument) \
57
+ (rb_gi_in_array_argument_from_ruby((array_argument), (length_argument), \
58
+ (array_arg_info), (length_arg_info), \
59
+ (rb_argument)))
44
60
 
45
61
 
46
62
  #define RVAL2GI_REGISTERED_TYPE_INFO(rb_object) \
@@ -91,10 +107,18 @@ GIBaseInfo *rb_gi_base_info_from_ruby (VALUE rb_info);
91
107
 
92
108
  VALUE rb_gi_argument_to_ruby (GIArgument *argument,
93
109
  GITypeInfo *type_info);
110
+ VALUE rb_gi_array_argument_to_ruby (GIArgument *array_argument,
111
+ GIArgument *length_argument,
112
+ GITypeInfo *array_type_info,
113
+ GITypeInfo *length_type_info);
94
114
  void rb_gi_out_argument_init (GIArgument *argument,
95
115
  GIArgInfo *arg_info);
96
116
  VALUE rb_gi_out_argument_to_ruby (GIArgument *argument,
97
117
  GIArgInfo *arg_info);
118
+ VALUE rb_gi_out_array_argument_to_ruby (GIArgument *array_argument,
119
+ GIArgument *length_argument,
120
+ GIArgInfo *array_arg_info,
121
+ GIArgInfo *length_arg_info);
98
122
  void rb_gi_out_argument_fin (GIArgument *argument,
99
123
  GIArgInfo *arg_info);
100
124
  VALUE rb_gi_return_argument_to_ruby (GIArgument *argument,
@@ -105,6 +129,11 @@ GIArgument *rb_gi_value_argument_from_ruby (GIArgument *argument,
105
129
  GIArgument *rb_gi_in_argument_from_ruby (GIArgument *argument,
106
130
  GIArgInfo *arg_info,
107
131
  VALUE rb_argument);
132
+ GIArgument *rb_gi_in_array_argument_from_ruby (GIArgument *array_argument,
133
+ GIArgument *length_argument,
134
+ GIArgInfo *array_arg_info,
135
+ GIArgInfo *length_arg_info,
136
+ VALUE rb_argument);
108
137
  void rb_gi_value_argument_free (GIArgument *argument,
109
138
  GITypeInfo *type_info);
110
139
  void rb_gi_in_argument_free (GIArgument *argument,
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -124,6 +124,15 @@ rg_storage_type(VALUE self)
124
124
  return GI_TYPE_TAG2RVAL(g_enum_info_get_storage_type(info));
125
125
  }
126
126
 
127
+ static VALUE
128
+ rg_error_domain(VALUE self)
129
+ {
130
+ GIEnumInfo *info;
131
+
132
+ info = SELF(self);
133
+ return CSTR2RVAL(g_enum_info_get_error_domain(info));
134
+ }
135
+
127
136
  void
128
137
  rb_gi_enum_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo)
129
138
  {
@@ -140,6 +149,7 @@ rb_gi_enum_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo)
140
149
  RG_DEF_METHOD(get_method, 1);
141
150
  RG_DEF_METHOD(methods, 0);
142
151
  RG_DEF_METHOD(storage_type, 0);
152
+ RG_DEF_METHOD(error_domain, 0);
143
153
 
144
154
  rb_gi_flags_info_init(rb_mGI, RG_TARGET_NAMESPACE);
145
155
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -44,7 +44,7 @@ gi_function_info_get_type(void)
44
44
  {
45
45
  static GType type = 0;
46
46
  if (type == 0) {
47
- type = g_boxed_type_register_static("GIFunctionInfo",
47
+ type = g_boxed_type_register_static("GIFunctionInfo",
48
48
  (GBoxedCopyFunc)g_base_info_ref,
49
49
  (GBoxedFreeFunc)g_base_info_unref);
50
50
  }
@@ -112,13 +112,16 @@ allocate_arguments(GICallableInfo *info,
112
112
  metadata->callback_p = (metadata->scope_type != GI_SCOPE_TYPE_INVALID);
113
113
  metadata->closure_p = FALSE;
114
114
  metadata->destroy_p = FALSE;
115
- metadata->inout_argv_p = FALSE;
115
+ metadata->array_p = FALSE;
116
+ metadata->array_length_p = FALSE;
116
117
  metadata->in_arg_index = -1;
117
118
  metadata->closure_in_arg_index = -1;
118
119
  metadata->destroy_in_arg_index = -1;
120
+ metadata->array_in_arg_index = -1;
121
+ metadata->array_length_in_arg_index = -1;
122
+ metadata->array_length_arg_index = -1;
119
123
  metadata->rb_arg_index = -1;
120
124
  metadata->out_arg_index = -1;
121
- metadata->inout_argc_arg_index = -1;
122
125
 
123
126
  direction = metadata->direction;
124
127
  if (direction == GI_DIRECTION_IN || direction == GI_DIRECTION_INOUT) {
@@ -135,32 +138,6 @@ allocate_arguments(GICallableInfo *info,
135
138
  }
136
139
  }
137
140
 
138
- static void
139
- fill_metadata_inout_argv(GPtrArray *args_metadata)
140
- {
141
- guint i;
142
- gint inout_argc_arg_index = -1;
143
-
144
- for (i = 0; i < args_metadata->len; i++) {
145
- RBGIArgMetadata *metadata;
146
- GIArgInfo *arg_info;
147
- const gchar *name;
148
-
149
- metadata = g_ptr_array_index(args_metadata, i);
150
- if (metadata->direction != GI_DIRECTION_INOUT) {
151
- continue;
152
- }
153
- arg_info = &(metadata->arg_info);
154
- name = g_base_info_get_name(arg_info);
155
- if (strcmp(name, "argc") == 0) {
156
- inout_argc_arg_index = i;
157
- } else if (strcmp(name, "argv") == 0) {
158
- metadata->inout_argv_p = TRUE;
159
- metadata->inout_argc_arg_index = inout_argc_arg_index;
160
- }
161
- }
162
- }
163
-
164
141
  static void
165
142
  fill_metadata_callback(GPtrArray *args_metadata)
166
143
  {
@@ -198,11 +175,49 @@ fill_metadata_callback(GPtrArray *args_metadata)
198
175
  }
199
176
  }
200
177
 
178
+ static void
179
+ fill_metadata_array(GPtrArray *args_metadata)
180
+ {
181
+ guint i;
182
+
183
+ for (i = 0; i < args_metadata->len; i++) {
184
+ RBGIArgMetadata *metadata;
185
+ RBGIArgMetadata *array_length_metadata;
186
+ GIArgInfo *arg_info;
187
+ GITypeInfo type_info;
188
+ gint array_length_index = -1;
189
+
190
+ metadata = g_ptr_array_index(args_metadata, i);
191
+ arg_info = &(metadata->arg_info);
192
+
193
+ g_arg_info_load_type(arg_info, &type_info);
194
+ if (g_type_info_get_tag(&type_info) != GI_TYPE_TAG_ARRAY) {
195
+ continue;
196
+ }
197
+ metadata->array_p = TRUE;
198
+
199
+ array_length_index = g_type_info_get_array_length(&type_info);
200
+ if (array_length_index == -1) {
201
+ continue;
202
+ }
203
+
204
+ array_length_metadata = g_ptr_array_index(args_metadata,
205
+ array_length_index);
206
+ array_length_metadata->array_length_p = TRUE;
207
+ array_length_metadata->rb_arg_index = -1;
208
+ array_length_metadata->array_in_arg_index =
209
+ metadata->in_arg_index;
210
+ metadata->array_length_in_arg_index =
211
+ array_length_metadata->in_arg_index;
212
+ metadata->array_length_arg_index = array_length_index;
213
+ }
214
+ }
215
+
201
216
  static void
202
217
  fill_metadata(GPtrArray *args_metadata)
203
218
  {
204
- fill_metadata_inout_argv(args_metadata);
205
219
  fill_metadata_callback(args_metadata);
220
+ fill_metadata_array(args_metadata);
206
221
  }
207
222
 
208
223
  static void
@@ -385,7 +400,7 @@ in_callback_argument_from_ruby(RBGIArgMetadata *metadata, GArray *in_args)
385
400
 
386
401
  static void
387
402
  in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments,
388
- GArray *in_args)
403
+ GArray *in_args, GPtrArray *args_metadata)
389
404
  {
390
405
  if (metadata->rb_arg_index == -1) {
391
406
  return;
@@ -393,6 +408,34 @@ in_argument_from_ruby(RBGIArgMetadata *metadata, VALUE rb_arguments,
393
408
 
394
409
  if (metadata->callback_p) {
395
410
  in_callback_argument_from_ruby(metadata, in_args);
411
+ } else if (metadata->array_p) {
412
+ GIArgument *array_argument;
413
+ GIArgument *length_argument = NULL;
414
+ GIArgInfo *length_arg_info = NULL;
415
+ VALUE rb_argument = Qnil;
416
+
417
+ if (RARRAY_LEN(rb_arguments) > metadata->rb_arg_index) {
418
+ rb_argument = RARRAY_PTR(rb_arguments)[metadata->rb_arg_index];
419
+ }
420
+ array_argument = &(g_array_index(in_args,
421
+ GIArgument,
422
+ metadata->in_arg_index));
423
+ if (metadata->array_length_in_arg_index != -1) {
424
+ RBGIArgMetadata *length_metadata;
425
+ length_argument =
426
+ &(g_array_index(in_args,
427
+ GIArgument,
428
+ metadata->array_length_in_arg_index));
429
+ length_metadata =
430
+ g_ptr_array_index(args_metadata,
431
+ metadata->array_length_arg_index);
432
+ length_arg_info = &(length_metadata->arg_info);
433
+ }
434
+ RVAL2GI_IN_ARRAY_ARGUMENT(array_argument,
435
+ length_argument,
436
+ &(metadata->arg_info),
437
+ length_arg_info,
438
+ rb_argument);
396
439
  } else {
397
440
  GIArgument *argument;
398
441
  VALUE rb_argument = Qnil;
@@ -443,35 +486,14 @@ arguments_from_ruby(GICallableInfo *info, VALUE rb_arguments,
443
486
 
444
487
  metadata = g_ptr_array_index(args_metadata, i);
445
488
  if (metadata->in_arg_index != -1) {
446
- in_argument_from_ruby(metadata, rb_arguments, in_args);
489
+ in_argument_from_ruby(metadata, rb_arguments,
490
+ in_args, args_metadata);
447
491
  } else {
448
492
  out_argument_from_ruby(metadata, out_args);
449
493
  }
450
494
  }
451
495
  }
452
496
 
453
- static VALUE
454
- inout_argv_argument_to_ruby(GArray *in_args, RBGIArgMetadata *metadata)
455
- {
456
- GIArgument *inout_argc_argument;
457
- GIArgument *inout_argv_argument;
458
- gint i, argc;
459
- gchar **argv;
460
- VALUE rb_argv_argument;
461
-
462
- inout_argc_argument = &g_array_index(in_args, GIArgument,
463
- metadata->inout_argc_arg_index);
464
- inout_argv_argument = &g_array_index(in_args, GIArgument,
465
- metadata->in_arg_index);
466
- argc = *((gint *)(inout_argc_argument->v_pointer));
467
- argv = *((gchar ***)(inout_argv_argument->v_pointer));
468
- rb_argv_argument = rb_ary_new2(argc);
469
- for (i = 0; i < argc; i++) {
470
- rb_ary_push(rb_argv_argument, CSTR2RVAL(argv[i]));
471
- }
472
- return rb_argv_argument;
473
- }
474
-
475
497
  static VALUE
476
498
  out_arguments_to_ruby(GICallableInfo *callable_info,
477
499
  GArray *in_args, GArray *out_args,
@@ -488,6 +510,10 @@ out_arguments_to_ruby(GICallableInfo *callable_info,
488
510
  VALUE rb_argument;
489
511
 
490
512
  metadata = g_ptr_array_index(args_metadata, i);
513
+ if (metadata->array_length_p) {
514
+ continue;
515
+ }
516
+
491
517
  switch (metadata->direction) {
492
518
  case GI_DIRECTION_IN:
493
519
  break;
@@ -508,8 +534,30 @@ out_arguments_to_ruby(GICallableInfo *callable_info,
508
534
  continue;
509
535
  }
510
536
 
511
- if (metadata->inout_argv_p) {
512
- rb_argument = inout_argv_argument_to_ruby(in_args, metadata);
537
+ if (metadata->array_p) {
538
+ GIArgument *length_argument = NULL;
539
+ GIArgInfo *length_arg_info = NULL;
540
+
541
+ if (metadata->array_length_in_arg_index != -1) {
542
+ RBGIArgMetadata *length_metadata;
543
+ length_metadata =
544
+ g_ptr_array_index(args_metadata,
545
+ metadata->array_length_arg_index);
546
+ if (length_metadata->direction == GI_DIRECTION_OUT) {
547
+ length_argument =
548
+ &g_array_index(in_args, GIArgument,
549
+ length_metadata->out_arg_index);
550
+ } else {
551
+ length_argument =
552
+ &g_array_index(in_args, GIArgument,
553
+ length_metadata->in_arg_index);
554
+ }
555
+ length_arg_info = &(length_metadata->arg_info);
556
+ }
557
+ rb_argument = GI_OUT_ARRAY_ARGUMENT2RVAL(argument,
558
+ length_argument,
559
+ &(metadata->arg_info),
560
+ length_arg_info);
513
561
  } else {
514
562
  rb_argument = GI_OUT_ARGUMENT2RVAL(argument, &(metadata->arg_info));
515
563
  }
@@ -576,9 +624,9 @@ rb_gi_function_info_invoke_raw_call(InvokeData *data)
576
624
  {
577
625
  data->succeeded =
578
626
  g_function_info_invoke(data->info,
579
- (GIArgument *)(data->in_args->data),
627
+ (GIArgument *)((void *)(data->in_args->data)),
580
628
  data->in_args->len,
581
- (GIArgument *)(data->out_args->data),
629
+ (GIArgument *)((void *)(data->out_args->data)),
582
630
  data->out_args->len,
583
631
  data->return_value,
584
632
  data->error);
@@ -695,7 +743,7 @@ rb_gi_function_info_invoke_raw(GIFunctionInfo *info, VALUE rb_options,
695
743
  if (!NIL_P(rb_out_args) && RARRAY_LEN(rb_out_args) == 1) {
696
744
  VALUE rb_out_arg;
697
745
  rb_out_arg = RARRAY_PTR(rb_out_args)[0];
698
- if (rb_obj_is_kind_of(rb_out_arg, rb_cGLibError)) {
746
+ if (rb_obj_is_kind_of(rb_out_arg, rb_eException)) {
699
747
  rb_exc_raise(rb_out_arg);
700
748
  }
701
749
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -87,6 +87,46 @@ rg_s_define_struct(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
87
87
  return rb_class;
88
88
  }
89
89
 
90
+ static VALUE
91
+ rg_s_define_error(int argc, VALUE *argv, G_GNUC_UNUSED VALUE klass)
92
+ {
93
+ VALUE rb_domain, rb_name, rb_module;
94
+ VALUE rb_options, rb_parent, rb_gtype;
95
+ GQuark domain;
96
+ const gchar *name;
97
+ GType gtype = G_TYPE_INVALID;
98
+
99
+ rb_scan_args(argc, argv, "31",
100
+ &rb_domain, &rb_name, &rb_module, &rb_options);
101
+ rbg_scan_options(rb_options,
102
+ "parent", &rb_parent,
103
+ "gtype", &rb_gtype,
104
+ NULL);
105
+
106
+ if (RB_TYPE_P(rb_domain, RUBY_T_STRING)) {
107
+ domain = g_quark_from_string(RVAL2CSTR(rb_domain));
108
+ if (domain == 0) {
109
+ rb_raise(rb_eArgError,
110
+ "invalid domain name: <%s>",
111
+ rbg_inspect(rb_domain));
112
+ }
113
+ } else {
114
+ domain = NUM2UINT(rb_domain);
115
+ }
116
+
117
+ name = RVAL2CSTR(rb_name);
118
+
119
+ if (NIL_P(rb_parent)) {
120
+ rb_parent = rb_eStandardError;
121
+ }
122
+
123
+ if (!NIL_P(rb_gtype)) {
124
+ gtype = NUM2ULONG(rb_funcall(rb_gtype, rb_intern("to_i"), 0));
125
+ }
126
+
127
+ return G_DEF_ERROR(domain, name, rb_module, rb_parent, gtype);
128
+ }
129
+
90
130
  typedef struct {
91
131
  GType type;
92
132
  VALUE rb_converters;
@@ -162,6 +202,7 @@ rb_gi_loader_init(VALUE rb_mGI)
162
202
  RG_DEF_SMETHOD(define_class, -1);
163
203
  RG_DEF_SMETHOD(define_interface, 3);
164
204
  RG_DEF_SMETHOD(define_struct, -1);
205
+ RG_DEF_SMETHOD(define_error, -1);
165
206
  RG_DEF_SMETHOD(register_boxed_class_converter, 1);
166
207
  RG_DEF_SMETHOD(start_callback_dispatch_thread, 0);
167
208
  }
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2012-2014 Ruby-GNOME2 Project Team
4
4
  *
5
5
  * This library is free software; you can redistribute it and/or
6
6
  * modify it under the terms of the GNU Lesser General Public
@@ -36,13 +36,16 @@ typedef struct
36
36
  gboolean callback_p;
37
37
  gboolean closure_p;
38
38
  gboolean destroy_p;
39
- gboolean inout_argv_p;
39
+ gboolean array_p;
40
+ gboolean array_length_p;
40
41
  gint in_arg_index;
41
42
  gint closure_in_arg_index;
42
43
  gint destroy_in_arg_index;
44
+ gint array_in_arg_index;
45
+ gint array_length_in_arg_index;
46
+ gint array_length_arg_index;
43
47
  gint rb_arg_index;
44
48
  gint out_arg_index;
45
- gint inout_argc_arg_index;
46
49
  } RBGIArgMetadata;
47
50
 
48
51
  typedef struct {