From 2e27cd1671ffa9fd09ff0f82f589b4189ab8ea08 Mon Sep 17 00:00:00 2001 From: Claudio Bustos Date: Wed, 22 Dec 2010 12:36:54 -0300 Subject: [PATCH] Works with ruby 1.8.7 --- ext/statsamplert/statsamplert.c | 15 ++++++++------- ext/statsamplert/statsamplert.h | 10 ++++++++++ 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 ext/statsamplert/statsamplert.h diff --git a/ext/statsamplert/statsamplert.c b/ext/statsamplert/statsamplert.c index 4a4f050..357abdf 100644 --- a/ext/statsamplert/statsamplert.c +++ b/ext/statsamplert/statsamplert.c @@ -1,4 +1,5 @@ #include +#include "statsamplert.h" #include "as116.h" /** * :stopdoc: @@ -157,13 +158,13 @@ VALUE statsample_tetrachoric(VALUE self, VALUE a, VALUE b, VALUE c, VALUE d) { result= tetra(&pa,&pb, &pc, &pd, &r, &sdr, &sdzero, &t_x,&t_y, &itype, &ifault); - rb_hash_aset(h, rb_str_new_cstr("r"), DBL2NUM(r)); - rb_hash_aset(h, rb_str_new_cstr("sdr"), DBL2NUM(sdr)); - rb_hash_aset(h, rb_str_new_cstr("sdzero"), DBL2NUM(sdzero)); - rb_hash_aset(h, rb_str_new_cstr("threshold_x"), DBL2NUM(t_x)); - rb_hash_aset(h, rb_str_new_cstr("threshold_y"), DBL2NUM(t_y)); - rb_hash_aset(h, rb_str_new_cstr("itype"), INT2NUM(itype)); - rb_hash_aset(h, rb_str_new_cstr("ifault"), INT2NUM(ifault)); + rb_hash_aset(h, rb_str_new2("r"), DBL2NUM(r)); + rb_hash_aset(h, rb_str_new2("sdr"), DBL2NUM(sdr)); + rb_hash_aset(h, rb_str_new2("sdzero"), DBL2NUM(sdzero)); + rb_hash_aset(h, rb_str_new2("threshold_x"), DBL2NUM(t_x)); + rb_hash_aset(h, rb_str_new2("threshold_y"), DBL2NUM(t_y)); + rb_hash_aset(h, rb_str_new2("itype"), INT2NUM(itype)); + rb_hash_aset(h, rb_str_new2("ifault"), INT2NUM(ifault)); return h; diff --git a/ext/statsamplert/statsamplert.h b/ext/statsamplert/statsamplert.h new file mode 100644 index 0000000..71e312e --- /dev/null +++ b/ext/statsamplert/statsamplert.h @@ -0,0 +1,10 @@ +#ifndef STATSAMPLERT_H +#define STATSAMPLERT_H + +#ifndef DBL2NUM +#define DBL2NUM(dbl) rb_float_new(dbl) +#endif + + +#endif +