summaryrefslogtreecommitdiff
path: root/lib/sbin
diff options
context:
space:
mode:
authorsbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-06-18 17:48:27 +0000
committersbrandt <sbrandt@17b73243-c579-4c4c-a9d2-2d5706c11dac>2012-06-18 17:48:27 +0000
commit0d07ac21bf7db6765b83ea1bc88f9f4f05d63af7 (patch)
tree4a411cf054e16707d91836e64c7cb666085689b3 /lib/sbin
parent47a6b6f908ad8f4607cb8e7830d8159522ce0947 (diff)
Changes for ticket #768
Change per thorn -DTHORN_IS_xxx to a per thorn -I bindings/include/xxx git-svn-id: http://svn.cactuscode.org/flesh/trunk@4839 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r--lib/sbin/CST35
-rw-r--r--lib/sbin/CreateConfigurationBindings.pl5
-rw-r--r--lib/sbin/CreateFunctionBindings.pl75
-rw-r--r--lib/sbin/CreateImplementationBindings.pl15
-rw-r--r--lib/sbin/CreateParameterBindings.pl54
-rw-r--r--lib/sbin/CreateScheduleBindings.pl27
-rw-r--r--lib/sbin/GridFuncStuff.pl158
7 files changed, 198 insertions, 171 deletions
diff --git a/lib/sbin/CST b/lib/sbin/CST
index 8f04f5cc..6dea94ca 100644
--- a/lib/sbin/CST
+++ b/lib/sbin/CST
@@ -142,7 +142,11 @@ print "Creating Thorn-Flesh bindings...\n";
&CreateThornsHeaders(%source_thorns);
&WriteFile("$bindings_dir/include/thornlist.h", \$thornsheader);
&WriteFile("$bindings_dir/include/cctk_DefineThorn.h", \$definethornsheader);
-&WriteFile("$bindings_dir/include/definethisthorn.h", \$definethisthornheader);
+for my $header (@$definethisthornheader) {
+ my $thorn = $header->{thorn};
+ my $body = $header->{body};
+ &WriteFile("$bindings_dir/include/$thorn/definethisthorn.h", \$body);
+}
# Create the header files used by the thorns
&BuildHeaders($cctk_home,$bindings_dir,%interface_database);
@@ -484,25 +488,31 @@ sub RequiredThorns
sub CreateThornsHeaders
{
my(%thorns) = @_;
- my($header1,$header2,$header3,$thorn,$nthorns);
+ my($header1,$header2,@header3,$thorn,$nthorns);
$header1 = "\/* List of compiled thorns in the code. *\/\n\n";
$header1 .= "static char const *const thorn_name[] = {\n";
$header2 = "\/* Defines for compiled thorns in the code. *\/\n\n";
- $header3 = "\/* Defines for thorn this file is part of *\/\n\n";
+
+ my @thorns = keys %thorns;
$nthorns = 0;
- foreach $thorn (sort keys %thorns)
+ foreach $thorn (sort @thorns)
{
# Only place package_name/thorn_name in the file.
$thorns{$thorn} =~ m:.*/(.*)/(.*):;
-
- $header3 .= "#ifdef THORN_IS_$thorn\n" .
- "#define CCTK_THORN $2\n" .
- "#define CCTK_THORNSTRING \"$2\"\n" .
- "#define CCTK_ARRANGEMENT $1\n" .
- "#define CCTK_ARRANGEMENTSTRING \"$1\"\n" .
- "#endif\n\n";
+ my ($arr,$th) = ($1,$2);
+
+ push @header3, {thorn => $thorn, body=>
+ "\/* Defines for thorn this file is part of *\/\n\n".
+ "#ifndef DEFINE_THIS_THORN_H\n".
+ "#define DEFINE_THIS_THORN_H 1\n".
+ "#define THORN_IS_$thorn 1\n".
+ "#define CCTK_THORN $th\n" .
+ "#define CCTK_THORNSTRING \"$th\"\n" .
+ "#define CCTK_ARRANGEMENT $arr\n" .
+ "#define CCTK_ARRANGEMENTSTRING \"$arr\"\n".
+ "#endif\n\n"};
# Ignore the main sources for the other headers - they may confuse
next if ($thorn eq 'Cactus');
@@ -515,8 +525,9 @@ sub CreateThornsHeaders
$header1 .= "\"\"};\n\n";
$header1 .= "static int const nthorns = $nthorns;\n\n";
+ push @header3, {thorn=>"CactusBindings", body=>"#define THORN_IS_CactusBindings\n\n"};
- return ($header1, $header2, $header3);
+ return ($header1, $header2, \@header3);
}
diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl
index 0d8ea53b..82466336 100644
--- a/lib/sbin/CreateConfigurationBindings.pl
+++ b/lib/sbin/CreateConfigurationBindings.pl
@@ -216,13 +216,12 @@ sub CreateConfigurationBindings
{
if ($cfg->{"\U$thorn\E REQUIRES"})
{
- $temp .= "#ifdef THORN_IS_$thorn\n";
$temp .= "#include \"../Configuration/Thorns/cctki_$thorn.h\"\n";
- $temp .= "#endif\n";
$temp .= "\n";
}
+ &WriteFile("../include/$thorn/cctk_Capabilities.h",\$temp);
}
- &WriteFile("../include/cctk_Capabilities.h",\$temp);
+ &WriteFile("../include/CactusBindings/cctk_Capabilities.h","#include \"../Configuration/Thorns/cctki_Cactus.h\"\n\n");
}
return 1;
diff --git a/lib/sbin/CreateFunctionBindings.pl b/lib/sbin/CreateFunctionBindings.pl
index b607ce69..b41d7b43 100644
--- a/lib/sbin/CreateFunctionBindings.pl
+++ b/lib/sbin/CreateFunctionBindings.pl
@@ -282,7 +282,6 @@ sub CreateFunctionBindings
###
$dataout = &ThornMasterIncludes($function_db);
- &WriteFile('include/cctk_Functions.h',\$dataout);
###
# Create the prototype header file for all thorns that USE a
@@ -1757,50 +1756,52 @@ sub ThornMasterIncludes
use strict;
my %function_db = %{$_[0]};
+ my @thorns = keys %function_db;
- my(@data) = ();
-
- # Header Data
- push(@data, '/*@@');
- push(@data, ' @header cctk_Functions.h');
- push(@data, ' @author Automatically generated by CreateFunctionBindings.pl');
- push(@data, ' @desc');
- push(@data, ' Prototypes for overloaded functions used by all thorns');
- push(@data, ' @enddesc');
- push(@data, ' @@*/');
- push(@data, '');
- push(@data, '');
-
- push(@data, '#ifndef _CCTK_FUNCTIONALIASES_H_');
- push(@data, '#define _CCTK_FUNCTIONALIASES_H_ 1');
- push(@data, '');
+ my $thorn;
+ foreach $thorn (sort @thorns)
+ {
+ my(@data) = ();
+
+ # Header Data
+ push(@data, '/*@@');
+ push(@data, ' @header $thorn/cctk_Functions.h');
+ push(@data, ' @author Automatically generated by CreateFunctionBindings.pl');
+ push(@data, ' @desc');
+ push(@data, ' Prototypes for overloaded functions used by all thorns');
+ push(@data, ' @enddesc');
+ push(@data, ' @@*/');
+ push(@data, '');
+ push(@data, '');
- push(@data, '#ifdef CCODE');
- push(@data, '#ifdef __cplusplus');
- push(@data, 'extern "C" {');
- push(@data, '#endif');
- push(@data, ' CCTK_INT CCTK_IsFunctionAliased(const char *function);');
- push(@data, '#ifdef __cplusplus');
- push(@data, '}');
- push(@data, '#endif');
- push(@data, '#endif');
- push(@data, '');
+ push(@data, '#ifndef _CCTK_FUNCTIONALIASES_H_');
+ push(@data, '#define _CCTK_FUNCTIONALIASES_H_ 1');
+ push(@data, '');
- my $thorn;
+ push(@data, '#ifdef CCODE');
+ push(@data, '#ifdef __cplusplus');
+ push(@data, 'extern "C" {');
+ push(@data, '#endif');
+ push(@data, ' CCTK_INT CCTK_IsFunctionAliased(const char *function);');
+ push(@data, '#ifdef __cplusplus');
+ push(@data, '}');
+ push(@data, '#endif');
+ push(@data, '#endif');
+ push(@data, '');
- foreach $thorn (sort keys %function_db)
- {
- 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, '#endif /* _CCTK_FUNCTIONALIASES_H_ */');
- push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
+ push(@data, '#endif /* _CCTK_FUNCTIONALIASES_H_ */');
+ push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
- return join ("\n",@data);
+ my $dataout = join ("\n",@data);
+ mkdir("include/${thorn}");
+ &WriteFile("include/${thorn}/cctk_Functions.h",\$dataout);
+ if($thorn eq "Cactus") {
+ &WriteFile("include/CactusBindings/cctk_Functions.h",\$dataout);
+ }
+ }
}
#/*@@
diff --git a/lib/sbin/CreateImplementationBindings.pl b/lib/sbin/CreateImplementationBindings.pl
index 474e0858..64c45cad 100644
--- a/lib/sbin/CreateImplementationBindings.pl
+++ b/lib/sbin/CreateImplementationBindings.pl
@@ -37,6 +37,21 @@ sub CreateImplementationBindings
}
@thorns = sort split(' ', $rhinterface_db->{'THORNS'});
+ if(! -d 'include')
+ {
+ mkdir('include', 0755) || die 'Unable to create include directory';
+ }
+ if(! -d 'include/CactusBindings')
+ {
+ mkdir('include/CactusBindings', 0755) || die 'Unable to create include/CactusBindings directory';
+ }
+ my $thorn;
+ foreach $thorn (@thorns) {
+ if(! -d "include/$thorns") {
+ mkdir("include/$thorn",0755) || die "Unable to create include/$thorn directory";
+ }
+ }
+
@data = map { "void CCTKi_BindingsThorn_$_(void);" } @thorns;
push(@data, '');
diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl
index 385bff80..52862243 100644
--- a/lib/sbin/CreateParameterBindings.pl
+++ b/lib/sbin/CreateParameterBindings.pl
@@ -154,13 +154,14 @@ sub CreateParameterBindings
foreach $thorn (split(' ',$rhinterface_db->{'THORNS'}))
{
$dataout = &CreateFortranThornParameterBindings($thorn, $rhparameter_db, $rhinterface_db);
- &WriteFile("include/${thorn}_FParameters.h",\$dataout);
+ mkdir("include/$thorn");
+ &WriteFile("include/${thorn}/FParameters.h",\$dataout);
$implementation = $rhinterface_db->{"\U$thorn\E IMPLEMENTS"};
@data = ();
push(@data, '/*@@');
- push(@data, " \@header ${thorn}_CParameters.h");
+ push(@data, " \@header ${thorn}/CParameters.h");
push(@data, ' @author Automatically generated by CreateParameterBindings.pl');
push(@data, ' @desc');
push(@data, " Declares parameters of thorn $thorn");
@@ -172,6 +173,7 @@ sub CreateParameterBindings
push(@data, "#ifndef _\U$thorn\E_PARAMETERS_H_");
push(@data, "#define _\U$thorn\E_PARAMETERS_H_ 1");
push(@data, '');
+ push(@data, '#include "CParameterStructNames.h"');
if($header_files{'GLOBAL'})
{
@@ -231,7 +233,7 @@ sub CreateParameterBindings
push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
$dataout = join ("\n", @data);
- &WriteFile("include/${thorn}_CParameters.h",\$dataout);
+ &WriteFile("include/${thorn}/CParameters.h",\$dataout);
}
# Write this one to a temporary file and read it back in
@@ -253,46 +255,22 @@ sub CreateParameterBindings
&WriteFile('include/CParameterStructNames.h',\$dataout);
-
- @data = ();
- push(@data, '#include "CParameterStructNames.h"');
- push(@data, '');
foreach $thorn (split(' ',$rhinterface_db->{'THORNS'}))
{
- push(@data, "#ifdef THORN\_IS\_$thorn");
- push(@data, "#include \"${thorn}_CParameters.h\"");
- push(@data, '#endif');
+ @data = ();
+ push(@data, '/* get the CCTK datatype definitions */');
+ push(@data, '#include "cctk_Types.h"');
push(@data, '');
- }
- push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
- $dataout = join ("\n", @data);
- &WriteFile('include/CParameters.h',\$dataout);
-
- @data = ();
- foreach $thorn (split(' ',$rhinterface_db->{'THORNS'}))
- {
- push(@data, "#ifdef THORN\_IS\_$thorn");
- push(@data, "#include \"${thorn}_FParameters.h\"");
+ push(@data, '#ifdef CCODE');
+ push(@data, "#include \"${thorn}/CParameters.h\"");
+ push(@data, '#elif FCODE');
+ push(@data, "#include \"${thorn}/FParameters.h\"");
push(@data, '#endif');
- push(@data, '');
- }
- push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
- $dataout = join ("\n", @data);
- &WriteFile('include/FParameters.h',\$dataout);
+ push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
- @data = ();
- push(@data, '/* get the CCTK datatype definitions */');
- push(@data, '#include "cctk_Types.h"');
- push(@data, '');
- push(@data, '#ifdef CCODE');
- push(@data, '#include "CParameters.h"');
- push(@data, '#elif FCODE');
- push(@data, '#include "FParameters.h"');
- push(@data, '#endif');
- push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
-
- $dataout = join ("\n", @data);
- &WriteFile('include/cctk_Parameters.h',\$dataout);
+ $dataout = join ("\n", @data);
+ &WriteFile("include/${thorn}/cctk_Parameters.h",\$dataout);
+ }
chdir $start_dir;
diff --git a/lib/sbin/CreateScheduleBindings.pl b/lib/sbin/CreateScheduleBindings.pl
index 095d49dc..18657189 100644
--- a/lib/sbin/CreateScheduleBindings.pl
+++ b/lib/sbin/CreateScheduleBindings.pl
@@ -53,20 +53,11 @@ sub CreateScheduleBindings
$file_list .= " Schedule$thorn.c";
$rsbuffer = &ScheduleCreateInterfaceFile($thorn, $rhinterface_db, $rhschedule_db);
- &WriteFile("../include/${thorn}_Schedule.h",\$rsbuffer);
- }
-
- @data = ();
- foreach $thorn (split(' ',$rhinterface_db->{'THORNS'}))
- {
- push(@data, "#ifdef THORN\_IS\_$thorn");
- push(@data, "#include \"${thorn}_Schedule.h\"");
- push(@data, '#endif');
- push(@data, '');
+ &WriteFile("../include/${thorn}/cctk_ScheduleFunctions.h",\$rsbuffer);
+ if($thorn eq "Cactus") {
+ &WriteFile("../include/CactusBindings/cctk_ScheduleFunctions.h",\$rsbuffer);
+ }
}
- push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
- $dataout = join ("\n", @data);
- &WriteFile('../include/cctk_ScheduleFunctions.h',\$dataout);
$rsbuffer = &ScheduleCreateBindings($rhinterface_db, $rhschedule_db);
&WriteFile("BindingsSchedule.c", \$rsbuffer);
@@ -115,7 +106,7 @@ sub ScheduleCreateInterfaceFile
# Process each schedule block
my @data = ();
- push (@data, '#include "cctk_Arguments.h"');
+ push (@data, "#include \"$thorn/cctk_Arguments.h\"");
for (my $block = 0;
$block < $rhschedule_db->{"\U$thorn\E N_BLOCKS"};
@@ -292,11 +283,13 @@ sub ScheduleCreateFile
push(@data, ' @enddesc');
push(@data, '@@*/');
push(@data, '');
- push(@data, "#define THORN_IS_$thorn");
+ #push(@data, "#define THORN_IS_$thorn");
+ #push(@data, "#define CCTK_THORNSTRING \"$thorn\"");
push(@data, '');
- push(@data, '#include "cctk.h"');
- push(@data, '#include "cctk_Parameters.h"');
+ push(@data, "#include \"$thorn/cctk.h\"");
+ push(@data, "#include \"$thorn/CParameters.h\"");
push(@data, '#include "cctki_ScheduleBindings.h"');
+ push(@data, "#include \"$thorn/cctk_ScheduleFunctions.h\"");
push(@data, '');
#push(@data, '/* prototypes for schedule bindings functions to be registered */');
#push(@data, '/* Note that this is a cheat, we just need a function pointer. */');
diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl
index c587e7e6..fde9dfce 100644
--- a/lib/sbin/GridFuncStuff.pl
+++ b/lib/sbin/GridFuncStuff.pl
@@ -43,68 +43,97 @@ sub CreateVariableBindings
WriteFile("include/$thorn\_Arguments.h",\$dataout);
}
- @data = ();
- push(@data, '/*@@');
- push(@data, ' @header cctk_Arguments.h');
- push(@data, ' @author Automatically generated by GridFuncStuff.pl');
- push(@data, ' @desc');
- push(@data, ' Defines the CCTK_ARGUMENTS macro for all thorns');
- push(@data, ' @enddesc');
- push(@data, ' @@*/');
- push(@data, '');
- push(@data, '');
+ my @thorns = split(" ",$rhinterface_db->{"THORNS"});
+ foreach my $thorn (@thorns)
+ {
+ @data = ();
+ push(@data, "#ifndef CCTK_ARGUMENTS_H_");
+ push(@data, "#define CCTK_ARGUMENTS_H_ 1");
+ push(@data, '/*@@');
+ push(@data, ' @header cctk_Arguments.h');
+ push(@data, ' @author Automatically generated by GridFuncStuff.pl');
+ push(@data, ' @desc');
+ push(@data, ' Defines the CCTK_ARGUMENTS macro for all thorns');
+ push(@data, ' @enddesc');
+ push(@data, ' @@*/');
+ push(@data, '');
+ push(@data, '');
+ push(@data, "#include \"${thorn}_Arguments.h\"");
- push(@data, '/* get the CCTK datatype definitions */');
- push(@data, '#include "cctk_Types.h"');
- push(@data, '');
- push(@data, '#ifdef CCODE');
-
- push(@data, '/* prototype for CCTKi_VarDataPtr() goes here');
- push(@data, ' because we don\'t want to include another CCTK header file */');
- push(@data, '#include "cGH.h"');
- push(@data, '#ifdef __cplusplus');
- push(@data, 'extern "C"');
- push(@data, '#endif');
- push(@data, 'void *CCTKi_VarDataPtr(const cGH *GH, int timelevel,');
- push(@data, ' const char *implementation, const char *varname);');
- push(@data, '');
+ push(@data, '/* get the CCTK datatype definitions */');
+ push(@data, '#include "cctk_Types.h"');
+ push(@data, '');
+ push(@data, '#ifdef CCODE');
+ push(@data, '/* prototype for CCTKi_VarDataPtr() goes here');
+ push(@data, ' because we don\'t want to include another CCTK header file */');
+ push(@data, '#include "cGH.h"');
+ push(@data, '#ifdef __cplusplus');
+ push(@data, 'extern "C"');
+ push(@data, '#endif');
+ push(@data, 'void *CCTKi_VarDataPtr(const cGH *GH, int timelevel,');
+ push(@data, ' const char *implementation, const char *varname);');
+ push(@data, '');
- push(@data, '#define PASS_GROUPSIZE(group, dir) CCTKGROUPNUM_##group >= 0 ? \\');
- push(@data, ' CCTK_ArrayGroupSizeI(GH, dir, CCTKGROUPNUM_##group) : &_cctk_zero');
- push(@data, '');
- push(@data, '#define PASS_GROUPLEN(thorn, group) CCTKGROUPNUM_##group >= 0 ? \\');
- push(@data, ' CCTKi_GroupLengthAsPointer(#thorn "::" #group) : &_cctk_zero');
- push(@data, '');
- push(@data, '#define PASS_REFERENCE(var, level) CCTKARGNUM_##var >= 0 ? \\');
- push(@data, ' GH->data[CCTKARGNUM_##var][level] : 0');
- push(@data, '');
+ push(@data, '#define PASS_GROUPSIZE(group, dir) CCTKGROUPNUM_##group >= 0 ? \\');
+ push(@data, ' CCTK_ArrayGroupSizeI(GH, dir, CCTKGROUPNUM_##group) : &_cctk_zero');
+ push(@data, '');
+ push(@data, '#define PASS_GROUPLEN(thorn, group) CCTKGROUPNUM_##group >= 0 ? \\');
+ push(@data, ' CCTKi_GroupLengthAsPointer(#thorn "::" #group) : &_cctk_zero');
+ push(@data, '');
+ push(@data, '#define PASS_REFERENCE(var, level) CCTKARGNUM_##var >= 0 ? \\');
+ push(@data, ' GH->data[CCTKARGNUM_##var][level] : 0');
+ push(@data, '');
- push(@data, '#define CCTK_ARGUMENTS CCTK_CARGUMENTS');
- push(@data, '#define _CCTK_ARGUMENTS _CCTK_CARGUMENTS');
- push(@data, '#define DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_CARGUMENTS');
- push(@data, '#endif');
- push(@data, '');
- push(@data, '#ifdef FCODE');
- push(@data, '#define CCTK_ARGUMENTS CCTK_FARGUMENTS');
- push(@data, '#define _CCTK_ARGUMENTS _CCTK_FARGUMENTS');
- push(@data, '#define DECLARE_CCTK_ARGUMENTS DECLARE_CCTK_FARGUMENTS');
- push(@data, '#endif');
+ push(@data, "#define CCTK_ARGUMENTS \U${thorn}_CARGUMENTS");
+ push(@data, '#define _CCTK_ARGUMENTS _CCTK_CARGUMENTS');
+ push(@data, "#define DECLARE_CCTK_ARGUMENTS DECLARE_\U${thorn}_CARGUMENTS");
+ push(@data, '#endif');
+ push(@data, '');
+ push(@data, '#ifdef FCODE');
+ push(@data, "#define CCTK_ARGUMENTS \U${thorn}_FARGUMENTS");
+ push(@data, '#define _CCTK_ARGUMENTS _CCTK_FARGUMENTS');
+ push(@data, "#define DECLARE_CCTK_ARGUMENTS DECLARE_\U${thorn}_FARGUMENTS");
+ push(@data, '#endif');
- foreach my $thorn (split(" ",$rhinterface_db->{"THORNS"}))
- {
push(@data, '');
- push(@data, "#ifdef THORN_IS_$thorn");
- push(@data, "#include \"${thorn}_Arguments.h\"");
push(@data, "#define CCTK_FARGUMENTS \U$thorn" . '_FARGUMENTS');
push(@data, "#define DECLARE_CCTK_FARGUMENTS DECLARE_\U$thorn" . '_FARGUMENTS');
push(@data, "#define CCTK_CARGUMENTS \U$thorn" . '_CARGUMENTS');
push(@data, "#define DECLARE_CCTK_CARGUMENTS DECLARE_\U$thorn" . '_CARGUMENTS');
- push(@data, '#endif');
- }
- push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
+ push(@data, "#endif");
+ push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline
- my $dataout = join ("\n", @data);
- WriteFile("include/cctk_Arguments.h",\$dataout);
+ my $dataout = join ("\n", @data);
+ unless(-d "include/$thorn") {
+ mkdir("include/$thorn");
+ }
+ WriteFile("include/$thorn/cctk_Arguments.h",\$dataout);
+ if($thorn eq "Cactus") {
+ unless(-d "include/CactusBindings") {
+ mkdir("include/CactusBindings");
+ }
+ WriteFile("include/CactusBindings/cctk_Arguments.h",\$dataout);
+ }
+ @data = ();
+ # alternate
+ push @data, "#ifndef _CCTK_H_";
+ push @data, "#define _CCTK_H_ 1";
+ push @data, "#include \"${thorn}/definethisthorn.h\"";
+ push @data, "";
+ push @data, "/* Include prototypes for scheduled functions */";
+ push @data, "#include \"${thorn}/cctk_ScheduleFunctions.h\"";
+ push @data, "#include \"cctk_core.h\"";
+ push @data, "#endif";
+ push @data, "";
+ $dataout = join ("\n", @data);
+ WriteFile("include/$thorn/cctk.h",\$dataout);
+ if($thorn eq "Cactus") {
+ unless(-d "include/CactusBindings") {
+ mkdir("include/CactusBindings");
+ }
+ WriteFile("include/CactusBindings/cctk.h",\$dataout);
+ }
+ }
if(! -d "Variables")
{
@@ -166,16 +195,17 @@ sub CreateVariableBindings
push(@data, '');
push(@data, '');
- push(@data, "#define THORN_IS_$thorn 1");
+ #push(@data, "#define THORN_IS_$thorn 1");
push(@data, '');
push(@data, '#include <stddef.h>');
push(@data, '');
- push(@data, '#include "cctk.h"');
- push(@data, '#include "cctk_Arguments.h"');
- push(@data, '#include "cctk_Parameter.h"');
+ push(@data, "#include \"$thorn/cctk.h\"");
+ push(@data, "#include \"$thorn/cctk_Arguments.h\"");
+ push(@data, "#include \"cctk_Parameter.h\"");
push(@data, '#include "cctk_WarnLevel.h"');
push(@data, '#include "cctki_Groups.h"');
push(@data, '#include "cctki_FortranWrappers.h"');
+ push(@data, "#include \"$thorn/cctk_ScheduleFunctions.h\"");
push(@data, '');
push(@data, "int CactusBindingsVariables_${thorn}_Initialise(void);");
@@ -354,20 +384,20 @@ sub GetThornArguments
$sep = ',';
if ($gtype ne 'GF')
{
- if($block eq 'PRIVATE')
- {
+ if($block eq 'PRIVATE')
+ {
# FIXME: quick hack to shorten argument names
# $arguments{"cctkv$dim$group"} = "(STORAGESIZE($thorn\::$group, $dim))";
- $arguments{"X$dim$group"} = "(STORAGESIZE($thorn\::$group, $dim))";
- }
- else
- {
+ $arguments{"X$dim$group"} = "(STORAGESIZE($thorn\::$group, $dim))";
+ }
+ else
+ {
# FIXME: quick hack to shorten argument names
# $arguments{"cctkv$dim$group"} = "(STORAGESIZE($imp\::$group, $dim))";
- $arguments{"X$dim$group"} = "(STORAGESIZE($imp\::$group, $dim))";
- }
+ $arguments{"X$dim$group"} = "(STORAGESIZE($imp\::$group, $dim))";
}
}
+ }
if(defined($vararraysize) && $compactgroup == 0)
{
$type .= "$sep${group}_length";