summaryrefslogtreecommitdiff
path: root/modules/VC6WorkspaceCreator.pm
blob: cd54f83bd9f40b170e38d474887f08e6e2ab0761 (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
package VC6WorkspaceCreator;

# ************************************************************
# Description   : A VC6 Workspace Creator
# Author        : Chad Elliott
# Create Date   : 5/13/2002
# ************************************************************

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

use strict;

use VC6ProjectCreator;
use WinWorkspaceBase;
use WorkspaceCreator;
use VCPropertyBase;

use vars qw(@ISA);
@ISA = qw(VCPropertyBase WinWorkspaceBase WorkspaceCreator);

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


sub compare_output {
  #my $self = shift;
  return 1;
}


sub workspace_file_extension {
  #my $self = shift;
  return '.dsw';
}


sub pre_workspace {
  my($self, $fh) = @_;
  my $crlf = $self->crlf();

  ## This identifies it as a Visual C++ file
  print $fh 'Microsoft Developer Studio Workspace File, Format Version 6.00', $crlf;

  ## Optionally print the workspace comment
  $self->print_workspace_comment($fh,
            '#', $crlf,
            '# This file was generated by MPC.  Any changes made directly to', $crlf,
            '# this file will be lost the next time it is generated.', $crlf,
            '#', $crlf,
            '# MPC Command:', $crlf,
            '# ', $self->create_command_line_string($0, @ARGV), $crlf, $crlf);
}


sub write_comps {
  my($self, $fh, $gen) = @_;
  my $projects = $self->get_projects();
  my $pjs = $self->get_project_info();
  my $crlf = $self->crlf();

  ## Sort the project so that they resulting file can be exactly
  ## reproduced given the same list of projects.
  foreach my $project (sort { $gen->file_sorter($a, $b) } @$projects) {

    ## Add the project name and project file information
    print $fh "###############################################################################$crlf$crlf",
              'Project: "', $$pjs{$project}->[ProjectCreator::PROJECT_NAME],
              '"=', $self->slash_to_backslash($project),
              " - Package Owner=<4>$crlf$crlf",
              "Package=<5>$crlf", '{{{', $crlf, "}}}$crlf$crlf",
              "Package=<4>$crlf", '{{{', $crlf;

    my $deps = $self->get_validated_ordering($project);
    if (defined $$deps[0]) {
      ## Add in the project dependencies
      foreach my $dep (@$deps) {
        print $fh "    Begin Project Dependency$crlf",
                  "    Project_Dep_Name $dep$crlf",
                  "    End Project Dependency$crlf";
      }
    }

    ## End the project section
    print $fh "}}}$crlf$crlf";
  }
}


sub post_workspace {
  my($self, $fh) = @_;
  my $crlf = $self->crlf();

  ## This text is always the same
  print $fh "###############################################################################$crlf$crlf",
            "Global:$crlf$crlf",
            "Package=<5>$crlf", '{{{', "$crlf}}}$crlf$crlf",
            "Package=<3>$crlf", '{{{', "$crlf}}}$crlf$crlf",
            "###############################################################################$crlf$crlf";
}


1;