# \[PATCH\] Added GString

**URL:** <https://www.ruby-forum.com/t/patch-added-gstring/168794>\
**Category:** Ruby-Gnome 2\
**Created:** [May 26, 2009, 2:06am UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794 "2009-05-26T02:06:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 26, 2009, 2:06am UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/1 "2009-05-26T02:06:56Z")

</div>

Hi ruby-gnome2,

For my personnal needs with Ruby GStreamer, I needed to access the  
g\_string\_\* stuff in GLib.  
Here is a first try to implement the g\_string\_\* stuff in a ruby class.  
Please tell me how to improve/add/remove things if necessary, so it  
could be integrated as soon as possible.

–  
[PATCH] Added GString

## Signed-off-by: Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

glib/src/rbglib.c | 10 ±  
glib/src/rbglib\_string.c | 329  
++++++++++++++++++++++++++++++++++++++++++++++  
2 files changed, 335 insertions(+), 4 deletions(-)  
create mode 100644 glib/src/rbglib\_string.c

diff --git a/glib/src/rbglib.c b/glib/src/rbglib.c  
index f163e89…e68cbab 100644  
— a/glib/src/rbglib.c  
+++ b/glib/src/rbglib.c  
@@ -42,6 +42,7 @@ extern void Init\_glib\_timer();  
extern void Init\_glib\_unicode();  
extern void Init\_glib\_keyfile();  
extern void Init\_glib\_bookmark\_file();  
+extern void Init\_glib\_string();

const gchar \*  
rbg\_rval\_inspect(VALUE object)  
@@ -97,14 +98,14 @@ So they occur “cross-thread violation”.  
static gpointer  
my\_malloc(gsize n\_bytes)  
{

- /\* Should we rescue NoMemoryError? \*/

- /\* Should we rescue NoMemoryError? \*/  
return ruby\_xmalloc(n\_bytes);  
}

static gpointer  
my\_realloc(gpointer mem, gsize n\_bytes)  
{

- /\* Should we rescue NoMemoryError? \*/

- /\* Should we rescue NoMemoryError? \*/  
return ruby\_xrealloc(mem, n\_bytes);  
}

@@ -162,7 +163,7 @@ rbg\_s\_os\_unix(self)  
#endif  
}

## -void +void Init\_glib2() { id\_inspect = rb\_intern(“inspect”); @@ -202,7 +203,7 @@ Init\_glib2() rb\_define\_const(mGLib, “MININT”, INT2FIX(G\_MININT)); rb\_define\_const(mGLib, “MAXINT”, INT2FIX(G\_MAXINT)); rb\_define\_const(mGLib, “MAXUINT”, INT2FIX(G\_MAXUINT));

- rb\_define\_const(mGLib, “MINSHORT”, INT2FIX(G\_MINSHORT));  
rb\_define\_const(mGLib, “MAXSHORT”, INT2FIX(G\_MAXSHORT));  
rb\_define\_const(mGLib, “MAXUSHORT”, INT2FIX(G\_MAXUSHORT));  
@@ -314,6 +315,7 @@ union GDoubleIEEE754;  
Init\_glib\_unicode();  
Init\_glib\_keyfile();  
Init\_glib\_bookmark\_file();

- Init\_glib\_string();

- 
- rbglib\_string.c -

- 
- $Author: $

- $Date: $

- 
- Copyright (C) 2009 Lionel L.  
+\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

- 

+#include “rbgprivate.h”  
+  
+/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*_/  
+  
+#define \_SELF(self) ((GString_)(RVAL2BOXED(self, G\_TYPE\_GSTRING)))  
+  
+static VALUE  
+string\_initialize(argc, argv, self)

- int argc;
- VALUE \*argv;
- VALUE self;  
+{
- 

```
   VALUE arg1;

```

- 
- if (argc == 0) {
- 

```
   G_INITIALIZE(self, g_string_new(NULL));

```

- } else {
- 

```
   rb_scan_args(argc, argv, "1", &arg1);

```

- 
- 

```
   if (TYPE(arg1) != T_STRING)

```

- 

```
       rb_raise(rb_eArgError, "argument should be a String");

```

- 
- 

```
   G_INITIALIZE(self, g_string_new(STR2CSTR(arg1)));

```

- }
- 
- return Qnil;  
+}
- 
- 

+static VALUE  
+string\_equal(self, value)

- VALUE self;
- VALUE value;  
+{
- return CBOOL2RVAL(g\_string\_equal(\_SELF(self), \_SELF(value)));  
+}
- 

+static VALUE  
+string\_assign(self, value)

- VALUE self;
- VALUE value;  
+{
- if (TYPE(value) != T\_STRING)
- 

```
   rb_raise(rb_eArgError, "argument should be a String");

```

- 
- g\_string\_assign(\_SELF(self), STR2CSTR(value));
- 
- return self;  
+}
- 

+static VALUE  
+string\_truncate(self, len)

- VALUE self;
- VALUE len;  
+{
- if (!FIXNUM\_P(len))
- 

```
   rb_raise(rb_eArgError, "argment should be a Fixnum");

```

- 
- g\_string\_truncate(\_SELF(self), FIX2INT(len));
- 
- return self;  
+}
- 

+static VALUE  
+string\_get\_size(self)

- VALUE self;  
+{
- return INT2FIX(\_SELF(self)-\>len);  
+}
- 

+static VALUE  
+string\_set\_size(self, size)

- VALUE self;
- VALUE size;  
+{
- if (!FIXNUM\_P(size))
- 

```
   rb_raise(rb_eArgError, "argment should be a Fixnum");

```

- 
- g\_string\_set\_size(\_SELF(self), FIX2INT(size));
- 
- return self;  
+}
- 

+static VALUE  
+string\_get\_char(self, pos)

- VALUE self;
- VALUE pos;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argment should be a Fixnum");

```

- 
- if (FIX2INT(pos) \>= \_SELF(self)-\>len)
- 

```
   return Qnil;

```

- 
- return INT2FIX(\_SELF(self)-\>str[FIX2INT(pos)]);  
+}
- 

+static VALUE  
+string\_set\_char(self, pos, value)

- VALUE self;
- VALUE pos;
- VALUE value;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argment 1 should be a Fixnum");

```

- 
- if (!FIXNUM\_P(value) && (FIX2INT(value) \>= 256))
- 

```
   rb_raise(rb_eArgError, "argment 2 should be a Fixnum < 256");

```

- 
- \_SELF(self)-\>str[FIX2INT(pos)] = (gchar) FIX2INT(value);
- 
- return self;  
+}
- 

+static VALUE  
+string\_append(self, data)

- VALUE self;
- VALUE data;  
+{
- if (FIXNUM\_P(data) && (FIX2INT(data) \< 256))
- 

```
   g_string_append_c(_SELF(self), (gchar) FIX2INT(data));

```

- else if (TYPE(data) == T\_STRING)
- 

```
   g_string_append(_SELF(self), STR2CSTR(data));

```

- else
- 

```
   rb_raise(rb_eArgError, "argument should be a Fixnum < 256 or 

```

String");  
+

- return self;  
+}
- 

+static VALUE  
+string\_append\_len(self, str, len)

- VALUE self;
- VALUE str;
- VALUE len;  
+{
- if (TYPE(str) != T\_STRING)
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a String");

```

- if (!FIXNUM\_P(len))
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a Fixnum");

```

- 
- g\_string\_append\_len(\_SELF(self), STR2CSTR(str), FIX2INT(len));
- 
- return self;  
+}
- 

+static VALUE  
+string\_prepend(self, data)

- VALUE self;
- VALUE data;  
+{
- if (FIXNUM\_P(data) && (FIX2INT(data) \< 256))
- 

```
   g_string_prepend_c(_SELF(self), (gchar) FIX2INT(data));

```

- else if (TYPE(data) == T\_STRING)
- 

```
   g_string_prepend(_SELF(self), STR2CSTR(data));

```

- else
- 

```
   rb_raise(rb_eArgError, "argument should be a Fixnum or 

```

String");  
+

- return self;  
+}
- 

+static VALUE  
+string\_prepend\_len(self, str, len)

- VALUE self;
- VALUE str;
- VALUE len;  
+{
- if (TYPE(str) != T\_STRING)
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a String");

```

- if (!FIXNUM\_P(len))
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a Fixnum");

```

- 
- g\_string\_prepend\_len(\_SELF(self), STR2CSTR(str), FIX2INT(len));
- 
- return self;  
+}
- 

+static VALUE  
+string\_insert(self, pos, data)

- VALUE self;
- VALUE pos;
- VALUE data;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a Fixnum");

