home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Lighthouse Design Suite
/
LIGHTHOUSE.mdf
/
TaskMaster_1.8
/
Application
/
FilterServicer.service
/
mp2tm
< prev
next >
Wrap
Text File
|
1993-09-02
|
5KB
|
211 lines
#
# mp2tm
#
# This file when used as input to perl will take a file in the PXF file
# format from MacProject and translate it into a TaskMaster project file.
#
# Copyright (C) 1993 Lighthouse Design Ltd.
#
# You may freely copy, distribute, and reuse the code in
# this example provided this copyright legend and disclaimer
# are preserved in all copies and derivative work.
#
# Lighthouse Design disclaims any warranty of any kind,
# expressed or implied, as to this code's fitness
# for any particular use.
#
if($ARGV[0] eq "-t"){
require "writetm.pl";
foreach $file (@ARGV) {
print "Trying $file...\n";
if (! open(TEXTFILE,"< $file")) {
printf(STDERR "$file not readable. Skipping $file\n");
next;
}
$dirName = ".";
if ($file =~ /\//) {
$dirName = $file;
$dirName =~ s/\/[^\/]$//;
}
$tmFilename = "/tmp/TEST.taskmaster";
$interfaceFilename = "";
&doFile();
close(TEXTFILE);
}
}else{
require "$ARGV[2]/writetm.pl";
if (!open(TEXTFILE,"< $ARGV[0]")) {
printf(STDERR "$ARGV[0] not readable. Skipping $ARGV[0]\n");
exit 0;
}
$tmFilename = $ARGV[1];
$interfaceFilename = "$ARGV[2]/ObjectArchive.tmoa";
&doFile();
close(TEXTFILE);
}
sub doFile {
$inMacProject = 0;
$lineNumber = 1;
$inTasks = 0;
$inResources = 0;
$inDependencies = 0;
$inAssignments = 0;
$skipNextRow = 0;
$taskCounter = 1;
$resourceCounter = 3;
$dependencyCounter = 0;
$assignmentCounter = 0;
select((select(STDERR), $| = 1)[0]);
$| = 1;
while ($separator ne "\015" && $separator ne "\012"){
if(!read(TEXTFILE, $separator, 1)){
print STDERR "\n\n";
print "Couldn't find line separator.\n\n";
exit 0;
}
}
$/ = $separator;
while(<TEXTFILE>){
$skipNextRow == 1 && do {
$skipNextRow = 0;
next;
};
/^Project Table\t([0-9]+)\t([0-9]+)/ && !$inTasks && do{
$inTasks = 1;
$numTasks = 0;
$numColumns = $1;
$skipNextRow = 1;
print "Tasks...\n\n" unless $silent;
next;
};
/^Resource Table\t([0-9]+)\t([0-9]+)/ && !$inResources && do{
$inTasks = 0;
$inResources = 1;
$numColumns = $1;
$skipNextRow = 1;
print "Resources...\n\n" unless $silent;
next;
};
/^Dependency Table\t([0-9]+)\t([0-9]+)/ && !$inDependencies && do{
$inResources = 0;
$inDependencies = 1;
$numColumns = $1;
$skipNextRow = 1;
print "Dependencies...\n\n" unless $silent;
next;
};
/^Allocation Table\t([0-9]+)\t([0-9]+)/ && !$inAssignments && do{
$inDependencies = 0;
$inAssignments = 1;
$numColumns = $1;
$skipNextRow = 1;
print "Assignments...\n\n" unless $silent;
next;
};
/^Calendars/ && $inAssignments && do {
$inAssignments = 0;
$inCalendars = 1;
$skipNextRow = 1;
print "Calendars...\n\n" unless $silent;
next;
};
if($inTasks){
@currentRow = split(/\t\t/);
if($currentRow[35] eq "Outline Summary"){
$currentRow[35] = "Group";
}else{
$currentRow[35] = "Task";
}
if($currentRow[42]){
if($currentRow[42] eq "Start On"){
$constraint = "StartOn";
}elsif($currentRow[42] eq "Start No Earlier Than"){
$constraint = "StartEarliestAfter";
}elsif($currentRow[42] eq "Start No Later Than"){
$constraint = "StartOn";
}elsif($currentRow[42] eq "Early Start"){
$constraint = "Earliest";
}
$constraintDate = $currentRow[6];
}elsif($currentRow[43]){
if($currentRow[43] eq "Finish On"){
$constraint = "EndOn";
}elsif($currentRow[43] eq "Finish No Earlier Than"){
$constraint = "EndOn";
}elsif($currentRow[43] eq "Finish No Later Than"){
$constraint = "EndEarliestBefore";
}elsif($currentRow[43] eq "Late Finish"){
$constraint = "Latest";
}
$constraintDate = $currentRow[7];
}else{
$constraint = "Earliest";
$constraintDate = "1/1/1970 0:00:00";
}
&addTask($currentRow[3], $currentRow[0], $currentRow[35], $currentRow[5], $currentRow[22], $currentRow[12], $constraint, $constraintDate, $currentRow[25], $currentRow[38]-99, $curretRow[40], $currentRow[1]);
};
if($inResources){
@currentRow = split(/\t\t/);
&addResource($currentRow[0], $currentRow[0], $currentRow[2], $currentRow[1], 0, $currentRow[3]);
};
if($inDependencies){
@currentRow = split(/\t\t/);
&addDependency($currentRow[1], $currentRow[3]);
};
if($inAssignments){
@currentRow = split(/\t\t/);
&addAssignment($currentRow[2], $currentRow[5], $currentRow[6], $currentRow[7], $currentRow[8]/100.0);
};
if($inCalendars){
@currentRow = split(/\t/);
if ($currentRow[0] eq "\n"){
next;
}
$index = 0;
for($ct = 1; $ct <= 19; $ct += 3){
if($currentRow[$ct] eq "True"){
$hours[$index] = $currentRow[$ct+1];
}
$index++;
}
@holidays = ();
for($ct = 22; $ct < $#currentRow; $ct++){
if($currentRow[$ct]){
push(@holidays, $currentRow[$ct]);
}
}
&addCalendar($currentRow[0], $hours[0], $hours[1], $hours[2], $hours[3], $hours[4], $hours[5], $hours[6], @holidays);
if($currentRow[0] eq "Default Calendar"){
&setDefaultCalendar($currentRow[0]);
}
}
next;
};
&outputToFile($tmFilename, $interfaceFilename);
}