From 60562ba5ee8ea05380d379e72bd4af46c02d575f Mon Sep 17 00:00:00 2001 From: Duke Leto Date: Sun, 5 Apr 2009 07:43:17 -0700 Subject: [PATCH] Return GSL_NAN instead of NAN when a callback fails --- swig/gsl_typemaps.i | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/swig/gsl_typemaps.i b/swig/gsl_typemaps.i index e025940..388056e 100644 --- a/swig/gsl_typemaps.i +++ b/swig/gsl_typemaps.i @@ -1,8 +1,13 @@ %include "system.i" +%include "gsl/gsl_nan.h" #ifdef GSL_MINOR_VERSION && GSL_MINOR_VERSION >= 12 %include "gsl_inline.h" #endif +%{ + #include "gsl/gsl_nan.h" +%} + %typemap(in) double const [] { AV *tempav; I32 len; @@ -12,7 +17,7 @@ croak("Math::GSL : $$1_name is not a reference!"); if (SvTYPE(SvRV($input)) != SVt_PVAV) croak("Math::GSL : $$1_name is not an array ref!"); - + tempav = (AV*)SvRV($input); len = av_len(tempav); $1 = (double *) malloc((len+1)*sizeof(double)); @@ -54,7 +59,7 @@ sv = hv_fetch(Callbacks, (char*)func, sizeof(func), FALSE ); if (sv == (SV**)NULL) { fprintf(stderr, "Math::GSL(callthis): %d not in Callbacks!\n", func); - return NAN; + return GSL_NAN; } PUSHMARK(SP); -- 2.11.4.GIT