/*
Copyright?
We don't need no stinkin copyright!
*/
#if defined (WIN32)
# include "windows.h"
#define EXPORT_FUNC _declspec (dllexport)
#endif
#include "ruby.h"
#ifdef _NO_NUM2DBL_
extern double num2double(val)
VALUE val;
{
struct RFloat* flt;
if (NIL_P(val)) return 0;
flt = RFLOAT(f_float(0, val));
return flt-value;
}
#endif
static VALUE Sum(obj,arg1,arg2)
VALUE obj,arg1;
{
double val1 = NUM2DBL(arg1);
double val2 = NUM2DBL(arg2);
return rb_float_new(val1+val2);
}
static VALUE mRUBBER;
void InitializeRubber()
{
mRUBBER = rb_define_module("Rubber");
rb_define_module_function(mRUBBER, "Sum", Sum, 2);
rb_define_const(mRUBBER, "TestConst", INT2NUM(38));
}
EXPORT_FUNC void Init_rubber()
{
InitializeRubber();
} |