glib2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- 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_mainloop.c
CHANGED
@@ -1,17 +1,28 @@
|
|
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,2006 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
|
/*****************************************/
|
25
|
+
#if !GLIB_CHECK_VERSION(2,30,0)
|
15
26
|
GType
|
16
27
|
g_main_loop_get_type(void)
|
17
28
|
{
|
@@ -22,14 +33,16 @@ g_main_loop_get_type(void)
|
|
22
33
|
(GBoxedFreeFunc)g_main_loop_unref);
|
23
34
|
return our_type;
|
24
35
|
}
|
36
|
+
#endif
|
25
37
|
/*****************************************/
|
26
38
|
|
39
|
+
#define RG_TARGET_NAMESPACE cMainLoop
|
27
40
|
#define _SELF(s) ((GMainLoop*)RVAL2BOXED(s, G_TYPE_MAIN_LOOP))
|
28
41
|
|
29
42
|
/*****************************************/
|
30
43
|
|
31
44
|
static VALUE
|
32
|
-
|
45
|
+
rg_initialize(int argc, VALUE *argv, VALUE self)
|
33
46
|
{
|
34
47
|
VALUE context, is_running;
|
35
48
|
GMainLoop *loop;
|
@@ -45,39 +58,39 @@ ml_initialize(int argc, VALUE *argv, VALUE self)
|
|
45
58
|
}
|
46
59
|
|
47
60
|
static VALUE
|
48
|
-
|
61
|
+
rg_run(VALUE self)
|
49
62
|
{
|
50
63
|
g_main_loop_run(_SELF(self));
|
51
64
|
return self;
|
52
65
|
}
|
53
66
|
|
54
67
|
static VALUE
|
55
|
-
|
68
|
+
rg_quit(VALUE self)
|
56
69
|
{
|
57
70
|
g_main_loop_quit(_SELF(self));
|
58
71
|
return Qnil;
|
59
72
|
}
|
60
73
|
|
61
74
|
static VALUE
|
62
|
-
|
75
|
+
rg_running_p(VALUE self)
|
63
76
|
{
|
64
77
|
return CBOOL2RVAL(g_main_loop_is_running(_SELF(self)));
|
65
78
|
}
|
66
79
|
|
67
80
|
static VALUE
|
68
|
-
|
81
|
+
rg_context(VALUE self)
|
69
82
|
{
|
70
83
|
return BOXED2RVAL(g_main_loop_get_context(_SELF(self)), G_TYPE_MAIN_CONTEXT);
|
71
84
|
}
|
72
85
|
|
73
86
|
void
|
74
|
-
Init_glib_main_loop()
|
87
|
+
Init_glib_main_loop(void)
|
75
88
|
{
|
76
|
-
VALUE
|
89
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_MAIN_LOOP, "MainLoop", mGLib);
|
77
90
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
91
|
+
RG_DEF_METHOD(initialize, -1);
|
92
|
+
RG_DEF_METHOD(run, 0);
|
93
|
+
RG_DEF_METHOD(quit, 0);
|
94
|
+
RG_DEF_METHOD_P(running, 0);
|
95
|
+
RG_DEF_METHOD(context, 0);
|
83
96
|
}
|
data/ext/glib2/rbglib_messages.c
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2002-2005 Masao Mutoh
|
5
|
+
* Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
6
|
+
* Daisuke Kanda,
|
7
|
+
* Hiroshi Igarashi
|
8
|
+
*
|
9
|
+
* This library is free software; you can redistribute it and/or
|
10
|
+
* modify it under the terms of the GNU Lesser General Public
|
11
|
+
* License as published by the Free Software Foundation; either
|
12
|
+
* version 2.1 of the License, or (at your option) any later version.
|
13
|
+
*
|
14
|
+
* This library is distributed in the hope that it will be useful,
|
15
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17
|
+
* Lesser General Public License for more details.
|
18
|
+
*
|
19
|
+
* You should have received a copy of the GNU Lesser General Public
|
20
|
+
* License along with this library; if not, write to the Free Software
|
21
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
22
|
+
* MA 02110-1301 USA
|
23
|
+
*/
|
17
24
|
|
18
25
|
#include "rbgprivate.h"
|
19
26
|
|
@@ -25,6 +32,8 @@
|
|
25
32
|
#define rb_sourceline() (ruby_sourceline)
|
26
33
|
#endif
|
27
34
|
|
35
|
+
#define RG_TARGET_NAMESPACE mLog
|
36
|
+
|
28
37
|
static VALUE rbglib_log_handler_procs;
|
29
38
|
static ID id_call;
|
30
39
|
static gboolean log_canceled;
|
@@ -64,78 +73,78 @@ rbglib_log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gcha
|
|
64
73
|
|
65
74
|
/* Use Internal only */
|
66
75
|
static VALUE
|
67
|
-
|
76
|
+
rg_m_cancel_handler(G_GNUC_UNUSED VALUE self)
|
68
77
|
{
|
69
78
|
log_canceled = TRUE;
|
70
79
|
return Qnil;
|
71
80
|
}
|
72
81
|
|
73
82
|
static VALUE
|
74
|
-
|
83
|
+
rg_m_set_handler(VALUE self, VALUE domain, VALUE levels)
|
75
84
|
{
|
76
|
-
guint handler_id = g_log_set_handler(
|
85
|
+
guint handler_id = g_log_set_handler(RVAL2CSTR_ACCEPT_NIL(domain),
|
77
86
|
NUM2INT(levels),
|
78
87
|
(GLogFunc)rbglib_log_handler, (gpointer)self);
|
79
88
|
return UINT2NUM(handler_id);
|
80
89
|
}
|
81
90
|
|
82
91
|
static VALUE
|
83
|
-
|
92
|
+
rg_m_remove_handler(VALUE self, VALUE domain, VALUE handler_id)
|
84
93
|
{
|
85
|
-
g_log_remove_handler(
|
94
|
+
g_log_remove_handler(RVAL2CSTR_ACCEPT_NIL(domain),
|
86
95
|
NUM2UINT(handler_id));
|
87
96
|
G_REMOVE_RELATIVE(self, handler_id, rbglib_log_handler_procs);
|
88
97
|
return Qnil;
|
89
98
|
}
|
90
99
|
|
91
100
|
static VALUE
|
92
|
-
|
101
|
+
rg_m_set_always_fatal(G_GNUC_UNUSED VALUE self, VALUE fatal_mask)
|
93
102
|
{
|
94
103
|
return INT2NUM(g_log_set_always_fatal(NUM2INT(fatal_mask)));
|
95
104
|
}
|
96
105
|
|
97
106
|
static VALUE
|
98
|
-
|
107
|
+
rg_m_set_fatal_mask(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE fatal_mask)
|
99
108
|
{
|
100
|
-
return INT2NUM(g_log_set_fatal_mask(
|
109
|
+
return INT2NUM(g_log_set_fatal_mask(RVAL2CSTR_ACCEPT_NIL(domain),
|
101
110
|
NUM2INT(fatal_mask)));
|
102
111
|
}
|
103
112
|
|
104
113
|
static VALUE
|
105
|
-
|
114
|
+
rg_m_log(G_GNUC_UNUSED VALUE self, VALUE domain, VALUE level, VALUE str)
|
106
115
|
{
|
107
|
-
g_log(
|
116
|
+
g_log(RVAL2CSTR_ACCEPT_NIL(domain), NUM2INT(level), "%s", RVAL2CSTR(str));
|
108
117
|
return Qnil;
|
109
118
|
}
|
110
119
|
|
111
120
|
void
|
112
|
-
Init_glib_messages()
|
121
|
+
Init_glib_messages(void)
|
113
122
|
{
|
114
|
-
VALUE
|
123
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Log");
|
115
124
|
|
116
125
|
id_call = rb_intern("call");
|
117
126
|
log_canceled = FALSE;
|
118
127
|
|
119
128
|
rb_global_variable(&rbglib_log_handler_procs);
|
120
129
|
rbglib_log_handler_procs = rb_hash_new();
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
130
|
+
RG_DEF_MODFUNC(set_handler, 2);
|
131
|
+
RG_DEF_MODFUNC(remove_handler, 2);
|
132
|
+
RG_DEF_MODFUNC(cancel_handler, 0);
|
133
|
+
RG_DEF_MODFUNC(set_always_fatal, 1);
|
134
|
+
RG_DEF_MODFUNC(set_fatal_mask, 2);
|
135
|
+
RG_DEF_MODFUNC(log, 3);
|
127
136
|
|
128
|
-
rb_define_const(
|
129
|
-
rb_define_const(
|
137
|
+
rb_define_const(RG_TARGET_NAMESPACE, "FATAL_MASK", INT2NUM(G_LOG_FATAL_MASK));
|
138
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_USER_SHIFT", INT2NUM(G_LOG_LEVEL_USER_SHIFT));
|
130
139
|
|
131
140
|
/* GLogLevelFlags */
|
132
|
-
rb_define_const(
|
133
|
-
rb_define_const(
|
134
|
-
rb_define_const(
|
135
|
-
rb_define_const(
|
136
|
-
rb_define_const(
|
137
|
-
rb_define_const(
|
138
|
-
rb_define_const(
|
139
|
-
rb_define_const(
|
140
|
-
rb_define_const(
|
141
|
+
rb_define_const(RG_TARGET_NAMESPACE, "FLAG_RECURSION", INT2NUM(G_LOG_FLAG_RECURSION));
|
142
|
+
rb_define_const(RG_TARGET_NAMESPACE, "FLAG_FATAL", INT2NUM(G_LOG_FLAG_FATAL));
|
143
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_ERROR", INT2NUM(G_LOG_LEVEL_ERROR));
|
144
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_CRITICAL", INT2NUM(G_LOG_LEVEL_CRITICAL));
|
145
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_WARNING", INT2NUM(G_LOG_LEVEL_WARNING));
|
146
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_MESSAGE", INT2NUM(G_LOG_LEVEL_MESSAGE));
|
147
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_INFO", INT2NUM(G_LOG_LEVEL_INFO));
|
148
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_DEBUG", INT2NUM(G_LOG_LEVEL_DEBUG));
|
149
|
+
rb_define_const(RG_TARGET_NAMESPACE, "LEVEL_MASK", INT2NUM(G_LOG_LEVEL_MASK));
|
141
150
|
}
|
data/ext/glib2/rbglib_pollfd.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
|
|
@@ -35,10 +45,11 @@ g_poll_fd_get_type(void)
|
|
35
45
|
}
|
36
46
|
/*****************************************/
|
37
47
|
|
48
|
+
#define RG_TARGET_NAMESPACE cPollFD
|
38
49
|
#define _SELF(s) ((GPollFD*)RVAL2BOXED(s, G_TYPE_POLL_FD))
|
39
50
|
|
40
51
|
static VALUE
|
41
|
-
|
52
|
+
rg_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents)
|
42
53
|
{
|
43
54
|
GPollFD gfd;
|
44
55
|
gfd.fd = NUM2INT(fd);
|
@@ -50,55 +61,55 @@ poll_initialize(VALUE self, VALUE fd, VALUE events, VALUE revents)
|
|
50
61
|
}
|
51
62
|
|
52
63
|
static VALUE
|
53
|
-
|
64
|
+
rg_set_fd(VALUE self, VALUE fd)
|
54
65
|
{
|
55
66
|
_SELF(self)->fd = fd;
|
56
67
|
return self;
|
57
68
|
}
|
58
69
|
static VALUE
|
59
|
-
|
70
|
+
rg_fd(VALUE self)
|
60
71
|
{
|
61
72
|
return INT2NUM(_SELF(self)->fd);
|
62
73
|
}
|
63
74
|
|
64
75
|
static VALUE
|
65
|
-
|
76
|
+
rg_set_events(VALUE self, VALUE events)
|
66
77
|
{
|
67
78
|
_SELF(self)->events = events;
|
68
79
|
return self;
|
69
80
|
}
|
70
81
|
static VALUE
|
71
|
-
|
82
|
+
rg_events(VALUE self)
|
72
83
|
{
|
73
84
|
return INT2NUM(_SELF(self)->events);
|
74
85
|
}
|
75
86
|
|
76
87
|
static VALUE
|
77
|
-
|
88
|
+
rg_set_revents(VALUE self, VALUE revents)
|
78
89
|
{
|
79
90
|
_SELF(self)->revents = revents;
|
80
91
|
return self;
|
81
92
|
}
|
82
93
|
static VALUE
|
83
|
-
|
94
|
+
rg_revents(VALUE self)
|
84
95
|
{
|
85
96
|
return INT2NUM(_SELF(self)->revents);
|
86
97
|
}
|
87
98
|
|
88
99
|
void
|
89
|
-
Init_glib_poll_fd()
|
100
|
+
Init_glib_poll_fd(void)
|
90
101
|
{
|
91
|
-
VALUE
|
102
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(G_TYPE_POLL_FD, "PollFD", mGLib);
|
92
103
|
|
93
|
-
|
104
|
+
RG_DEF_METHOD(initialize, 3);
|
94
105
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
106
|
+
RG_DEF_METHOD(set_fd, 1);
|
107
|
+
RG_DEF_METHOD(fd, 0);
|
108
|
+
RG_DEF_METHOD(set_events, 1);
|
109
|
+
RG_DEF_METHOD(events, 0);
|
110
|
+
RG_DEF_METHOD(set_revents, 1);
|
111
|
+
RG_DEF_METHOD(revents, 0);
|
101
112
|
|
102
|
-
G_DEF_SETTERS(
|
113
|
+
G_DEF_SETTERS(RG_TARGET_NAMESPACE);
|
103
114
|
|
104
115
|
}
|
data/ext/glib2/rbglib_shell.c
CHANGED
@@ -1,18 +1,30 @@
|
|
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
|
|
24
|
+
#define RG_TARGET_NAMESPACE mShell
|
25
|
+
|
14
26
|
static VALUE
|
15
|
-
|
27
|
+
rg_m_parse(G_GNUC_UNUSED VALUE self, VALUE command_line)
|
16
28
|
{
|
17
29
|
gint argc;
|
18
30
|
gchar **argv;
|
@@ -25,13 +37,13 @@ shell_parse(VALUE self, VALUE command_line)
|
|
25
37
|
}
|
26
38
|
|
27
39
|
static VALUE
|
28
|
-
|
40
|
+
rg_m_quote(G_GNUC_UNUSED VALUE self, VALUE unquoted_string)
|
29
41
|
{
|
30
42
|
return CSTR2RVAL_FREE(g_shell_quote(RVAL2CSTR(unquoted_string)));
|
31
43
|
}
|
32
44
|
|
33
45
|
static VALUE
|
34
|
-
|
46
|
+
rg_m_unquote(G_GNUC_UNUSED VALUE self, VALUE quoted_string)
|
35
47
|
{
|
36
48
|
GError *error = NULL;
|
37
49
|
gchar *str = g_shell_unquote(RVAL2CSTR(quoted_string), &error);
|
@@ -42,16 +54,11 @@ shell_unquote(VALUE self, VALUE quoted_string)
|
|
42
54
|
}
|
43
55
|
|
44
56
|
void
|
45
|
-
Init_glib_shell()
|
57
|
+
Init_glib_shell(void)
|
46
58
|
{
|
47
|
-
VALUE
|
48
|
-
VALUE cShellError = G_DEF_ERROR2(G_SHELL_ERROR, "ShellError", mGLib, rb_eRuntimeError);
|
49
|
-
|
50
|
-
rb_define_module_function(mShell, "parse", shell_parse, 1);
|
51
|
-
rb_define_module_function(mShell, "quote", shell_quote, 1);
|
52
|
-
rb_define_module_function(mShell, "unquote", shell_unquote, 1);
|
59
|
+
VALUE RG_TARGET_NAMESPACE = rb_define_module_under(mGLib, "Shell");
|
53
60
|
|
54
|
-
|
55
|
-
|
56
|
-
|
61
|
+
RG_DEF_MODFUNC(parse, 1);
|
62
|
+
RG_DEF_MODFUNC(quote, 1);
|
63
|
+
RG_DEF_MODFUNC(unquote, 1);
|
57
64
|
}
|