summaryrefslogtreecommitdiff
path: root/lib/sbin/GridFuncStuff.pl
diff options
context:
space:
mode:
authortradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-09-03 10:27:46 +0000
committertradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac>2001-09-03 10:27:46 +0000
commit8a167af0ac1dc190baa0a2889fbdd693e9f8d9fd (patch)
tree46ab91ebaa3661178d67235219cd6c944342934d /lib/sbin/GridFuncStuff.pl
parentd77d4624d62303d581a20f934fe27644ae22baa1 (diff)
Extended CheckArraySizes() to parse SIZE option of ARRAY declarations.
Now this can be a comma-separated list of positive integer constants or parameter names (optionally with an integer constant added/substracted to/from it). git-svn-id: http://svn.cactuscode.org/flesh/trunk@2328 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/GridFuncStuff.pl')
-rw-r--r--lib/sbin/GridFuncStuff.pl54
1 files changed, 32 insertions, 22 deletions
diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl
index 3cf5967a..b5befda2 100644
--- a/lib/sbin/GridFuncStuff.pl
+++ b/lib/sbin/GridFuncStuff.pl
@@ -1237,44 +1237,54 @@ sub CreateThornFortranWrapper
#/*@@
-# @routine CheckArraySize
+# @routine CheckArraySizes
# @date Thu May 10 2001
# @author Gabrielle Allen
# @desc
-# Arrays sizes need to be parameters
+# Arrays sizes must be given as a comma-separated list of
+# - integer contants (no sign character)
+# - parameter names (either fullname or just the basename)
+# optionally with a "+/-<integer constant>" postfix
# @enddesc
-# @calls
-# @calledby
-# @history
-#
-# @endhistory
-#
#@@*/
sub CheckArraySizes
{
- my($size,$thorn,$rhparameter_db,$rhinterface_db) = @_;
- my($gotit,$par,$th,$message);
+ my($size,$thornname,$rhparameter_db,$rhinterface_db) = @_;
+ my($par,$thorn,$base);
foreach $par (split(",",$size))
{
- $gotit = 0;
- # Get the basename
- $par =~ /([^:]*)$/;
- $base = $1;
- foreach $th (split(" ",$rhinterface_db->{"THORNS"}))
+ # check for size to be a constant
+ next if $par =~ /^\d+$/;
+
+ # check for size to be a parameter
+ if ($par =~ /^([A-Za-z]\w*)(::([A-Za-z]\w*))?([+-]\d+)?$/)
{
- if ($rhparameter_db->{"\U$th Private\E variables"} =~ m:$base:i ||
- $rhparameter_db->{"\U$th Global\E variables"} =~ m:$base:i ||
- $rhparameter_db->{"\U$th Restricted\E variables"} =~ m:$base:i)
+ if (defined $2)
{
- $gotit = 1;
+ $thorn = $1;
+ $base = $3;
+ }
+ else
+ {
+ $thorn = $thornname;
+ $base = $1;
+ }
+
+ # check if the parameter really exists
+ if ($rhparameter_db->{"\U$thorn Private\E variables"} !~ m:$base:i &&
+ $rhparameter_db->{"\U$thorn Global\E variables"} !~ m:$base:i &&
+ $rhparameter_db->{"\U$thorn Restricted\E variables"} !~ m:$base:i)
+ {
+ &CST_error(0,"Array size \'$par\' in $thornname is not a parameter",
+ "",__LINE__,__FILE__);
}
}
- if ($gotit == 0)
+ else
{
- $message = "Array size $par in $thorn is not a parameter";
- &CST_error(0,$message,"",__LINE__,__FILE__);
+ &CST_error(0,"Array size \'$par\' in $thornname has invalid syntax",
+ "",__LINE__,__FILE__);
}
}
}