diff options
-rw-r--r-- | lib/sbin/GridFuncStuff.pl | 10 | ||||
-rw-r--r-- | lib/sbin/interface_parser.pl | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index 218d1ec0..76d61b1d 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -1240,8 +1240,12 @@ sub CreateThornGroupInitialisers . " \"" . $rhinterface_db->{"\U$thorn GROUP $group\E SIZE"} . "\",\n" . " \"" . $rhinterface_db->{"\U$thorn GROUP $group\E GHOSTSIZE"} . "\",\n"; + # Is it a vector group ? if(defined($rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"})) { + # Check that the size is allowed. + &CheckArraySizes($rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"},$thorn,$rhparameter_db,$rhinterface_db); + # Flag Cactus that it is a vector group. $line .= " -1"; } else @@ -1254,7 +1258,7 @@ sub CreateThornGroupInitialisers $line .= ",\n \"$variable\""; } - # Pass in the size of the GV array, which may be an integer or a parameter + # Pass in the size of the GV array, which may be a valid parameter expression if(defined($rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"})) { $line .= ",\n \"" . $rhinterface_db->{"\U$thorn GROUP $group\E VARARRAY_SIZE"} . "\""; @@ -1401,9 +1405,9 @@ sub VerifyParameterExpression { my($expression,$thornname,$rhparameter_db) = @_; my($i,$count,@fields); - + # First do some global checks - if($expression !~ m%[-+*/a-zA-Z0-9_()]%) + if($expression !~ m%^[-+*/a-zA-Z0-9_()]+$%) { &CST_error(0, "Array size in $thornname is an invalid arithmatic expression \n" . " '$expression' contains invalid characters"); diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl index 10b71f62..aa7a2bda 100644 --- a/lib/sbin/interface_parser.pl +++ b/lib/sbin/interface_parser.pl @@ -804,19 +804,19 @@ sub parse_interface_ccl $interface_db{"\U$thorn PROVIDES FUNCTION\E $funcname LANG"} .= "$provided_by_language"; } } - elsif ($line =~ m/^\s*(CCTK_)?(CHAR|BYTE|INT|INT2|INT4|INT8|REAL|REAL4|REAL8|REAL16|COMPLEX|COMPLEX8|COMPLEX16|COMPLEX32)\s*(([a-zA-Z]+[a-zA-Z_0-9]*)(\[([a-zA-Z1-9][a-zA-Z_0-9]*)(::[a-zA-Z]+[a-zA-Z_0-9]*)?\])?)\s*(.*)\s*$/i) + elsif ($line =~ m/^\s*(CCTK_)?(CHAR|BYTE|INT|INT2|INT4|INT8|REAL|REAL4|REAL8|REAL16|COMPLEX|COMPLEX8|COMPLEX16|COMPLEX32)\s*(([a-zA-Z]+[a-zA-Z_0-9]*)(\[([^]]+)\])?)\s*(.*)\s*$/i) { # for($i = 1; $i < 10; $i++) # { -# print "$i is ${$i}\n"; +# print "$i is ${$i}\n"; # } my $vtype = $2; my $current_group = "$4"; my $isgrouparray = $5; my $grouparray_size = $6; - my $options_list = $8; + my $options_list = $7; if($known_groups{"\U$current_group\E"}) { @@ -970,11 +970,8 @@ sub parse_interface_ccl &CST_error(0,$message,"",__LINE__,__FILE__); } - # get its size and, if a parameter, get fullname - if($grouparray_size !~ m/::/) - { - $grouparray_size = "$thorn\::$grouparray_size"; - } + # get its size + $interface_db{"\U$thorn GROUP $current_group\E VARARRAY_SIZE"} = $grouparray_size; if($data[$line_number+1] =~ m/^\s*\{\s*$/) |