Kouhei Sutou
kous****@users*****
2006年 12月 14日 (木) 17:46:21 JST
Index: tomoe/ext/ruby/tomoe-rb-dict.c diff -u tomoe/ext/ruby/tomoe-rb-dict.c:1.26 tomoe/ext/ruby/tomoe-rb-dict.c:1.27 --- tomoe/ext/ruby/tomoe-rb-dict.c:1.26 Tue Dec 12 22:45:33 2006 +++ tomoe/ext/ruby/tomoe-rb-dict.c Thu Dec 14 17:46:21 2006 @@ -6,20 +6,32 @@ static VALUE mTomoe; +void +_tomoe_rb_dict_module_load(void) +{ + _tomoe_rb_module_load(tomoe_dict_get_registered_types(), mTomoe, + DICT_PREFIX); +} + +static void +_tomoe_rb_dict_module_unload(void) +{ + _tomoe_rb_module_unload(tomoe_dict_get_registered_types(), mTomoe, + DICT_PREFIX); +} + static VALUE td_s_load(VALUE self, VALUE base_dir) { tomoe_dict_load(NIL_P(base_dir) ? NULL : RVAL2CSTR(base_dir)); - _tomoe_rb_module_load(tomoe_dict_get_registered_types(), mTomoe, - DICT_PREFIX); + _tomoe_rb_dict_module_load(); return Qnil; } static VALUE td_s_unload(VALUE self) { - _tomoe_rb_module_unload(tomoe_dict_get_registered_types(), mTomoe, - DICT_PREFIX); + _tomoe_rb_dict_module_unload(); tomoe_dict_unload(); return Qnil; } Index: tomoe/ext/ruby/tomoe-rb-recognizer.c diff -u tomoe/ext/ruby/tomoe-rb-recognizer.c:1.8 tomoe/ext/ruby/tomoe-rb-recognizer.c:1.9 --- tomoe/ext/ruby/tomoe-rb-recognizer.c:1.8 Tue Dec 12 22:45:33 2006 +++ tomoe/ext/ruby/tomoe-rb-recognizer.c Thu Dec 14 17:46:21 2006 @@ -4,20 +4,32 @@ static VALUE mTomoe; +void +_tomoe_rb_recognizer_module_load(void) +{ + _tomoe_rb_module_load(tomoe_recognizer_get_registered_types(), + mTomoe, RECOGNIZER_PREFIX); +} + +static void +_tomoe_rb_recognizer_module_unload(void) +{ + _tomoe_rb_module_unload(tomoe_recognizer_get_registered_types(), + mTomoe, RECOGNIZER_PREFIX); +} + static VALUE tr_s_load(VALUE self, VALUE base_dir) { tomoe_recognizer_load(NIL_P(base_dir) ? NULL : RVAL2CSTR(base_dir)); - _tomoe_rb_module_load(tomoe_recognizer_get_registered_types(), - mTomoe, RECOGNIZER_PREFIX); + _tomoe_rb_recognizer_module_load(); return Qnil; } static VALUE tr_s_unload(VALUE self) { - _tomoe_rb_module_unload(tomoe_recognizer_get_registered_types(), - mTomoe, RECOGNIZER_PREFIX); + _tomoe_rb_recognizer_module_unload(); tomoe_recognizer_unload(); return Qnil; } Index: tomoe/ext/ruby/tomoe-rb.c diff -u tomoe/ext/ruby/tomoe-rb.c:1.6 tomoe/ext/ruby/tomoe-rb.c:1.7 --- tomoe/ext/ruby/tomoe-rb.c:1.6 Tue Dec 12 22:45:33 2006 +++ tomoe/ext/ruby/tomoe-rb.c Thu Dec 14 17:46:21 2006 @@ -18,9 +18,6 @@ { VALUE mTomoe; - tomoe_init(); - atexit(tomoe_quit); - mTomoe = rb_define_module("Tomoe"); _tomoe_rb_init_tomoe_candidate(mTomoe); @@ -32,4 +29,11 @@ _tomoe_rb_init_tomoe_reading(mTomoe); _tomoe_rb_init_tomoe_recognizer(mTomoe); _tomoe_rb_init_tomoe_writing(mTomoe); + + + tomoe_init(); + atexit(tomoe_quit); + + _tomoe_rb_dict_module_load(); + _tomoe_rb_recognizer_module_load(); } Index: tomoe/ext/ruby/tomoe-rb.h diff -u tomoe/ext/ruby/tomoe-rb.h:1.13 tomoe/ext/ruby/tomoe-rb.h:1.14 --- tomoe/ext/ruby/tomoe-rb.h:1.13 Tue Dec 12 22:45:33 2006 +++ tomoe/ext/ruby/tomoe-rb.h Thu Dec 14 17:46:21 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.13 2006/12/12 13:45:33 kous Exp $ + * $Id: tomoe-rb.h,v 1.14 2006/12/14 08:46:21 kous Exp $ */ #ifndef __TOMOE_RB_H__ @@ -58,6 +58,9 @@ void _tomoe_rb_module_unload (GList *registered_types, VALUE klass, const gchar *prefix); +void _tomoe_rb_dict_module_load(void); +void _tomoe_rb_recognizer_module_load(void); + G_END_DECLS #endif /* __TOMOE_RB_H__ */