```

- 
- if (FIXNUM\_P(data) && (FIX2INT(data) \< 256))
- 

```
   g_string_insert_c(_SELF(self), FIX2INT(pos), (gchar) 

```

FIX2INT(data));

- else if (TYPE(data) == T\_STRING)
- 

```
   g_string_insert(_SELF(self), FIX2INT(pos), STR2CSTR(data));

```

- else
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a Fixnum or 

```

String");  
+

- return self;  
+}
- 

+static VALUE  
+string\_insert\_len(self, pos, str, len)

- VALUE self;
- VALUE pos;
- VALUE str;
- VALUE len;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a Fixnum");

```

- 
- if (TYPE(str) != T\_STRING)
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a String");

```

- if (!FIXNUM\_P(len))
- 

```
   rb_raise(rb_eArgError, "argument 3 should be a Fixnum");

```

- 
- g\_string\_insert\_len(\_SELF(self), FIX2INT(pos), STR2CSTR(str),  
FIX2INT(len));
- 
- return self;  
+}
- 

+static VALUE  
+string\_overwrite(self, pos, data)

- VALUE self;
- VALUE pos;
- VALUE data;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a Fixnum");

```

- 
- if (FIXNUM\_P(data) && (FIX2INT(data) \< 256))
- 

```
   _SELF(self)->str[FIX2INT(pos)] = (gchar) FIX2INT(data);

```

- else if (TYPE(data) == T\_STRING)
- 

```
   g_string_overwrite(_SELF(self), FIX2INT(pos), STR2CSTR(data));

```

- else
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a Fixnum or 

```

String");  
+

- return self;  
+}
- 

+static VALUE  
+string\_overwrite\_len(self, pos, str, len)

- VALUE self;
- VALUE pos;
- VALUE str;
- VALUE len;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a Fixnum");

```

- 
- if (TYPE(str) != T\_STRING)
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a String");

```

- if (!FIXNUM\_P(len))
- 

```
   rb_raise(rb_eArgError, "argument 3 should be a Fixnum");

```

- 
- g\_string\_overwrite\_len(\_SELF(self), FIX2INT(pos), STR2CSTR(str),  
FIX2INT(len));
- 
- return self;  
+}
- 

+static VALUE  
+string\_erase(self, pos, len)

- VALUE self;
- VALUE pos;
- VALUE len;  
+{
- if (!FIXNUM\_P(pos))
- 

```
   rb_raise(rb_eArgError, "argument 1 should be a Fixnum");

```

- if (!FIXNUM\_P(len))
- 

```
   rb_raise(rb_eArgError, "argument 2 should be a String");

```

- 
- g\_string\_erase(\_SELF(self), FIX2INT(pos), FIX2INT(len));
- 
- return self;  
+}
- 

+static VALUE  
+string\_ascii\_down(self)

- VALUE self;  
+{
- g\_string\_ascii\_down(\_SELF(self));
- 
- return self;  
+}
- 

+static VALUE  
+string\_ascii\_up(self)

- VALUE self;  
+{
- g\_string\_ascii\_up(\_SELF(self));
- 
- return self;  
+}
- 

+void  
+Init\_glib\_string()  
+{

- VALUE str = G\_DEF\_CLASS(G\_TYPE\_GSTRING, “String”, mGLib);
- 
- rb\_define\_method(str, “initialize”, string\_initialize, -1);
- rb\_define\_method(str, “==”, string\_equal, 1);
- rb\_define\_method(str, “assign”, string\_assign, -1);
- rb\_define\_method(str, “truncate”, string\_truncate, -1);
- 
- rb\_define\_method(str, “size”, string\_get\_size, 0);
- rb\_define\_method(str, “size=”, string\_set\_size, 1);
- 
- rb\_define\_method(str, “[]”, string\_get\_char, 1);
- rb\_define\_method(str, “[]=”, string\_set\_char, 2);
- 
- rb\_define\_method(str, “append”, string\_append, 1);
- rb\_define\_method(str, “append\_len”, string\_append\_len, 2);
- rb\_define\_method(str, “insert”, string\_insert, 2);
- rb\_define\_method(str, “insert\_len”, string\_insert\_len, 3);
- rb\_define\_method(str, “prepend”, string\_prepend, 1);
- rb\_define\_method(str, “prepend\_len”, string\_prepend\_len, 1);
- rb\_define\_method(str, “overwrite”, string\_overwrite, 2);
- rb\_define\_method(str, “overwrite\_len”, string\_overwrite\_len, 3);
- 
- rb\_define\_method(str, “erase”, string\_erase, 2);
- 
- rb\_define\_method(str, “ascii\_down”, string\_ascii\_down, 0);
- rb\_define\_method(str, “ascii\_up”, string\_ascii\_up, 0);  
+}  
–  
1.6.3.1

