Re: a few ruby-root questions

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 22 Aug 2006 08:20:34 +0200 (MEST)


Mike,

I am forwarding your question to Elias Athanasopoulos, the author of the Ruby interface.

Rene Brun

On
Mon, 21 Aug 2006, Mike Williams wrote:

>
> hi,
>
> i have a few ruby-root questions:
>
> 1) is there a way to call static member functions of classes? for example,
> how would i use TMath::Prob, the ruby-esque TMath.Prob(chi2,ndf) doesn't
> work.
>
> 2) is there a good way to deal with arrays of strings? it's nice how
> TArray's/TList's are converted to ruby arrays...but i can't store string
> or char* in these since anything in a TList must derive from TObject.
>
> 3) knowing this would answer #2...is there a way to simply return the
> VALUE object created in pure C code? i tried to include ruby.h when
> generating a dictionary and it gave lots of errors. what i can do is
> define a member method like:
>
> void foo(const char *__var);
>
> then include the ruby.h file in the classes .C file (keeping it away from
> cint) then use the rb_ary_new etc...to fill an array with
> strings,floats,etc. and then use rb_gv_set to set a variable named __var
> on the ruby side to be the array. this works, but isn't the way i want to
> have to call things. if i knew how to simply return the VALUE object, then
> i could just fill the arrays myself.
>
> just to note, since i couldn't include the ruby.h file without getting
> lots of errors...i tried simply copying the VALUE typedef (which is
> unsigned long) into my classes .h file. this compiled and ran, however
> the VALUE ruby array ended up as just an integer (bignum) on the ruby
> side...so it was just an unsigned long.
>
> thanks.
>
> mike williams
>
Received on Tue Aug 22 2006 - 08:20:44 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET