diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-10-20 12:46:22 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-10-20 12:46:22 +0000 |
commit | 91d9f35c351b54547d7cab6d69c1ccc554d22d17 (patch) | |
tree | 27eb648bc7abc83a8c687c390e60fbf56c8c58f6 /lib/sbin/BuildHeaders.pl | |
parent | 019f6271792eba1d1d4d9c385bd545638d8d3cc4 (diff) |
CST only writes files which have changed (still a couple more writes
to replace).
Also a bug fix for Build Headers for when the file to be included is
in the include directory of the thorn.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1068 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/BuildHeaders.pl')
-rw-r--r-- | lib/sbin/BuildHeaders.pl | 88 |
1 files changed, 36 insertions, 52 deletions
diff --git a/lib/sbin/BuildHeaders.pl b/lib/sbin/BuildHeaders.pl index 9ab4e6eb..9dbd6e58 100644 --- a/lib/sbin/BuildHeaders.pl +++ b/lib/sbin/BuildHeaders.pl @@ -14,6 +14,7 @@ # @endhistory #@@*/ +require "$sbin_dir/CSTUtils.pl"; sub BuildHeaders { @@ -24,35 +25,12 @@ sub BuildHeaders chdir $bindings_dir; chdir include; -# First delete all global include files since we will be appending +# First set all data strings foreach $thorn (split(" ",$interface_database{"THORNS"})) { foreach $inc_file (split(" ",$interface_database{"\U$thorn USES HEADER"})) { - if (-e $inc_file) - { - system("rm $inc_file"); - } - } - } - -# Create all the global include files used by thorns - foreach $thorn (split(" ",$interface_database{"THORNS"})) - { - foreach $inc_file (split(" ",$interface_database{"\U$thorn USES HEADER"})) - { - if (!-e $inc_file) - { - open(OUT,">$inc_file") || die "Cannot open $inc_dir"; - print OUT "/* Include file $inc_file used by $thorn */\n"; - close OUT; - } - else - { - open(OUT,">>$inc_file") || die "Cannot open $inc_dir"; - print OUT "/* Include file $inc_file used by $thorn */\n"; - close OUT; - } + $data{"$inc_file"} = "/* Include file $inc_file used by $thorn */\n"; } } @@ -69,42 +47,48 @@ sub BuildHeaders $inc_file1 =~ s/ //g; $inc_file2 = $interface_database{"\U$thorn ADD HEADER $inc_file1 TO"}; - # Write information to the global include file - open(OUT,">>$inc_file2") || die "Cannot open $inc_dir2"; - print OUT "/* Including file $inc_file1 from $thorn */\n"; + # Write information to the global include file + $data{"$inc_file2"} .= "/* Including file $inc_file1 from $thorn */\n"; - # Now have to find the include file and copy it - if (-e "$cctk_home/arrangements/$arrangement/$thorn/src/$inc_file1") + # Now have to find the include file and copy it + if (-e "$cctk_home/arrangements/$arrangement/$thorn/src/$inc_file1") + { + open(HEADER,"<$cctk_home/arrangements/$arrangement/$thorn/src/$inc_file1"); + while (<HEADER>) { - open(HEADER,"<$cctk_home/arrangements/$arrangement/$thorn/src/$inc_file1"); - while (<HEADER>) - { - print OUT; - } - print OUT "\n\n\n"; - close HEADER; + $data{"$inc_file2"} .= $_; } - elsif (-e "$cctk_home/arrangements/$arrangement/$thorn/src/include/$inc_file1") + $data{"$inc_file2"} .= "\n\n\n"; + close HEADER; + } + elsif (-e "$cctk_home/arrangements/$arrangement/$thorn/src/include/$inc_file1") + { + open(HEADER,"<$cctk_home/arrangements/$arrangement/$thorn/src/include/$inc_file1"); + while (<HEADER>) { - open(HEADER,"<$cctk_home/arrangements/$arrangement/$thorn/src/$inc_file1"); - while (<HEADER>) - { - print OUT; - } - print OUT "\n\n\n"; - close HEADER; + $data{"$inc_file2"} .= $_; } - else - { - $message = "Include file $inc_file1 not found in $arrangement/$thorn\n"; - &CST_error(0,$message,__LINE__,__FILE__); - } - print OUT "/* End of include file $inc_file1 from $thorn */\n"; - close OUT; + $data{"$inc_file2"} .= "\n\n\n"; + close HEADER; + } + else + { + $message = "Include file $inc_file1 not found in $arrangement/$thorn\n"; + &CST_error(0,$message,__LINE__,__FILE__); + } + $data{"$inc_file2"} .= "/* End of include file $inc_file1 from $thorn */\n"; } } } + foreach $thorn (split(" ",$interface_database{"THORNS"})) + { + foreach $inc_file1 (split(" ",$interface_database{"\U$thorn USES HEADER"})) + { + &WriteFile($inc_file1,$data{"$inc_file1"}); + } + } + chdir $start_dir; return; |