Dirk, * Dirk Eddelbuettel <e...@debian.org> [131226 02:09]: > Could you possibly help with some Ruby assistance?
I'm attaching a patch which makes 'make' in quantlib-swig-1.3/Ruby run to completion. I have not tested if the built code works. Christian -- ,''`. Christian Hofstaedtler <z...@debian.org> : :' : Debian Developer `. `' 7D1A CFFA D9E0 806C 9C4C D392 5C13 D6DB 9305 2E03 `-
Index: quantlib-swig-1.3/SWIG/linearalgebra.i =================================================================== --- quantlib-swig-1.3.orig/SWIG/linearalgebra.i 2013-06-14 16:31:46.000000000 +0200 +++ quantlib-swig-1.3/SWIG/linearalgebra.i 2013-12-30 19:25:39.227673574 +0100 @@ -283,10 +283,10 @@ bool extractArray(PyObject* source, Arra #elif defined(SWIGRUBY) %typemap(in) Array (Array* v) { if (rb_obj_is_kind_of($input,rb_cArray)) { - Size size = RARRAY($input)->len; + Size size = RARRAY_LEN($input); $1 = Array(size); for (Size i=0; i<size; i++) { - VALUE o = RARRAY($input)->ptr[i]; + VALUE o = RARRAY_PTR($input)[i]; if (TYPE(o) == T_FLOAT) (($1_type &)$1)[i] = NUM2DBL(o); else if (FIXNUM_P(o)) @@ -304,11 +304,11 @@ bool extractArray(PyObject* source, Arra %typemap(in) const Array& (Array temp), const Array* (Array temp) { if (rb_obj_is_kind_of($input,rb_cArray)) { - Size size = RARRAY($input)->len; + Size size = RARRAY_LEN($input); temp = Array(size); $1 = &temp; for (Size i=0; i<size; i++) { - VALUE o = RARRAY($input)->ptr[i]; + VALUE o = RARRAY_PTR($input)[i]; if (TYPE(o) == T_FLOAT) temp[i] = NUM2DBL(o); else if (FIXNUM_P(o)) @@ -355,11 +355,11 @@ bool extractArray(PyObject* source, Arra %typemap(in) Matrix (Matrix* m) { if (rb_obj_is_kind_of($input,rb_cArray)) { Size rows, cols; - rows = RARRAY($input)->len; + rows = RARRAY_LEN($input); if (rows > 0) { - VALUE o = RARRAY($input)->ptr[0]; + VALUE o = RARRAY_PTR($input)[0]; if (rb_obj_is_kind_of(o,rb_cArray)) { - cols = RARRAY(o)->len; + cols = RARRAY_LEN(o); } else { rb_raise(rb_eTypeError, "wrong argument type (expected Matrix)"); @@ -369,14 +369,14 @@ bool extractArray(PyObject* source, Arra } $1 = Matrix(rows,cols); for (Size i=0; i<rows; i++) { - VALUE o = RARRAY($input)->ptr[i]; + VALUE o = RARRAY_PTR($input)[i]; if (rb_obj_is_kind_of(o,rb_cArray)) { - if (Size(RARRAY(o)->len) != cols) { + if (Size(RARRAY_LEN(o)) != cols) { rb_raise(rb_eTypeError, "Matrix must have equal-length rows"); } for (Size j=0; j<cols; j++) { - VALUE x = RARRAY(o)->ptr[j]; + VALUE x = RARRAY_PTR(o)[j]; if (SWIG_FLOAT_P(x)) $1[i][j] = SWIG_NUM2DBL(x); else @@ -397,11 +397,11 @@ bool extractArray(PyObject* source, Arra const Matrix* (Matrix temp) { if (rb_obj_is_kind_of($input,rb_cArray)) { Size rows, cols; - rows = RARRAY($input)->len; + rows = RARRAY_LEN($input); if (rows > 0) { - VALUE o = RARRAY($input)->ptr[0]; + VALUE o = RARRAY_PTR($input)[0]; if (rb_obj_is_kind_of(o,rb_cArray)) { - cols = RARRAY(o)->len; + cols = RARRAY_LEN(o); } else { rb_raise(rb_eTypeError, "wrong argument type (expected Matrix)"); @@ -412,14 +412,14 @@ bool extractArray(PyObject* source, Arra temp = Matrix(rows,cols); $1 = &temp; for (Size i=0; i<rows; i++) { - VALUE o = RARRAY($input)->ptr[i]; + VALUE o = RARRAY_PTR($input)[i]; if (rb_obj_is_kind_of(o,rb_cArray)) { - if (Size(RARRAY(o)->len) != cols) { + if (Size(RARRAY_LEN(o)) != cols) { rb_raise(rb_eTypeError, "Matrix must have equal-length rows"); } for (Size j=0; j<cols; j++) { - VALUE x = RARRAY(o)->ptr[j]; + VALUE x = RARRAY_PTR(o)[j]; if (SWIG_FLOAT_P(x)) temp[i][j] = SWIG_NUM2DBL(x); else Index: quantlib-swig-1.3/Ruby/setup.rb =================================================================== --- quantlib-swig-1.3.orig/Ruby/setup.rb 2013-12-30 19:26:37.567320743 +0100 +++ quantlib-swig-1.3/Ruby/setup.rb 2013-12-30 19:27:06.379146597 +0100 @@ -18,7 +18,6 @@ require 'rbconfig' require 'mkmf' -require 'ftools' def usage puts <<EOU @@ -59,7 +58,7 @@ end # Current QuantLib version Version = "1.3" -cfg = Config::MAKEFILE_CONFIG +cfg = RbConfig::MAKEFILE_CONFIG # commands class Command @@ -79,7 +78,7 @@ Wrap = Command.new { } Build = Command.new { - cfg = Config::MAKEFILE_CONFIG + cfg = RbConfig::MAKEFILE_CONFIG if cfg['host_os'] == 'mswin32' QL_DIR = ENV['QL_DIR'] if QL_DIR @@ -140,19 +139,19 @@ Install = Command.new { Build.execute if defined? Prefix # strip old prefix and add the new one - oldPrefix = Config::CONFIG["prefix"] + oldPrefix = RbConfig::CONFIG["prefix"] if defined? Debian - archDir = Config::CONFIG["archdir"] - libDir = Config::CONFIG["rubylibdir"] + archDir = RbConfig::CONFIG["archdir"] + libDir = RbConfig::CONFIG["rubylibdir"] else - archDir = Config::CONFIG["sitearchdir"] - libDir = Config::CONFIG["sitelibdir"] + archDir = RbConfig::CONFIG["sitearchdir"] + libDir = RbConfig::CONFIG["sitelibdir"] end archDir = Prefix + archDir.gsub(/^#{oldPrefix}/,"") libDir = Prefix + libDir.gsub(/^#{oldPrefix}/,"") else - archDir = Config::CONFIG["sitearchdir"] - libDir = Config::CONFIG["sitelibdir"] + archDir = RbConfig::CONFIG["sitearchdir"] + libDir = RbConfig::CONFIG["sitelibdir"] end [archDir,libDir].each { |path| File.makedirs path } if cfg['host_os'][0..5] == 'darwin'
signature.asc
Description: Digital signature