build/tools/localised_emu.pl
branchRCL_3
changeset 18 ea3e26ea6629
parent 6 c8ecf89eb77f
equal deleted inserted replaced
6:c8ecf89eb77f 18:ea3e26ea6629
     1 #
       
     2 # Copyright (c) 2002-2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 #
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 #
       
    12 # Contributors:
       
    13 #
       
    14 # Description: Script that takes an optional language ID as a parameter and updates features.dat and languages.txt
       
    15 # in emulator environment.
       
    16 #
       
    17 # localised_emu.pl
       
    18 #
       
    19 # Script is RnD Emulator specific!
       
    20 #
       
    21 # Usage example: localised_emu.pl 
       
    22 # Usage example: localised_emu.pl 31
       
    23 # Usage example: localised_emu.pl 31 urel
       
    24 # Usage example: localised_emu.pl 31 udeb
       
    25 #
       
    26 
       
    27 $HRHFILE = "\\epoc32\\include\\bldpublic.hrh";
       
    28 $xml_china_filename = "\\epoc32\\include\\s60features_apac.xml";
       
    29 $xml_japan_filename = "\\epoc32\\include\\s60features_japan.xml";
       
    30 $xml_korean_filename = "\\epoc32\\include\\s60features_korean.xml";
       
    31 @china_languages=(29,30,31,129,157,158,159,326,327);
       
    32 @japan_languages=(32,160);
       
    33 $korean_language=65;
       
    34 
       
    35 $lang_id = $ARGV[0];
       
    36 $ureludeb = lc $ARGV[1];
       
    37 
       
    38 if ($lang_id eq "")
       
    39 {
       
    40 	$lang_id ="01";
       
    41   print "No language selected, default language used: $lang_id\n";
       
    42 }
       
    43 
       
    44 # Check that given id is digit
       
    45 if (!($lang_id =~ /^\d+$/ ))
       
    46 {
       
    47 	$lang_id = "01";
       
    48 	print "faulty lang id!\n";
       
    49 	&printHelp;
       
    50 	exit;
       
    51 }
       
    52 
       
    53 if ($ureludeb eq "")
       
    54 {
       
    55 	$ureludeb = "udeb";
       
    56 	print "No urel/udeb selection made. Selecting UDEB.\n";
       
    57 }
       
    58 
       
    59 # Check that urel/udeb selection is valid
       
    60 if (!(($ureludeb eq "urel") or ($ureludeb eq "udeb")))
       
    61 {
       
    62 	print "faulty urel/udeb selection!\n"; 
       
    63 	&printHelp;
       
    64 	exit;
       
    65 }
       
    66 
       
    67 $targetfile= "\\epoc32\\release\\winscw\\$ureludeb\\Z\\Resource\\bootdata\\languages.txt";
       
    68 
       
    69 # check that given id is supported
       
    70 open(HRHFILE) or die("Could not open bldpublic.hrh file.");
       
    71 foreach $line (<HRHFILE>) {
       
    72     chomp($line);              # remove the newline from $line.
       
    73     if ($line =~ m/LANGUAGE_IDS/)
       
    74     {
       
    75     	if ($line =~ m/$lang_id/)
       
    76     	{
       
    77     		#print "Language ID found from bldpublic.hrh.\n";
       
    78     	} else
       
    79     	{
       
    80     	print "Not supported language ID selected.\n";
       
    81     	print "Supported language ID's:\n";
       
    82     	print "$line\n";
       
    83     	#$lang_id="01";
       
    84     	exit;
       
    85     	}
       
    86     	}
       
    87     	}
       
    88 close(HRHFILE);
       
    89 
       
    90 ## generate feature.dat for emulator
       
    91 if (grep {$_ eq $lang_id} @china_languages) {
       
    92   #print "China Language ID '$lang_id' selected.\n" ;
       
    93   system("perl -S \\epoc32\\tools\\features.pl \\epoc32\\rom\\include\\featuredatabase.xml $xml_china_filename -d=\\epoc32\\release\\winscw\\$ureludeb\\z\\private\\10205054\\");
       
    94 	print "China version of features.dat generated.\n";
       
    95 } elsif (grep {$_ eq $lang_id} @japan_languages) {
       
    96 	#print "Japan Language ID '$lang_id' selected.\n" ;
       
    97 	system("perl -S \\epoc32\\tools\\features.pl \\epoc32\\rom\\include\\featuredatabase.xml $xml_japan_filename -d=\\epoc32\\release\\winscw\\$ureludeb\\z\\private\\10205054\\");	
       
    98 	print "Japan version of features.dat generated.\n";
       
    99 } elsif ($lang_id == $korean_language) {
       
   100 	#print "Korean Language ID '$lang_id' selected.\n" ;
       
   101 	system("perl -S \\epoc32\\tools\\features.pl \\epoc32\\rom\\include\\featuredatabase.xml $xml_korean_filename -d=\\epoc32\\release\\winscw\\$ureludeb\\z\\private\\10205054\\");
       
   102 	print "Korean version of features.dat generated.\n";
       
   103 } else {
       
   104 	#print "western Language ID '$lang_id' selected.\n" ;
       
   105 	system("perl -S \\epoc32\\tools\\features.pl \\epoc32\\rom\\include\\featuredatabase.xml \\epoc32\\include\\s60features.xml -d=\\epoc32\\release\\winscw\\$ureludeb\\z\\private\\10205054\\");
       
   106 	print "Western version of features.dat generated.\n";
       
   107 }
       
   108 
       
   109 
       
   110 
       
   111 # Put language ID to languages.txt
       
   112 $version_string = sprintf("%s,d", $lang_id);
       
   113 
       
   114 # Make sure that read only flag is off in the target file
       
   115 chmod 0755, $targetfile;
       
   116 
       
   117 # Write the version string in the unicode format
       
   118 open OUT, ">$targetfile" or die "Can't open output file: $targetfile $!\n";
       
   119 print OUT "\xFF\xFE";
       
   120 for (my $i = 0; $i < length($version_string); $i++)
       
   121 {
       
   122  printf OUT "%s\0", substr($version_string, $i, 1);
       
   123 }
       
   124 close OUT;
       
   125 
       
   126 #start the actual emulator
       
   127 if ((lc $ureludeb) eq "urel")
       
   128 {
       
   129 	system("epoc -rel");
       
   130 	print "urel emulator started!\n";
       
   131 } 
       
   132 else
       
   133 {
       
   134 	system("epoc");
       
   135 	print "udeb emulator started!\n";
       
   136 } 
       
   137 
       
   138 
       
   139 
       
   140 sub printHelp
       
   141 {
       
   142 	print "*****************************************\n";
       
   143 	print "**Usage of the localised_emulator.pl:\n";
       
   144 	print "**localised_emulator.pl <lang_ID> <urel/udeb>\n";
       
   145 	print "**Default english udeb (01):localised_emulator.pl\n";
       
   146 	print "**China language: localised_emulator.pl 31\n";
       
   147 	print "*****************************************\n";
       
   148 	print "China ID's: @china_languages\n";
       
   149 	print "Japan ID's: @japan_languages\n";
       
   150 	print "Korean ID: $korean_language\n";
       
   151 }
       
   152 
       
   153 exit;