sbsv1/abld/e32util/checksource.pm
author jascui
Wed, 17 Nov 2010 13:27:16 +0800
changeset 686 3e502c8c584c
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Update release information and product version.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Routines involved in checking that source matches various filename policy constraints
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
package CheckSource;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
require Exporter;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
@ISA=qw(Exporter);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
# Exported for clarity in calling scripts and modules
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
our $CheckSource_PhysicalCheck = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
our $CheckSource_NoUserSystemDistinction = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
@EXPORT=qw(
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	CheckSource_MetaData
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
	CheckSource_Includes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
	CheckSource_ExportedIncludes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
	CheckSource_MakefileOutput
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
	CheckSource_UnixSlash
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
	CheckSource_Lowercase
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
	CheckSource_Physical
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
	$CheckSource_PhysicalCheck
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
	$CheckSource_NoUserSystemDistinction
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
use Cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
use Pathutl;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
use Win32;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
my $exclusionsFile = $ENV{EPOCROOT}."epoc32\\tools\\filenamepolicyexclusions.txt";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
my $makefileWarningPrefix = "\@echo ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
my $checksourcePrefix = "\@perl -S checksource.pl";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
my $releaseLocationRoot = quotemeta ($ENV{EPOCROOT}."epoc32");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
sub CheckSource_MetaData (\%$$$$;$;$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
	my ($actionHash, $sourceFile, $item, $reference, $lineNumber, $physical, $offset) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
	return if ($reference =~ /^(\.|\.\.)$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
	my $checksourceCall = "$checksourcePrefix --metadata \"$sourceFile\" \"$item\" \"$reference\" $lineNumber";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	$checksourceCall .= " $physical" if ($physical);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
	$checksourceCall .= " \"$offset\"" if ($offset);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
	$$actionHash{$checksourceCall} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
sub CheckSource_UnixSlash (\%$$$$;$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
	my ($actionHash, $sourceFile, $item, $reference, $lineNumber, $verbose) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
	$sourceFile =~ s/^[a-zA-Z]{1}://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
	$item =~ s/PRJ_EXPORTS \(NO DESTINATION\)/PRJ_EXPORTS/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
	print "Checking - Unix slash : $sourceFile ($lineNumber) - $item:$reference\n" if ($verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	if ($reference =~/\\/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
		{	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
		$$actionHash{constructWarning ($sourceFile, $lineNumber, $item, "Incorrect slash in", $reference)} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
sub CheckSource_Lowercase (\%$$$;$;$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
	my ($actionHash, $sourceFile, $item, $reference, $lineNumber, $verbose) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
	return if ($reference =~ /^[\/|\\]epoc32[\/|\\]tools[\/|\\].*$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
	$sourceFile =~ s/^[a-zA-Z]{1}://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
	print "Checking - lowercase  : $sourceFile ($lineNumber) - $item:$reference\n" if ($verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
	my $exclusion = lowercaseExclusionCheck ($reference);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
	if ($exclusion eq "UNLISTED")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
		if ($reference =~ /[A-Z]/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
			{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
			$$actionHash{constructWarning ($sourceFile, $lineNumber, $item, "Incorrect case for epoc32 tree in", $reference)} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
	elsif ($exclusion !~ /(OK|ERROR)/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
		$$actionHash{constructWarning($sourceFile, $lineNumber, $item, "Incorrect case versus exclusion list in", $reference, " vs. $exclusion")} = 1;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
sub CheckSource_Physical (\%$$$$;$;$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
	my ($actionHash, $sourceFile, $item, $reference, $lineNumber, $path, $verbose) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
	print "Checking - physical   : $sourceFile ($lineNumber) - $item:$reference:$path\n" if ($verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
	my $physicalCheck;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
	my $searchText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
	my $examineDefaultExportDestination = ($item =~ s/PRJ_EXPORTS \(NO DESTINATION\)/PRJ_EXPORTS/) ? 1 : 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
	if ($item eq "#include")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
		# In the case of #includes, the path passed in is already the fully pathed physical file
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
		# that needs to be checked (as obtained from the parsed output of CPP)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
		$searchText = $reference;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
		$physicalCheck = $path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
		my $physicalReference;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
		if (($item =~ /^PRJ_(TEST)?MMPFILES MMP/) && ($reference !~ /\.\w+$/i))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
			$physicalReference = $reference."\.mmp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
			$searchText = $reference."\.*";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
		elsif ($item =~ /^DEFFILE/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
			# The full path for DEFFILE entries is always passed in, so we just
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
			# need to concentrate on sorting out the oddities for the search
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
			# text and then just take the final file bit as the physical
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
			# reference
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
			$searchText = $reference;			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
			$searchText .= "?\.*" if ($reference !~ /(\.def|[\\|\/])$/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
			$searchText =~ s/(\.def)/\?$1/i if ($item !~ /NOSTRICTDEF/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
			$searchText =~ s/\~/\*/;			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
			$physicalReference = $searchText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
			$physicalReference =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
			$physicalReference =~ s/\?/u/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
			$physicalReference =~ s/\.\w+$/\.def/;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
			$physicalReference = &Path_Split ('File', $physicalReference);			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
			$searchText = $reference;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
			$physicalReference = $searchText;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
		my $physicalLocation;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
		if ($path)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
			$physicalLocation = $path;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
		elsif ($reference =~ /^(\\|\/)/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
			$physicalLocation = $ENV{EPOCROOT};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
		elsif ($reference =~ /^\+/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
			$physicalLocation = $ENV{EPOCROOT}."epoc32\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
		elsif ($item =~ /EXTENSIONS/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
			$physicalLocation = $ENV{EPOCROOT}."epoc32\\tools\\makefile_templates\\";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
			$physicalLocation = &Path_Split ('Path', $sourceFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
		$physicalReference =~ s/^[\\|\/]//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
		$physicalCheck = $physicalLocation.$physicalReference;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
	$physicalCheck =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
	$physicalCheck = &Path_Strip ($physicalCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
	# If a file reference is actually under \epoc32, we just need to confirm that it's lowercase
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
	if ($physicalCheck =~ /^$releaseLocationRoot/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
		CheckSource_Lowercase (%$actionHash, $sourceFile, $item, $reference, $lineNumber, $verbose);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
		return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
	# Massage search text to provide something we can compare with a physical check on the filesystem
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
	$searchText =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
	$searchText =~ s/\.\.\\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
	$searchText =~ s/\.\\//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
	$searchText =~ s/\\\\/\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
	my $warningSearchText = $searchText;	# Record a more intelligible version of the search text for warning purposes
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
	$searchText = quotemeta ($searchText);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
	$searchText =~ s/\\\*/\\w\+/g;			# * -> \w+
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
	$searchText =~ s/\\\?/\\w\{1\}/g;		# ? -> \w{1}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
	my $physicalReality = getPhysical ($physicalCheck);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
	my $warningSuffix = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
	if (!$physicalReality)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
		$$actionHash{constructWarning($sourceFile, $lineNumber, $item, "Can\'t find physical file match for", $reference, " on filesystem")} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
	elsif ($physicalReality !~ /^.*$searchText$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
		if ($physicalReality !~ /^.*$searchText$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
			# Doesn't just differ in case...something's gone wrong
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
			$$actionHash{constructWarning($sourceFile, $lineNumber, $item, "Can\'t find physical file match for", $reference, " - match was attempted against $physicalReality")} = 1;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
			if (($item =~ /^DEFFILE/ || $item =~ /^PRJ_(TEST)?MMPFILES MMP/) && ($reference !~ /$searchText$/))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
				$warningSuffix .= " (actual test \'$warningSearchText\')"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
			$warningSuffix .= " vs. $physicalReality";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
			$$actionHash{constructWarning($sourceFile, $lineNumber, $item, "Incorrect case versus filesystem in", $reference, $warningSuffix)} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
			}
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
	# Special case - PRJ_EXPORTS source lines with no destination must be normalised via a new destination compliant
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
	# with the filename policy.  FIXSOURCE will do this, but it needs a warning to work on
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
	if ($examineDefaultExportDestination)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
		$physicalReality =~ /^.*($searchText)$/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
		my $defaultExportReference = $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
		my $exclusion = lowercaseExclusionCheck ($defaultExportReference);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
		if ($defaultExportReference =~ /[A-Z]/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
			$$actionHash{constructWarning ($sourceFile, $lineNumber, $item, "Incorrect case for epoc32 tree from default export in", $reference, $warningSuffix)} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
sub CheckSource_Includes ($\%$\@;\@;\@;$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
	# References are used for array arguments only so that they can be distinguished within the subroutine
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
	my ($sourceFile, $actionHash, $preInclude, $macros, $userIncludesRef, $systemIncludesRef, $noUserSystemDistinction) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
	my (@userIncludes, @systemIncludes);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
	@userIncludes = @$userIncludesRef if ($userIncludesRef);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
	@systemIncludes = @$systemIncludesRef if ($systemIncludesRef);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
	my $call = "$checksourcePrefix --preprocess -- ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
	if (($sourceFile !~ /\.inf$/i) && ($sourceFile !~ /\.mmp/i))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
		push @$macros, "__SUPPORT_CPP_EXCEPTIONS__";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
	my $platformPreInclude = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
	foreach my $macro (@$macros)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
		$call .= "-D$macro ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
		if ($macro =~ /__ARMCC_2_2__/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
			$platformPreInclude = $ENV{EPOCROOT}."epoc32\\include\\rvct2_2\\rvct2_2.h";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
			if (($sourceFile =~ /BASE\\E32\\compsupp\\/i) && $ENV{RVCT22INC})
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
				{					
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
				# Need some way to deal with ARMINC from the front-end...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
				my $rvctIncDir = $ENV{RVCT22INC};
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
				push @systemIncludes, $rvctIncDir;
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
		elsif ($macro =~ /__GCCE__/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
			$platformPreInclude = $ENV{EPOCROOT}."epoc32\\include\\GCCE\\GCCE.h";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
			my $GCCEinstall = Cl_bpabi::getConfigVariable('COMPILER_INSTALL_PATH');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
			push @systemIncludes, "\"\\\"$GCCEinstall\\..\\lib\\gcc\\arm-none-symbianelf\\3.4.3\\include\\\"\"";
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 ($preInclude ne "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
		$call .= "-include ".getDrive().$preInclude." ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
		push @systemIncludes, &Path_Split ('Path', getDrive().$preInclude);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
		}		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
	if ($platformPreInclude ne "")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
		$call .= "-include ".getDrive().$platformPreInclude." ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
		push @systemIncludes, &Path_Split ('Path', getDrive().$platformPreInclude);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
		}	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
	# Enforce user and system includes in checksource processing.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
	foreach my $include (@userIncludes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
		$include =~ s/\\$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
		$include = getDrive().$include if (($include !~ /^[a-zA-Z]:/) && ($include !~ /^[\"|\.]/));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
		$call .= "-I $include ";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
	$call .= "-I- " unless $noUserSystemDistinction;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
	foreach my $include (@systemIncludes)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
		$include =~ s/\\$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
		$include = getDrive().$include if (($include !~ /^[a-zA-Z]:/) && ($include !~ /^[\"|\.]/));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
		$call .= "-I $include ";
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
	$sourceFile =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
	$sourceFile = &Path_Strip ($sourceFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
	$sourceFile = getDrive().$sourceFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
	$call .= $sourceFile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
	$$actionHash{$call} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
	return $call;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
sub CheckSource_ExportedIncludes ($$\%)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
	my ($sourceFile, $destinationFile, $actionHash) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
	# Exclude exported files as appropriate
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
	if ($destinationFile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
		my $epoc32Include = quotemeta ($ENV{EPOCROOT})."epoc32\\\\include";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
		return if ($destinationFile !~ /^$epoc32Include/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
		return if ($destinationFile =~ /\.def$/i);
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
	$$actionHash{"$checksourcePrefix --parsefile -- $sourceFile"} = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
sub CheckSource_MakefileOutput(%)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
	my (%actionHash) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
	return "\t\@rem\n" if !(keys (%actionHash));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
	my $output = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
	foreach (keys (%actionHash))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
		$output .= "\t$_\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
	return $output;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
sub getDrive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
    if(cwd =~ /^([a-zA-Z]:)/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
    	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
		return $1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
    	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
	return "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
sub getPhysical ($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
	my ($physicalReference) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
	my $physicalReality = Win32::GetLongPathName($physicalReference);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
	if ($physicalReality)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
		{			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
		$physicalReality =~ s/^.*://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
		$physicalReality = &Path_Strip ($physicalReality);		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
	return $physicalReality;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
sub constructWarning ($$$$$;$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
	my ($sourceFile, $lineNumber, $item, $warningText, $reference, $suffix) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
	$sourceFile =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
	$sourceFile = Win32::GetLongPathName($sourceFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
	$sourceFile =~ s/^[a-zA-Z]{1}://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
	$sourceFile = &Path_Strip ($sourceFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
	my $warning = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
	$warning .= $sourceFile.":".$lineNumber.": ".$warningText." $item - \'".$reference."\'";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
	$warning .= $suffix if ($suffix);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
	$warning .= ".";		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
	return $warning;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
sub lowercaseExclusionCheck ($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
	my ($reference) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
	# An exclusions file isn't mandatory
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
	return "UNLISTED" if (! -e $exclusionsFile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418
	my $EXCLUSIONS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   419
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   420
	if (!(open EXCLUSIONS, "< $exclusionsFile"))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   421
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   422
			print ("ERROR: Can't open $exclusionsFile in checksource processing.\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   423
			return "ERROR";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   424
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   425
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   426
	my $referenceDOSSlash = $reference;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   427
	$referenceDOSSlash =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   428
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   429
	my $exclusionCheck = "UNLISTED";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   430
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   431
	while (my $exclusion = <EXCLUSIONS>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   432
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   433
		next if ($exclusion =~ /^\s*$/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   434
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   435
		$exclusion =~ s/^\s+//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   436
		$exclusion =~ s/\s+$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   437
		$exclusion =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   438
		my $quotemetaExclusion = quotemeta ($exclusion);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   439
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   440
		if ($referenceDOSSlash =~ /^$quotemetaExclusion$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   441
			{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   442
			if ($referenceDOSSlash !~ /^$quotemetaExclusion$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   443
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   444
				$exclusionCheck = $exclusion;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   445
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   446
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   447
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   448
				$exclusionCheck = "OK";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   449
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   450
			last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   451
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   452
			elsif($referenceDOSSlash =~ /\\$quotemetaExclusion$/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   453
			{				
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   454
			if ($referenceDOSSlash !~ /\\$quotemetaExclusion$/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   455
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   456
				$exclusionCheck = $exclusion;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   457
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   458
			else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   459
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   460
				$exclusionCheck = "OK";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   461
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   462
			last;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   463
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   464
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   465
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   466
	close EXCLUSIONS;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   467
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   468
	return $exclusionCheck;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   469
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   470
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   471
1;