Skip to content

Commit

Permalink
Works with ruby 1.8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
clbustos committed Dec 22, 2010
1 parent d3d3930 commit 2e27cd1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ext/statsamplert/statsamplert.c
@@ -1,4 +1,5 @@
#include <ruby.h>
#include "statsamplert.h"
#include "as116.h"
/**
* :stopdoc:
Expand Down Expand Up @@ -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;

Expand Down
10 changes: 10 additions & 0 deletions 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

0 comments on commit 2e27cd1

Please sign in to comment.