Test zlib on linux
[MPC.git] / modules / WB30ProjectCreator.pm
blob4a64382fd33391282df107649901dec5618567cd
1 package WB30ProjectCreator;
3 # ************************************************************
4 # Description : Wind River Workbench 3.0 generator
5 # Author : Adam Mitz (Object Computing, Inc.)
6 # Create Date : 07/21/2010
7 # ************************************************************
9 # ************************************************************
10 # Pragmas
11 # ************************************************************
13 use strict;
15 use WB26ProjectCreator;
16 use XMLProjectBase;
18 use vars qw(@ISA);
19 @ISA = qw(XMLProjectBase WB26ProjectCreator);
21 # ************************************************************
22 # Data Section
23 # ************************************************************
25 my %templates = ('wb26' => '.project',
26 'wb26wrproject' => '.wrproject',
27 'wb26wrmakefile' => '.wrmakefile',
28 'wb30cproject' => '.cproject');
30 my @tkeys = sort keys %templates;
32 # ************************************************************
33 # Subroutine Section
34 # ************************************************************
36 sub project_file_name {
37 my($self, $name, $template) = @_;
39 ## Fill in the name and template if they weren't provided
40 $name = $self->project_name() if (!defined $name);
41 $template = 'wb26' if (!defined $template || !defined $templates{$template});
43 if ($self->{'make_coexistence'}) {
44 return $self->get_modified_project_file_name("wb_$name",
45 '/' . $templates{$template});
47 else {
48 return $templates{$template};
52 sub post_file_creation {
53 my($self, $file) = @_;
54 if ($file =~ /$templates{'wb26wrmakefile'}$/) {
55 my @lines;
56 if (open(IN, $file)) {
57 while(<IN>) {
58 s/\\&quot;/\\"/g;
59 s/&quot;/"/g;
60 s/&gt;/>/g;
61 s/&lt;/</g;
62 s/&amp;/&/g;
63 push(@lines, $_);
65 close(IN);
67 else {
68 return "Can't open $file for post-processing input.";
70 if (open(OUT, ">$file")) {
71 print OUT @lines;
72 close(OUT);
74 else {
75 return "Can't open $file for post-processing output.";
78 return undef;
81 sub get_template {
82 #my $self = shift;
83 return @tkeys;
86 sub get_dll_exe_template_input_file {
87 #my $self = shift;
88 return 'wb30exe';
91 sub get_dll_template_input_file {
92 #my $self = shift;
93 return 'wb30dll';