summaryrefslogtreecommitdiff
path: root/lib/sbin/create_fortran_stuff.pl
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-05-20 16:53:20 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2002-05-20 16:53:20 +0000
commit198f32a7660442c2f7c0f83c2ad179e932074db8 (patch)
tree49e00822cb466dc3b8c3e1642424d430574100e8 /lib/sbin/create_fortran_stuff.pl
parent2e56de0aaa761f45dc3fb81fae41566c85c03db1 (diff)
Added AS for parameters. You can now have one name for a parameter as seen
by the user, and another name for the vaiable in your code. This will be particularly useful for avoiding conflicts when sharing parameters from other implementations. Syntax: [uses|extends] <type> <name> ["<description>"] AS <newname> Tom git-svn-id: http://svn.cactuscode.org/flesh/trunk@2832 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/create_fortran_stuff.pl')
-rw-r--r--lib/sbin/create_fortran_stuff.pl55
1 files changed, 30 insertions, 25 deletions
diff --git a/lib/sbin/create_fortran_stuff.pl b/lib/sbin/create_fortran_stuff.pl
index 1bd517a4..4f2283f0 100644
--- a/lib/sbin/create_fortran_stuff.pl
+++ b/lib/sbin/create_fortran_stuff.pl
@@ -4,8 +4,9 @@
# @date Tue Jan 12 09:52:35 1999
# @author Tom Goodale
# @desc
-#
+# Create the Fortran parameter stuff
# @enddesc
+#version $Header$
#@@*/
sub CreateFortranThornParameterBindings
@@ -69,8 +70,11 @@ sub CreateFortranThornParameterBindings
# thorns, especially if the variable isn't being used !
$num_aliases = 0;
+# print "DEBUG ********************************************\n";
+# print "DEBUG thorn is $thorn\n";
foreach $friend (split(' ',$rhparameter_db->{"\U$thorn\E SHARES implementations"}))
{
+# print "DEBUG friend is $friend\n";
# Determine which thorn provides this friend implementation
$rhinterface_db->{"IMPLEMENTATION \U$friend\E THORNS"} =~ m:([^ ]*):;
@@ -83,25 +87,30 @@ sub CreateFortranThornParameterBindings
foreach $parameter (sort(keys %these_parameters))
{
- # Alias the parameter unless it is one we want.
- if(($rhparameter_db->{"\U$thorn SHARES $friend\E variables"} =~ m:( )*$parameter( )*:) &&
- (length($1) > 0)||length($2)>0||$1 eq $rhparameter_db->{"\U$thorn SHARES $friend\E variables"})
- {
- # See if we are sharing it AS something
- my $name = $rhparameter_db->{"\U$thorn $parameter\E alias"};
+# print "DEBUG parameter is $parameter\n";
+ my $foundit = 0;
+ my $thornparam;
+ my $name = "";
- if(! $name)
+ foreach $thornparam (split(/\s+/,$rhparameter_db->{"\U$thorn SHARES $friend\E variables"}))
+ {
+# print "DEBUG thorn parameter is $thornparam\n";
+# print "DEBUG realname is " . $rhparameter_db->{"\U$thorn $thornparam\E realname"} ."\n";
+
+ if($rhparameter_db->{"\U$thorn $thornparam\E realname"} =~ m/^$parameter$/i)
{
- $name = "$parameter";
+# print "DEBUG ... " . $rhparameter_db->{"\U$thorn $thornparam\E realname"} . "\n";
+ $name = $thornparam; #$rhparameter_db->{"\U$thorn $thornparam\E realname"};
+ last;
}
-
- $alias_names{$parameter} = $name;
}
- else
+
+ if($name eq "")
{
- $alias_names{$parameter} = "CCTKH$num_aliases";
+ $name = "CCTKH$num_aliases";
$num_aliases++;
}
+ $alias_names{$parameter} = "$name";
}
@data = &CreateFortranCommonDeclaration("${friend}rest", \%these_parameters, $rhparameter_db, \%alias_names);
@@ -158,23 +167,19 @@ sub CreateFortranCommonDeclaration
$suffix = "($array_size)";
}
- if($aliases == 0)
- {
- my $name = $rhparameter_db->{"\U$rhparameters->{$parameter} $parameter\E alias"};
+ my $name;
- if(! $name)
- {
- $name = "$parameter";
- }
-
- $line = "$type_string $name$suffix";
- $definition .= "$sepchar$name";
+ if($aliases)
+ {
+ $name = $rhaliases->{$parameter};
}
else
{
- $line = "$type_string $rhaliases->{$parameter}$suffix";
- $definition .= "$sepchar$rhaliases->{$parameter}";
+ $name = $rhparameter_db->{"\U$rhparameters->{$parameter} $parameter\E realname"};
}
+
+ $line = "$type_string $name$suffix";
+ $definition .= "$sepchar$name";
push(@data, $line);