From: Kevin S. <kev...@ya...> - 2001-09-02 15:49:58
|
--- Takaaki Tateishi <tt...@ja...> wrote: > Did you mention Fl::add_fd(), Fl::add_idle(), > Fl::add_timeout() and so on? > I'm going to pass the Array object which contains Proc > object and user data to a function, if the function has the > parameter for user data. For example: > > void rb_idle_func(void *data) > { > VALUE proc = rb_ary_entry((VALUE)data, 0); > VALUE user_data = rb_ary_entry((VALUE)data, 1); > > rb_funcall(proc, rb_intern("call"), 1, user_data); > }; > > VALUE rb_fl_idle(VALUE self, VALUE proc, VALUE user_data) > { > VALUE pass_data = rb_assoc_new(proc, user_data); > > Fl::add_idle(rb_idle_func, (void*)pass_data); > return Qnil; > }; Looks good to me. Kevin __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger http://im.yahoo.com |