Kouhei Sutou
kous****@users*****
2006年 11月 26日 (日) 16:30:37 JST
Index: tomoe/ext/ruby/tomoe-rb-dict.c diff -u tomoe/ext/ruby/tomoe-rb-dict.c:1.1 tomoe/ext/ruby/tomoe-rb-dict.c:1.2 --- tomoe/ext/ruby/tomoe-rb-dict.c:1.1 Mon Nov 20 15:47:09 2006 +++ tomoe/ext/ruby/tomoe-rb-dict.c Sun Nov 26 16:30:37 2006 @@ -1,10 +1,31 @@ #include "tomoe-rb.h" +#define _SELF(obj) RVAL2TDIC(obj) + +static VALUE +td_initialize(VALUE self, VALUE filename, VALUE editable) +{ + G_INITIALIZE(self, tomoe_dict_new(RVAL2CSTR(filename), + RVAL2CBOOL(editable))); + return Qnil; +} + +static VALUE +td_save(VALUE self) +{ + tomoe_dict_save(_SELF(self)); + return Qnil; +} + + void Init_tomoe_dict(VALUE mTomoe) { VALUE cTomoeDict; cTomoeDict = G_DEF_CLASS(TOMOE_TYPE_DICT, "Dict", mTomoe); -} + rb_define_method(cTomoeDict, "initialize", td_initialize, 2); + + rb_define_method(cTomoeDict, "save", td_save, 0); +}