summaryrefslogtreecommitdiff
path: root/bin/MakeProjectCreator/modules/BorlandProjectCreator.pm
blob: 2c45a070d299de9520c1f56b90efbaa60f97cafd (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
package BorlandProjectCreator;

# ************************************************************
# Description   : A Borland Project Creator
# Author        : Chad Elliott
# Create Date   : 3/14/2002
# ************************************************************

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

use strict;

use ProjectCreator;
use File::Basename;

use vars qw(@ISA);
@ISA = qw(ProjectCreator);

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

sub dollar_special {
  #my($self) = shift;
  return 1;
}


sub fill_value {
  my($self)  = shift;
  my($name)  = shift;
  my($value) = undef;
  my(%names) = ('cppdir' => 'source_files',
                'rcdir'  => 'resource_files',
               );

  if (defined $names{$name}) {
    my(%dirnames) = ();
    foreach my $file ($self->get_component_list($names{$name}, 1)) {
      my($dirname) = $self->mpc_dirname($file);
      if ($dirname eq '') {
        $dirname = '.';
      }
      elsif ($self->convert_slashes()) {
        $dirname = $self->slash_to_backslash($dirname);
      }
      $dirnames{$dirname} = 1;
    }

    ## Sort the directories to ensure that '.' comes first
    $value = join(';', sort keys %dirnames);
  }
  elsif ($name eq 'relwd') {
    my($useenv) = $self->get_use_env();
    my($rel)    = ($useenv ? \%ENV : $self->get_relative());
    $value = $self->getcwd();

    foreach my $key (keys %$rel) {
      ## Do not use PWD or CD if we are expanding environment variables.
      ## They could conflict with the "real" values we're looking for.
      if ($useenv && ($key eq 'PWD' || $key eq 'CD')) {
        next;
      }

      ## Get the relative replacement value and convert back-slashes
      my($val) = $$rel{$key};
      $val =~ s/\\/\//g;

      ## We only need to check for reverse replacement if the length
      ## of the string is less than or equal to the length of our
      ## replacement value or the string has a slash at the position
      ## of the length of the replacement value
      my($vlen) = length($val);
      if (length($value) <= $vlen || substr($value, $vlen, 1) eq '/') {
        ## Cut the string down by the length of the replacement value
        my($lval) = substr($value, 0, $vlen);

        ## Here we make an assumption that we
        ## have a case-insensitive file system.
        if (lc($lval) eq lc($val)) {
          substr($value, 0, length($val) + 1) = '';
          last;
        }
      }
    }
    $value = $self->slash_to_backslash($value);
  }

  return $value;
}


sub project_file_name {
  my($self) = shift;
  my($name) = shift;

  if (!defined $name) {
    $name = $self->project_name();
  }

  return $self->get_modified_project_file_name($name, '.bor');
}


sub get_dll_exe_template_input_file {
  #my($self) = shift;
  return 'borexe';
}


sub get_dll_template_input_file {
  #my($self) = shift;
  return 'bordll';
}


sub get_template {
  #my($self) = shift;
  return 'bor';
}


1;