[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

rb_rescue2 crashes 1.9.0-0

Edwin Pratomo

1/12/2008 1:44:00 PM

good day all,=0A=0Athe following rb_rescue2 works with old versions - teste=
d with 1.8.5 and 1.8.6. but crashes 1.9.0-0. =0Asomething's wrong with the =
code or is it a problem in 1.9.0-0's rb_rescue2?=0A=0A#include <ruby.h>=0A#=
include <stdio.h>=0A=0A#ifndef RSTRING_PTR=0A#define RSTRING_PTR(o) RSTRING=
(o)->ptr=0A#endif=0A=0Astatic VALUE eval_failed(VALUE v, VALUE exc)=0A{=0A =
printf("eval_failed\n");=0A return exc;=0A}=0A=0Aint main() {=0A V=
ALUE retv;=0A int i;=0A char *codes[] =3D {=0A "de foo; puts \=
"in foo()\"; end",=0A "1/0"=0A };=0A =0A ruby_init();=0A =
ruby_init_loadpath();=0A=0A for (i =3D 0; i < 2; i++) {=0A#ifdef USE_RB=
_STR_NEW2=0A retv =3D rb_rescue2(rb_eval_string, rb_str_new2(codes[i=
]), eval_failed, Qnil, rb_eException, 0);=0A#else=0A retv =3D rb_res=
cue2(rb_eval_string, (VALUE)codes[i], eval_failed, Qnil, rb_eException, 0);=
=0A#endif=0A if (rb_obj_is_kind_of(retv, rb_eException))=0A {=
=0A VALUE msg =3D rb_funcall(retv, rb_intern("message"), 0);=0A =
printf("Error: %s\n", RSTRING_PTR(msg));=0A }=0A }=0A=
=0A ruby_finalize();=0A exit(0);=0A}=0A=0Argds,=0AEdwin=0A=0A=0A=0A=
=0A=0A ________________________________________________________ =0ABer=
gabunglah dengan orang-orang yang berwawasan, di di bidang Anda! Kunjungi Y=
ahoo! Answers saat ini juga di http://id.answers....