gobject-introspection 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/gobject-introspection/depend +10 -0
- data/ext/gobject-introspection/rb-gi-arg-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-argument.c +30 -12
- data/ext/gobject-introspection/rb-gi-base-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-boxed-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-callable-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-callback-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constant-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-constructor-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-enum-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-field-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-flags-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-function-info.c +122 -81
- data/ext/gobject-introspection/rb-gi-interface-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-loader.c +9 -1
- data/ext/gobject-introspection/rb-gi-method-info.c +6 -2
- data/ext/gobject-introspection/rb-gi-object-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-private.h +110 -0
- data/ext/gobject-introspection/rb-gi-property-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-registered-type-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-repository.c +1 -1
- data/ext/gobject-introspection/rb-gi-signal-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-struct-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-type-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-type-tag.c +1 -1
- data/ext/gobject-introspection/rb-gi-union-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-unresolved-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-value-info.c +1 -1
- data/ext/gobject-introspection/rb-gi-vfunc-info.c +1 -1
- data/ext/gobject-introspection/rb-gobject-introspection.c +1 -1
- data/ext/gobject-introspection/rb-gobject-introspection.h +30 -81
- data/lib/gobject-introspection/callable-info.rb +38 -2
- data/lib/gobject-introspection/loader.rb +81 -15
- metadata +92 -108
@@ -18,7 +18,7 @@
|
|
18
18
|
* MA 02110-1301 USA
|
19
19
|
*/
|
20
20
|
|
21
|
-
#include "rb-
|
21
|
+
#include "rb-gi-private.h"
|
22
22
|
|
23
23
|
#define RG_TARGET_NAMESPACE rb_cGILoader
|
24
24
|
|
@@ -138,6 +138,13 @@ rg_s_register_boxed_class_converter(VALUE klass, VALUE rb_gtype)
|
|
138
138
|
return Qnil;
|
139
139
|
}
|
140
140
|
|
141
|
+
static VALUE
|
142
|
+
rg_s_start_callback_dispatch_thread(G_GNUC_UNUSED VALUE klass)
|
143
|
+
{
|
144
|
+
rbgutil_start_callback_dispatch_thread();
|
145
|
+
return Qnil;
|
146
|
+
}
|
147
|
+
|
141
148
|
void
|
142
149
|
rb_gi_loader_init(VALUE rb_mGI)
|
143
150
|
{
|
@@ -151,4 +158,5 @@ rb_gi_loader_init(VALUE rb_mGI)
|
|
151
158
|
RG_DEF_SMETHOD(define_interface, 3);
|
152
159
|
RG_DEF_SMETHOD(define_struct, -1);
|
153
160
|
RG_DEF_SMETHOD(register_boxed_class_converter, 1);
|
161
|
+
RG_DEF_SMETHOD(start_callback_dispatch_thread, 0);
|
154
162
|
}
|
@@ -18,7 +18,7 @@
|
|
18
18
|
* MA 02110-1301 USA
|
19
19
|
*/
|
20
20
|
|
21
|
-
#include "rb-
|
21
|
+
#include "rb-gi-private.h"
|
22
22
|
|
23
23
|
#define RG_TARGET_NAMESPACE rb_cGIMethodInfo
|
24
24
|
#define SELF(self) RVAL2GI_FUNCTION_INFO(self)
|
@@ -88,7 +88,11 @@ rg_invoke(int argc, VALUE *argv, VALUE self)
|
|
88
88
|
if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_VOID) {
|
89
89
|
rb_ary_unshift(rb_out_args, rb_return_value);
|
90
90
|
}
|
91
|
-
|
91
|
+
if (RARRAY_LEN(rb_out_args) == 1) {
|
92
|
+
return RARRAY_PTR(rb_out_args)[0];
|
93
|
+
} else {
|
94
|
+
return rb_out_args;
|
95
|
+
}
|
92
96
|
}
|
93
97
|
}
|
94
98
|
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2012-2013 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef RB_GI_PRIVATE_H
|
22
|
+
#define RB_GI_PRIVATE_H
|
23
|
+
|
24
|
+
#include <ruby.h>
|
25
|
+
#include <rbgobject.h>
|
26
|
+
#include <glib-enum-types.h>
|
27
|
+
|
28
|
+
#include <girffi.h>
|
29
|
+
#include "gobject-introspection-enum-types.h"
|
30
|
+
|
31
|
+
#include "rbgiversion.h"
|
32
|
+
|
33
|
+
#include "rb-gi-types.h"
|
34
|
+
#include "rb-gi-conversions.h"
|
35
|
+
|
36
|
+
#include "rb-gobject-introspection.h"
|
37
|
+
|
38
|
+
#ifndef RB_TYPE_P
|
39
|
+
# define RB_TYPE_P(object, type) (TYPE(object) == type)
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#ifndef HAVE_TYPE_ENUM_RUBY_VALUE_TYPE
|
43
|
+
# define RUBY_T_FIXNUM T_FIXNUM
|
44
|
+
#endif
|
45
|
+
|
46
|
+
extern void Init_gobject_introspection(void);
|
47
|
+
|
48
|
+
void rb_gi_argument_init (void);
|
49
|
+
|
50
|
+
void rb_gi_type_tag_init (VALUE rb_mGI);
|
51
|
+
void rb_gi_base_info_init (VALUE rb_mGI);
|
52
|
+
void rb_gi_callable_info_init (VALUE rb_mGI,
|
53
|
+
VALUE rb_cGIBaseInfo);
|
54
|
+
void rb_gi_function_info_init (VALUE rb_mGI,
|
55
|
+
VALUE rb_cGICallableInfo);
|
56
|
+
void rb_gi_method_info_init (VALUE rb_mGI,
|
57
|
+
VALUE rb_cGIFunctionInfo);
|
58
|
+
void rb_gi_constructor_info_init (VALUE rb_mGI,
|
59
|
+
VALUE rb_cGIFunctionInfo);
|
60
|
+
void rb_gi_callback_info_init (VALUE rb_mGI,
|
61
|
+
VALUE rb_cGICallableInfo);
|
62
|
+
void rb_gi_registered_type_info_init (VALUE rb_mGI,
|
63
|
+
VALUE rb_cGIBaseInfo);
|
64
|
+
void rb_gi_struct_info_init (VALUE rb_mGI,
|
65
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
66
|
+
void rb_gi_boxed_info_init (VALUE rb_mGI,
|
67
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
68
|
+
void rb_gi_enum_info_init (VALUE rb_mGI,
|
69
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
70
|
+
void rb_gi_flags_info_init (VALUE rb_mGI,
|
71
|
+
VALUE rb_cGIEnumInfo);
|
72
|
+
void rb_gi_object_info_init (VALUE rb_mGI,
|
73
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
74
|
+
void rb_gi_interface_info_init (VALUE rb_mGI,
|
75
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
76
|
+
void rb_gi_constant_info_init (VALUE rb_mGI,
|
77
|
+
VALUE rb_cGIBaseInfo);
|
78
|
+
void rb_gi_union_info_init (VALUE rb_mGI,
|
79
|
+
VALUE rb_cGIRegisteredTypeInfo);
|
80
|
+
void rb_gi_value_info_init (VALUE rb_mGI,
|
81
|
+
VALUE rb_cGIBaseInfo);
|
82
|
+
void rb_gi_signal_info_init (VALUE rb_mGI,
|
83
|
+
VALUE rb_cGICallableInfo);
|
84
|
+
void rb_gi_vfunc_info_init (VALUE rb_mGI,
|
85
|
+
VALUE rb_cGICallableInfo);
|
86
|
+
void rb_gi_property_info_init (VALUE rb_mGI,
|
87
|
+
VALUE rb_cGIBaseInfo);
|
88
|
+
void rb_gi_field_info_init (VALUE rb_mGI,
|
89
|
+
VALUE rb_cGIBaseInfo);
|
90
|
+
void rb_gi_arg_info_init (VALUE rb_mGI,
|
91
|
+
VALUE rb_cGIBaseInfo);
|
92
|
+
void rb_gi_type_info_init (VALUE rb_mGI,
|
93
|
+
VALUE rb_cGIBaseInfo);
|
94
|
+
void rb_gi_unresolved_info_init (VALUE rb_mGI,
|
95
|
+
VALUE rb_cGIBaseInfo);
|
96
|
+
void rb_gi_repository_init (VALUE rb_mGI);
|
97
|
+
void rb_gi_loader_init (VALUE rb_mGI);
|
98
|
+
|
99
|
+
VALUE rb_gi_function_info_invoke_raw (GIFunctionInfo *info,
|
100
|
+
GIArgument *receiver,
|
101
|
+
int argc, VALUE *argv,
|
102
|
+
GIArgument *return_value);
|
103
|
+
|
104
|
+
VALUE rb_gi_field_info_get_field_raw (GIFieldInfo *info,
|
105
|
+
gpointer memory);
|
106
|
+
void rb_gi_field_info_set_field_raw (GIFieldInfo *info,
|
107
|
+
gpointer memory,
|
108
|
+
VALUE rb_field_value);
|
109
|
+
|
110
|
+
#endif
|
@@ -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-2013 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
|
@@ -23,86 +23,35 @@
|
|
23
23
|
|
24
24
|
#include <ruby.h>
|
25
25
|
#include <rbgobject.h>
|
26
|
-
#include <glib-enum-types.h>
|
27
26
|
|
28
|
-
#include <
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
void
|
57
|
-
VALUE rb_cGIFunctionInfo);
|
58
|
-
void rb_gi_callback_info_init (VALUE rb_mGI,
|
59
|
-
VALUE rb_cGICallableInfo);
|
60
|
-
void rb_gi_registered_type_info_init (VALUE rb_mGI,
|
61
|
-
VALUE rb_cGIBaseInfo);
|
62
|
-
void rb_gi_struct_info_init (VALUE rb_mGI,
|
63
|
-
VALUE rb_cGIRegisteredTypeInfo);
|
64
|
-
void rb_gi_boxed_info_init (VALUE rb_mGI,
|
65
|
-
VALUE rb_cGIRegisteredTypeInfo);
|
66
|
-
void rb_gi_enum_info_init (VALUE rb_mGI,
|
67
|
-
VALUE rb_cGIRegisteredTypeInfo);
|
68
|
-
void rb_gi_flags_info_init (VALUE rb_mGI,
|
69
|
-
VALUE rb_cGIEnumInfo);
|
70
|
-
void rb_gi_object_info_init (VALUE rb_mGI,
|
71
|
-
VALUE rb_cGIRegisteredTypeInfo);
|
72
|
-
void rb_gi_interface_info_init (VALUE rb_mGI,
|
73
|
-
VALUE rb_cGIRegisteredTypeInfo);
|
74
|
-
void rb_gi_constant_info_init (VALUE rb_mGI,
|
75
|
-
VALUE rb_cGIBaseInfo);
|
76
|
-
void rb_gi_union_info_init (VALUE rb_mGI,
|
77
|
-
VALUE rb_cGIRegisteredTypeInfo);
|
78
|
-
void rb_gi_value_info_init (VALUE rb_mGI,
|
79
|
-
VALUE rb_cGIBaseInfo);
|
80
|
-
void rb_gi_signal_info_init (VALUE rb_mGI,
|
81
|
-
VALUE rb_cGICallableInfo);
|
82
|
-
void rb_gi_vfunc_info_init (VALUE rb_mGI,
|
83
|
-
VALUE rb_cGICallableInfo);
|
84
|
-
void rb_gi_property_info_init (VALUE rb_mGI,
|
85
|
-
VALUE rb_cGIBaseInfo);
|
86
|
-
void rb_gi_field_info_init (VALUE rb_mGI,
|
87
|
-
VALUE rb_cGIBaseInfo);
|
88
|
-
void rb_gi_arg_info_init (VALUE rb_mGI,
|
89
|
-
VALUE rb_cGIBaseInfo);
|
90
|
-
void rb_gi_type_info_init (VALUE rb_mGI,
|
91
|
-
VALUE rb_cGIBaseInfo);
|
92
|
-
void rb_gi_unresolved_info_init (VALUE rb_mGI,
|
93
|
-
VALUE rb_cGIBaseInfo);
|
94
|
-
void rb_gi_repository_init (VALUE rb_mGI);
|
95
|
-
void rb_gi_loader_init (VALUE rb_mGI);
|
96
|
-
|
97
|
-
VALUE rb_gi_function_info_invoke_raw (GIFunctionInfo *info,
|
98
|
-
GIArgument *receiver,
|
99
|
-
int argc, VALUE *argv,
|
100
|
-
GIArgument *return_value);
|
101
|
-
|
102
|
-
VALUE rb_gi_field_info_get_field_raw (GIFieldInfo *info,
|
103
|
-
gpointer memory);
|
104
|
-
void rb_gi_field_info_set_field_raw (GIFieldInfo *info,
|
105
|
-
gpointer memory,
|
106
|
-
VALUE rb_field_value);
|
27
|
+
#include <girepository.h>
|
28
|
+
|
29
|
+
typedef gpointer (*RBGICallbackFinderFunc)(GIArgInfo *info);
|
30
|
+
|
31
|
+
typedef struct
|
32
|
+
{
|
33
|
+
GIArgInfo arg_info;
|
34
|
+
GIScopeType scope_type;
|
35
|
+
GIDirection direction;
|
36
|
+
gboolean callback_p;
|
37
|
+
gboolean closure_p;
|
38
|
+
gboolean destroy_p;
|
39
|
+
gboolean inout_argv_p;
|
40
|
+
gint in_arg_index;
|
41
|
+
gint closure_in_arg_index;
|
42
|
+
gint destroy_in_arg_index;
|
43
|
+
gint rb_arg_index;
|
44
|
+
gint out_arg_index;
|
45
|
+
gint inout_argc_arg_index;
|
46
|
+
} RBGIArgMetadata;
|
47
|
+
|
48
|
+
typedef struct {
|
49
|
+
RBGIArgMetadata *metadata;
|
50
|
+
VALUE rb_gc_guard_key;
|
51
|
+
VALUE rb_callback;
|
52
|
+
} RBGICallbackData;
|
53
|
+
|
54
|
+
void rb_gi_callback_register_finder (RBGICallbackFinderFunc finder);
|
55
|
+
void rb_gi_callback_data_free (RBGICallbackData *callback_data);
|
107
56
|
|
108
57
|
#endif
|
@@ -23,20 +23,56 @@ module GObjectIntrospection
|
|
23
23
|
collection_reader("args")
|
24
24
|
|
25
25
|
def in_args
|
26
|
-
|
26
|
+
callback_indexes = []
|
27
|
+
closure_indexes = []
|
28
|
+
destroy_indexes = []
|
29
|
+
args.each_with_index do |arg, i|
|
30
|
+
next if arg.scope == ScopeType::INVALID
|
31
|
+
callback_indexes << i
|
32
|
+
closure_index = arg.closure
|
33
|
+
closure_indexes << closure_index if closure_index != -1
|
34
|
+
destroy_index = arg.destroy
|
35
|
+
destroy_indexes << destroy_index if destroy_index != -1
|
36
|
+
end
|
37
|
+
|
38
|
+
args.find_all.with_index do |arg, i|
|
27
39
|
case arg.direction
|
28
40
|
when Direction::IN, Direction::INOUT
|
29
|
-
|
41
|
+
if callback_indexes.include?(i)
|
42
|
+
false
|
43
|
+
elsif closure_indexes.include?(i)
|
44
|
+
false
|
45
|
+
elsif destroy_indexes.include?(i)
|
46
|
+
false
|
47
|
+
else
|
48
|
+
true
|
49
|
+
end
|
30
50
|
else
|
31
51
|
false
|
32
52
|
end
|
33
53
|
end
|
34
54
|
end
|
35
55
|
|
56
|
+
def required_in_args
|
57
|
+
in_args.reject do |arg|
|
58
|
+
arg.may_be_null?
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
36
62
|
def n_in_args
|
37
63
|
in_args.size
|
38
64
|
end
|
39
65
|
|
66
|
+
def n_required_in_args
|
67
|
+
required_in_args.size
|
68
|
+
end
|
69
|
+
|
70
|
+
def require_callback?
|
71
|
+
args.any? do |arg|
|
72
|
+
arg.direction == Direction::IN and arg.scope != ScopeType::INVALID
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
40
76
|
def out_args
|
41
77
|
args.find_all do |arg|
|
42
78
|
case arg.direction
|