summaryrefslogtreecommitdiff
path: root/modules/WB30ProjectCreator.pm
blob: 4a64382fd33391282df107649901dec5618567cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package WB30ProjectCreator;

# ************************************************************
# Description   : Wind River Workbench 3.0 generator
# Author        : Adam Mitz (Object Computing, Inc.)
# Create Date   : 07/21/2010
# ************************************************************

# ************************************************************
# Pragmas
# ************************************************************

use strict;

use WB26ProjectCreator;
use XMLProjectBase;

use vars qw(@ISA);
@ISA = qw(XMLProjectBase WB26ProjectCreator);

# ************************************************************
# Data Section
# ************************************************************

my %templates = ('wb26'           => '.project',
                 'wb26wrproject'  => '.wrproject',
                 'wb26wrmakefile' => '.wrmakefile',
                 'wb30cproject'   => '.cproject');

my @tkeys = sort keys %templates;

# ************************************************************
# Subroutine Section
# ************************************************************

sub project_file_name {
  my($self, $name, $template) = @_;

  ## Fill in the name and template if they weren't provided
  $name = $self->project_name() if (!defined $name);
  $template = 'wb26' if (!defined $template || !defined $templates{$template});

  if ($self->{'make_coexistence'}) {
    return $self->get_modified_project_file_name("wb_$name",
                                                 '/' . $templates{$template});
  }
  else {
    return $templates{$template};
  }
}

sub post_file_creation {
  my($self, $file) = @_;
  if ($file =~ /$templates{'wb26wrmakefile'}$/) {
    my @lines;
    if (open(IN, $file)) {
      while(<IN>) {
        s/\\&quot;/\\"/g;
        s/&quot;/"/g;
        s/&gt;/>/g;
        s/&lt;/</g;
        s/&amp;/&/g;
        push(@lines, $_);
      }
      close(IN);
    }
    else {
      return "Can't open $file for post-processing input.";
    }
    if (open(OUT, ">$file")) {
      print OUT @lines;
      close(OUT);
    }
    else {
      return "Can't open $file for post-processing output.";
    }
  }
  return undef;
}

sub get_template {
  #my $self = shift;
  return @tkeys;
}

sub get_dll_exe_template_input_file {
  #my $self = shift;
  return 'wb30exe';
}

sub get_dll_template_input_file {
  #my $self = shift;
  return 'wb30dll';
}

1;