deprecated/buildtools/emulatorlauncher/perl/epoc.pl
author Zheng Shen <zheng.shen@nokia.com>
Wed, 27 Oct 2010 19:35:19 +0800
changeset 664 44b0e894b7ab
parent 655 3f65fd25dfd4
permissions -rw-r--r--
Merge again
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
655
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     1
# Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     2
# All rights reserved.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     3
# This component and the accompanying materials are made available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     4
# under the terms of "Eclipse Public License v1.0"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     5
# which accompanies this distribution, and is available
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     6
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     7
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     8
# Initial Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
     9
# Nokia Corporation - initial contribution.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    10
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    11
# Contributors:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    12
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    13
# Description:
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    14
# Launcher for the Symbian Emulator, including
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    15
# functionality to read the $ENV{EPOCROOT}epoc32\data\BuildInfo.txt
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    16
# file to find out information regarding the current Emulator.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    17
# Depends on the current working directory providing
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    18
# the drive of the currently used SDK.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    19
# 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    20
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    21
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    22
use Cwd;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    23
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    24
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    25
# Check the argument(s), if any.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    26
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    27
$numArgs = $#ARGV + 1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    28
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    29
if($numArgs == 0) 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    30
	{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    31
    	&launchEmulator("udeb","winscw");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    32
    	exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    33
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    34
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    35
if($numArgs > 2) 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    36
	{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    37
    	&printHelp;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    38
    	die "ERROR: Too many arguments.\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    39
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    40
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    41
if($numArgs == 1)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    42
	{ 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    43
	if(lc($ARGV[0]) eq "-rel") 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    44
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    45
    		&launchEmulator("urel","winscw");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    46
    		exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    47
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    48
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    49
	if (lc($ARGV[0]) eq "-version") 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    50
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    51
    		&printVersion;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    52
    		exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    53
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    54
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    55
	if(lc($ARGV[0]) eq "-wins") 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    56
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    57
    		&launchEmulator("udeb", "wins");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    58
    		exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    59
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    60
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    61
	if(lc($ARGV[0]) eq "-winscw") 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    62
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    63
    		&launchEmulator("udeb", "winscw");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    64
    		exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    65
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    66
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    67
	if(lc($ARGV[0]) eq "-help") 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    68
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    69
    		&printHelp;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    70
    		exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    71
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    72
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    73
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    74
if ($numArgs == 2)
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    75
	{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    76
	if(lc($ARGV[0]) eq "-rel") 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    77
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    78
		if (lc($ARGV[1]) eq "-wins")
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    79
			{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    80
    			&launchEmulator("urel","wins");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    81
    			exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    82
			}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    83
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    84
		if (lc($ARGV[1]) eq "-winscw")
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    85
			{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    86
    			&launchEmulator("urel","winscw");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    87
    			exit(0);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    88
			}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    89
		}	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    90
	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    91
	if (lc($ARGV[0]) eq "-winscw")
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    92
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    93
		if (lc($ARGV[1] eq "-rel"))
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    94
			{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    95
			&launchEmulator("urel","winscw");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    96
			exit(0);	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    97
			}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    98
		}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
    99
	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   100
	if (lc($ARGV[0]) eq "-wins")
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   101
		{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   102
		if (lc($ARGV[1] eq "-rel"))
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   103
			{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   104
			&launchEmulator("urel","wins");
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   105
			exit(0);	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   106
			}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   107
		}	
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   108
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   109
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   110
# Error, unknown argument.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   111
&printHelp;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   112
die "ERROR: Unknown argument " . "\"" . $ARGV[0] . "\".\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   113
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   114
sub launchEmulator
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   115
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   116
    my ($type,$win) = @_;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   117
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   118
    my $epocroot = &getEpocroot;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   119
    my $drive = &getDrive;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   120
    my $emu = $drive . $epocroot . "epoc32" . "\\" 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   121
	      . "release\\" . $win . "\\" . $type . "\\" . "epoc.exe";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   122
    -e $emu ||
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   123
	die "ERROR: File \"$emu\" not found.\n\n" .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   124
	    "The EPOCROOT environment variable does not identify\n" .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   125
	    "a valid Symbian emulator installation on this drive.\n" . 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   126
		"EPOCROOT must be an absolute path to an existing\n" .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   127
		    "directory - it should have no drive qualifier and\n" .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   128
			"must end with a backslash.\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   129
    # If the execute is successful, this never returns.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   130
    exec("\"" . $emu . "\"") || die "Failed to execute the emulator \"$emu\": $!";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   131
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   132
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   133
sub printHelp
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   134
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   135
    print "Symbian Platform Emulator Launcher\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   136
    print "Syntax :\tepoc [-rel] [-wins|-winscw] [-version] [-help]\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   137
    print "(no options)\tLaunch active winscw debug emulator\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   138
    print "-rel\t\tLaunch active release emulator\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   139
    print "-wins\t\tLaunch active wins emulator\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   140
    print "-winscw\t\tLaunch active winscw emulator\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   141
    print "-version\tDisplay active emulator details\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   142
    print "-help\tOutput this help message\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   143
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   144
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   145
sub printVersion
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   146
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   147
    my $epocroot = &getEpocroot;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   148
    my $drive = &getDrive;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   149
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   150
    my $binfo = $drive . $epocroot . "epoc32" . "\\" 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   151
	        . "data" . "\\" . "BuildInfo.txt";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   152
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   153
    -e $binfo || die "ERROR: File \"" . $binfo . "\" does not exist.\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   154
    open(IFILE, $binfo) ||
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   155
	die "ERROR: Failed to open file \"" . $binfo . "\": $!";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   156
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   157
    my $DeviceFamily = "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   158
    my $DeviceFamilyRev = "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   159
    my $ManufacturerSoftwareRev = "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   160
    my $ManufacturerSoftwareBuild = "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   161
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   162
    while(<IFILE>) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   163
	if(/DeviceFamily\s+(.*\S)\s*$/i) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   164
	    $DeviceFamily = $1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   165
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   166
	if(/DeviceFamilyRev\s+(.*\S)\s*$/i) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   167
	    $DeviceFamilyRev = $1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   168
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   169
	if(/ManufacturerSoftwareRev\s+(.*\S)\s*$/i) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   170
	    $ManufacturerSoftwareRev = $1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   171
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   172
	if(/ManufacturerSoftwareBuild\s+(.*\S)\s*$/i) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   173
	    $ManufacturerSoftwareBuild = $1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   174
	}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   175
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   176
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   177
    close(IFILE);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   178
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   179
    #
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   180
    # Verify that we got everything we should have.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   181
    #
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   182
    $DeviceFamily ne "" ||
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   183
	die "ERROR: Device family not specified in file \"" . $binfo .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   184
	    "\".\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   185
    $DeviceFamilyRev ne "" ||
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   186
	die "ERROR: Device family revision not specified in file \"" . $binfo .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   187
	    "\".\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   188
    $ManufacturerSoftwareBuild ne "" ||
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   189
	die "ERROR: Manufacturer software build not specified in file \"" .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   190
	    $binfo . "\".\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   191
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   192
    $Revision = (($ManufacturerSoftwareRev eq "")?($DeviceFamilyRev):
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   193
		 ($ManufacturerSoftwareRev));
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   194
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   195
    $DeviceFamily = getDFRDName($DeviceFamily);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   196
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   197
    #
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   198
    # Make the standard revision representation prettier,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   199
    # but leave other representations untouched.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   200
    #
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   201
    if($Revision =~ /^0x([0-9])([0-9][0-9])$/) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   202
	$Revision = $1 . "." . $2;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   203
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   204
   
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   205
    print $DeviceFamily . " " .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   206
	"version " . $Revision . " " .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   207
	    "build " . $ManufacturerSoftwareBuild . "\n";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   208
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   209
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   210
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   211
# Determines, validates, and returns EPOCROOT.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   212
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   213
sub getEpocroot
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   214
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   215
    my $epocroot = $ENV{EPOCROOT};
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   216
    die "ERROR: Must set the EPOCROOT environment variable.\n"
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   217
	if (!defined($epocroot));
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   218
    $epocroot =~ s-/-\\-go;	# for those working with UNIX shells
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   219
    die "ERROR: EPOCROOT must be an absolute path, " .
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   220
	"not containing a drive letter.\n" if ($epocroot !~ /^\\/);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   221
    die "ERROR: EPOCROOT must not be a UNC path.\n" if ($epocroot =~ /^\\\\/);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   222
    die "ERROR: EPOCROOT must end with a backslash.\n" if ($epocroot !~ /\\$/);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   223
    die "ERROR: EPOCROOT must specify an existing directory.\n" 
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   224
	if (!-d $epocroot);
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   225
    return $epocroot;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   226
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   227
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   228
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   229
# Determines and returns the current drive, if any.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   230
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   231
sub getDrive
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   232
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   233
    my $wd = cwd;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   234
    my $drive;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   235
    if($wd =~ /^([a-zA-Z]:)/) {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   236
	$drive = $1;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   237
    } else {
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   238
	# Perhaps we're on a machine that has no drives.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   239
	$drive = "";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   240
    }
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   241
    return $drive;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   242
}
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   243
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   244
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   245
# The DFRD may be represented by a numeric value, as defined by HAL.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   246
# Changes known numeric values to the name of the DFRD,
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   247
# and leaves all other values untouched.
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   248
#
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   249
sub getDFRDName
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   250
{
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   251
    my $dfrd = shift;
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   252
    return "Crystal" if $dfrd eq "0";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   253
    return "Pearl" if $dfrd eq "1";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   254
    return "Quartz" if $dfrd eq "2";
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   255
    return $dfrd; # as fallback
3f65fd25dfd4 sync up SVN codes
kelvzhu
parents:
diff changeset
   256
}