Hi,

At Mon, 16 Apr 2007 16:26:03 +0900,
Adam Bozanich wrote in [ruby-core:10923]:
> 
> I'm having problems with 1.9(trunk) because for some reason
> rb_block_given_p() returns true all of the time, see the examples below.
> The first one is a simple test, the next I tried to copy everything that
> main,eval,ruby.c did before they start to use ruby classes ( i stopped when
> rb_str_new() was used in proc_options() ).

Point taken.  rb_block_given_p() refers lfp regardless it has
enough space.

> I think there might be an initialization function that I'm not calling
> because this does not happen in 1.8.6.  Any suggestions?

I guess no function is provided for such purpose now.

> #include "ruby.h"
> #include "eval_intern.h"

You should not use "eval_intern.h".
It is planned not to be installed in the near future.


A provisional patch.


Index: yarvcore.c =================================================================== --- yarvcore.c (revision 12186) +++ yarvcore.c (working copy) @@ -319,8 +320,9 @@ th_init2(rb_thread_t *th) th->cfp->pc = 0; - th->cfp->sp = th->stack; + th->cfp->sp = th->stack + 1; th->cfp->bp = 0; th->cfp->lfp = th->stack; - th->cfp->dfp = th->stack; + *th->cfp->lfp = 0; + th->cfp->dfp = th->stack + 1; th->cfp->self = Qnil; th->cfp->magic = 0;
-- Nobu Nakada