summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2003-03-21 19:08:08 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2003-03-21 19:08:08 +0000
commit18af7082322980ba8f7f0506ceac973435cc74a8 (patch)
tree6eabd02d54b960d5c9e040b20ca73d8d447f6bd3
parent5e6c06dfd6f5143f5ba12045029cfca5df28100f (diff)
downloadMPC-18af7082322980ba8f7f0506ceac973435cc74a8.tar.gz
ChangeLogTag: Fri Mar 21 13:07:09 2003 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--modules/Creator.pm32
-rw-r--r--modules/Driver.pm9
-rw-r--r--modules/Options.pm44
-rw-r--r--modules/ProjectCreator.pm29
-rw-r--r--modules/WorkspaceCreator.pm30
5 files changed, 100 insertions, 44 deletions
diff --git a/modules/Creator.pm b/modules/Creator.pm
index b7b50e83..a9905bff 100644
--- a/modules/Creator.pm
+++ b/modules/Creator.pm
@@ -24,18 +24,19 @@ use vars qw(@ISA);
# ************************************************************
sub new {
- my($class) = shift;
- my($global) = shift;
- my($inc) = shift;
- my($template) = shift;
- my($ti) = shift;
- my($relative) = shift;
- my($addtemp) = shift;
- my($addproj) = shift;
- my($progress) = shift;
- my($toplevel) = shift;
- my($type) = shift;
- my($self) = Parser::new($class);
+ my($class) = shift;
+ my($global) = shift;
+ my($inc) = shift;
+ my($template) = shift;
+ my($ti) = shift;
+ my($relative) = shift;
+ my($addtemp) = shift;
+ my($addproj) = shift;
+ my($progress) = shift;
+ my($toplevel) = shift;
+ my($baseprojs) = shift;
+ my($type) = shift;
+ my($self) = Parser::new($class);
$self->{'relative'} = $relative;
$self->{'template'} = $template;
@@ -54,6 +55,7 @@ sub new {
$self->{'reading_global'} = 0;
$self->{'global_assign'} = {};
$self->{'assign'} = {};
+ $self->{'baseprojs'} = $baseprojs;
return $self;
}
@@ -514,6 +516,12 @@ sub get_assignment {
return $self->{$tag}->{$name};
}
+
+sub get_baseprojs {
+ my($self) = shift;
+ return $self->{'baseprojs'};
+}
+
# ************************************************************
# Virtual Methods To Be Overridden
# ************************************************************
diff --git a/modules/Driver.pm b/modules/Driver.pm
index 87fe00e1..79988d38 100644
--- a/modules/Driver.pm
+++ b/modules/Driver.pm
@@ -40,7 +40,7 @@ sub new {
$self->{'path'} = $path;
$self->{'name'} = $name;
- $self->{'version'} = 1.5;
+ $self->{'version'} = 1.6;
$self->{'types'} = {};
$self->{'creators'} = \@creators;
$self->{'default'} = $creators[0];
@@ -61,7 +61,7 @@ sub optionError {
print STDERR "$base v$self->{'version'}\n" .
"Usage: $base [-global <file>] [-include <directory>] [-recurse]\n" .
$spaces . "[-ti <dll | lib | dll_exe | lib_exe>:<file>]\n" .
- $spaces . "[-template <file>] [-relative NAME=VAR]\n" .
+ $spaces . "[-template <file>] [-relative NAME=VAR] [-base <project>]\n" .
$spaces . "[-noreldefs] [-notoplevel] [-static] [-static_only]\n" .
$spaces . "[-value_template <NAME+=VAL | NAME=VAL | NAME-=VAL>]\n" .
$spaces . "[-value_project <NAME+=VAL | NAME=VAL | NAME-=VAL>]\n" .
@@ -82,6 +82,8 @@ sub optionError {
my($default) = $self->extractType($self->{'default'});
print STDERR
+" -base Add <project> as a base project to each generated\n" .
+" project file.\n" .
" -global Specifies the global input file. Values stored\n" .
" within this file are applied to all projects.\n" .
" -include Specifies a directory to search when looking for base\n" .
@@ -252,7 +254,8 @@ sub run {
$options->{'addtemp'},
$options->{'addproj'},
(-t 1 ? \&progress : undef),
- $options->{'toplevel'});
+ $options->{'toplevel'},
+ $options->{'baseprojs'});
if ($base ne $file) {
my($dir) = dirname($file);
if (!$generator->cd($dir)) {
diff --git a/modules/Options.pm b/modules/Options.pm
index 83d8d59b..2b990657 100644
--- a/modules/Options.pm
+++ b/modules/Options.pm
@@ -54,6 +54,7 @@ sub options {
my(@include) = ();
my(@input) = ();
my(@generators) = ();
+ my(@baseprojs) = ();
my(%ti) = ();
my(%relative) = ();
my(%addtemp) = ();
@@ -73,29 +74,39 @@ sub options {
print $self->completion_command($name, $types) . "\n";
return undef;
}
+ elsif ($arg eq '-base') {
+ $i++;
+ if (!defined $args[$i]) {
+ $self->optionError('-base requires an argument');
+ }
+ else {
+ push(@baseprojs, $args[$i]);
+ }
+ }
elsif ($arg eq '-type') {
$i++;
if (!defined $args[$i]) {
$self->optionError('-type requires an argument');
}
-
- my($type) = lc($args[$i]);
- if (defined $types->{$type}) {
- my($call) = $types->{$type};
- my($found) = 0;
- foreach my $generator (@generators) {
- if ($generator eq $call) {
- $found = 1;
- last;
+ else {
+ my($type) = lc($args[$i]);
+ if (defined $types->{$type}) {
+ my($call) = $types->{$type};
+ my($found) = 0;
+ foreach my $generator (@generators) {
+ if ($generator eq $call) {
+ $found = 1;
+ last;
+ }
+ }
+ if (!$found) {
+ push(@generators, $call);
}
}
- if (!$found) {
- push(@generators, $call);
+ else {
+ $self->optionError("Invalid type: $args[$i]");
}
}
- else {
- $self->optionError("Invalid type: $args[$i]");
- }
}
elsif ($arg eq '-global') {
$i++;
@@ -110,7 +121,9 @@ sub options {
if (!defined $include) {
$self->optionError('-include requires a directory argument');
}
- push(@include, $include);
+ else {
+ push(@include, $include);
+ }
}
elsif ($arg eq '-noreldefs') {
$reldefs = 0;
@@ -241,6 +254,7 @@ sub options {
'include' => \@include,
'input' => \@input,
'generators' => \@generators,
+ 'baseprojs' => \@baseprojs,
'template' => $template,
'ti' => \%ti,
'dynamic' => $dynamic,
diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm
index 24bc5b0b..68985e51 100644
--- a/modules/ProjectCreator.pm
+++ b/modules/ProjectCreator.pm
@@ -84,10 +84,12 @@ sub new {
my($addproj) = shift;
my($progress) = shift;
my($toplevel) = shift;
+ my($baseprojs) = shift;
my($self) = Creator::new($class, $global, $inc,
$template, $ti, $relative,
$addtemp, $addproj,
- $progress, $toplevel, 'project');
+ $progress, $toplevel, $baseprojs,
+ 'project');
$self->{$self->{'type_check'}} = 0;
$self->{'project_info'} = [];
@@ -222,6 +224,31 @@ sub parse_line {
## Project Beginning
## Deal with the inheritance hiearchy first
my($parents) = $values[2];
+
+ ## Add in the base projects from the command line
+ if (!$self->{'reading_global'} &&
+ !defined $self->{'reading_parent'}->[0]) {
+ my($baseprojs) = $self->get_baseprojs();
+
+ if (defined $parents) {
+ foreach my $base (@$baseprojs) {
+ my($found) = 0;
+ foreach my $parent (@$parents) {
+ if ($base eq $parent) {
+ $found = 1;
+ last;
+ }
+ }
+ if (!$found) {
+ push(@$parents, $base);
+ }
+ }
+ }
+ else {
+ $parents = $baseprojs;
+ }
+ }
+
if (defined $parents) {
foreach my $parent (@$parents) {
## Read in the parent onto ourself
diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm
index 0d9b0906..7d51b9b2 100644
--- a/modules/WorkspaceCreator.pm
+++ b/modules/WorkspaceCreator.pm
@@ -48,10 +48,12 @@ sub new {
my($addproj) = shift;
my($progress) = shift;
my($toplevel) = shift;
+ my($baseprojs) = shift;
my($self) = Creator::new($class, $global, $inc,
$template, $ti, $relative,
$addtemp, $addproj,
- $progress, $toplevel, 'workspace');
+ $progress, $toplevel, $baseprojs,
+ 'workspace');
my($typecheck) = $self->{'type_check'};
$self->{'workspace_name'} = undef;
@@ -536,17 +538,18 @@ sub project_creator {
## Set up values for each project creator
## If we have command line arguments in the workspace, then
## we process them before creating the project creator
- my(%parameters) = ('global' => $self->get_global_cfg(),
- 'include' => $self->get_include_path(),
- 'template' => $self->get_template_override(),
- 'ti' => $self->get_ti_override(),
- 'dynamic' => $self->get_dynamic(),
- 'static' => $self->get_static(),
- 'relative' => $self->get_relative(),
- 'addtemp' => $self->get_addtemp(),
- 'addproj' => $self->get_addproj(),
- 'progress' => $self->get_progress_callback(),
- 'toplevel' => 1,
+ my(%parameters) = ('global' => $self->get_global_cfg(),
+ 'include' => $self->get_include_path(),
+ 'template' => $self->get_template_override(),
+ 'ti' => $self->get_ti_override(),
+ 'dynamic' => $self->get_dynamic(),
+ 'static' => $self->get_static(),
+ 'relative' => $self->get_relative(),
+ 'addtemp' => $self->get_addtemp(),
+ 'addproj' => $self->get_addproj(),
+ 'progress' => $self->get_progress_callback(),
+ 'toplevel' => 1,
+ 'baseprojs' => $self->get_baseprojs(),
);
$self->process_cmdline(\%parameters);
@@ -562,7 +565,8 @@ sub project_creator {
$parameters{'addtemp'},
$parameters{'addproj'},
$parameters{'progress'},
- $parameters{'toplevel'});
+ $parameters{'toplevel'},
+ $parameters{'baseprojs'});
}