From 0d07ac21bf7db6765b83ea1bc88f9f4f05d63af7 Mon Sep 17 00:00:00 2001 From: sbrandt Date: Mon, 18 Jun 2012 17:48:27 +0000 Subject: 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 --- lib/sbin/CST | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'lib/sbin/CST') 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); } -- cgit v1.2.3