diff options
-rw-r--r-- | lib/sbin/CreateFunctionBindings.pl | 32 | ||||
-rw-r--r-- | src/include/cctk.h | 8 |
2 files changed, 35 insertions, 5 deletions
diff --git a/lib/sbin/CreateFunctionBindings.pl b/lib/sbin/CreateFunctionBindings.pl index 4f2966dd..469918d9 100644 --- a/lib/sbin/CreateFunctionBindings.pl +++ b/lib/sbin/CreateFunctionBindings.pl @@ -279,7 +279,7 @@ sub CreateFunctionBindings ### $dataout = &ThornMasterIncludes($function_db); - &WriteFile('include/cctk_FunctionAliases.h',\$dataout); + &WriteFile('include/cctk_Functions.h',\$dataout); ### # Create the prototype header file for all thorns that USE a @@ -1610,11 +1610,17 @@ sub ThornMasterIncludes { push(@data, "#ifdef THORN_IS_$thorn"); push(@data, "#include \"${thorn}_Prototypes.h\""); + push(@data, "#define DECLARE_CCTK_FUNCTIONS DECLARE_\U$thorn\E_FUNCTIONS"); push(@data, '#endif'); push(@data, ''); } } + push(@data, '#ifndef DECLARE_CCTK_FUNCTIONS'); + push(@data, '#define DECLARE_CCTK_FUNCTIONS _DECLARE_CCTK_FUNCTIONS'); + push(@data, '#endif'); + push(@data, ''); + push(@data, '#endif /* _CCTK_FUNCTIONALIASES_H_ */'); push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline @@ -1694,6 +1700,30 @@ sub UsesPrototypes push(@data, '#endif /* CCODE */'); push(@data, ''); + push(@data, '#ifdef FCODE'); + + push(@data, "#define DECLARE_\U$thorn\E_FUNCTIONS _DECLARE_CCTK_FUNCTIONS &&\\"); + + foreach my $FunctionKey (sort keys %FunctionList) + { + $Function = $FunctionList{$FunctionKey}; + if ($Function) + { + if ($Function->{"Used"}) + { + push(@data, " external $Function->{\"Name\"} &&\\"); + if ($Function->{"Return Type"} ne 'void') { + push(@data, " $Function->{\"Return Type\"} $Function->{\"Name\"} && \\"); + } + } + } + } + + push(@data, ''); + + push(@data, '#endif /* FCODE */'); + push(@data, ''); + push(@data, '#endif'); push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline diff --git a/src/include/cctk.h b/src/include/cctk.h index 7181eba9..22f0fe20 100644 --- a/src/include/cctk.h +++ b/src/include/cctk.h @@ -72,11 +72,11 @@ #define CCTK_LSSH(stag,dim) cctk_lssh((stag)+CCTK_NSTAGGER+(dim)) #define CCTK_LSSH_IDX(stag,dim) ((stag)+CCTK_NSTAGGER*(dim)) -#define DECLARE_CCTK_FUNCTIONS &&\ +#define _DECLARE_CCTK_FUNCTIONS &&\ integer CCTK_Equals, CCTK_MyProc, CCTK_nProcs, CCTK_IsThornActive&&\ external CCTK_Equals, CCTK_MyProc, CCTK_nProcs, CCTK_IsThornActive&&\ - CCTK_POINTER CCTK_PointerTo, CCTK_NullPointer&&\ - external CCTK_PointerTo, CCTK_NullPointer + CCTK_POINTER CCTK_PointerTo, CCTK_NullPointer&&\ + external CCTK_PointerTo, CCTK_NullPointer #endif /*FCODE*/ @@ -95,7 +95,7 @@ #include "cctk_Faces.h" #include "cctk_File.h" #include "cctk_Flesh.h" -#include "cctk_FunctionAliases.h" +#include "cctk_Functions.h" #include "cctk_GHExtensions.h" #include "cctk_Groups.h" #include "cctk_GroupsOnGH.h" |