–  
Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 26, 2009, 12:50pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/2 "2009-05-26T12:50:07Z")

</div>

Hi,

2009/5/26 Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hi ruby-gnome2,
> 
> For my personnal needs with Ruby GStreamer, I needed to access the  
> g\_string\_\* stuff in GLib.  
> Here is a first try to implement the g\_string\_\* stuff in a ruby class.  
> Please tell me how to improve/add/remove things if necessary, so it  
> could be integrated as soon as possible.

Could you show your GStreamer case?  
If it really needs GStreing, we will accept the patch.

P.S. You can use ANSI style function definition instead of K&R:  
func (a, b, c)  
VALUE a, b, c;  
{  
}  
|  
/  
func (VALUE a, VALUE b, VALUE c)  
{  
}

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 26, 2009, 2:09pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/3 "2009-05-26T14:09:58Z")

</div>

Le mardi 26 mai 2009 Ã 19:47 +0900, Kouhei S. a Ã©crit :

> func (VALUE a, VALUE b, VALUE c)  
> {  
> }
> 
> ## Thanks,
> 
> kou

About the coding style, I just followed the same rules than the other  
files.

Here is an example.  
It displays the GstStructure values emitted by the mpegtsparse plugin  
from GStreamer. One of them are MPEG/TS descriptors, found in PSI  
tables. They might contain more than one ‘\0’ character, so g\_string\_\*  
is required.

Regards,

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 26, 2009, 9:16pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/4 "2009-05-26T21:16:16Z")

</div>

Le mardi 26 mai 2009 Ã 01:34 +0200, Lionel L. a Ã©crit :

> Hi ruby-gnome2,

Added 2 new methods : each\_byte and to\_a.

Regards,

–

Added to\_a and each\_byte methods

## Signed-off-by: Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

glib/src/rbglib\_string.c | 36 ++++++++++++++++++++++++++++++++++++  
1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/glib/src/rbglib\_string.c b/glib/src/rbglib\_string.c  
index 374c369..f71097e 100644  
— a/glib/src/rbglib\_string.c  
+++ b/glib/src/rbglib\_string.c  
@@ -107,6 +107,23 @@ string\_get\_char(self, pos)  
}

static VALUE  
+string\_each\_byte(self)

- VALUE self;  
+{
- gsize i;
- 
- if (!rb\_block\_given\_p()) {
- 

```
   rb_raise(rb_eArgError, "called without a block");

```

- }
- 
- for (i = 0 ; i \< \_SELF(self)-\>len ; i++) {
- 

```
   rb_yield(UINT2NUM(_SELF(self)->str[i]));

```

- }
- 
- return self;  
+}
- 

+static VALUE  
string\_set\_char(self, pos, value)  
VALUE self;  
VALUE pos;  
@@ -297,6 +314,21 @@ string\_ascii\_up(self)  
return self;  
}

+static VALUE  
+string\_to\_a(self)

- VALUE self;  
+{
- gsize i;
- VALUE ary;
- 
- ary = rb\_ary\_new();
- for (i = 0 ; i \< \_SELF(self)-\>len ; i++) {
- 

```
   rb_ary_push(ary, UINT2NUM(_SELF(self)->str[i]));

```

- }
- 
- return ary;  
+}
- 

void  
Init\_glib\_string()  
{  
@@ -313,6 +345,8 @@ Init\_glib\_string()  
rb\_define\_method(str, “”, string\_get\_char, 1);  
rb\_define\_method(str, “=”, string\_set\_char, 2);

- rb\_define\_method(str, “each\_byte”, string\_each\_byte, 0);

- rb\_define\_method(str, “append”, string\_append, 1);  
rb\_define\_method(str, “append\_len”, string\_append\_len, 2);  
rb\_define\_method(str, “insert”, string\_insert, 2);  
@@ -326,4 +360,6 @@ Init\_glib\_string()

- 
- rb\_define\_method(str, “to\_a”, string\_to\_a, 0);  
}  
–  
1.6.3.1

–  
Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 27, 2009, 1:42pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/5 "2009-05-27T13:42:09Z")

</div>

Hi,

2009/5/26 Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> About the coding style, I just followed the same rules than the other  
> files.

Yes. Many of the current source codes are written with K&R style.  
But it’s a historical reason. We are moving to ANSI style from K&R style  
because Ruby itself were moved to ANSI style.

