diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2002-11-08 18:59:24 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2002-11-08 18:59:24 +0000 |
commit | e62e759b7176231673f0fbbf9c372ef88abd540b (patch) | |
tree | 2f08004f907835169d6d224fba463ca74a26de51 /bin | |
parent | 7716ffa6a9aa66edf53fdea256ac783fad2bcdf5 (diff) | |
download | ATCD-e62e759b7176231673f0fbbf9c372ef88abd540b.tar.gz |
ChangeLogTag: Fri Nov 8 12:57:57 2002 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'bin')
-rw-r--r-- | bin/MakeProjectCreator/README | 14 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/ProjectCreator.pm | 85 | ||||
-rw-r--r-- | bin/MakeProjectCreator/modules/TemplateParser.pm | 18 | ||||
-rw-r--r-- | bin/MakeProjectCreator/templates/gnu.mpd | 12 |
4 files changed, 114 insertions, 15 deletions
diff --git a/bin/MakeProjectCreator/README b/bin/MakeProjectCreator/README index 56c382c6153..8b69baa3bdc 100644 --- a/bin/MakeProjectCreator/README +++ b/bin/MakeProjectCreator/README @@ -112,6 +112,20 @@ depends Specifies 1 or more project names upon which this project depend dllflags (Windows Only) Specifies preprocessor flags needed for dll's libflags (Windows Only) Specifies preprocessor flags needed for lib's +verbatim This allows arbitrary information to be place in a generated + project file. The syntax is as follows: + + verbatim(<project type>, <location>) { + .. + .. + } + + When MPC is generating a project of type <project type> and + comes upon a marker that matches the <location> name, it + will place the text found inside the construct directly into + the generated project. If you need to preserve whitespace, + the line or lines should be placed inside double quotes. + The Following are GNU only: requires Specifies which tao macros should be set to build the target avoids Specifies which tao macros should not be set to build the target diff --git a/bin/MakeProjectCreator/modules/ProjectCreator.pm b/bin/MakeProjectCreator/modules/ProjectCreator.pm index e460e578690..fe13bb5e6e2 100644 --- a/bin/MakeProjectCreator/modules/ProjectCreator.pm +++ b/bin/MakeProjectCreator/modules/ProjectCreator.pm @@ -104,6 +104,9 @@ sub new { $self->{'want_static_projects'} = $static; $self->{'flag_overrides'} = {}; + ## Set up the verbatim constructs + $self->{'verbatim'} = {}; + ## Valid component names within a project along with the valid file extensions my(%vc) = ('source_files' => [ "\\.cpp", "\\.cxx", "\\.cc", "\\.c", "\\.C", ], 'template_files' => [ "_T\\.cpp", "_T\\.cxx", "_T\\.cc", "_T\\.c", "_T\\.C", ], @@ -205,7 +208,8 @@ sub parse_line { foreach my $key (keys %{$self->{'valid_components'}}) { delete $self->{$key}; } - $self->{'assign'} = {}; + $self->{'assign'} = {}; + $self->{'verbatim'} = {}; } } $self->{$typecheck} = 0; @@ -228,10 +232,9 @@ sub parse_line { } if (defined $file) { - my($rp) = $self->{'reading_parent'}; - push(@$rp, 1); + push(@{$self->{'reading_parent'}}, 1); $status = $self->parse_file($file); - pop(@$rp); + pop(@{$self->{'reading_parent'}}); if (!$status) { $errorString = "ERROR: Invalid parent: $parent"; @@ -314,8 +317,17 @@ sub parse_line { } } else { - $errorString = "ERROR: Invalid component name: $comp"; - $status = 0; + 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"; + $status = 0; + } + } + else { + $errorString = "ERROR: Invalid component name: $comp"; + $status = 0; + } } } else { @@ -438,6 +450,41 @@ sub parse_components { } +sub parse_verbatim { + my($self) = shift; + my($fh) = shift; + my($tag) = shift; + my($type) = shift; + my($loc) = shift; + + ## All types are lowercase + $type = lc($type); + + if (!defined $self->{'verbatim'}->{$type}) { + $self->{'verbatim'}->{$type} = {}; + } + $self->{'verbatim'}->{$type}->{$loc} = []; + my($array) = $self->{'verbatim'}->{$type}->{$loc}; + + while(<$fh>) { + my($line) = $self->strip_line($_); + + if ($line eq "") { + } + elsif ($line =~ /^}/) { + ## This is not an error, + ## this is the end of the components + last; + } + else { + push(@$array, $line); + } + } + + return 1; +} + + sub process_assignment { my($self) = shift; my($name) = shift; @@ -1384,6 +1431,32 @@ sub update_project_info { } +sub get_verbatim { + my($self) = shift; + my($marker) = shift; + my($type) = lc(substr("$self", 0, 3)); ## This number corresponds to + ## signif in Driver.pm + my($str) = undef; + my($thash) = $self->{'verbatim'}->{$type}; + + if (defined $thash) { + if (defined $thash->{$marker}) { + my($crlf) = $self->crlf(); + foreach my $line (@{$thash->{$marker}}) { + if (!defined $str) { + $str = ""; + } + $str .= $self->process_special($line) . $crlf; + } + if (defined $str) { + $str .= $crlf; + } + } + } + return $str; +} + + # ************************************************************ # Virtual Methods To Be Overridden # ************************************************************ diff --git a/bin/MakeProjectCreator/modules/TemplateParser.pm b/bin/MakeProjectCreator/modules/TemplateParser.pm index 03e01a36aa9..ce76cde094f 100644 --- a/bin/MakeProjectCreator/modules/TemplateParser.pm +++ b/bin/MakeProjectCreator/modules/TemplateParser.pm @@ -26,7 +26,7 @@ my(@keywords) = ('if', 'else', 'endif', 'noextension', 'dirname', 'basename', 'basenoextension', 'foreach', 'forfirst', 'fornotfirst', 'fornotlast', 'forlast', 'endfor', - 'comment', 'flag_overrides', + 'comment', 'flag_overrides', 'marker', ); # ************************************************************ @@ -666,6 +666,19 @@ sub handle_flag_overrides { } +sub handle_marker { + my($self) = shift; + my($name) = shift; + + if (!$self->{'if_skip'}) { + my($value) = $self->{'prjc'}->get_verbatim($name); + if (defined $value) { + $self->append_current($value); + } + } +} + + ## Given a line that starts with an identifier, we split ## then name from the possible value stored inside ()'s and ## we stop looking at the line when we find the %> ending @@ -744,6 +757,9 @@ sub process_name { elsif ($name eq 'flag_overrides') { $self->handle_flag_overrides($val); } + elsif ($name eq 'marker') { + $self->handle_marker($val); + } elsif ($name eq 'noextension') { $self->handle_noextension($val); } diff --git a/bin/MakeProjectCreator/templates/gnu.mpd b/bin/MakeProjectCreator/templates/gnu.mpd index 107d1065284..2319bccfe0d 100644 --- a/bin/MakeProjectCreator/templates/gnu.mpd +++ b/bin/MakeProjectCreator/templates/gnu.mpd @@ -1,7 +1,7 @@ #---------------------------------------------------------------------------- # GNU Makefile #---------------------------------------------------------------------------- - +<%marker(top)%> MAKEFILE = <%project_file%> DEPENDENCY_FILE = .depend.<%project_file%> <%if(exename)%> @@ -73,6 +73,7 @@ endif #---------------------------------------------------------------------------- # Include macros and targets #---------------------------------------------------------------------------- +<%marker(macros)%> include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU <%if(tao)%> include $(TAO_ROOT)/rules.tao.GNU @@ -176,6 +177,7 @@ TAO_IDLFLAGS += <%idlflags%> #---------------------------------------------------------------------------- # Local targets #---------------------------------------------------------------------------- +<%marker(local)%> <%comptarget%> <%if(idl_files)%> @@ -224,10 +226,4 @@ realclean: clean <%compclean%> -$(RM) $(foreach ext, $(IDL_EXT), $(foreach file, $(IDL_FILES), $(file)$(ext))) <%endif%> -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY +<%marker(bottom)%>
\ No newline at end of file |