summaryrefslogtreecommitdiff
path: root/lib/sbin
diff options
context:
space:
mode:
authorallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-12-22 09:44:23 +0000
committerallen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac>2000-12-22 09:44:23 +0000
commit4e41b62d559f8fc381b58b0b79096b7214cf9ade (patch)
tree490fc8d64a87354db6f69df158f39a201e756042 /lib/sbin
parent80933e40236dcf50807ebe6d6648eeab4848c538 (diff)
Enhancing error messages, especially for inconsistent implementations
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1981 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r--lib/sbin/CSTUtils.pl10
-rw-r--r--lib/sbin/ScheduleParser.pl12
-rw-r--r--lib/sbin/interface_parser.pl130
3 files changed, 63 insertions, 89 deletions
diff --git a/lib/sbin/CSTUtils.pl b/lib/sbin/CSTUtils.pl
index f441df0b..afff5150 100644
--- a/lib/sbin/CSTUtils.pl
+++ b/lib/sbin/CSTUtils.pl
@@ -18,13 +18,13 @@ sub CST_error
if ($level == 0)
{
$CST_errors++;
- $error = "CST error in $file (at $line)\n -> $mess\n";
+ $error = "\nCST error in $file (at $line)\n -> $mess\n";
print STDERR $error;
$error_string .= $error;
}
else
{
- $error = "CST warning in $file (at $line)\n -> $mess\n";
+ $error = "\nCST warning in $file (at $line)\n -> $mess\n";
print STDERR $error;
$error_string .= $error;
}
@@ -34,13 +34,13 @@ sub CST_error
if ($level == 0)
{
$CST_errors++;
- $error = "CST error $CST_errors:\n -> $mess\n";
+ $error = "\nCST error $CST_errors:\n -> $mess\n";
print STDERR $error;
$error_string .= $error;
}
else
{
- $error = "CST warning:\n -> $mess\n";
+ $error = "\nCST warning:\n -> $mess\n";
print STDERR $error;
$error_string .= $error;
}
@@ -61,7 +61,7 @@ sub CST_error
sub CST_PrintErrors
{
- print $error_string;
+ print "$error_string";
}
diff --git a/lib/sbin/ScheduleParser.pl b/lib/sbin/ScheduleParser.pl
index 87186901..6c09552b 100644
--- a/lib/sbin/ScheduleParser.pl
+++ b/lib/sbin/ScheduleParser.pl
@@ -90,7 +90,7 @@ sub parse_schedule_ccl
($line_number,
$name, $as, $type, $description, $where, $language,
$mem_groups, $comm_groups, $trigger_groups, $sync_groups,
- $options,$before_list, $after_list, $while_list) = &ParseScheduleBlock($line_number, @data);
+ $options,$before_list, $after_list, $while_list) = &ParseScheduleBlock($thorn,$line_number, @data);
$schedule_db{"\U$thorn\E BLOCK_$n_blocks NAME"} = $name;
$schedule_db{"\U$thorn\E BLOCK_$n_blocks AS"} = $as;
@@ -147,7 +147,7 @@ sub parse_schedule_ccl
#@@*/
sub ParseScheduleBlock
{
- my($line_number, @data) = @_;
+ my($thorn,$line_number, @data) = @_;
my($name, $as, $type, $description, $where, $language,
$mem_groups, $comm_groups, $trigger_groups, $sync_groups,
$options, $before_list, $after_list, $while_list);
@@ -400,8 +400,12 @@ sub ParseScheduleBlock
{
if($language ne "")
{
- print STDERR "Error parsing schedule block line '$data[$line_number]'\n";
- print STDERR "Attempt to specify language more than once.\n";
+ $thisline = $data[$line_number];
+ $thisline =~ s/^\s*([^\s])\s$/$1/;
+ $message = "Error parsing schedule block in $thorn\n";
+ $message .= "Attempt to specify language more than once\n";
+ $message .= "Line: $thisline";
+ &CST_error(0,$message,__LINE__,__FILE__);
}
else
{
diff --git a/lib/sbin/interface_parser.pl b/lib/sbin/interface_parser.pl
index f1e1a31f..3657682b 100644
--- a/lib/sbin/interface_parser.pl
+++ b/lib/sbin/interface_parser.pl
@@ -353,12 +353,10 @@ sub check_interface_consistency
{
if(split(" ", $inherits{$thing}) != $n_thorns)
{
- if(!$n_errors)
- {
- $message = "Inconsistent implementations of $implementation. Implemented by thorns " . join(" ", @thorns);
- &CST_error(0,$message,__LINE,__FILE__);
- }
- print STDERR " Not all inherit: $thing\n";
+ $message = "Inconsistent implementations of $implementation. \n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Not all inherit: $thing";
+ &CST_error(0,$message,__LINE,__FILE__);
$n_errors++;
}
}
@@ -368,12 +366,10 @@ sub check_interface_consistency
{
if(split(" ", $friend{$thing}) != $n_thorns)
{
- if(!$n_errors)
- {
- $message = "Inconsistent implementations of $implementation\n Implemented by thorns " . join(" ", @thorns) . "\n";
- &CST_error(0,$message,__LINE,__FILE__);
- }
- print STDERR " Not all are friends of : $thing\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Not all are friends of: $thing";
+ &CST_error(0,$message,__LINE,__FILE__);
$n_errors++;
}
}
@@ -383,13 +379,11 @@ sub check_interface_consistency
{
if(split(" ", $public_groups{$thing}) != $n_thorns)
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- &CST_error(0," Not all declare public group: $thing",__LINE__,__FILE__);
- $n_errors++;
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Not all declare public group: $thing";
+ &CST_error(0,$message,__LINE__,__FILE__);
+ $n_errors++;
}
}
@@ -398,22 +392,14 @@ sub check_interface_consistency
{
if(split(" ", $protected_groups{$thing}) != $n_thorns)
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- &CST_error(0," Not all declare protected group: $thing\n",__LINE__,__FILE__);
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Not all declare protected group: $thing";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
- # Stop if any errors discovered so far.
-# if($n_errors)
-# {
-# print STDERR "$n_errors Errors found, please fix before continuing.\n";
-# exit;
-# }
-
# Check consistancy of group definitions
foreach $group ((keys %public_groups), (keys %protected_groups))
{
@@ -441,12 +427,10 @@ sub check_interface_consistency
{
if($attributes{"VTYPE"} ne $interface_data{"\U$thorn GROUP $group\E VTYPE"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent variable type.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent variable type";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -460,12 +444,10 @@ sub check_interface_consistency
{
if($attributes{"GTYPE"} ne $interface_data{"\U$thorn GROUP $group\E GTYPE"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent group type.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent group type";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -479,12 +461,10 @@ sub check_interface_consistency
{
if($attributes{"TIMELEVELS"} ne $interface_data{"\U$thorn GROUP $group\E TIMELEVELS"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent time levels.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent time levels";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -498,12 +478,10 @@ sub check_interface_consistency
{
if($attributes{"SIZE"} ne $interface_data{"\U$thorn GROUP $group\E SIZE"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent size.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent size";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -517,12 +495,10 @@ sub check_interface_consistency
{
if($attributes{"GHOSTSIZE"} ne $interface_data{"\U$thorn GROUP $group\E GHOSTSIZE"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent ghostsize.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent ghostsize";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -536,12 +512,10 @@ sub check_interface_consistency
{
if($attributes{"DISTRIB"} ne $interface_data{"\U$thorn GROUP $group\E DISTRIB"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent distribution.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= " Group $group has inconsistent distribution";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -555,12 +529,10 @@ sub check_interface_consistency
{
if($attributes{"DIM"} ne $interface_data{"\U$thorn GROUP $group\E DIM"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent dimension.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent dimension";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -574,12 +546,10 @@ sub check_interface_consistency
{
if($attributes{"STYPE"} ne $interface_data{"\U$thorn GROUP $group\E STYPE"})
{
- if(!$n_errors)
- {
- print STDERR "Inconsistent implementations of $implementation\n";
- print STDERR " Implemented by thorns " . join(" ", @thorns) . "\n";
- }
- print STDERR " Group $group has inconsistent staggering type.\n";
+ $message = "Inconsistent implementations of $implementation\n";
+ $message .= "Implemented by thorns " . join(" ", @thorns) . "\n";
+ $message .= "Group $group has inconsistent staggering type";
+ &CST_error(0,$message,__LINE__,__FILE__);
$n_errors++;
}
}
@@ -952,7 +922,7 @@ sub parse_interface_ccl
}
else
{
- $message = "Unknown line $line";
+ $message = "Unknown line in thorn $arrangement/$thorn\n$line";
&CST_error(0,$message,__LINE__,__FILE__);
}
}