glib2 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +8 -7
- data/ext/glib2/extconf.rb +1 -0
- data/ext/glib2/glib2.def +7 -0
- data/ext/glib2/rbglib.c +32 -1
- data/ext/glib2/rbglib.h +18 -1
- data/ext/glib2/rbglib_iochannel.c +1 -5
- data/ext/glib2/rbglib_utils.c +1 -1
- data/ext/glib2/rbgobj_boxed.c +16 -0
- data/ext/glib2/rbgobj_object.c +2 -2
- data/ext/glib2/rbgobj_type.c +36 -4
- data/ext/glib2/rbgobject.c +4 -4
- data/ext/glib2/rbgobject.h +11 -5
- data/ext/glib2/rbgutil.c +1 -1
- data/lib/gnome2/rake/package-task.rb +1 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -23,7 +23,7 @@ package = GNOME2Package.new do |_package|
|
|
23
23
|
:name => "glib",
|
24
24
|
:download_site => :gnome,
|
25
25
|
:label => "GLib",
|
26
|
-
:version => "2.36.
|
26
|
+
:version => "2.36.2",
|
27
27
|
:compression_method => "xz",
|
28
28
|
:windows => {
|
29
29
|
:configure_args => [
|
@@ -31,14 +31,15 @@ package = GNOME2Package.new do |_package|
|
|
31
31
|
"LIBFFI_LIBS=-L#{libffi_lib_dir} -lffi",
|
32
32
|
"--disable-modular-tests",
|
33
33
|
],
|
34
|
+
:need_autoreconf => true,
|
34
35
|
},
|
35
36
|
},
|
36
37
|
{
|
37
38
|
:name => "gmp",
|
38
|
-
:download_base_url => "ftp://ftp.gmplib.org/pub/gmp-5.1.
|
39
|
+
:download_base_url => "ftp://ftp.gmplib.org/pub/gmp-5.1.2",
|
39
40
|
:label => "GNU MP",
|
40
|
-
:version => "5.1.
|
41
|
-
:compression_method => "
|
41
|
+
:version => "5.1.2",
|
42
|
+
:compression_method => "xz",
|
42
43
|
:windows => {
|
43
44
|
:configure_args => [
|
44
45
|
"--disable-static",
|
@@ -50,7 +51,7 @@ package = GNOME2Package.new do |_package|
|
|
50
51
|
:name => "nettle",
|
51
52
|
:download_base_url => "http://www.lysator.liu.se/~nisse/archive",
|
52
53
|
:label => "Nettle",
|
53
|
-
:version => "2.
|
54
|
+
:version => "2.7",
|
54
55
|
:windows => {
|
55
56
|
:configure_args => [],
|
56
57
|
},
|
@@ -59,7 +60,7 @@ package = GNOME2Package.new do |_package|
|
|
59
60
|
:name => "gnutls",
|
60
61
|
:download_base_url => "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.1",
|
61
62
|
:label => "GnuTLS",
|
62
|
-
:version => "3.1.
|
63
|
+
:version => "3.1.11",
|
63
64
|
:compression_method => "xz",
|
64
65
|
:windows => {
|
65
66
|
:configure_args => [
|
@@ -72,7 +73,7 @@ package = GNOME2Package.new do |_package|
|
|
72
73
|
:name => "glib-networking",
|
73
74
|
:download_site => :gnome,
|
74
75
|
:label => "glib-networking",
|
75
|
-
:version => "2.36.
|
76
|
+
:version => "2.36.2",
|
76
77
|
:compression_method => "xz",
|
77
78
|
:windows => {
|
78
79
|
:configure_args => [
|
data/ext/glib2/extconf.rb
CHANGED
@@ -36,6 +36,7 @@ have_func("g_listenv", glib_header)
|
|
36
36
|
|
37
37
|
ruby_header = "ruby.h"
|
38
38
|
have_func("rb_check_array_type", ruby_header)
|
39
|
+
have_func("rb_check_hash_type", ruby_header)
|
39
40
|
have_func("rb_exec_recursive", ruby_header)
|
40
41
|
have_func("rb_errinfo", ruby_header)
|
41
42
|
have_func("rb_sourcefile", ruby_header)
|
data/ext/glib2/glib2.def
CHANGED
@@ -11,6 +11,8 @@ EXPORTS
|
|
11
11
|
rbgobj_remove_relative_all
|
12
12
|
rbgobj_define_class
|
13
13
|
rbgobj_define_class_dynamic
|
14
|
+
rbgobj_register_mark_func
|
15
|
+
rbgobj_register_free_func
|
14
16
|
rbgobj_instance_from_ruby_object
|
15
17
|
rbgobj_ruby_object_from_instance
|
16
18
|
rbgobj_ruby_object_from_instance2
|
@@ -23,6 +25,7 @@ EXPORTS
|
|
23
25
|
rbgobj_boxed_get
|
24
26
|
rbgobj_boxed_get_default
|
25
27
|
rbgobj_boxed_not_copy_obj
|
28
|
+
rbgobj_boxed_unown
|
26
29
|
rbgobj_make_boxed
|
27
30
|
rbgobj_make_boxed_raw
|
28
31
|
rbgobj_make_boxed_default
|
@@ -99,6 +102,10 @@ EXPORTS
|
|
99
102
|
rbg_gslist2rval_with_type
|
100
103
|
rbg_define_method
|
101
104
|
rbg_define_singleton_method
|
105
|
+
rbg_to_array
|
106
|
+
rbg_to_hash
|
107
|
+
rbg_check_array_type
|
108
|
+
rbg_check_hash_type
|
102
109
|
rbg_scan_options
|
103
110
|
rbgutil_id_module_eval DATA
|
104
111
|
rbgutil_def_setters
|
data/ext/glib2/rbglib.c
CHANGED
@@ -825,6 +825,37 @@ rbg_inspect (VALUE object)
|
|
825
825
|
return StringValueCStr(inspected);
|
826
826
|
}
|
827
827
|
|
828
|
+
VALUE
|
829
|
+
rbg_to_array (VALUE object)
|
830
|
+
{
|
831
|
+
return rb_convert_type(object, RUBY_T_ARRAY, "Array", "to_ary");
|
832
|
+
}
|
833
|
+
|
834
|
+
VALUE
|
835
|
+
rbg_to_hash (VALUE object)
|
836
|
+
{
|
837
|
+
return rb_convert_type(object, RUBY_T_HASH, "Hash", "to_hash");
|
838
|
+
}
|
839
|
+
|
840
|
+
VALUE
|
841
|
+
rbg_check_array_type (VALUE object)
|
842
|
+
{
|
843
|
+
#ifdef HAVE_RB_CHECK_ARRAY_TYPE
|
844
|
+
return rb_check_array_type(object);
|
845
|
+
#else
|
846
|
+
return rb_check_convert_type(object, RUBY_T_ARRAY, "Array", "to_ary");
|
847
|
+
#endif
|
848
|
+
}
|
849
|
+
|
850
|
+
VALUE
|
851
|
+
rbg_check_hash_type (VALUE object)
|
852
|
+
{
|
853
|
+
#ifdef HAVE_RB_CHECK_HASH_TYPE
|
854
|
+
return rb_check_hash_type(object);
|
855
|
+
#else
|
856
|
+
return rb_check_convert_type(object, RUBY_T_HASH, "Hash", "to_hash");
|
857
|
+
#endif
|
858
|
+
}
|
828
859
|
|
829
860
|
void
|
830
861
|
rbg_scan_options (VALUE options, ...)
|
@@ -835,7 +866,7 @@ rbg_scan_options (VALUE options, ...)
|
|
835
866
|
VALUE *value;
|
836
867
|
va_list args;
|
837
868
|
|
838
|
-
options =
|
869
|
+
options = rbg_check_hash_type(options);
|
839
870
|
if (NIL_P(options)) {
|
840
871
|
options = rb_hash_new();
|
841
872
|
} else if (options == original_options) {
|
data/ext/glib2/rbglib.h
CHANGED
@@ -35,7 +35,7 @@ extern "C" {
|
|
35
35
|
|
36
36
|
#define RBGLIB_MAJOR_VERSION 2
|
37
37
|
#define RBGLIB_MINOR_VERSION 0
|
38
|
-
#define RBGLIB_MICRO_VERSION
|
38
|
+
#define RBGLIB_MICRO_VERSION 1
|
39
39
|
|
40
40
|
#ifndef RSTRING_PTR
|
41
41
|
# define RSTRING_PTR(s) (RSTRING(s)->ptr)
|
@@ -63,6 +63,19 @@ typedef int GPid;
|
|
63
63
|
# define G_SOURCE_CONTINUE TRUE
|
64
64
|
#endif
|
65
65
|
|
66
|
+
/* For suppressing a warning:
|
67
|
+
* warning: format '%p' expects argument of type 'void *', but argument 3 has type 'VALUE' [-Wformat]
|
68
|
+
*
|
69
|
+
* Ruby's printf format that is used in rb_raise() uses '%p" for
|
70
|
+
* argument.inspect instead of formatting pointer address that is used
|
71
|
+
* in printf(3).
|
72
|
+
*/
|
73
|
+
#ifdef __GNUC__
|
74
|
+
# define RBG_PRINTF_INSPECT_VALUE(rb_object) GUINT_TO_POINTER(rb_object)
|
75
|
+
#else
|
76
|
+
# define RBG_PRINTF_INSPECT_VALUE(rb_object) (rb_object)
|
77
|
+
#endif
|
78
|
+
|
66
79
|
#define RBG_INSPECT(object) (rbg_rval_inspect(object))
|
67
80
|
|
68
81
|
#define RVAL2CSTR(v) (rbg_rval2cstr(&(v)))
|
@@ -179,6 +192,10 @@ gdouble *rbg_rval2gdoubles(volatile VALUE *value, long *n);
|
|
179
192
|
VALUE rbg_gints2rval(const gint *gints, long n);
|
180
193
|
VALUE rbg_gints2rval_free(gint *gints, long n);
|
181
194
|
|
195
|
+
extern VALUE rbg_to_array(VALUE object);
|
196
|
+
extern VALUE rbg_to_hash(VALUE object);
|
197
|
+
extern VALUE rbg_check_array_type(VALUE object);
|
198
|
+
extern VALUE rbg_check_hash_type(VALUE object);
|
182
199
|
extern void rbg_scan_options(VALUE options, ...);
|
183
200
|
|
184
201
|
/* rbgerror.h */
|
@@ -689,11 +689,7 @@ rg_puts(int argc, VALUE *argv, VALUE self)
|
|
689
689
|
line = rb_str_new2("nil");
|
690
690
|
}
|
691
691
|
else {
|
692
|
-
|
693
|
-
line = rb_check_array_type(argv[i]);
|
694
|
-
#else
|
695
|
-
line = rb_check_convert_type(argv[i], T_ARRAY, "Array", "to_ary");
|
696
|
-
#endif
|
692
|
+
line = rbg_check_array_type(argv[i]);
|
697
693
|
if (!NIL_P(line)) {
|
698
694
|
#ifdef HAVE_RB_EXEC_RECURSIVE
|
699
695
|
rb_exec_recursive(ioc_puts_ary, line, self);
|
data/ext/glib2/rbglib_utils.c
CHANGED
@@ -255,7 +255,7 @@ rg_s_parse_debug_string(G_GNUC_UNUSED VALUE self, VALUE string, VALUE keys)
|
|
255
255
|
VALUE ary;
|
256
256
|
GDebugKey* gkeys;
|
257
257
|
|
258
|
-
Check_Type(keys,
|
258
|
+
Check_Type(keys, RUBY_T_HASH);
|
259
259
|
ary = rb_funcall(keys, rb_intern("to_a"), 0);
|
260
260
|
nkeys = RARRAY_LEN(ary);
|
261
261
|
gkeys = ALLOCA_N(GDebugKey, nkeys);
|
data/ext/glib2/rbgobj_boxed.c
CHANGED
@@ -225,6 +225,22 @@ rbgobj_boxed_not_copy_obj(GType gtype)
|
|
225
225
|
cinfo->flags |= RBGOBJ_BOXED_NOT_COPY;
|
226
226
|
}
|
227
227
|
|
228
|
+
void
|
229
|
+
rbgobj_boxed_unown(VALUE boxed)
|
230
|
+
{
|
231
|
+
boxed_holder *holder;
|
232
|
+
|
233
|
+
Data_Get_Struct(boxed, boxed_holder, holder);
|
234
|
+
|
235
|
+
if (!holder->own) {
|
236
|
+
rb_raise(rb_eArgError,
|
237
|
+
"The boxed is already unowned: %p",
|
238
|
+
boxed);
|
239
|
+
}
|
240
|
+
|
241
|
+
holder->own = FALSE;
|
242
|
+
}
|
243
|
+
|
228
244
|
/**********************************************************************/
|
229
245
|
|
230
246
|
static VALUE
|
data/ext/glib2/rbgobj_object.c
CHANGED
@@ -225,7 +225,7 @@ rg_s_new_bang(int argc, VALUE *argv, VALUE self)
|
|
225
225
|
rb_scan_args(argc, argv, "01", ¶ms_hash);
|
226
226
|
|
227
227
|
if (!NIL_P(params_hash))
|
228
|
-
Check_Type(params_hash,
|
228
|
+
Check_Type(params_hash, RUBY_T_HASH);
|
229
229
|
|
230
230
|
if (cinfo->klass != self)
|
231
231
|
rb_raise(rb_eTypeError, "%s isn't registered class",
|
@@ -635,7 +635,7 @@ rg_initialize(int argc, VALUE *argv, VALUE self)
|
|
635
635
|
rb_scan_args(argc, argv, "01", ¶ms_hash);
|
636
636
|
|
637
637
|
if (!NIL_P(params_hash))
|
638
|
-
Check_Type(params_hash,
|
638
|
+
Check_Type(params_hash, RUBY_T_HASH);
|
639
639
|
|
640
640
|
gobj = rbgobj_gobject_new(RVAL2GTYPE(self), params_hash);
|
641
641
|
|
data/ext/glib2/rbgobj_type.c
CHANGED
@@ -40,8 +40,8 @@ static GHashTable* dynamic_gtype_list;
|
|
40
40
|
typedef struct {
|
41
41
|
const gchar* name;
|
42
42
|
VALUE module;
|
43
|
-
|
44
|
-
|
43
|
+
RGMarkFunc mark;
|
44
|
+
RGFreeFunc free;
|
45
45
|
int flags; /* RGObjClassFlag */
|
46
46
|
} RGObjClassInfoDynamic;
|
47
47
|
|
@@ -294,7 +294,8 @@ rbgobj_gtype_to_ruby_class(GType gtype)
|
|
294
294
|
}
|
295
295
|
|
296
296
|
VALUE
|
297
|
-
rbgobj_define_class(GType gtype, const gchar *name, VALUE module,
|
297
|
+
rbgobj_define_class(GType gtype, const gchar *name, VALUE module,
|
298
|
+
RGMarkFunc mark, RGFreeFunc free, VALUE parent)
|
298
299
|
{
|
299
300
|
RGObjClassInfo* cinfo;
|
300
301
|
if (gtype == 0)
|
@@ -307,8 +308,39 @@ rbgobj_define_class(GType gtype, const gchar *name, VALUE module, void *mark, vo
|
|
307
308
|
return cinfo->klass;
|
308
309
|
}
|
309
310
|
|
311
|
+
void
|
312
|
+
rbgobj_register_mark_func(GType gtype, RGMarkFunc mark)
|
313
|
+
{
|
314
|
+
RGObjClassInfo *cinfo;
|
315
|
+
|
316
|
+
cinfo =
|
317
|
+
(RGObjClassInfo *)rbgobj_lookup_class_by_gtype_full(gtype, Qnil, FALSE);
|
318
|
+
if (!cinfo) {
|
319
|
+
rb_raise(rb_eArgError,
|
320
|
+
"rbgobj_register_free_func(): no class is defined: <%s>",
|
321
|
+
g_type_name(gtype));
|
322
|
+
}
|
323
|
+
cinfo->mark = mark;
|
324
|
+
}
|
325
|
+
|
326
|
+
void
|
327
|
+
rbgobj_register_free_func(GType gtype, RGFreeFunc free)
|
328
|
+
{
|
329
|
+
RGObjClassInfo *cinfo;
|
330
|
+
|
331
|
+
cinfo =
|
332
|
+
(RGObjClassInfo *)rbgobj_lookup_class_by_gtype_full(gtype, Qnil, FALSE);
|
333
|
+
if (!cinfo) {
|
334
|
+
rb_raise(rb_eArgError,
|
335
|
+
"rbgobj_register_free_func(): no class is defined: <%s>",
|
336
|
+
g_type_name(gtype));
|
337
|
+
}
|
338
|
+
cinfo->free = free;
|
339
|
+
}
|
340
|
+
|
310
341
|
VALUE
|
311
|
-
rbgobj_define_class_dynamic(const gchar *gtype_name, const gchar *name,
|
342
|
+
rbgobj_define_class_dynamic(const gchar *gtype_name, const gchar *name,
|
343
|
+
VALUE module, RGMarkFunc mark, RGFreeFunc free)
|
312
344
|
{
|
313
345
|
RGObjClassInfoDynamic* cinfo;
|
314
346
|
cinfo = (RGObjClassInfoDynamic*)g_new(RGObjClassInfoDynamic, 1);
|
data/ext/glib2/rbgobject.c
CHANGED
@@ -182,7 +182,7 @@ rbgobj_add_relative(VALUE obj, VALUE relative)
|
|
182
182
|
if (RVAL2CBOOL(rb_ivar_defined(obj, id_relatives)))
|
183
183
|
hash = rb_ivar_get(obj, id_relatives);
|
184
184
|
|
185
|
-
if (NIL_P(hash) || TYPE(hash) !=
|
185
|
+
if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
|
186
186
|
hash = rb_hash_new();
|
187
187
|
rb_ivar_set(obj, id_relatives, hash);
|
188
188
|
}
|
@@ -206,7 +206,7 @@ rbgobj_add_relative_removable(VALUE obj, VALUE relative, ID obj_ivar_id, VALUE h
|
|
206
206
|
if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
|
207
207
|
hash = rb_ivar_get(obj, obj_ivar_id);
|
208
208
|
|
209
|
-
if (NIL_P(hash) || TYPE(hash) !=
|
209
|
+
if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
|
210
210
|
hash = rb_hash_new();
|
211
211
|
rb_ivar_set(obj, obj_ivar_id, hash);
|
212
212
|
}
|
@@ -221,7 +221,7 @@ rbgobj_get_relative_removable(VALUE obj, ID obj_ivar_id, VALUE hash_key)
|
|
221
221
|
if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
|
222
222
|
hash = rb_ivar_get(obj, obj_ivar_id);
|
223
223
|
|
224
|
-
if (NIL_P(hash) || TYPE(hash) !=
|
224
|
+
if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
|
225
225
|
return Qnil;
|
226
226
|
}
|
227
227
|
return rb_hash_aref(hash, hash_key);
|
@@ -235,7 +235,7 @@ rbgobj_remove_relative(VALUE obj, ID obj_ivar_id, VALUE hash_key)
|
|
235
235
|
if (RVAL2CBOOL(rb_ivar_defined(obj, obj_ivar_id)))
|
236
236
|
hash = rb_ivar_get(obj, obj_ivar_id);
|
237
237
|
|
238
|
-
if (NIL_P(hash) || TYPE(hash) !=
|
238
|
+
if (NIL_P(hash) || TYPE(hash) != RUBY_T_HASH) {
|
239
239
|
/* should not happen. */
|
240
240
|
} else {
|
241
241
|
rb_funcall(hash, id_delete, 1, hash_key);
|
data/ext/glib2/rbgobject.h
CHANGED
@@ -124,12 +124,15 @@ typedef enum
|
|
124
124
|
RBGOBJ_BOXED_NOT_COPY = 1 << 1,
|
125
125
|
RBGOBJ_DEFINED_BY_RUBY = 1 << 2,
|
126
126
|
} RGObjClassFlag;
|
127
|
-
|
127
|
+
|
128
|
+
typedef void (*RGMarkFunc)(gpointer object);
|
129
|
+
typedef void (*RGFreeFunc)(gpointer object);
|
130
|
+
|
128
131
|
typedef struct {
|
129
132
|
VALUE klass;
|
130
133
|
GType gtype;
|
131
|
-
|
132
|
-
|
134
|
+
RGMarkFunc mark;
|
135
|
+
RGFreeFunc free;
|
133
136
|
int flags; /* RGObjClassFlag */
|
134
137
|
} RGObjClassInfo;
|
135
138
|
|
@@ -173,14 +176,16 @@ extern const RGObjClassInfo *rbgobj_lookup_class_by_gtype_full(GType gtype,
|
|
173
176
|
gboolean create_object);
|
174
177
|
extern VALUE rbgobj_gtype_to_ruby_class(GType gtype);
|
175
178
|
extern VALUE rbgobj_define_class(GType gtype, const gchar* name, VALUE module,
|
176
|
-
|
179
|
+
RGMarkFunc mark, RGFreeFunc free, VALUE parent);
|
177
180
|
extern VALUE rbgobj_define_class_dynamic(const gchar* gtype_name,
|
178
181
|
const gchar* name, VALUE module,
|
179
|
-
|
182
|
+
RGMarkFunc mark, RGFreeFunc free);
|
180
183
|
extern void rbgobj_register_class(VALUE klass,
|
181
184
|
GType gtype,
|
182
185
|
gboolean klass2gtype,
|
183
186
|
gboolean gtype2klass);
|
187
|
+
extern void rbgobj_register_mark_func(GType gtype, RGMarkFunc mark);
|
188
|
+
extern void rbgobj_register_free_func(GType gtype, RGFreeFunc free);
|
184
189
|
extern VALUE rbgobj_cType;
|
185
190
|
extern VALUE rbgobj_gtype_new(GType gtype);
|
186
191
|
extern GType rbgobj_gtype_get(VALUE obj);
|
@@ -233,6 +238,7 @@ extern VALUE rbgobj_make_boxed_raw(gpointer p, GType gtype,
|
|
233
238
|
VALUE klass, gint flags);
|
234
239
|
extern VALUE rbgobj_make_boxed_default(gpointer data, GType gtype);
|
235
240
|
extern void rbgobj_boxed_not_copy_obj(GType gtype);
|
241
|
+
extern void rbgobj_boxed_unown(VALUE boxed);
|
236
242
|
|
237
243
|
/* rbgobj_enums.c */
|
238
244
|
extern void rbgobj_constant_remap(const char *original, const char *replacement);
|
data/ext/glib2/rbgutil.c
CHANGED
@@ -234,7 +234,7 @@ module GNOME2
|
|
234
234
|
|
235
235
|
def append_version(dependency)
|
236
236
|
name, *ver = dependency.is_a?(Array) ? dependency : [dependency]
|
237
|
-
ver << "
|
237
|
+
ver << "= #{@package.version}" if @package.ruby_gnome2_package?(name)
|
238
238
|
[name, *ver]
|
239
239
|
end
|
240
240
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glib2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pkg-config
|