gobject-introspection 1.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. data/Rakefile +50 -0
  2. data/ext/gobject-introspection/extconf.rb +97 -0
  3. data/ext/gobject-introspection/rb-gi-arg-info.c +151 -0
  4. data/ext/gobject-introspection/rb-gi-argument.c +223 -0
  5. data/ext/gobject-introspection/rb-gi-base-info.c +218 -0
  6. data/ext/gobject-introspection/rb-gi-boxed-info.c +48 -0
  7. data/ext/gobject-introspection/rb-gi-callable-info.c +124 -0
  8. data/ext/gobject-introspection/rb-gi-callback-info.c +48 -0
  9. data/ext/gobject-introspection/rb-gi-constant-info.c +77 -0
  10. data/ext/gobject-introspection/rb-gi-constructor-info.c +82 -0
  11. data/ext/gobject-introspection/rb-gi-conversions.h +95 -0
  12. data/ext/gobject-introspection/rb-gi-enum-info.c +145 -0
  13. data/ext/gobject-introspection/rb-gi-field-info.c +149 -0
  14. data/ext/gobject-introspection/rb-gi-flags-info.c +48 -0
  15. data/ext/gobject-introspection/rb-gi-function-info.c +199 -0
  16. data/ext/gobject-introspection/rb-gi-interface-info.c +222 -0
  17. data/ext/gobject-introspection/rb-gi-loader.c +61 -0
  18. data/ext/gobject-introspection/rb-gi-method-info.c +66 -0
  19. data/ext/gobject-introspection/rb-gi-object-info.c +345 -0
  20. data/ext/gobject-introspection/rb-gi-property-info.c +77 -0
  21. data/ext/gobject-introspection/rb-gi-registered-type-info.c +86 -0
  22. data/ext/gobject-introspection/rb-gi-repository.c +164 -0
  23. data/ext/gobject-introspection/rb-gi-signal-info.c +77 -0
  24. data/ext/gobject-introspection/rb-gi-struct-info.c +183 -0
  25. data/ext/gobject-introspection/rb-gi-type-info.c +143 -0
  26. data/ext/gobject-introspection/rb-gi-type-tag.c +43 -0
  27. data/ext/gobject-introspection/rb-gi-types.h +71 -0
  28. data/ext/gobject-introspection/rb-gi-union-info.c +206 -0
  29. data/ext/gobject-introspection/rb-gi-unresolved-info.c +48 -0
  30. data/ext/gobject-introspection/rb-gi-value-info.c +57 -0
  31. data/ext/gobject-introspection/rb-gi-vfunc-info.c +91 -0
  32. data/ext/gobject-introspection/rb-gobject-introspection.c +42 -0
  33. data/ext/gobject-introspection/rb-gobject-introspection.h +105 -0
  34. data/extconf.rb +71 -0
  35. data/lib/gobject-introspection.rb +39 -0
  36. data/lib/gobject-introspection/collection-reader.rb +34 -0
  37. data/lib/gobject-introspection/loader.rb +148 -0
  38. data/lib/gobject-introspection/object-info.rb +33 -0
  39. data/lib/gobject-introspection/repository.rb +32 -0
  40. data/lib/gobject-introspection/struct-info.rb +28 -0
  41. data/sample/clutter-basic-actor.rb +132 -0
  42. data/sample/clutter.rb +29 -0
  43. data/test/gobject-introspection-test-utils.rb +26 -0
  44. data/test/run-test.rb +45 -0
  45. data/test/test-arg-info.rb +68 -0
  46. data/test/test-base-info.rb +31 -0
  47. data/test/test-boxed-info.rb +21 -0
  48. data/test/test-callable-info.rb +49 -0
  49. data/test/test-callback-info.rb +29 -0
  50. data/test/test-constant-info.rb +24 -0
  51. data/test/test-enum-info.rb +56 -0
  52. data/test/test-field-type.rb +42 -0
  53. data/test/test-flags-info.rb +27 -0
  54. data/test/test-function-info.rb +37 -0
  55. data/test/test-interface-info.rb +97 -0
  56. data/test/test-loader.rb +30 -0
  57. data/test/test-object-info.rb +131 -0
  58. data/test/test-property-info.rb +38 -0
  59. data/test/test-registered-type-info.rb +35 -0
  60. data/test/test-repository.rb +59 -0
  61. data/test/test-signal-info.rb +37 -0
  62. data/test/test-struct-info.rb +57 -0
  63. data/test/test-type-info.rb +62 -0
  64. data/test/test-type-tag.rb +29 -0
  65. data/test/test-union-info.rb +21 -0
  66. data/test/test-value-info.rb +28 -0
  67. data/test/test-vfunc-info.rb +42 -0
  68. metadata +162 -0
