glib2 1.0.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/glib2/extconf.rb +1 -0
- data/ext/glib2/glib2.def +23 -0
- data/ext/glib2/rbgcompat.h +19 -5
- data/ext/glib2/rbglib.c +607 -160
- data/ext/glib2/rbglib.h +81 -26
- data/ext/glib2/rbglib2conversions.h +57 -0
- data/ext/glib2/rbglib_bookmarkfile.c +117 -107
- data/ext/glib2/rbglib_completion.c +37 -26
- data/ext/glib2/rbglib_convert.c +42 -30
- data/ext/glib2/rbglib_error.c +20 -10
- data/ext/glib2/rbglib_fileutils.c +48 -37
- data/ext/glib2/rbglib_i18n.c +24 -14
- data/ext/glib2/rbglib_int64.c +24 -16
- data/ext/glib2/rbglib_iochannel.c +146 -204
- data/ext/glib2/rbglib_iochannel_win32_socket.c +56 -0
- data/ext/glib2/rbglib_iochannelerror.c +49 -0
- data/ext/glib2/rbglib_keyfile.c +171 -182
- data/ext/glib2/rbglib_maincontext.c +107 -92
- data/ext/glib2/rbglib_mainloop.c +34 -21
- data/ext/glib2/rbglib_messages.c +53 -44
- data/ext/glib2/rbglib_pollfd.c +37 -26
- data/ext/glib2/rbglib_shell.c +29 -22
- data/ext/glib2/rbglib_shellerror.c +34 -0
- data/ext/glib2/rbglib_source.c +49 -36
- data/ext/glib2/rbglib_spawn.c +50 -61
- data/ext/glib2/rbglib_spawnerror.c +53 -0
- data/ext/glib2/rbglib_threads.c +28 -16
- data/ext/glib2/rbglib_timer.c +35 -24
- data/ext/glib2/rbglib_ucs4.c +79 -0
- data/ext/glib2/rbglib_unichar.c +209 -0
- data/ext/glib2/rbglib_unicode.c +34 -584
- data/ext/glib2/rbglib_utf16.c +78 -0
- data/ext/glib2/rbglib_utf8.c +259 -0
- data/ext/glib2/rbglib_utils.c +95 -91
- data/ext/glib2/rbglib_win32.c +52 -45
- data/ext/glib2/rbglibdeprecated.c +56 -0
- data/ext/glib2/rbglibdeprecated.h +34 -0
- data/ext/glib2/rbgobj_boxed.c +40 -33
- data/ext/glib2/rbgobj_closure.c +45 -34
- data/ext/glib2/rbgobj_convert.c +19 -9
- data/ext/glib2/rbgobj_enumflags.c +109 -0
- data/ext/glib2/rbgobj_enums.c +67 -646
- data/ext/glib2/rbgobj_flags.c +522 -0
- data/ext/glib2/rbgobj_fundamental.c +19 -6
- data/ext/glib2/rbgobj_object.c +90 -81
- data/ext/glib2/rbgobj_param.c +78 -83
- data/ext/glib2/rbgobj_paramspecs.c +20 -12
- data/ext/glib2/rbgobj_signal.c +248 -193
- data/ext/glib2/rbgobj_strv.c +20 -10
- data/ext/glib2/rbgobj_type.c +153 -149
- data/ext/glib2/rbgobj_typeinstance.c +49 -39
- data/ext/glib2/rbgobj_typeinterface.c +37 -27
- data/ext/glib2/rbgobj_typemodule.c +39 -29
- data/ext/glib2/rbgobj_typeplugin.c +36 -26
- data/ext/glib2/rbgobj_value.c +41 -11
- data/ext/glib2/rbgobj_valuearray.c +59 -23
- data/ext/glib2/rbgobj_valuetypes.c +27 -17
- data/ext/glib2/rbgobject.c +26 -40
- data/ext/glib2/rbgobject.h +38 -20
- data/ext/glib2/rbgprivate.h +87 -5
- data/ext/glib2/rbgutil.c +52 -238
- data/ext/glib2/rbgutil.h +55 -42
- data/ext/glib2/rbgutil_callback.c +47 -12
- data/ext/glib2/rbgutil_list.c +173 -0
- data/ext/glib2/rbgutil_list.h +85 -0
- data/ext/glib2/rbgutildeprecated.c +252 -0
- data/ext/glib2/rbgutildeprecated.h +63 -0
- data/lib/glib-mkenums.rb +2 -2
- data/lib/glib2.rb +2 -25
- data/lib/glib2/deprecatable.rb +149 -0
- data/lib/gnome2-raketask.rb +45 -15
- data/lib/gnome2-win32-binary-downloader.rb +1 -1
- data/lib/mkmf-gnome2.rb +37 -18
- data/test/test_flags.rb +129 -0
- data/test/test_key_file.rb +6 -2
- data/test/test_spawn.rb +33 -0
- metadata +26 -7
- data/ChangeLog +0 -3513
data/ext/glib2/rbglib_threads.c
CHANGED
@@ -1,20 +1,32 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
11
21
|
|
12
22
|
#include "rbgprivate.h"
|
13
23
|
|
14
|
-
|
24
|
+
#define RG_TARGET_NAMESPACE cThread
|
25
|
+
|
26
|
+
static VALUE RG_TARGET_NAMESPACE;
|
15
27
|
|
16
28
|
static VALUE
|
17
|
-
|
29
|
+
rg_s_init(VALUE self)
|
18
30
|
{
|
19
31
|
#ifdef HAVE_G_THREAD_INIT
|
20
32
|
#ifdef G_THREADS_ENABLED
|
@@ -25,7 +37,7 @@ gt_init(VALUE self)
|
|
25
37
|
}
|
26
38
|
|
27
39
|
static VALUE
|
28
|
-
|
40
|
+
rg_s_supported_p(G_GNUC_UNUSED VALUE self)
|
29
41
|
{
|
30
42
|
#ifdef HAVE_G_THREAD_INIT
|
31
43
|
#ifdef G_THREADS_ENABLED
|
@@ -40,10 +52,10 @@ gt_supported(VALUE self)
|
|
40
52
|
}
|
41
53
|
|
42
54
|
void
|
43
|
-
Init_glib_threads()
|
55
|
+
Init_glib_threads(void)
|
44
56
|
{
|
45
|
-
|
57
|
+
RG_TARGET_NAMESPACE = rb_define_class_under(mGLib, "Thread", rb_cObject);
|
46
58
|
|
47
|
-
|
48
|
-
|
59
|
+
RG_DEF_SMETHOD(init, 0);
|
60
|
+
RG_DEF_SMETHOD_P(supported, 0);
|
49
61
|
}
|
data/ext/glib2/rbglib_timer.c
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2005 Masao Mutoh
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
11
21
|
|
12
22
|
#include "rbgprivate.h"
|
13
23
|
|
@@ -42,7 +52,7 @@ timer_copy(GTimer *timer)
|
|
42
52
|
return new_timer;
|
43
53
|
}
|
44
54
|
|
45
|
-
GType
|
55
|
+
static GType
|
46
56
|
g_timer_get_type(void)
|
47
57
|
{
|
48
58
|
static GType our_type = 0;
|
@@ -56,24 +66,25 @@ g_timer_get_type(void)
|
|
56
66
|
|
57
67
|
#define G_TYPE_TIMER (g_timer_get_type())
|
58
68
|
|
69
|
+
#define RG_TARGET_NAMESPACE cTimer
|
59
70
|
#define _SELF(s) ((GTimer*)RVAL2BOXED(s, G_TYPE_TIMER))
|
60
71
|
|
61
72
|
static VALUE
|
62
|
-
|
73
|
+
rg_initialize(VALUE self)
|
63
74
|
{
|
64
75
|
G_INITIALIZE(self, g_timer_new());
|
65
76
|
return Qnil;
|
66
77
|
}
|
67
78
|
|
68
79
|
static VALUE
|
69
|
-
|
80
|
+
rg_start(VALUE self)
|
70
81
|
{
|
71
82
|
g_timer_start(_SELF(self));
|
72
83
|
return self;
|
73
84
|
}
|
74
85
|
|
75
86
|
static VALUE
|
76
|
-
|
87
|
+
rg_stop(VALUE self)
|
77
88
|
{
|
78
89
|
g_timer_stop(_SELF(self));
|
79
90
|
return self;
|
@@ -81,7 +92,7 @@ timer_stop(VALUE self)
|
|
81
92
|
|
82
93
|
#if GLIB_CHECK_VERSION(2,4,0)
|
83
94
|
static VALUE
|
84
|
-
|
95
|
+
rg_continue(VALUE self)
|
85
96
|
{
|
86
97
|
g_timer_continue(_SELF(self));
|
87
98
|
return self;
|
@@ -89,7 +100,7 @@ timer_continue(VALUE self)
|
|
89
100
|
#endif
|
90
101
|
|
91
102
|
static VALUE
|
92
|
-
|
103
|
+
rg_elapsed(VALUE self)
|
93
104
|
{
|
94
105
|
gulong microseconds;
|
95
106
|
gdouble ret = g_timer_elapsed(_SELF(self), µseconds);
|
@@ -98,23 +109,23 @@ timer_elapsed(VALUE self)
|
|
98
109
|
}
|
99
110
|
|
100
111
|
static VALUE
|
101
|
-
|
112
|
+
rg_reset(VALUE self)
|
102
113
|
{
|
103
114
|
g_timer_reset(_SELF(self));
|
104
115
|
return self;
|
105
116
|
}
|
106
117
|
|
107
118
|
void
|
108
|
-
Init_glib_timer()
|
119
|
+
Init_glib_timer(void)
|
109
120
|
{
|
110
|
-
VALUE
|
121
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_TIMER, "Timer", mGLib);
|
111
122
|
|
112
|
-
|
113
|
-
|
114
|
-
|
123
|
+
RG_DEF_METHOD(initialize, 0);
|
124
|
+
RG_DEF_METHOD(start, 0);
|
125
|
+
RG_DEF_METHOD(stop, 0);
|
115
126
|
#if GLIB_CHECK_VERSION(2,4,0)
|
116
|
-
|
127
|
+
RG_DEF_METHOD(continue, 0);
|
117
128
|
#endif
|
118
|
-
|
119
|
-
|
129
|
+
RG_DEF_METHOD(elapsed, 0);
|
130
|
+
RG_DEF_METHOD(reset, 0);
|
120
131
|
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2006 Kouhei Sutou
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgprivate.h"
|
23
|
+
#include "rbglib.h"
|
24
|
+
|
25
|
+
#define RG_TARGET_NAMESPACE mUCS4
|
26
|
+
|
27
|
+
static VALUE
|
28
|
+
rg_m_to_utf16(G_GNUC_UNUSED VALUE self, VALUE rb_ucs4)
|
29
|
+
{
|
30
|
+
VALUE result;
|
31
|
+
gunichar *ucs4;
|
32
|
+
gunichar2 *utf16;
|
33
|
+
glong len, items_written;
|
34
|
+
GError *error = NULL;
|
35
|
+
|
36
|
+
ucs4 = (gunichar *)StringValuePtr(rb_ucs4);
|
37
|
+
len = RSTRING_LEN(rb_ucs4) / sizeof(*ucs4);
|
38
|
+
|
39
|
+
utf16 = g_ucs4_to_utf16(ucs4, len, NULL, &items_written, &error);
|
40
|
+
|
41
|
+
if (error)
|
42
|
+
RAISE_GERROR(error);
|
43
|
+
|
44
|
+
result = CSTR2RVAL_LEN_UTF16((char *)utf16,
|
45
|
+
items_written * sizeof(*utf16));
|
46
|
+
g_free(utf16);
|
47
|
+
return result;
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rg_m_to_utf8(G_GNUC_UNUSED VALUE self, VALUE rb_ucs4)
|
52
|
+
{
|
53
|
+
VALUE result;
|
54
|
+
gunichar *ucs4;
|
55
|
+
gchar *utf8;
|
56
|
+
glong len, items_written;
|
57
|
+
GError *error = NULL;
|
58
|
+
|
59
|
+
ucs4 = (gunichar *)StringValuePtr(rb_ucs4);
|
60
|
+
len = RSTRING_LEN(rb_ucs4) / sizeof(*ucs4);
|
61
|
+
|
62
|
+
utf8 = g_ucs4_to_utf8(ucs4, len, NULL, &items_written, &error);
|
63
|
+
|
64
|
+
if (error)
|
65
|
+
RAISE_GERROR(error);
|
66
|
+
|
67
|
+
result = CSTR2RVAL_LEN(utf8, items_written);
|
68
|
+
g_free(utf8);
|
69
|
+
return result;
|
70
|
+
}
|
71
|
+
|
72
|
+
void
|
73
|
+
Init_glib_ucs4(void)
|
74
|
+
{
|
75
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "UCS4");
|
76
|
+
|
77
|
+
RG_DEF_MODFUNC(to_utf16, 1);
|
78
|
+
RG_DEF_MODFUNC(to_utf8, 1);
|
79
|
+
}
|
@@ -0,0 +1,209 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2006 Kouhei Sutou
|
5
|
+
*
|
6
|
+
* This library is free software; you can redistribute it and/or
|
7
|
+
* modify it under the terms of the GNU Lesser General Public
|
8
|
+
* License as published by the Free Software Foundation; either
|
9
|
+
* version 2.1 of the License, or (at your option) any later version.
|
10
|
+
*
|
11
|
+
* This library is distributed in the hope that it will be useful,
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
* Lesser General Public License for more details.
|
15
|
+
*
|
16
|
+
* You should have received a copy of the GNU Lesser General Public
|
17
|
+
* License along with this library; if not, write to the Free Software
|
18
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19
|
+
* MA 02110-1301 USA
|
20
|
+
*/
|
21
|
+
|
22
|
+
#include "rbgprivate.h"
|
23
|
+
#include "rbglib.h"
|
24
|
+
|
25
|
+
#define RG_TARGET_NAMESPACE mUniChar
|
26
|
+
|
27
|
+
#define DEF_IS_UNICHAR(name) \
|
28
|
+
static VALUE \
|
29
|
+
rbglib_m_unichar_is ## name(G_GNUC_UNUSED VALUE self, VALUE unichar) \
|
30
|
+
{ \
|
31
|
+
return CBOOL2RVAL(g_unichar_is ## name(NUM2UINT(unichar))); \
|
32
|
+
}
|
33
|
+
|
34
|
+
DEF_IS_UNICHAR(alnum)
|
35
|
+
DEF_IS_UNICHAR(alpha)
|
36
|
+
DEF_IS_UNICHAR(cntrl)
|
37
|
+
DEF_IS_UNICHAR(digit)
|
38
|
+
DEF_IS_UNICHAR(graph)
|
39
|
+
DEF_IS_UNICHAR(lower)
|
40
|
+
DEF_IS_UNICHAR(print)
|
41
|
+
DEF_IS_UNICHAR(punct)
|
42
|
+
DEF_IS_UNICHAR(space)
|
43
|
+
DEF_IS_UNICHAR(upper)
|
44
|
+
DEF_IS_UNICHAR(xdigit)
|
45
|
+
DEF_IS_UNICHAR(title)
|
46
|
+
DEF_IS_UNICHAR(defined)
|
47
|
+
DEF_IS_UNICHAR(wide)
|
48
|
+
#if GLIB_CHECK_VERSION(2,12,0)
|
49
|
+
DEF_IS_UNICHAR(wide_cjk)
|
50
|
+
#endif
|
51
|
+
|
52
|
+
#undef DEF_IS_UNICHAR
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
rg_m_to_upper(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
56
|
+
{
|
57
|
+
return UINT2NUM(g_unichar_toupper(NUM2UINT(unichar)));
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
rg_m_to_lower(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
62
|
+
{
|
63
|
+
return UINT2NUM(g_unichar_tolower(NUM2UINT(unichar)));
|
64
|
+
}
|
65
|
+
|
66
|
+
static VALUE
|
67
|
+
rg_m_to_title(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
68
|
+
{
|
69
|
+
return UINT2NUM(g_unichar_totitle(NUM2UINT(unichar)));
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE
|
73
|
+
rg_m_digit_value(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
74
|
+
{
|
75
|
+
return INT2NUM(g_unichar_digit_value(NUM2UINT(unichar)));
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE
|
79
|
+
rg_m_xdigit_value(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
80
|
+
{
|
81
|
+
return INT2NUM(g_unichar_xdigit_value(NUM2UINT(unichar)));
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE
|
85
|
+
rg_m_type(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
86
|
+
{
|
87
|
+
return GENUM2RVAL(g_unichar_type(NUM2UINT(unichar)),
|
88
|
+
G_TYPE_UNICODE_TYPE);
|
89
|
+
}
|
90
|
+
|
91
|
+
static VALUE
|
92
|
+
rg_m_break_type(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
93
|
+
{
|
94
|
+
return GENUM2RVAL(g_unichar_break_type(NUM2UINT(unichar)),
|
95
|
+
G_TYPE_UNICODE_BREAK_TYPE);
|
96
|
+
}
|
97
|
+
|
98
|
+
#if GLIB_CHECK_VERSION(2,4,0)
|
99
|
+
static VALUE
|
100
|
+
rg_m_get_mirror_char(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
101
|
+
{
|
102
|
+
gunichar mirrored_char;
|
103
|
+
|
104
|
+
if (g_unichar_get_mirror_char(NUM2UINT(unichar), &mirrored_char)) {
|
105
|
+
return UINT2NUM(mirrored_char);
|
106
|
+
} else {
|
107
|
+
return unichar;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
#endif
|
111
|
+
|
112
|
+
#if GLIB_CHECK_VERSION(2,14,0)
|
113
|
+
static VALUE
|
114
|
+
rg_m_combining_class(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
115
|
+
{
|
116
|
+
return INT2NUM(g_unichar_combining_class(NUM2UINT(unichar)));
|
117
|
+
}
|
118
|
+
|
119
|
+
static VALUE
|
120
|
+
rg_m_get_script(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
121
|
+
{
|
122
|
+
return GENUM2RVAL(g_unichar_get_script(NUM2UINT(unichar)),
|
123
|
+
G_TYPE_UNICODE_SCRIPT);
|
124
|
+
}
|
125
|
+
|
126
|
+
static VALUE
|
127
|
+
rg_m_mark_p(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
128
|
+
{
|
129
|
+
return CBOOL2RVAL(g_unichar_ismark(NUM2UINT(unichar)));
|
130
|
+
}
|
131
|
+
|
132
|
+
static VALUE
|
133
|
+
rg_m_zero_width_p(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
134
|
+
{
|
135
|
+
return CBOOL2RVAL(g_unichar_iszerowidth(NUM2UINT(unichar)));
|
136
|
+
}
|
137
|
+
#endif
|
138
|
+
|
139
|
+
static VALUE
|
140
|
+
rg_m_to_utf8(G_GNUC_UNUSED VALUE self, VALUE unichar)
|
141
|
+
{
|
142
|
+
gchar utf8[6];
|
143
|
+
gint len;
|
144
|
+
|
145
|
+
len = g_unichar_to_utf8(NUM2UINT(unichar), utf8);
|
146
|
+
return CSTR2RVAL_LEN(utf8, len);
|
147
|
+
}
|
148
|
+
|
149
|
+
void
|
150
|
+
Init_glib_unichar(void)
|
151
|
+
{
|
152
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "UniChar");
|
153
|
+
|
154
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "alnum?",
|
155
|
+
rbglib_m_unichar_isalnum, 1);
|
156
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "alpha?",
|
157
|
+
rbglib_m_unichar_isalpha, 1);
|
158
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "cntrl?",
|
159
|
+
rbglib_m_unichar_iscntrl, 1);
|
160
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "digit?",
|
161
|
+
rbglib_m_unichar_isdigit, 1);
|
162
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "graph?",
|
163
|
+
rbglib_m_unichar_isgraph, 1);
|
164
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "lower?",
|
165
|
+
rbglib_m_unichar_islower, 1);
|
166
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "print?",
|
167
|
+
rbglib_m_unichar_isprint, 1);
|
168
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "punct?",
|
169
|
+
rbglib_m_unichar_ispunct, 1);
|
170
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "space?",
|
171
|
+
rbglib_m_unichar_isspace, 1);
|
172
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "upper?",
|
173
|
+
rbglib_m_unichar_isupper, 1);
|
174
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "xdigit?",
|
175
|
+
rbglib_m_unichar_isxdigit, 1);
|
176
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "title?",
|
177
|
+
rbglib_m_unichar_istitle, 1);
|
178
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "defined?",
|
179
|
+
rbglib_m_unichar_isdefined, 1);
|
180
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "wide?",
|
181
|
+
rbglib_m_unichar_iswide, 1);
|
182
|
+
#if GLIB_CHECK_VERSION(2,12,0)
|
183
|
+
rb_define_module_function(RG_TARGET_NAMESPACE, "wide_cjk?",
|
184
|
+
rbglib_m_unichar_iswide_cjk, 1);
|
185
|
+
#endif
|
186
|
+
|
187
|
+
RG_DEF_MODFUNC(to_upper, 1);
|
188
|
+
RG_DEF_MODFUNC(to_lower, 1);
|
189
|
+
RG_DEF_MODFUNC(to_title, 1);
|
190
|
+
|
191
|
+
RG_DEF_MODFUNC(digit_value, 1);
|
192
|
+
RG_DEF_MODFUNC(xdigit_value, 1);
|
193
|
+
|
194
|
+
RG_DEF_MODFUNC(type, 1);
|
195
|
+
RG_DEF_MODFUNC(break_type, 1);
|
196
|
+
|
197
|
+
#if GLIB_CHECK_VERSION(2,4,0)
|
198
|
+
RG_DEF_MODFUNC(get_mirror_char, 1);
|
199
|
+
#endif
|
200
|
+
|
201
|
+
#if GLIB_CHECK_VERSION(2,14,0)
|
202
|
+
RG_DEF_MODFUNC(combining_class, 1);
|
203
|
+
RG_DEF_MODFUNC(get_script, 1);
|
204
|
+
RG_DEF_MODFUNC_P(mark, 1);
|
205
|
+
RG_DEF_MODFUNC_P(zero_width, 1);
|
206
|
+
#endif
|
207
|
+
|
208
|
+
RG_DEF_MODFUNC(to_utf8, 1);
|
209
|
+
}
|