[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Passing a block to rb_funcall

Berger, Daniel

5/31/2005 3:53:00 PM

> -----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 <djberg96@hotmail.com> 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