@@ -0,0 +1,82 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 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
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIConstructorInfo
24
+ #define SELF(self) RVAL2GI_FUNCTION_INFO(self)
25
+
26
+ GType
27
+ gi_constructor_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GIConstructorInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ static VALUE
39
+ rg_invoke(int argc, VALUE *argv, VALUE self)
40
+ {
41
+ GIFunctionInfo *info;
42
+ GICallableInfo *callable_info;
43
+ VALUE receiver;
44
+ GIArgument return_value;
45
+ GITypeInfo return_value_info;
46
+ GIBaseInfo *interface_info;
47
+ GIInfoType interface_type;
48
+
49
+ info = SELF(self);
50
+ callable_info = (GICallableInfo *)info;
51
+
52
+ /* TODO: check argc. */
53
+ receiver = argv[0];
54
+ rb_gi_function_info_invoke_raw(info, argc - 1, argv + 1, &return_value);
55
+ g_callable_info_load_return_type(callable_info, &return_value_info);
56
+
57
+ if (g_type_info_get_tag(&return_value_info) != GI_TYPE_TAG_INTERFACE) {
58
+ rb_raise(rb_eRuntimeError, "TODO: returned value isn't interface");
59
+ }
60
+ interface_info = g_type_info_get_interface(&return_value_info);
61
+ interface_type = g_base_info_get_type(interface_info);
62
+ if (interface_type != GI_INFO_TYPE_OBJECT) {
63
+ rb_raise(rb_eRuntimeError, "TODO: returned value isn't object");
64
+ }
65
+ g_object_ref_sink(return_value.v_pointer);
66
+ G_INITIALIZE(receiver, return_value.v_pointer);
67
+
68
+ return receiver;
69
+ }
70
+
71
+ void
72
+ rb_gi_constructor_info_init(VALUE rb_mGI, VALUE rb_cGIFunctionInfo)
73
+ {
74
+ VALUE RG_TARGET_NAMESPACE;
75
+
76
+ RG_TARGET_NAMESPACE =
77
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_CONSTRUCTOR_INFO,
78
+ "ConstructorInfo", rb_mGI,
79
+ rb_cGIFunctionInfo);
80
+
81
+ RG_DEF_METHOD(invoke, -1);
82
+ }
@@ -0,0 +1,95 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 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_CONVERSIONS_H
22
+ #define RB_GI_CONVERSIONS_H
23
+
24
+ #define RVAL2GI_REPOSITORY(rb_object) (G_IREPOSITORY(RVAL2GOBJ(rb_object)))
25
+ #define RVAL2GI_REPOSITORY_LOAD_FLAGS(rb_flags) \
26
+ (RVAL2GFLAGS(rb_flags, G_TYPE_I_REPOSITORY_LOAD_FLAGS))
27
+
28
+ #define GI_BASE_INFO2RVAL(info) \
29
+ (rb_gi_base_info_to_ruby((GIBaseInfo *)(info)))
30
+ #define GI_BASE_INFO2RVAL_WITH_UNREF(info) \
31
+ (rb_gi_base_info_to_ruby_with_unref((GIBaseInfo *)(info)))
32
+ #define RVAL2GI_BASE_INFO(rb_object) (rb_gi_base_info_from_ruby(rb_object))
33
+
34
+ #define GI_ARGUMENT2RVAL(argument, type_info) \
35
+ (rb_gi_argument_to_ruby((argument), (type_info)))
36
+ #define RVAL2GI_ARGUMENT(argument, type_info, rb_argument) \
37
+ (rb_gi_argument_from_ruby((argument), (type_info), (rb_argument)))
38
+
39
+
40
+ #define RVAL2GI_REGISTERED_TYPE_INFO(rb_object) \
41
+ ((GIRegisteredTypeInfo *)RVAL2GI_BASE_INFO(rb_object))
42
+ #define RVAL2GI_FUNCTION_INFO(rb_object) \
43
+ ((GIFunctionInfo *)RVAL2GI_BASE_INFO(rb_object))
44
+ #define RVAL2GI_STRUCT_INFO(rb_object) \
45
+ ((GIStructInfo *)RVAL2GI_BASE_INFO(rb_object))
46
+ #define RVAL2GI_ENUM_INFO(rb_object) \
47
+ ((GIEnumInfo *)RVAL2GI_BASE_INFO(rb_object))
48
+ #define RVAL2GI_OBJECT_INFO(rb_object) \
49
+ ((GIObjectInfo *)RVAL2GI_BASE_INFO(rb_object))
50
+ #define RVAL2GI_INTERFACE_INFO(rb_object) \
51
+ ((GIInterfaceInfo *)RVAL2GI_BASE_INFO(rb_object))
52
+ #define RVAL2GI_CONSTANT_INFO(rb_object) \
53
+ ((GIConstantInfo *)RVAL2GI_BASE_INFO(rb_object))
54
+ #define RVAL2GI_UNION_INFO(rb_object) \
55
+ ((GIUnionInfo *)RVAL2GI_BASE_INFO(rb_object))
56
+ #define RVAL2GI_VALUE_INFO(rb_object) \
57
+ ((GIValueInfo *)RVAL2GI_BASE_INFO(rb_object))
58
+ #define RVAL2GI_ARG_INFO(rb_object) \
59
+ ((GIArgInfo *)RVAL2GI_BASE_INFO(rb_object))
60
+ #define RVAL2GI_FIELD_INFO(rb_object) \
61
+ ((GIFieldInfo *)RVAL2GI_BASE_INFO(rb_object))
62
+ #define RVAL2GI_TYPE_INFO(rb_object) \
63
+ ((GITypeInfo *)RVAL2GI_BASE_INFO(rb_object))
64
+
65
+ #define GI_INFO_TYPE2RVAL(type) (GENUM2RVAL(type, G_TYPE_I_INFO_TYPE))
66
+ #define GI_TRANSFER2RVAL(transfer) (GENUM2RVAL(transfer, G_TYPE_I_TRANSFER))
67
+ #define GI_DIRECTION2RVAL(direction) (GENUM2RVAL(direction, G_TYPE_I_DIRECTION))
68
+ #define GI_SCOPE_TYPE2RVAL(scope) (GENUM2RVAL(scope, G_TYPE_I_SCOPE_TYPE))
69
+ #define RVAL2GI_TYPE_TAG(rb_tag) (RVAL2GENUM(rb_tag, G_TYPE_I_TYPE_TAG))
70
+ #define GI_TYPE_TAG2RVAL(tag) (GENUM2RVAL(tag, G_TYPE_I_TYPE_TAG))
71
+ #define GI_ARRAY_TYPE2RVAL(type) (rb_gi_array_type_to_ruby(type))
72
+
73
+ #define GI_FUNCTION_INFO_FLAGS2RVAL(tag) \
74
+ (GFLAGS2RVAL(tag, G_TYPE_I_FUNCTION_INFO_FLAGS))
75
+ #define GI_SIGNAL_FLAGS2RVAL(tag) \
76
+ (GFLAGS2RVAL(tag, G_TYPE_SIGNAL_FLAGS))
77
+ #define GI_VFUNC_INFO_FLAGS2RVAL(tag) \
78
+ (GFLAGS2RVAL(tag, G_TYPE_IV_FUNC_INFO_FLAGS))
79
+ #define GI_FIELD_INFO_FLAGS2RVAL(tag) \
80
+ (GFLAGS2RVAL(tag, G_TYPE_I_FIELD_INFO_FLAGS))
81
+
82
+ VALUE rb_gi_base_info_to_ruby (GIBaseInfo *info);
83
+ VALUE rb_gi_base_info_to_ruby_with_unref(GIBaseInfo *info);
84
+ GIBaseInfo *rb_gi_base_info_from_ruby (VALUE rb_info);
85
+
86
+ VALUE rb_gi_argument_to_ruby (GIArgument *argument,
87
+ GITypeInfo *type_info);
88
+ GIArgument *rb_gi_argument_from_ruby (GIArgument *argument,
89
+ GITypeInfo *type_info,
90
+ VALUE rb_argument);
91
+
92
+ VALUE rb_gi_array_type_to_ruby (GIArrayType type);
93
+
94
+ #endif
95
+
@@ -0,0 +1,145 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 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
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIEnumInfo
24
+ #define SELF(self) (RVAL2GI_ENUM_INFO(self))
25
+
26
+ GType
27
+ gi_enum_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GIEnumInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ static VALUE
39
+ rg_n_values(VALUE self)
40
+ {
41
+ GIEnumInfo *info;
42
+
43
+ info = SELF(self);
44
+ return INT2NUM(g_enum_info_get_n_values(info));
45
+ }
46
+
47
+ static VALUE
48
+ rg_get_value(VALUE self, VALUE rb_n)
49
+ {
50
+ GIEnumInfo *info;
51
+ gint n;
52
+
53
+ info = SELF(self);
54
+ n = NUM2INT(rb_n);
55
+ return GI_BASE_INFO2RVAL_WITH_UNREF(g_enum_info_get_value(info, n));
56
+ }
57
+
58
+ static VALUE
59
+ rg_values(VALUE self)
60
+ {
61
+ GIEnumInfo *info;
62
+ gint i, n;
63
+ VALUE rb_values;
64
+
65
+ info = SELF(self);
66
+
67
+ rb_values = rb_ary_new();
68
+ n = g_enum_info_get_n_values(info);
69
+ for (i = 0; i < n; i++) {
70
+ GIValueInfo *value_info;
71
+ value_info = g_enum_info_get_value(info, i);
72
+ rb_ary_push(rb_values, GI_BASE_INFO2RVAL_WITH_UNREF(value_info));
73
+ }
74
+
75
+ return rb_values;
76
+ }
77
+
78
+ static VALUE
79
+ rg_n_methods(VALUE self)
80
+ {
81
+ GIEnumInfo *info;
82
+
83
+ info = SELF(self);
84
+ return INT2NUM(g_enum_info_get_n_methods(info));
85
+ }
86
+
87
+ static VALUE
88
+ rg_get_method(VALUE self, VALUE rb_n)
89
+ {
90
+ GIEnumInfo *info;
91
+ gint n;
92
+
93
+ info = SELF(self);
94
+ n = NUM2INT(rb_n);
95
+ return GI_BASE_INFO2RVAL_WITH_UNREF(g_enum_info_get_method(info, n));
96
+ }
97
+
98
+ static VALUE
99
+ rg_methods(VALUE self)
100
+ {
101
+ GIEnumInfo *info;
102
+ gint i, n;
103
+ VALUE rb_methods;
104
+
105
+ info = SELF(self);
106
+
107
+ rb_methods = rb_ary_new();
108
+ n = g_enum_info_get_n_methods(info);
109
+ for (i = 0; i < n; i++) {
110
+ GIFunctionInfo *function_info;
111
+ function_info = g_enum_info_get_method(info, i);
112
+ rb_ary_push(rb_methods, GI_BASE_INFO2RVAL_WITH_UNREF(function_info));
113
+ }
114
+
115
+ return rb_methods;
116
+ }
117
+
118
+ static VALUE
119
+ rg_storage_type(VALUE self)
120
+ {
121
+ GIEnumInfo *info;
122
+
123
+ info = SELF(self);
124
+ return GI_TYPE_TAG2RVAL(g_enum_info_get_storage_type(info));
125
+ }
126
+
127
+ void
128
+ rb_gi_enum_info_init(VALUE rb_mGI, VALUE rb_cGIRegisteredTypeInfo)
129
+ {
130
+ VALUE RG_TARGET_NAMESPACE;
131
+
132
+ RG_TARGET_NAMESPACE =
133
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_ENUM_INFO, "EnumInfo", rb_mGI,
134
+ rb_cGIRegisteredTypeInfo);
135
+
136
+ RG_DEF_METHOD(n_values, 0);
137
+ RG_DEF_METHOD(get_value, 1);
138
+ RG_DEF_METHOD(values, 0);
139
+ RG_DEF_METHOD(n_methods, 0);
140
+ RG_DEF_METHOD(get_method, 1);
141
+ RG_DEF_METHOD(methods, 0);
142
+ RG_DEF_METHOD(storage_type, 0);
143
+
144
+ rb_gi_flags_info_init(rb_mGI, RG_TARGET_NAMESPACE);
145
+ }
@@ -0,0 +1,149 @@
1
+ /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright (C) 2012 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
+ #include "rb-gobject-introspection.h"
22
+
23
+ #define RG_TARGET_NAMESPACE rb_cGIFieldInfo
24
+ #define SELF(self) (RVAL2GI_FIELD_INFO(self))
25
+
26
+ GType
27
+ gi_field_info_get_type(void)
28
+ {
29
+ static GType type = 0;
30
+ if (type == 0) {
31
+ type = g_boxed_type_register_static("GIFieldInfo",
32
+ (GBoxedCopyFunc)g_base_info_ref,
33
+ (GBoxedFreeFunc)g_base_info_unref);
34
+ }
35
+ return type;
36
+ }
37
+
38
+ static VALUE
39
+ rg_flags(VALUE self)
40
+ {
41
+ GIFieldInfo *info;
42
+
43
+ info = SELF(self);
44
+ return GI_FIELD_INFO_FLAGS2RVAL(g_field_info_get_flags(info));
45
+ }
46
+
47
+ static VALUE
48
+ rg_size(VALUE self)
49
+ {
50
+ GIFieldInfo *info;
51
+
52
+ info = SELF(self);
53
+ return INT2NUM(g_field_info_get_size(info));
54
+ }
55
+
56
+ static VALUE
57
+ rg_offset(VALUE self)
58
+ {
59
+ GIFieldInfo *info;
60
+
61
+ info = SELF(self);
62
+ return INT2NUM(g_field_info_get_offset(info));
63
+ }
64
+
65
+ static VALUE
66
+ rg_type(VALUE self)
67
+ {
68
+ GIFieldInfo *info;
69
+
70
+ info = SELF(self);
71
+ return GI_BASE_INFO2RVAL_WITH_UNREF(g_field_info_get_type(info));
72
+ }
73
+
74
+ VALUE
75
+ rb_gi_field_info_get_field_raw(GIFieldInfo *info, gpointer memory)
76
+ {
77
+ GIArgument argument;
78
+ GITypeInfo *type_info;
79
+ VALUE rb_field_value;
80
+
81
+ if (!g_field_info_get_field(info, memory, &argument)) {
82
+ rb_raise(rb_eArgError, "failed to get field value");
83
+ }
84
+
85
+ type_info = g_field_info_get_type(info);
86
+ rb_field_value = GI_ARGUMENT2RVAL(&argument, type_info);
87
+ g_base_info_unref(type_info);
88
+
89
+ return rb_field_value;
90
+ }
91
+
92
+ void
93
+ rb_gi_field_info_set_field_raw(GIFieldInfo *info, gpointer memory,
94
+ VALUE rb_field_value)
95
+ {
96
+ GIArgument field_value;
97
+ GITypeInfo *type_info;
98
+
99
+ type_info = g_field_info_get_type(info);
100
+ RVAL2GI_ARGUMENT(&field_value, type_info, rb_field_value);
101
+ g_base_info_unref(type_info);
102
+
103
+ if (!g_field_info_set_field(info, memory, &field_value)) {
104
+ rb_raise(rb_eArgError, "failed to set field value");
105
+ }
106
+ }
107
+
108
+ static VALUE
109
+ rg_get_field(VALUE self, VALUE rb_memory)
110
+ {
111
+ GIFieldInfo *info;
112
+ gpointer memory;
113
+
114
+ info = SELF(self);
115
+ memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory));
116
+ return rb_gi_field_info_get_field_raw(info, memory);
117
+ }
118
+
119
+ static VALUE
120
+ rg_set_field(VALUE self, VALUE rb_memory, VALUE rb_field_value)
121
+ {
122
+ GIFieldInfo *info;
123
+ gpointer memory;
124
+
125
+ info = SELF(self);
126
+ memory = GUINT_TO_POINTER(NUM2ULONG(rb_memory));
127
+ rb_gi_field_info_set_field_raw(info, memory, rb_field_value);
128
+
129
+ return Qnil;
130
+ }
131
+
132
+ void
133
+ rb_gi_field_info_init(VALUE rb_mGI, VALUE rb_cGIBaseInfo)
134
+ {
135
+ VALUE RG_TARGET_NAMESPACE;
136
+
137
+ RG_TARGET_NAMESPACE =
138
+ G_DEF_CLASS_WITH_PARENT(GI_TYPE_FIELD_INFO, "FieldInfo", rb_mGI,
139
+ rb_cGIBaseInfo);
140
+
141
+ RG_DEF_METHOD(flags, 0);
142
+ RG_DEF_METHOD(size, 0);
143
+ RG_DEF_METHOD(offset, 0);
144
+ RG_DEF_METHOD(type, 0);
145
+ RG_DEF_METHOD(get_field, 1);
146
+ RG_DEF_METHOD(set_field, 2);
147
+
148
+ G_DEF_CLASS(G_TYPE_I_FIELD_INFO_FLAGS, "FieldInfoFlags", rb_mGI);
149
+ }