summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2004-02-02 19:56:50 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2004-02-02 19:56:50 +0000
commit7ec198e18571c2776806357a3db37c9137265932 (patch)
treee0ba126c96cf276b1d4cb50783e158c62f48987e
parent6c72644bb50699c32f06816d001b10c399d3872b (diff)
downloadATCD-7ec198e18571c2776806357a3db37c9137265932.tar.gz
ChangeLogTag: Mon Feb 2 13:53:08 2004 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog23
-rw-r--r--bin/MakeProjectCreator/modules/Creator.pm37
-rw-r--r--bin/MakeProjectCreator/modules/Driver.pm16
-rw-r--r--bin/MakeProjectCreator/modules/FeatureParser.pm6
-rw-r--r--bin/MakeProjectCreator/modules/OutputMessage.pm79
-rw-r--r--bin/MakeProjectCreator/modules/Parser.pm10
-rw-r--r--bin/MakeProjectCreator/modules/ProjectCreator.pm65
-rw-r--r--bin/MakeProjectCreator/modules/StringProcessor.pm8
-rw-r--r--bin/MakeProjectCreator/modules/TemplateInputReader.pm6
-rw-r--r--bin/MakeProjectCreator/modules/TemplateParser.pm14
-rw-r--r--bin/MakeProjectCreator/modules/WorkspaceCreator.pm54
11 files changed, 213 insertions, 105 deletions
diff --git a/ChangeLog b/ChangeLog
index 547b306f5ec..a6dc8fe4300 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+Mon Feb 2 13:53:08 2004 Chad Elliott <elliott_c@ociweb.com>
+
+ * bin/MakeProjectCreator/modules/OutputMessage.pm:
+
+ Added an interface for printing informational, warning and error
+ messages. This allows messages to be manipulated prior to being
+ printed. Informational messages are off by default and can be
+ enabled by setting the MPC_INFORMATION environment variable. The
+ informational and warning messages can be turned off by setting the
+ MPC_SILENT environment variable.
+
+ * bin/MakeProjectCreator/modules/Creator.pm:
+ * bin/MakeProjectCreator/modules/Driver.pm:
+ * bin/MakeProjectCreator/modules/FeatureParser.pm:
+ * bin/MakeProjectCreator/modules/Parser.pm:
+ * bin/MakeProjectCreator/modules/ProjectCreator.pm:
+ * bin/MakeProjectCreator/modules/StringProcessor.pm:
+ * bin/MakeProjectCreator/modules/TemplateInputReader.pm:
+ * bin/MakeProjectCreator/modules/TemplateParser.pm:
+ * bin/MakeProjectCreator/modules/WorkspaceCreator.pm:
+
+ Use the OutputMessage interface instead of print for messages.
+
Mon Feb 2 13:48:23 2004 Chad Elliott <elliott_c@ociweb.com>
* bin/MakeProjectCreator/templates/bor.mpd:
diff --git a/bin/MakeProjectCreator/modules/Creator.pm b/bin/MakeProjectCreator/modules/Creator.pm
index feb09975e6b..f09debfb32a 100644
--- a/bin/MakeProjectCreator/modules/Creator.pm
+++ b/bin/MakeProjectCreator/modules/Creator.pm
@@ -117,7 +117,7 @@ sub generate_default_input {
($status, $error) = $self->parse_line(undef, '}');
if (!$status) {
- print STDERR "$error\n";
+ $self->error($error);
}
return $status;
@@ -135,15 +135,17 @@ sub parse_file {
if (!$status) {
print STDERR $self->getcwd() .
"/$input: line " . $self->get_line_number() .
- ":\n$errorString\n";
+ ":\n";
+ $self->error($errorString);
}
elsif ($status && $self->{$self->{'type_check'}}) {
## If we are at the end of the file and the type we are looking at
## is still defined, then we have an error
print STDERR $self->getcwd() .
"/$input: line " . $self->get_line_number() .
- ":\nERROR: Did not " .
- "find the end of the $self->{'grammar_type'}\n";
+ ":\n";
+ $self->error("Did not " .
+ "find the end of the $self->{'grammar_type'}");
$status = 0;
}
$self->set_line_number($oline);
@@ -237,7 +239,7 @@ sub parse_known {
my($name) = $1;
my($parents) = $2;
if ($self->{$self->{'type_check'}}) {
- $errorString = "ERROR: Did not find the end of the $type";
+ $errorString = "Did not find the end of the $type";
$status = 0;
}
else {
@@ -254,7 +256,7 @@ sub parse_known {
if (!defined $parents[0]) {
## The : was used, but no parents followed. This
## is an error.
- $errorString = 'ERROR: No parents listed';
+ $errorString = 'No parents listed';
$status = 0;
}
$parents = \@parents;
@@ -267,7 +269,7 @@ sub parse_known {
push(@values, $type, $line);
}
else {
- $errorString = "ERROR: Did not find the beginning of the $type";
+ $errorString = "Did not find the beginning of the $type";
$status = 0;
}
}
@@ -290,7 +292,7 @@ sub parse_known {
if (!defined $parents[0]) {
## The : was used, but no parents followed. This
## is an error.
- $errorString = 'ERROR: No parents listed';
+ $errorString = 'No parents listed';
$status = 0;
}
$parents = \@parents;
@@ -298,7 +300,7 @@ sub parse_known {
push(@values, $type, \@names, $parents);
}
elsif (!$self->{$self->{'type_check'}}) {
- $errorString = "ERROR: No $type was defined";
+ $errorString = "No $type was defined";
$status = 0;
}
elsif ($self->parse_assignment($line, \@values)) {
@@ -318,7 +320,7 @@ sub parse_known {
push(@values, 'component', $comp, $name);
}
else {
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
$status = -1;
}
@@ -334,7 +336,7 @@ sub parse_scope {
my($validNames) = shift;
my($flags) = shift;
my($status) = 0;
- my($errorString) = "ERROR: Unable to process $name";
+ my($errorString) = "Unable to process $name";
if (!defined $flags) {
$flags = {};
@@ -367,7 +369,7 @@ sub parse_scope {
}
else {
$status = 0;
- $errorString = "ERROR: Invalid assignment name: $values[1]";
+ $errorString = "Invalid assignment name: $values[1]";
last;
}
}
@@ -463,13 +465,14 @@ sub add_file_written {
foreach my $written (@{$self->{'files_written'}}) {
if ($written eq $file) {
- print "WARNING: $file has been overwritten by a " .
- "$self->{'grammar_type'} with a duplicate name.\n";
+ $self->warning("$file has been overwritten by a " .
+ "$self->{'grammar_type'} with a duplicate name.");
last;
}
elsif (lc($written) eq lc($file)) {
- print "WARNING: $file has been overwritten by a " .
- "$self->{'grammar_type'} with different casing: $written.\n";
+ $self->warning("$file has been overwritten by a " .
+ "$self->{'grammar_type'} with different casing: " .
+ "$written.");
last;
}
}
@@ -859,7 +862,7 @@ sub handle_scoped_unknown {
my($type) = shift;
my($flags) = shift;
my($line) = shift;
- return 0, "ERROR: Unrecognized line: $line";
+ return 0, "Unrecognized line: $line";
}
diff --git a/bin/MakeProjectCreator/modules/Driver.pm b/bin/MakeProjectCreator/modules/Driver.pm
index 39de1b48df1..57d509496e4 100644
--- a/bin/MakeProjectCreator/modules/Driver.pm
+++ b/bin/MakeProjectCreator/modules/Driver.pm
@@ -78,7 +78,7 @@ sub parse_line {
}
else {
$status = 0;
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
}
return $status, $errorString;
@@ -91,7 +91,7 @@ sub optionError {
my($base) = $self->{'name'};
if (defined $line) {
- print STDERR "ERROR: $line\n";
+ $self->error($line);
}
my($spaces) = (' ' x (length($base) + 8));
print STDERR "$base v" . Version::get() . "\n" .
@@ -237,8 +237,8 @@ sub run {
## If no files were found above, then we issue a warning
## that we are going to use the default input
if (!defined $options->{'input'}->[0]) {
- print "WARNING: No files were found using the -recurse option.\n" .
- " Using the default input.\n";
+ $self->information('No files were found using the -recurse option. ' .
+ 'Using the default input.');
}
}
}
@@ -277,7 +277,7 @@ sub run {
if (-r $rel) {
my($srel, $errorString) = $self->read_file($rel);
if (!$srel) {
- print STDERR "$errorString\nin $rel\n";
+ $self->error("$errorString\nin $rel");
return $status;
}
}
@@ -353,7 +353,7 @@ sub run {
if ($base ne $file) {
my($dir) = ($base eq '' ? $file : dirname($file));
if (!$creator->cd($dir)) {
- print STDERR "ERROR: Unable to change to directory: $dir\n";
+ $self->error("Unable to change to directory: $dir");
$status++;
last;
}
@@ -371,8 +371,8 @@ sub run {
}
print "\n" . 'Start Time: ' . scalar(localtime(time())) . "\n";
if (!$creator->generate($file)) {
- print STDERR "ERROR: Unable to process: " .
- ($file eq '' ? 'default input' : $file) . "\n";
+ $self->error("Unable to process: " .
+ ($file eq '' ? 'default input' : $file));
$status++;
last;
}
diff --git a/bin/MakeProjectCreator/modules/FeatureParser.pm b/bin/MakeProjectCreator/modules/FeatureParser.pm
index c5d608bc7be..46c871ab1e8 100644
--- a/bin/MakeProjectCreator/modules/FeatureParser.pm
+++ b/bin/MakeProjectCreator/modules/FeatureParser.pm
@@ -38,8 +38,8 @@ sub new {
## We only want to warn the user about problems
## with the feature file.
my($lnumber) = $self->get_line_number();
- $warn =~ s/ERROR/WARNING/;
- print "$f: line $lnumber:\n$warn\n";
+ print "$f: line $lnumber:\n";
+ $self->warning($warn);
}
}
}
@@ -62,7 +62,7 @@ sub parse_line {
}
else {
$status = 0;
- $error = "ERROR: Unrecognized line: $line";
+ $error = "Unrecognized line: $line";
}
return $status, $error;
diff --git a/bin/MakeProjectCreator/modules/OutputMessage.pm b/bin/MakeProjectCreator/modules/OutputMessage.pm
new file mode 100644
index 00000000000..f418b9a06c1
--- /dev/null
+++ b/bin/MakeProjectCreator/modules/OutputMessage.pm
@@ -0,0 +1,79 @@
+package OutputMessage;
+
+# ************************************************************
+# Description : Prints information, warnings and errors.
+# Author : Chad Elliott
+# Create Date : 2/02/2004
+# ************************************************************
+
+# ************************************************************
+# Pragmas
+# ************************************************************
+
+use strict;
+
+# ************************************************************
+# Data Section
+# ************************************************************
+
+my($information) = 'INFORMATION: ';
+my($warning) = 'WARNING: ';
+my($error) = 'ERROR: ';
+
+# ************************************************************
+# Subroutine Section
+# ************************************************************
+
+sub new {
+ my($class) = shift;
+ my($info) = shift;
+ my($warn) = shift;
+ my($self) = bless {'information' => $info,
+ 'warnings' => $warn,
+ }, $class;
+ return $self;
+}
+
+
+sub split_message {
+ my($self) = shift;
+ my($msg) = shift;
+ my($spc) = shift;
+
+ $msg =~ s/\.\s+/.\n$spc/g;
+ return $msg . "\n";
+}
+
+
+sub information {
+ my($self) = shift;
+ my($msg) = shift;
+
+ if ($self->{'information'}) {
+ print $information . $self->split_message($msg, ' ' x
+ length($information));
+ }
+}
+
+
+sub warning {
+ my($self) = shift;
+ my($msg) = shift;
+
+ if ($self->{'warnings'}) {
+ print $warning . $self->split_message($msg, ' ' x
+ length($warning));
+ }
+}
+
+
+sub error {
+ my($self) = shift;
+ my($msg) = shift;
+
+ print $error . $self->split_message($msg, ' ' x
+ length($error));
+}
+
+
+1;
diff --git a/bin/MakeProjectCreator/modules/Parser.pm b/bin/MakeProjectCreator/modules/Parser.pm
index 2ccbad5c341..c6f07d02487 100644
--- a/bin/MakeProjectCreator/modules/Parser.pm
+++ b/bin/MakeProjectCreator/modules/Parser.pm
@@ -13,10 +13,11 @@ package Parser;
use strict;
use FileHandle;
+use OutputMessage;
use StringProcessor;
use vars qw(@ISA);
-@ISA = qw(StringProcessor);
+@ISA = qw(OutputMessage StringProcessor);
# ************************************************************
# Data Section
@@ -38,7 +39,10 @@ if ($^O eq 'cygwin' && $cwd !~ /[A-Za-z]:/) {
sub new {
my($class) = shift;
my($inc) = shift;
- my($self) = $class->SUPER::new();
+ my($info) = (defined $ENV{MPC_SILENT} ||
+ !defined $ENV{MPC_INFORMATION} ? 0 : 1);
+ my($warn) = (defined $ENV{MPC_SILENT} ? 0 : 1);
+ my($self) = $class->SUPER::new($info, $warn);
$self->{'line_number'} = 0;
$self->{'include'} = $inc;
@@ -133,7 +137,7 @@ sub read_file {
close($ih);
}
else {
- $errorString = 'ERROR: Unable to open for reading';
+ $errorString = 'Unable to open for reading';
$status = 0;
}
diff --git a/bin/MakeProjectCreator/modules/ProjectCreator.pm b/bin/MakeProjectCreator/modules/ProjectCreator.pm
index bb04cbe0649..e64160a92ba 100644
--- a/bin/MakeProjectCreator/modules/ProjectCreator.pm
+++ b/bin/MakeProjectCreator/modules/ProjectCreator.pm
@@ -280,7 +280,7 @@ sub begin_project {
foreach my $currently (@{$self->{'reading_parent'}}) {
if ($currently eq $file) {
$status = 0;
- $error = 'ERROR: Cyclic inheritance detected: ' .
+ $error = 'Cyclic inheritance detected: ' .
$parent;
}
}
@@ -294,14 +294,25 @@ sub begin_project {
pop(@{$self->{'reading_parent'}});
if (!$status) {
- $error = "ERROR: Invalid parent: $parent";
+ $error = "Invalid parent: $parent";
+ }
+ }
+ else {
+ ## The base project has already been read. So, if
+ ## we are reading the original project (not a parent base
+ ## project), then the current base project is redundant.
+ if (!defined $self->{'reading_parent'}->[0]) {
+ $file =~ s/\.[^\.]+$//;
+ $self->information("Inheriting from '" . basename($file) .
+ "' in " . $self->get_current_input() .
+ " is redundant.");
}
}
}
}
else {
$status = 0;
- $error = "ERROR: Unable to locate parent: $parent";
+ $error = "Unable to locate parent: $parent";
}
}
}
@@ -364,7 +375,7 @@ sub parse_line {
}
}
else {
- $errorString = 'ERROR: Invalid ' .
+ $errorString = 'Invalid ' .
"assignment modification name: $ap";
$status = 0;
}
@@ -382,7 +393,7 @@ sub parse_line {
if (defined $self->{'verbatim_accessed'}->{$key}) {
foreach my $ikey (keys %{$self->{'verbatim'}->{$key}}) {
if (!defined $self->{'verbatim_accessed'}->{$key}->{$ikey}) {
- print "WARNING: Marker $ikey does not exist.\n";
+ $self->warning("Marker $ikey does not exist.");
}
}
}
@@ -415,7 +426,7 @@ sub parse_line {
if (defined $name) {
if ($name =~ /[\/\\]/) {
$status = 0;
- $errorString = 'ERROR: Projects can not have a slash ' .
+ $errorString = 'Projects can not have a slash ' .
'or a back slash in the name';
}
else {
@@ -445,7 +456,7 @@ sub parse_line {
$self->process_assignment($name, $value);
}
else {
- $errorString = "ERROR: Invalid assignment name: $name";
+ $errorString = "Invalid assignment name: $name";
$status = 0;
}
}
@@ -456,7 +467,7 @@ sub parse_line {
$self->process_assignment_add($name, $value);
}
else {
- $errorString = "ERROR: Invalid addition name: $name";
+ $errorString = "Invalid addition name: $name";
$status = 0;
}
}
@@ -467,7 +478,7 @@ sub parse_line {
$self->process_assignment_sub($name, $value);
}
else {
- $errorString = "ERROR: Invalid subtraction name: $name";
+ $errorString = "Invalid subtraction name: $name";
$status = 0;
}
}
@@ -485,7 +496,7 @@ sub parse_line {
my($vc) = $self->{'valid_components'};
if (defined $$vc{$comp}) {
if (!$self->parse_components($ih, $comp, $name)) {
- $errorString = "ERROR: Unable to process $comp";
+ $errorString = "Unable to process $comp";
$status = 0;
}
}
@@ -493,7 +504,7 @@ sub parse_line {
if ($comp eq 'verbatim') {
my($type, $loc) = split(/\s*,\s*/, $name);
if (!$self->parse_verbatim($ih, $comp, $type, $loc)) {
- $errorString = "ERROR: Unable to process $comp";
+ $errorString = "Unable to process $comp";
$status = 0;
}
}
@@ -506,7 +517,7 @@ sub parse_line {
($status, $errorString) = $self->parse_define_custom($ih, $name);
}
else {
- $errorString = "ERROR: Invalid component name: $comp";
+ $errorString = "Invalid component name: $comp";
$status = 0;
}
}
@@ -515,12 +526,12 @@ sub parse_line {
$self->{'feature_defined'} = 1;
$self->process_feature($ih, $values[1], $values[2]);
if ($self->{'feature_defined'}) {
- $errorString = "ERROR: Did not find the end of the feature";
+ $errorString = "Did not find the end of the feature";
$status = 0;
}
}
else {
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
$status = 0;
}
}
@@ -844,14 +855,14 @@ sub parse_define_custom {
my($fh) = shift;
my($tag) = shift;
my($status) = 0;
- my($errorString) = "ERROR: Unable to process $tag";
+ my($errorString) = "Unable to process $tag";
my(%flags) = ();
## Make the tag something _files
$tag = lc($tag) . '_files';
if (defined $self->{'valid_components'}->{$tag}) {
- $errorString = "ERROR: $tag has already been defined";
+ $errorString = "$tag has already been defined";
}
else {
## Update the custom_types assignment
@@ -964,7 +975,7 @@ sub parse_define_custom {
}
else {
$status = 0;
- $errorString = "ERROR: Invalid assignment name: $name";
+ $errorString = "Invalid assignment name: $name";
last;
}
}
@@ -976,7 +987,7 @@ sub parse_define_custom {
if ($keyword eq 'keyword') {
if (defined $self->{'valid_names'}->{$newkey}) {
$status = 0;
- $errorString = "ERROR: Cannot map $newkey onto an " .
+ $errorString = "Cannot map $newkey onto an " .
"existing keyword";
last;
}
@@ -989,26 +1000,26 @@ sub parse_define_custom {
}
else {
$status = 0;
- $errorString = "ERROR: Cannot map $newkey to an " .
+ $errorString = "Cannot map $newkey to an " .
"undefined custom keyword: $mapkey";
last;
}
}
else {
$status = 0;
- $errorString = "ERROR: Cannot map $newkey to $mapkey";
+ $errorString = "Cannot map $newkey to $mapkey";
last;
}
}
else {
$status = 0;
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
last;
}
}
else {
$status = 0;
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
last;
}
}
@@ -2204,7 +2215,7 @@ sub write_output_file {
&$cb($name, $pjname, @list);
}
else {
- print "WARNING: Ignoring callback: $cb\n";
+ $self->warning("Ignoring callback: $cb.");
}
}
@@ -2233,7 +2244,7 @@ sub write_output_file {
}
}
else {
- $error = "ERROR: Unable to open $tmp for output.";
+ $error = "Unable to open $tmp for output.";
$status = 0;
}
@@ -2245,7 +2256,7 @@ sub write_output_file {
$self->add_file_written($name);
}
else {
- $error = "ERROR: Unable to open $name for output.";
+ $error = "Unable to open $name for output.";
$status = 0;
}
}
@@ -2266,7 +2277,7 @@ sub write_output_file {
$self->add_file_written($name);
}
else {
- $error = "ERROR: Unable to open $name for output.";
+ $error = "Unable to open $name for output.";
$status = 0;
}
}
@@ -2275,7 +2286,7 @@ sub write_output_file {
}
}
else {
- $error = "ERROR: Unable to locate the template file: $template.";
+ $error = "Unable to locate the template file: $template.";
$status = 0;
}
diff --git a/bin/MakeProjectCreator/modules/StringProcessor.pm b/bin/MakeProjectCreator/modules/StringProcessor.pm
index 66e9d783f56..180f2341d2f 100644
--- a/bin/MakeProjectCreator/modules/StringProcessor.pm
+++ b/bin/MakeProjectCreator/modules/StringProcessor.pm
@@ -16,14 +16,6 @@ use strict;
# Subroutine Section
# ************************************************************
-sub new {
- my($class) = shift;
- my($self) = bless {
- }, $class;
- return $self;
-}
-
-
sub extractType {
my($self) = shift;
my($name) = shift;
diff --git a/bin/MakeProjectCreator/modules/TemplateInputReader.pm b/bin/MakeProjectCreator/modules/TemplateInputReader.pm
index 3dbd7d4faab..cdf143d155b 100644
--- a/bin/MakeProjectCreator/modules/TemplateInputReader.pm
+++ b/bin/MakeProjectCreator/modules/TemplateInputReader.pm
@@ -67,7 +67,7 @@ sub parse_line {
}
else {
$status = 0;
- $errorString = 'ERROR: Unmatched curly brace';
+ $errorString = 'Unmatched curly brace';
}
}
elsif ($line =~ /^(\w+)\s*(\+=|=)\s*(.*)?/) {
@@ -112,7 +112,7 @@ sub parse_line {
}
else {
$status = 0;
- $errorString = "ERROR: Redifinition of '$name'";
+ $errorString = "Redifinition of '$name'";
}
}
}
@@ -126,7 +126,7 @@ sub parse_line {
}
else {
$status = 0;
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
}
return $status, $errorString;
diff --git a/bin/MakeProjectCreator/modules/TemplateParser.pm b/bin/MakeProjectCreator/modules/TemplateParser.pm
index 26a608ca89f..0372c1699e3 100644
--- a/bin/MakeProjectCreator/modules/TemplateParser.pm
+++ b/bin/MakeProjectCreator/modules/TemplateParser.pm
@@ -304,11 +304,9 @@ sub get_value_with_default {
else {
$value = $self->{'defaults'}->{$name};
if (!defined $value) {
-# print "DEBUG: WARNING: $name defaulting to empty string\n";
$value = '';
}
else {
-# print "DEBUG: WARNING: $name using default value of $value\n";
$value = $self->adjust_value($name, $value);
}
$value = $self->{'prjc'}->relative($value);
@@ -424,7 +422,7 @@ sub handle_end {
if (!defined $end) {
$status = 0;
- $errorString = "ERROR: Unmatched $name\n";
+ $errorString = "Unmatched $name\n";
}
elsif ($end eq 'endif') {
$self->{'if_skip'} = 0;
@@ -623,12 +621,12 @@ sub handle_foreach {
## with custom types.
if ($val =~ /^custom_type\->/ || $val eq 'custom_types') {
$status = 0;
- $errorString = 'ERROR: The foreach variable can not be ' .
+ $errorString = 'The foreach variable can not be ' .
'named when dealing with custom types';
}
elsif ($val =~ /^grouped_.*_file\->/ || $val =~ /^grouped_.*files$/) {
$status = 0;
- $errorString = 'ERROR: The foreach variable can not be ' .
+ $errorString = 'The foreach variable can not be ' .
'named when dealing with grouped files';
}
}
@@ -865,7 +863,7 @@ sub process_name {
}
}
$status = 0;
- $errorString = "ERROR: Unable to parse line starting at $error";
+ $errorString = "Unable to parse line starting at $error";
}
return $status, $errorString, $length;
@@ -992,7 +990,7 @@ sub parse_line {
$nlen) = $self->process_name($substr);
if ($status && $nlen == 0) {
- $errorString = "ERROR: Could not parse this line at column $i";
+ $errorString = "Could not parse this line at column $i";
$status = 0;
}
if (!$status) {
@@ -1045,7 +1043,7 @@ sub parse_file {
if (defined $$sstack[0]) {
my($lstack) = $self->{'lstack'};
$status = 0;
- $errorString = "ERROR: missing an $$sstack[0] starting at $$lstack[0]";
+ $errorString = "Missing an $$sstack[0] starting at $$lstack[0]";
}
}
diff --git a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
index e3ebaab9d0a..666e5cd7480 100644
--- a/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
+++ b/bin/MakeProjectCreator/modules/WorkspaceCreator.pm
@@ -142,8 +142,7 @@ sub parse_line {
$self->{'assign'} = {};
}
else {
- $errorString = 'ERROR: Unable to ' .
- 'generate all of the project files';
+ $errorString = 'Unable to generate all of the project files';
$status = 0;
}
@@ -174,12 +173,12 @@ sub parse_line {
pop(@$rp);
if (!$status) {
- $errorString = "ERROR: Invalid parent: $parent";
+ $errorString = "Invalid parent: $parent";
}
}
else {
$status = 0;
- $errorString = "ERROR: Unable to locate parent: $parent";
+ $errorString = "Unable to locate parent: $parent";
}
}
}
@@ -188,7 +187,7 @@ sub parse_line {
if (defined $name) {
if ($name =~ /[\/\\]/) {
$status = 0;
- $errorString = 'ERROR: Workspaces can not have a slash ' .
+ $errorString = 'Workspaces can not have a slash ' .
'or a back slash in the name';
}
else {
@@ -210,7 +209,7 @@ sub parse_line {
$self->process_assignment($values[1], $values[2]);
}
else {
- $errorString = "ERROR: Invalid assignment name: $values[1]";
+ $errorString = "Invalid assignment name: $values[1]";
$status = 0;
}
}
@@ -219,7 +218,7 @@ sub parse_line {
$self->process_assignment_add($values[1], $values[2]);
}
else {
- $errorString = "ERROR: Invalid addition name: $values[1]";
+ $errorString = "Invalid addition name: $values[1]";
$status = 0;
}
}
@@ -228,7 +227,7 @@ sub parse_line {
$self->process_assignment_sub($values[1], $values[2]);
}
else {
- $errorString = "ERROR: Invalid subtraction name: $values[1]";
+ $errorString = "Invalid subtraction name: $values[1]";
$status = 0;
}
}
@@ -245,7 +244,7 @@ sub parse_line {
}
}
else {
- $errorString = "ERROR: Unrecognized line: $line";
+ $errorString = "Unrecognized line: $line";
$status = 0;
}
}
@@ -263,7 +262,7 @@ sub parse_exclude {
my($fh) = shift;
my($typestr) = shift;
my($status) = 0;
- my($errorString) = 'ERROR: Unable to process exclude';
+ my($errorString) = 'Unable to process exclude';
if ($typestr eq $self->get_default_component_name()) {
$typestr = $self->{'wctype'};
@@ -500,7 +499,7 @@ sub write_workspace {
my($name) = lc($self->{'project_info'}->{$project}->[0]);
if (defined $names{$name}) {
++$duplicates;
- print "ERROR: Duplicate case-insensitive project '$name'.\n";
+ $self->error("Duplicate case-insensitive project '$name'.");
}
else {
$names{$name} = 1;
@@ -515,13 +514,14 @@ sub write_workspace {
my($abort_creation) = 0;
if ($duplicates > 0) {
- print "ERROR: Duplicate project names are " .
- "not allowed within a workspace.\n";
$abort_creation = 1;
+ $error = "Duplicate case-insensitive project names are " .
+ "not allowed within a workspace.";
+ $status = 0;
}
else {
if (!defined $self->{'projects'}->[0]) {
- print "No projects were created.\n";
+ $self->information('No projects were created.');
$abort_creation = 1;
}
}
@@ -555,7 +555,7 @@ sub write_workspace {
}
}
else {
- $error = "ERROR: Unable to open $tmp for output.";
+ $error = "Unable to open $tmp for output.";
$status = 0;
}
@@ -568,7 +568,7 @@ sub write_workspace {
}
}
else {
- $error = 'ERROR: Unable to open ' . $self->getcwd() .
+ $error = 'Unable to open ' . $self->getcwd() .
"/$name for output";
$status = 0;
}
@@ -594,14 +594,12 @@ sub write_workspace {
}
}
else {
- $error = "ERROR: Unable to open $name for output.";
+ $error = "Unable to open $name for output.";
$status = 0;
}
}
}
- else {
- print "Workspace $name has not been created.\n";
- }
+
if (!$addfile) {
$self->{'per_project_workspace_name'} = undef;
}
@@ -686,7 +684,7 @@ sub generate_hierarchy {
my($status, $error) = $self->write_workspace($creator);
if (!$status) {
- print STDERR "$error\n";
+ $self->error($error);
}
$self->cd($cwd);
@@ -717,7 +715,7 @@ sub generate_hierarchy {
my($status, $error) = $self->write_workspace($creator);
if (!$status) {
- print STDERR "$error\n";
+ $self->error($error);
}
$self->cd($cwd);
}
@@ -845,7 +843,7 @@ sub generate_project_files {
my($error) = '';
($status, $error) = $self->write_workspace($creator);
if (!$status) {
- print STDERR "$error\n";
+ $self->error($error);
}
## Reset our project information to empty
@@ -1100,8 +1098,8 @@ sub sort_dependencies {
## dependencies in question may have been generated and
## that's not the users fault.
if (!$self->generate_implicit_project_dependencies()) {
- print 'WARNING: Circular dependency between ' .
- "$list[$j] and $project\n";
+ $self->warning('Circular dependency between ' .
+ "$list[$j] and $project.");
}
}
else {
@@ -1181,7 +1179,7 @@ sub number_target_deps {
sub optionError {
my($self) = shift;
my($str) = shift;
- print 'WARNING: ' . $self->get_current_input() . ": $str\n";
+ $self->warning($self->get_current_input() . ": $str.");
}
@@ -1413,8 +1411,8 @@ sub get_validated_ordering {
}
if (!$found) {
if ($warn && defined $ENV{MPC_VERBOSE_ORDERING}) {
- print "WARNING: '$name' references '$dep' which has " .
- "not been processed\n";
+ $self->warning("'$name' references '$dep' which has " .
+ "not been processed.");
}
$deps =~ s/\s*"$dep"\s*/ /g;
}