We want to use ANSI style for newly written codes.

> Here is an example.  
> It displays the GstStructure values emitted by the mpegtsparse plugin  
> from GStreamer. One of them are MPEG/TS descriptors, found in PSI  
> tables. They might contain more than one ‘\0’ character, so g\_string\_\*  
> is required.

Could you show us an example code?  
I can’t confirm the case because I don’t have an environment for that…

Ruby’s string can also contain more than ‘\0’ character.  
Is Ruby’s string bad solution in the case?

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 27, 2009, 2:54pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/6 "2009-05-27T14:54:33Z")

</div>

Le mercredi 27 mai 2009 Ã 20:40 +0900, Kouhei S. a Ã©crit :

> Hi,

Hi,

> We want to use ANSI style for newly written codes.  
> Ok, I will rewrite it using ANSI style.

> > Here is an example.  
> > It displays the GstStructure values emitted by the mpegtsparse plugin  
> > from GStreamer. One of them are MPEG/TS descriptors, found in PSI  
> > tables. They might contain more than one ‘\0’ character, so g\_string\_\*  
> > is required.
> 
> Could you show us an example code?  
> I can’t confirm the case because I don’t have an environment for that…

I already did that in my previous mail, can’t you see the attachment ?  
If not, you can get it at [http://potipota.net/~djdeath/test\_ts\_pids.rb](http://potipota.net/~djdeath/test_ts_pids.rb)

If you’re running a debian/ubuntu system, you need the following  
packages :  
\* gstreamer0.10-plugins-bad  
\* ruby-gnome2

Then just run the test\_ts\_pids.rb script with the first argument beeing  
a MPEG/TS file. You can download one from  
[http://potipota.net/~djdeath/NRJ\_12\_HD.ts](http://potipota.net/~djdeath/NRJ_12_HD.ts)

> Ruby’s string can also contain more than ‘\0’ character.  
> Is Ruby’s string bad solution in the case?

The problem is that GString is a boxed type.  
For boxed types, ruby-gnome does the following conversion :  
Ruby String ↔ GBoxed (gchar \*)

So ruby cannot automaticly knows which conversion must be done :  
Ruby String ↔ GBoxed (gchar \*)  
or  
Ruby String ↔ GBoxed (GLib String)

So introducing a new Ruby class to handle the GLib String component  
seems to be the better solution to me (just like it has been done for  
GKeyFile or GTimer).

–  
Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 28, 2009, 7:38am UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/7 "2009-05-28T07:38:04Z")

</div>

Le mercredi 27 mai 2009 Ã 22:19 +0900, Kouhei S. a Ã©crit :

> > I already did that in my previous mail, can’t you see the attachment ?

Ok, I just created an account, login : llandwerlin

–  
Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 27, 2009, 3:20pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/8 "2009-05-27T15:20:24Z")

</div>

Hi,

2009/5/27 Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > We want to use ANSI style for newly written codes.
> 
> Ok, I will rewrite it using ANSI style.

Thanks!

> I already did that in my previous mail, can’t you see the attachment ?

Oops…  
Sorry… I missed it…

OK. I understood.

Do you have [SF.net](http://SF.net) account?  
I’ll add you to the Ruby-GNOME2 developers, please commit your patch  
by yourself. (It’s more better that your patch also includes unit test.  
🙂

## Thanks,

kou

---

<div class="post-metadata">

**Author:** ![djdeath](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/b782af/32.png) [@djdeath](https://www.ruby-forum.com/u/djdeath)\
**Post date:** [May 28, 2009, 4:09pm UTC](https://www.ruby-forum.com/t/patch-added-gstring/168794/9 "2009-05-28T16:09:08Z")

</div>

Hi,

2009/5/28 Lionel L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> > Do you have [SF.net](http://SF.net) account?  
> > I’ll add you to the Ruby-GNOME2 developers, please commit your patch  
> > by yourself. (It’s more better that your patch also includes unit test. 🙂
> 
> Ok, I just created an account, login : llandwerlin

I’ve add you to the Ruby-GNOME2 developers. Welcome!

BTW, do you know rbgobj\_register\_g2r\_func()?  
Your case may be solved by the function without providing GString  
bindings.

It’s better that we use Ruby’s String rather than GString bindings  
because  
users doesn’t need to lean about new class and Ruby’s string is more  
powerful  
rather than GString.  
If you’re interested in Rubyish API, please consider about the function  
before  
you commit your patch. 🙂

## Thanks,

kou
