diff options
author | Chad Elliott <elliottc@objectcomputing.com> | 2019-05-17 09:45:55 -0500 |
---|---|---|
committer | Chad Elliott <elliottc@objectcomputing.com> | 2019-05-17 09:45:55 -0500 |
commit | d07b201048ef6556e64da7ff0c4d3e3e70f23359 (patch) | |
tree | 09aaca155c44795d301055707c278fe257fae5fe /modules/TemplateParser.pm | |
parent | 8c0ffa80ca129b431329b9d4a1ce7979dad9dfdc (diff) | |
download | MPC-d07b201048ef6556e64da7ff0c4d3e3e70f23359.tar.gz |
Fri May 17 14:42:45 UTC 2019 Chad Elliott <elliott_c@ociweb.com>
* modules/Creator.pm:
* modules/IARProjectCreator.pm:
* modules/IARWorkspaceCreator.pm:
If a project type requires relative paths, locate a relative path
when replacing $() variables if at all possible.
* modules/ProjectCreator.pm:
* modules/TemplateParser.pm:
* templates/iar.mpd:
A new template function, 'extension', can be used to get the
extension of a file. Additionally, non-template files can now be
obtained through the custom input file interface.
Diffstat (limited to 'modules/TemplateParser.pm')
-rw-r--r-- | modules/TemplateParser.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm index 723e524a..39f9762e 100644 --- a/modules/TemplateParser.pm +++ b/modules/TemplateParser.pm @@ -92,6 +92,7 @@ my %keywords = ('if' => 0, 'deref' => 0, 'set' => 0, 'is_relative' => $get_type|$doif_type|$get_combined_type, + 'extension' => $get_type, ); my %target_type_vars = ('type_is_static' => 1, @@ -388,7 +389,7 @@ sub get_value { if (!defined $value && $name =~ /^(.*)\->(\w+)/) { my $pre = $1; my $post = $2; - my $base = $self->get_value($pre); + my $base = $self->get_value($pre); if (defined $base) { $value = $self->{'prjc'}->get_special_value( @@ -2014,6 +2015,19 @@ sub handle_is_relative { } +sub get_extension { + my($self, $name) = @_; + my $val = $self->get_value_with_default($name); + return ($val =~ /(\.[^\.]+)$/ ? $1 : ''); +} + + +sub handle_extension { + my($self, $name) = @_; + $self->append_current($self->get_extension($name)); +} + + sub prepare_parameters { my($self, $prefix) = @_; my $input = $self->get_value($prefix . '->input_file'); |