diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-08-31 14:35:04 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2006-08-31 14:35:04 +0000 |
commit | 0d35d9803134bbeef077f53270d315f47ebcf873 (patch) | |
tree | 5e4742982817855d409cccaddd4e28ee7af7f832 /lib/sbin/CreateFunctionBindings.pl | |
parent | e23f240709154019feeef1b4826f5fe9ee58867b (diff) |
Fix a bug in generating the bindings for aliased functions which take a
CCTK_FPOINTER callback argument which itself takes a CCTK_STRING argument.
This CCTK_STRING argument used to be passed by reference but should be passed
by value.
Example:
interface.ccl:
CCTK_INT FUNCTION Foo (CCTK_INT CCTK_FPOINTER IN Bar (CCTK_STRING IN s))
PROVIDES FUNCTION Foo WITH MyFoo LANGUAGE C
generated C bindings for invocation of callback:
static CCTK_INT (*CCTK_FptrMyFooBar) (CCTK_STRING s);
static CCTK_INT CCTK_WrapMyFooBar (CCTK_STRING s);
CCTK_INT CCTK_WrapMyFooBar (CCTK_STRING s)
{
return (*CCTK_FptrMyFooBar) (&s); /* before applying this patch WRONG */
return (*CCTK_FptrMyFooBar) (s); /* after applying this patch */
}
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4369 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CreateFunctionBindings.pl')
-rw-r--r-- | lib/sbin/CreateFunctionBindings.pl | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/lib/sbin/CreateFunctionBindings.pl b/lib/sbin/CreateFunctionBindings.pl index 69500931..55fcf369 100644 --- a/lib/sbin/CreateFunctionBindings.pl +++ b/lib/sbin/CreateFunctionBindings.pl @@ -2416,24 +2416,14 @@ sub printCallArg my ($providetype,$calltype,%Arg) = ($_[0],$_[1],%{$_[2]}); - my $data; - - my $varname = $Arg{"Name"}; - my $prefix = ""; - - if ($providetype eq $calltype) + my $prefix = ''; + if ($providetype ne $calltype and + not ($Arg{'Is Array'} or $Arg{'String'} or $Arg{'Intent'} =~ /OUT/)) { - $prefix = ""; + $prefix = $calltype eq 'Fortran' ? '*' : '&'; } - elsif ( ($calltype eq "Fortran")&&( !(($Arg{"Is Array"})||($Arg{"String"})||($Arg{"Intent"}=~/OUT/)) ) ) - { - $prefix = "*"; - } - elsif ( ($calltype eq "C")&&((!$Arg{"Is Array"})&&($Arg{"Intent"}!~/OUT/)) ) - { - $prefix = "&"; - } - $data=$prefix.$varname; + my $varname = $Arg{"Name"}; + my $data=$prefix.$varname; # print "$varname $providetype $calltype $Arg{\"Is Array\"} $data\n"; |