From 2ee1706bba5828f2e13ba48a360fc6ec168b5206 Mon Sep 17 00:00:00 2001 From: Jonathan Leto Date: Sun, 27 Jul 2008 13:59:38 -0700 Subject: [PATCH] Refactor Deriv and get rid of "Math::GSL::Math" which was accidentally installed on my system previously. --- Deriv.i | 8 ++++++-- lib/Math/GSL/Deriv/Test.pm | 5 +++-- lib/Math/GSL/SF/Test.pm | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Deriv.i b/Deriv.i index d14df65..4614ec5 100644 --- a/Deriv.i +++ b/Deriv.i @@ -13,13 +13,17 @@ typedef struct gsl_function_struct gsl_function ; %include "typemaps.i" %typemap(in) gsl_function * { gsl_function F; + int count; F.params = 0; F.function = &xsquared; + if( !SvROK($input) ) { croak("Math::GSL : not a reference value!"); } - fprintf(stderr,"gsl_func;input=%d\n", (int) $input); - Perl_sv_dump( $input ); + //Perl_sv_dump( $input ); + + // does not work + //count = call_sv((SV*) $input, G_ARRAY); $1 = &F; }; diff --git a/lib/Math/GSL/Deriv/Test.pm b/lib/Math/GSL/Deriv/Test.pm index addf10c..5ddbde4 100644 --- a/lib/Math/GSL/Deriv/Test.pm +++ b/lib/Math/GSL/Deriv/Test.pm @@ -44,10 +44,11 @@ sub TEST_DERIV_CENTRAL: Tests { ok_similar( $result, 2*$x, 'gsl_deriv_central works for a static function' ); } sub TEST_SWIG_FUNCTION : Tests { - local $TODO = "gsl_function *"; + local $TODO = "swig_function_set doesn't work"; my $self = shift; my $gsl_func = $self->{gsl_func}; - $gsl_func->swig_function_set( sub { print "FOO\n" } ); + my ($x,$h)=(10,0.01); + $gsl_func->swig_function_set( sub { die "I GOT CALLED!" } ); my $func = $gsl_func->swig_function_get(); ok( ref $func eq 'CODE', 'swig_function_get works' ); diff --git a/lib/Math/GSL/SF/Test.pm b/lib/Math/GSL/SF/Test.pm index 7fcc52f..40a80b1 100644 --- a/lib/Math/GSL/SF/Test.pm +++ b/lib/Math/GSL/SF/Test.pm @@ -6,7 +6,6 @@ use Math::GSL::Const qw/:all/; use Math::GSL::Errno qw/:all/; use Math::GSL::SF qw/:all/; use Math::GSL::Machine qw/:all/; -use Math::GSL::Math qw/:all/; use Math::GSL::Poly qw/:all/; use Data::Dumper; use strict; -- 2.11.4.GIT