[Tomoe-cvs 1260] CVS update: tomoe/ext/ruby

アーカイブの一覧に戻る

Kouhei Sutou kous****@users*****
2006年 11月 28日 (火) 12:19:00 JST


Index: tomoe/ext/ruby/tomoe-rb-char.c
diff -u tomoe/ext/ruby/tomoe-rb-char.c:1.6 tomoe/ext/ruby/tomoe-rb-char.c:1.7
--- tomoe/ext/ruby/tomoe-rb-char.c:1.6	Mon Nov 27 16:05:51 2006
+++ tomoe/ext/ruby/tomoe-rb-char.c	Tue Nov 28 12:19:00 2006
@@ -1,40 +1,34 @@
 #include "tomoe-rb.h"
 
-#define _SELF(obj) (TOMOE_CHAR(RVAL2GOBJ(obj)))
+#define _SELF(obj) RVAL2TCHR(obj)
 
 static VALUE
-tc_get_utf8(VALUE self)
+tc_get_readings(VALUE self)
 {
-    return CSTR2RVAL(tomoe_char_get_utf8(_SELF(self)));
+    return GLIST2ARY((GList *)tomoe_char_get_readings(_SELF(self)));
 }
 
 static VALUE
-tc_set_utf8(VALUE self, VALUE utf8)
+tc_add_reading(VALUE self, VALUE reading)
 {
-    tomoe_char_set_utf8(_SELF(self), RVAL2CSTR(utf8));
+    tomoe_char_add_reading(_SELF(self), RVAL2TRDG(reading));
     return Qnil;
 }
 
 static VALUE
-tc_get_n_strokes(VALUE self)
+tc_get_radicals(VALUE self)
 {
-    return INT2NUM(tomoe_char_get_n_strokes(_SELF(self)));
+    return GLIST2ARY((GList *)tomoe_char_get_radicals(_SELF(self)));
 }
 
 static VALUE
-tc_set_n_strokes(VALUE self, VALUE n_strokes)
+tc_add_radical(VALUE self, VALUE radical)
 {
-    tomoe_char_set_n_strokes(_SELF(self), NUM2INT(n_strokes));
+    tomoe_char_add_radical(_SELF(self), RVAL2TCHR(radical));
     return Qnil;
 }
 
 static VALUE
-tc_get_writing(VALUE self)
-{
-    return GOBJ2RVAL(tomoe_char_get_writing(_SELF(self)));
-}
-
-static VALUE
 tc_to_xml(VALUE self)
 {
     gchar *xml;
@@ -58,12 +52,10 @@
 
     cTomoeChar = G_DEF_CLASS(TOMOE_TYPE_CHAR, "Char", mTomoe);
 
-    rb_define_method(cTomoeChar, "utf8", tc_get_utf8, 0);
-    rb_define_method(cTomoeChar, "utf8=", tc_set_utf8, 1);
-    rb_define_method(cTomoeChar, "n_strokes", tc_get_n_strokes, 0);
-    rb_define_method(cTomoeChar, "n_strokes=", tc_set_n_strokes, 1);
-    rb_define_method(cTomoeChar, "writing", tc_get_writing, 0);
+    rb_define_method(cTomoeChar, "readings", tc_get_readings, 0);
+    rb_define_method(cTomoeChar, "add_reading", tc_add_reading, 1);
+    rb_define_method(cTomoeChar, "radicals", tc_get_radicals, 0);
+    rb_define_method(cTomoeChar, "add_radical", tc_add_radical, 1);
 
     rb_define_method(cTomoeChar, "to_xml", tc_to_xml, 0);
 }
-
Index: tomoe/ext/ruby/tomoe-rb-reading.c
diff -u tomoe/ext/ruby/tomoe-rb-reading.c:1.1 tomoe/ext/ruby/tomoe-rb-reading.c:1.2
--- tomoe/ext/ruby/tomoe-rb-reading.c:1.1	Wed Nov 22 18:04:47 2006
+++ tomoe/ext/ruby/tomoe-rb-reading.c	Tue Nov 28 12:19:00 2006
@@ -18,6 +18,7 @@
 
     cTomoeReading = G_DEF_CLASS(TOMOE_TYPE_READING, "Reading", mTomoe);
     G_DEF_CONSTANTS(mTomoe, TOMOE_TYPE_READING_TYPE, "TOMOE_");
+    G_DEF_CONSTANTS(cTomoeReading, TOMOE_TYPE_READING_TYPE, "TOMOE_READING_");
 
     rb_define_method(cTomoeReading, "initialize", tr_initialize, 2);
 }
Index: tomoe/ext/ruby/tomoe-rb.h
diff -u tomoe/ext/ruby/tomoe-rb.h:1.6 tomoe/ext/ruby/tomoe-rb.h:1.7
--- tomoe/ext/ruby/tomoe-rb.h:1.6	Wed Nov 22 18:04:47 2006
+++ tomoe/ext/ruby/tomoe-rb.h	Tue Nov 28 12:19:00 2006
@@ -17,7 +17,7 @@
  *  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  *  Boston, MA  02111-1307  USA
  *
- *  $Id: tomoe-rb.h,v 1.6 2006/11/22 09:04:47 kous Exp $
+ *  $Id: tomoe-rb.h,v 1.7 2006/11/28 03:19:00 kous Exp $
  */
 
 #ifndef __TOMOE_RB_H__
@@ -35,6 +35,7 @@
 #define RVAL2TWTG(obj) (TOMOE_WRITING(RVAL2GOBJ(obj)))
 #define RVAL2TQRY(obj) (TOMOE_QUERY(RVAL2GOBJ(obj)))
 #define RVAL2TRDG(obj) (TOMOE_READING(RVAL2GOBJ(obj)))
+#define RVAL2TCHR(obj) (TOMOE_CHAR(RVAL2GOBJ(obj)))
 
 #define RVAL2TRT(obj) (RVAL2GENUM(obj, TOMOE_TYPE_READING_TYPE))
 


tomoe-cvs メーリングリストの案内
アーカイブの一覧に戻る