From: "Berger, Daniel" Date: 2005-06-01T00:52:30+09:00 Subject: Re: Passing a block to rb_funcall > -----Original Message----- > From: ts [mailto:decoux@moulon.inra.fr] > Sent: Tuesday, May 31, 2005 9:41 AM > To: ruby-talk ML > Cc: ruby-talk@ruby-lang.org > Subject: Re: Passing a block to rb_funcall > > > >>>>> "D" == Daniel Berger writes: > > D> I've seen some mention of rb_iterate, but I wasn't sure > how to apply > D> it here. > > From plruby > > static VALUE > pl_each(tmp) > VALUE *tmp; > { > return rb_funcall2(tmp[0], (ID)tmp[1], (int)tmp[2], > (VALUE *)tmp[3]); } > /* ... */ > > if (rb_block_given_p()) { > VALUE tmp[4]; > > tmp[0] = obj; > tmp[1] = (VALUE)id; > tmp[2] = (VALUE)argc; > tmp[3] = (VALUE)argv; > return rb_iterate((VALUE(*)(VALUE))pl_each, > (VALUE)tmp, rb_yield, 0); > } > > /* ... */ > > > Guy Decoux I guess I need more hand holding because I don't get it. Regards, Dan