diff options
author | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-01-19 09:32:29 +0000 |
---|---|---|
committer | goodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 1999-01-19 09:32:29 +0000 |
commit | 425852ca3a04dc21a49f904e4a90e7edf5a354ee (patch) | |
tree | c14b25fdf0581763ace2662a121f2fd08b30127e | |
parent | a692cfb150e1aac9fc21d722d287749feb64635a (diff) |
Added routine to parse an ActiveThornsList.
Tom
git-svn-id: http://svn.cactuscode.org/flesh/trunk@69 17b73243-c579-4c4c-a9d2-2d5706c11dac
-rw-r--r-- | lib/sbin/config_parser.pl | 86 |
1 files changed, 67 insertions, 19 deletions
diff --git a/lib/sbin/config_parser.pl b/lib/sbin/config_parser.pl index 96a1fec7..df499d47 100644 --- a/lib/sbin/config_parser.pl +++ b/lib/sbin/config_parser.pl @@ -1,19 +1,32 @@ -#! /usr/bin/perl +#! /usr/bin/perl -s -$in = shift(@ARGV); -$tmphome = shift(@ARGV); +if(! $top) +{ + $top = `pwd`; +} -if (!$in || !$tmphome) +if(! $config_dir) { - printf "Usage: xxx indir tmpdir"; + $config_dir = "$top/config-data"; } # Set up the CCTK home directory -$cachome = $ENV{'CCTK_HOME'} || "$ENV{HOME}/CCTK"; -$cachome =~ s:/$::g; +if(! $cctk_home) +{ + $cctk_home = $ENV{'CCTK_HOME'} || "$ENV{HOME}/CCTK"; + $cachome =~ s:/$::g; +} -# -#if (!-e "$cachome/lib/perl/thorn_utils.pl" ) { +$activethorns = shift(@ARGV); + +if (! $activethorns) +{ + printf "Usage: config_parser [-top=<TOP>] [-config_dir=<config directory>] [-cctk_home=<CCTK home dir>] ActiveThornList"; + exit; +} + + +#if (!-e "$cctk_home/lib/perl/thorn_utils.pl" ) { # print <<EOE; # #ERROR: Cannot find the cactus perl libraries! @@ -34,14 +47,18 @@ $cachome =~ s:/$::g; # exit; #} +require "$cctk_home/lib/sbin/parameter_parser.pl"; +require "$cctk_home/lib/sbin/interface_parser.pl"; +require "$cctk_home/lib/sbin/create_c_stuff.pl"; +require "$cctk_home/lib/sbin/create_fortran_stuff.pl"; +require "$cctk_home/lib/sbin/GridFuncStuff.pl"; -require "lib/sbin/parameter_parser.pl"; -require "lib/sbin/interface_parser.pl"; -require "lib/sbin/create_c_stuff.pl"; -require "lib/sbin/create_fortran_stuff.pl"; -require "lib/sbin/GridFuncStuff.pl"; +%thorns = &create_thorn_list($activethorns); -%thorns = &create_thorn_list; +foreach $thorn (keys %thorns) +{ + print "$thorn in dir $thorns{$thorn}\n"; +} %interface_database = &create_interface_database(%thorns); @@ -94,10 +111,41 @@ foreach $line (@GFstuff) sub create_thorn_list { - return ("flesh", "toolkits/test/flesh", - "test1", "toolkits/test/test1", - "test2", "toolkits/test/test2", - "test3", "toolkits/test/test3"); + local($activethorns) = @_; + local(%thornlist); + local($thorn, $toolkit, $thorn_name); + + open(ACTIVE, "<$activethorns") || die "Cannot open ActiveThorns file $activethorns !"; + + while(<ACTIVE>) + { + s/thorn_//g; + s/\#(.*)$//g; + s/\n//g; # Different from chop... + next if (m:^\s*$:); + foreach $thorn (split(' ')) + { + $thorn =~ m:(.*)[/\\](.*):; + + $toolkit = $1; + $thorn_name = $2; + + if( -r "$cctk_home/toolkits/$thorn/param.ccl" && + -r "$cctk_home/toolkits/$thorn/interface.ccl" && + -r "$cctk_home/toolkits/$thorn/schedule.ccl") + { + $thornlist{"$thorn_name"} = "$cctk_home/toolkits/$thorn"; + } + else + { + print "Ignoring $thorn - missing ccl file(s)\n"; + next; + } + } + } + close ACTIVE; + + return %thornlist; } |