sbsv1/abld/test/fixeabidefs.bat
author Zheng Shen <zheng.shen@nokia.com>
Mon, 30 Aug 2010 15:04:06 +0800
changeset 631 9435b9008a58
parent 599 fa7a3cc6effd
permissions -rw-r--r--
ROM Tools 13.1.0.1 Bug468 initialized static data built into a static library does not get initialized correctly
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
@rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
@rem All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
@rem This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
@rem under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
@rem which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
@rem Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
@rem Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
@rem Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
@rem Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
@rem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
@rem = '--*-Perl-*--
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
@echo off
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
if "%OS%" == "Windows_NT" goto WinNT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
:WinNT
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
perl -x -S "%0" %*
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
if %errorlevel% == 9009 echo You do not have Perl in your PATH.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
goto endofperl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
@rem ';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
#!perl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
#line 14
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
use strict;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
use Getopt::Long;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
my $toolVersion = 1.0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
my $RVCTVersion = 2.1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
my $RVCTBuild = 416;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
my @redundantExportsRegEx = (qr/^_ZTI/, qr/^_ZTV/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
# 1. Check arguments, output help etc.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
if (@ARGV == 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
	print (STDERR "\nFIXEABIDEFS.BAT - Version $toolVersion for RVCT$RVCTVersion b$RVCTBuild\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
	print STDERR << 'END_OF_HELP';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
Usage: fixeabidefs.bat [-analyse|-list|-update] build_log.log 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
Parses the output from build_log.log and locates all MAKEDEF errors where ARMV5 built
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
object files do not include exports specified in the current, frozen, EABI .def file.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
Where this has occurred, the tool checks against an internal list to determine
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
whether these are redundant exports that are no longer required.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
-analyse  Process MAKEDEF errors and warnings list .def files that cannot be updated by this tool.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
-list     Lists all .def files that will be updated by the tool.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
-update   Creates updated .def files with redundant exports removed.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
Updated .def files have redundant exports removed by "back-filling" from unfrozen exports
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
flagged against the same .def file.  If no unfrozen exports are available, the "ABSENT"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
export placeholder is used to effectively remove the export, but maintain a degree of BC.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
NOTE: The tool assumes that the original build source layout is replicated on the drive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
where it is being executed.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
Redundant exports processed on the following regex:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
END_OF_HELP
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	foreach my $redundantExportRegEx (@redundantExportsRegEx)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
		print ("\t$redundantExportRegEx\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	exit(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
my $list = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
my $update = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
my $analyse = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
GetOptions ('list' => \$list, 'update' => \$update, 'analyse' => \$analyse);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
# 2. Parse the log and record the detail of all relevant MAKEDEF errors and warnings
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
my $BUILD_LOG = $ARGV[0];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
open BUILD_LOG, "< $BUILD_LOG" or die "\nCan't read $BUILD_LOG!\n\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
my $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
my @buildLog;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
while ($line = <BUILD_LOG>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
	push @buildLog, $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
close BUILD_LOG;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
my $defFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
my $export;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
my $processExport;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
my $variant;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
# All hashes keyed on fully pathed .def file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
my %impactedDefFiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
my %missingURELExports;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
my %missingUDEBExports;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
my %unfrozenURELExports;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
my %unfrozenUDEBExports;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
my $parseWarning = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
my $parseError = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
my @exports;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
# Scan the log and build up UREL and UDEB lists of unfrozen and missing exports
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
foreach $line (@buildLog)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
	if (($line !~ /^  /))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
		if ($parseError)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
			$variant =~ /UREL/ ? push @{$missingURELExports{$defFile}}, [@exports] : push @{$missingUDEBExports{$defFile}}, [@exports];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
			$parseError = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
			$impactedDefFiles{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
		elsif ($parseWarning)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
			$variant =~ /UREL/ ? push @{$unfrozenURELExports{$defFile}}, [@exports] : push @{$unfrozenUDEBExports{$defFile}}, [@exports];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
			$parseWarning = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
			$impactedDefFiles{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
		@exports = ();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
	if ($line =~ /^  make.* CFG\=/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
		$variant = $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
		$variant =~ s/^.*CFG\=//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
		$variant =~ s/ .*$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
		$variant =~ s/\s//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
		next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
	if ($line =~ /MAKEDEF WARNING:.*not yet Frozen in/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
		{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
		$parseError = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
		$parseWarning = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
		$defFile = $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
		$defFile =~ s/^.*not yet Frozen in//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
		$defFile =~ s/:$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
		$defFile =~ s/\s//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
		$defFile = lc $defFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
		next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
	if ($line =~ /MAKEDEF ERROR:/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
		$parseError = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
		$parseWarning = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
		next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
	if (($line =~ /^  /) && ($parseError || $parseWarning))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
		{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
		$export = $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
		$export =~ s/^.* : //;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
		$export =~ s/ .*$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
		$export =~ s/\s//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
		if ($parseError)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
			$defFile = $line;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
			$defFile =~ s/\(.*$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
			$defFile =~ s/\s//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
			$defFile = lc $defFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
		push @exports, $export;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
		next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
my %validDefFiles = %impactedDefFiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
my %missingExportDifferences;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
my %unfrozenExportDifferences;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
my %sharedDifferences;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
my $redundantExportRegEx;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
my %invalidExports;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
my $validExport;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
my $URELelements;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
my $UDEBelements;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
my $index1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
my $index2;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
foreach $defFile (sort keys %impactedDefFiles)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
	if ($missingURELExports{$defFile})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
		{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
		$URELelements = @{$missingURELExports{$defFile}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
		$UDEBelements = @{$missingUDEBExports{$defFile}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
		for ($index1 = 0; $index1 < $URELelements; $index1++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
			foreach $export (@{@{$missingURELExports{$defFile}}[$index1]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
				for ($index2 = 0; $index2 < $UDEBelements; $index2++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
					if (!grep (/$export/, @{@{$missingUDEBExports{$defFile}}[$index2]}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
						if (!$index1 && !$index2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
							$missingExportDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
							$sharedDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
						delete $validDefFiles{$defFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
				$validExport = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
				foreach $redundantExportRegEx (@redundantExportsRegEx)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
					if ($export =~ /$redundantExportRegEx/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
						$validExport = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
				if (!$validExport)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
					${$invalidExports{$defFile}}{$export} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
					delete $validDefFiles{$defFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
		for ($index1 = 0; $index1 < $URELelements; $index1++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
			foreach $export (@{@{$missingUDEBExports{$defFile}}[$index1]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
				for ($index2 = 0; $index2 < $URELelements; $index2++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
					if (!grep (/$export/, @{@{$missingURELExports{$defFile}}[$index2]}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
						if (!$index1 && !$index2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
							$missingExportDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
							$sharedDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
							
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
						delete $validDefFiles{$defFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
				$validExport = 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
				foreach $redundantExportRegEx (@redundantExportsRegEx)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
					if ($export =~ /$redundantExportRegEx/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
						$validExport = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
				if (!$validExport)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
					${$invalidExports{$defFile}}{$export} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
					delete $validDefFiles{$defFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
	if (!$unfrozenURELExports{$defFile} && $unfrozenUDEBExports{$defFile})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
		$unfrozenExportDifferences{$defFile}  = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
	elsif ($unfrozenURELExports{$defFile})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
		$URELelements = @{$unfrozenURELExports{$defFile}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
		$UDEBelements = @{$unfrozenUDEBExports{$defFile}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
		for ($index1 = 0; $index1 < $URELelements; $index1++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
			foreach $export (@{@{$unfrozenURELExports{$defFile}}[$index1]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
				for ($index2 = 0; $index2 < $UDEBelements; $index2++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
					if (!grep (/$export/, @{@{$unfrozenUDEBExports{$defFile}}[$index2]}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
						if (!$index1 && !$index2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
							$unfrozenExportDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
							delete $validDefFiles{$defFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
							$sharedDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
		for ($index1 = 0; $index1 < $URELelements; $index1++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
			foreach $export (@{@{$unfrozenUDEBExports{$defFile}}[$index1]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
				for ($index2 = 0; $index2 < $URELelements; $index2++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
					if (!grep (/$export/, @{@{$unfrozenURELExports{$defFile}}[$index2]}))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
						if (!$index1 && !$index2)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
							$unfrozenExportDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
							delete $validDefFiles{$defFile};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
							$sharedDifferences{$defFile} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
if ($analyse)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
	if (%missingExportDifferences)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
		print ("\nThe following .def files differ in the number of missing exports between UREL and UDEB builds.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
		print ("These files will not be treated by this tool.\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
		foreach $defFile (sort keys %missingExportDifferences)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
			print ("\t$defFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
	if (%unfrozenExportDifferences)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
		{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
		print ("\nThe following .def files differ in the number of unfrozen exports between UREL and UDEB builds.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
		print ("These files will be or were back-filled with regard to any UREL unfrozen exports available.");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
		print ("If no UREL unfrozen exports are available, the classes in question have to be marked non-sharable.\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
		foreach $defFile (sort keys %unfrozenExportDifferences)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
			print ("\t$defFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
	if (%sharedDifferences)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
		print ("\nThe following .def files are shared between multiple components, and differ in exports\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
		print ("between either UDEB or UREL builds, or between the build of the components from which they are used.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
		print ("These files will not be treated by this tool.\n\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
		foreach $defFile (sort keys %sharedDifferences)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
			print ("\t$defFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
	if (%invalidExports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
		print ("\nThe following .def files contain missing exports that cannot be resolved by this tool.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
		foreach $defFile (sort keys %invalidExports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
			print ("\n\t$defFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
			foreach $export (sort keys %{$invalidExports{$defFile}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
				print ("\t\t$export\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
	if (!%missingExportDifferences && !%unfrozenExportDifferences && !%sharedDifferences && !%invalidExports)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
		print ("\nAll MAKEDEF ERRORs and WARNINGs in the specified log can be treated by this tool.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
if ($list)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
	foreach $defFile (sort keys %validDefFiles)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
		print ("$defFile\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
if ($update)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
	my %updatedDefFiles;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
	my $missingExport;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418
	my $unfrozenExport;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   419
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   420
	foreach $defFile (keys %validDefFiles)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   421
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   422
		if (!open DEF_FILE, "< $defFile")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   423
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   424
			print "Can't read $defFile!\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   425
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   426
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   427
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   428
		while ($line = <DEF_FILE>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   429
		 	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   430
		 		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   431
# Either Back-fill or make 'ABSENT' any missing exports
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   432
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   433
			if ($missingURELExports{$defFile})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   434
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   435
				foreach $missingExport (@{@{$missingURELExports{$defFile}}[0]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   436
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   437
					if ($line =~ /$missingExport/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   438
						{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   439
						$unfrozenExport = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   440
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   441
						if ($unfrozenURELExports{$defFile})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   442
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   443
							$unfrozenExport = pop @{@{$unfrozenURELExports{$defFile}}[0]};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   444
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   445
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   446
						if ($unfrozenExport)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   447
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   448
							$line =~ s/$missingExport/$unfrozenExport/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   449
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   450
							# If there's an existing comment section, then update it appropriately
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   451
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   452
							my $commentUpdate = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   453
					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   454
							if ($unfrozenExport =~ /^_ZTV/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   455
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   456
								$commentUpdate = '; #<VT>#';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   457
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   458
							elsif ($unfrozenExport =~ /^_ZTI/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   459
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   460
								$commentUpdate = '; #<TI>#';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   461
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   462
					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   463
							$line =~ s/;.*$/$commentUpdate/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   464
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   465
						else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   466
							{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   467
							if ($line =~ / \;/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   468
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   469
								$line =~ s/ \;/ ABSENT \;/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   470
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   471
							else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   472
								{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   473
								$line.= ' ABSENT';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   474
								}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   475
							}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   476
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   477
						$line .= "\n" unless ($line =~ /\n$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   478
							
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   479
						last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   480
						}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   481
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   482
			 	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   483
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   484
			push (@{$updatedDefFiles{$defFile}}, $line);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   485
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   486
		close DEF_FILE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   487
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   488
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   489
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   490
# Resolve any remaining unfrozen exports in the standard way
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   491
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   492
	my $lastExportIndex;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   493
	my $lastExportOrdinal;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   494
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   495
	foreach $defFile (keys %updatedDefFiles)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   496
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   497
		if ($unfrozenURELExports{$defFile} && @{@{$unfrozenURELExports{$defFile}}[0]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   498
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   499
			$lastExportIndex = @{$updatedDefFiles{$defFile}}-1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   500
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   501
			while (@{$updatedDefFiles{$defFile}}[$lastExportIndex] =~ /^\s$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   502
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   503
				pop @{$updatedDefFiles{$defFile}};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   504
				$lastExportIndex--;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   505
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   506
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   507
			@{$updatedDefFiles{$defFile}}[$lastExportIndex] .= "\n" unless (@{$updatedDefFiles{$defFile}}[$lastExportIndex] =~ /\n$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   508
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   509
			$lastExportOrdinal = @{$updatedDefFiles{$defFile}}[$lastExportIndex];
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   510
			$lastExportOrdinal =~ s/^.*@\s+//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   511
			$lastExportOrdinal =~ s/ .*$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   512
			$lastExportOrdinal =~ s/\s//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   513
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   514
			foreach $unfrozenExport (@{@{$unfrozenURELExports{$defFile}}[0]})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   515
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   516
				$lastExportOrdinal++;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   517
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   518
				my $comment = '';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   519
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   520
				if ($unfrozenExport =~ /^_ZTV/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   521
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   522
					$comment = ' ; #<VT>#';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   523
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   524
				elsif ($unfrozenExport =~ /^_ZTI/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   525
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   526
					$comment = ' ; #<TI>#';
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   527
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   528
				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   529
				push (@{$updatedDefFiles{$defFile}}, "\t$unfrozenExport @ $lastExportOrdinal NONAME$comment\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   530
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   531
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   532
			push (@{$updatedDefFiles{$defFile}}, "\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   533
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   534
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   535
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   536
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   537
# Create the new .def files
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   538
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   539
	foreach $defFile (sort keys %updatedDefFiles)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   540
		{		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   541
		if (!open NEW_DEF_FILE, ">$defFile")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   542
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   543
			print ("ERROR : Can\'t create \"$defFile\"\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   544
			next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   545
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   546
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   547
		foreach $line (@{$updatedDefFiles{$defFile}})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   548
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   549
			print (NEW_DEF_FILE $line);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   550
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   551
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   552
		close NEW_DEF_FILE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   553
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   554
		print ("Created : \"$defFile\"\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   555
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   556
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   557
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   558
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   559
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   560
__END__
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   561
:endofperl