textinput/ptienginev2/group/VariantParser.pl
changeset 0 eb1f2e154e89
child 5 a47de9135b21
equal deleted inserted replaced
-1:000000000000 0:eb1f2e154e89
       
     1 #
       
     2 # Copyright (c) 2007 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:   Sets up bld.inf file for language dlls.
       
    15 #
       
    16 
       
    17 ($time_second, $time_minute, $time_hour,          # time/date
       
    18     $date_day, $date_month, $date_year,
       
    19     $day_week, $day_year, $isdst) = localtime(time);
       
    20 
       
    21 if ($date_year < 70) {$date_year += 2000;}        # add century
       
    22     else {$date_year += 1900;}
       
    23 
       
    24 $keymapdata_interface_uid = "10281896";
       
    25 $keymapsdirstart = "..\/keymaps\/";
       
    26 $keymapsdir = $keymapsdirstart;
       
    27 $langdir = "..\/languages\/";
       
    28 $output_dll = "PtiKeymappings_";
       
    29 $iby_file_prefix_path = "..\/rom\/";
       
    30 $iby_file_prefix = "PtiKeymappings_variant_"; 
       
    31 $VariantFolder = "";
       
    32 
       
    33 @lang_name_array = ();
       
    34 
       
    35 $use_block_12_key = 0;
       
    36 $use_block_qwerty_standard = 0;
       
    37 $use_block_qwerty_mini = 0;
       
    38 $use_block_qwerty_3x11 = 0;
       
    39 $use_block_qwerty_half = 0;
       
    40 $use_block_custom = 0;
       
    41 
       
    42 #############################################
       
    43 # Create empty body for languages 
       
    44 # bld.inf file
       
    45 #############################################
       
    46 
       
    47 # Make sure the language directory is in there.
       
    48 mkdir "$langdir";
       
    49 
       
    50 unlink("${langdir}bld.inf");
       
    51 if ( ! open(INFFILE,">${langdir}bld.inf") )
       
    52     { 
       
    53 	  die "Could not create bld.inf file for language databases!"; 
       
    54     } 
       
    55 
       
    56 print(INFFILE "/*\n");
       
    57 print(INFFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
    58 print(INFFILE "* All rights reserved.\n");
       
    59 print(INFFILE "* This component and the accompanying materials are made available\n");
       
    60 print(INFFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
    61 print(INFFILE "* which accompanies this distribution, and is available\n");
       
    62 print(INFFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
    63 print(INFFILE "*\n");
       
    64 print(INFFILE "* Initial Contributors:\n");
       
    65 print(INFFILE "* Nokia Corporation - initial contribution.\n");
       
    66 print(INFFILE "*\n");
       
    67 print(INFFILE "* Contributors:\n");
       
    68 print(INFFILE "*\n");
       
    69 print(INFFILE "* Description: Build info file for language keymapping dlls.\n");
       
    70 print(INFFILE "*\n");
       
    71 print(INFFILE "*/\n");
       
    72 print(INFFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
    73 
       
    74 
       
    75 # Open configuration source file
       
    76 if ( ! open(MASTERVARFILE,"MasterVariants.txt") )
       
    77     { 
       
    78 	  die "ERROR: Could not find MastersVariants.txt!"; 
       
    79     } 
       
    80 	
       
    81 @master_raw_data=<MASTERVARFILE>;
       
    82 foreach $line (@master_raw_data)
       
    83 {
       
    84 	if (index($line, "#") >= 0)
       
    85 	{
       
    86 		# Comment line, just skip
       
    87 	}
       
    88 	elsif (index($line, "USE Folder") >= 0)
       
    89 	{
       
    90 		$use_block_12_key = 0;
       
    91 		$use_block_qwerty_standard = 0;
       
    92 		$use_block_qwerty_mini = 0;
       
    93 		$use_block_qwerty_3x11 = 0;
       
    94 		$use_block_qwerty_half = 0;
       
    95 		$use_block_custom = 0;
       
    96 		chop($line);   # Remove '\n'
       
    97 		@words = split(/ +/,$line);    # Split into words.
       
    98 
       
    99 		$VariantFolder = $keymapsdirstart . $words[2];
       
   100 		# Open configuration source file
       
   101 		if ( ! open(VARFILE,"${VariantFolder}\/Variants.txt") )
       
   102 		{
       
   103 			print("\nWARNING: Could not find ${VariantFolder}\\Variants.txt! \n");
       
   104 			goto endblock;
       
   105 		}
       
   106 
       
   107 		@raw_data=<VARFILE>;
       
   108 		foreach $line (@raw_data)
       
   109 		{
       
   110 			if (index($line, "#") >= 0)
       
   111 			{
       
   112 				# Comment line, just skip
       
   113 			}
       
   114 			elsif (index($line, "[PACKAGE") >= 0)
       
   115 			{
       
   116 				# Finalize and close files from previous round.
       
   117 				print(CHHFILE "#endif\n");
       
   118 				print(CHHFILE "\n// End of file. \n");
       
   119 				close(CHHFILE);
       
   120 
       
   121 				#
       
   122 				# Finalize factory class from previous round.
       
   123 				#
       
   124 				print(CFFFILE "\n");
       
   125 				print(CFFFILE "    return NULL;\n");
       
   126 				print(CFFFILE "    }\n");
       
   127 				print(CFFFILE "\n");
       
   128 				print(CFFFILE "\n");
       
   129 				print(CFFFILE "void CPtiVariant${variant_name}DataFactory::ListLanguagesL(RArray<TInt>& aResult)\n");
       
   130 				print(CFFFILE "    {\n");
       
   131 
       
   132 				for ($ii = 0; $ii < scalar(@lang_name_array); $ii++)
       
   133 				{
       
   134 					if (@lang_name_array[$ii] eq "Basque" || @lang_name_array[$ii] eq "Galician")
       
   135 					{
       
   136 						print(CFFFILE "    aResult.AppendL(KLang@lang_name_array[$ii]);\n");
       
   137 					}
       
   138 					else
       
   139 					{
       
   140 						print(CFFFILE "    aResult.AppendL(ELang@lang_name_array[$ii]);\n");
       
   141 					}
       
   142 				}
       
   143 
       
   144 				print(CFFFILE "    }\n");
       
   145 				print(CFFFILE "\n");
       
   146 				print(CFFFILE "// End of file\n");
       
   147 				close(CFFFILE);
       
   148 
       
   149 				# Start a new variant
       
   150 				$impl_uid = "";
       
   151 				$dll_uid = "";
       
   152 				$variant_name = "";
       
   153 
       
   154 				$wins_only = 0;
       
   155 				$no_wins = 0;
       
   156 
       
   157 				while (scalar(@lang_name_array) > 0)
       
   158 				{
       
   159 					# Clear array.
       
   160 					pop(@lang_name_array);
       
   161 				}
       
   162 
       
   163 				$line =~ s/<.*?>//sg;
       
   164 				@words = grep(/./,("\n",split(/[^[:alnum:]]+/s,$line)));
       
   165 
       
   166 				$variant_name = $words[1] . "_" . $words[2];
       
   167 				$impl_uid = $words[3];
       
   168 				$dll_uid = $words[4];
       
   169 				$target_name = $output_dll . $variant_name;
       
   170 
       
   171 				# Do we want to build only for wins, not for wins at all or for both wins and armv5
       
   172 				if ($words[5] eq "NOWINS")
       
   173 				{
       
   174 					$no_wins = 1;
       
   175 				}
       
   176 				elsif ($words[5] eq "WINSONLY")
       
   177 				{
       
   178 					$wins_only = 1;
       
   179 				}
       
   180 
       
   181 				print("**** Generating variant $variant_name ****\n");
       
   182 				print("    implementation uid: $impl_uid \n");
       
   183 				print("    dll uid: $dll_uid \n");
       
   184 
       
   185 				##############################################################
       
   186 				#
       
   187 				# Create ecom resource file.
       
   188 				#
       
   189 				##############################################################
       
   190 				unlink("${langdir}${dll_uid}.rss");
       
   191 				if ( ! open(RESFILE,">${langdir}${dll_uid}.rss") )
       
   192 				{
       
   193 					die "Could not create res file for $language";
       
   194 				}
       
   195 
       
   196 				print(RESFILE "/*\n");
       
   197 				print(RESFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
   198 				print(RESFILE "* All rights reserved.\n");
       
   199 				print(RESFILE "* This component and the accompanying materials are made available\n");
       
   200 				print(RESFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
   201 				print(RESFILE "* which accompanies this distribution, and is available\n");
       
   202 				print(RESFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
   203 				print(RESFILE "*\n");
       
   204 				print(RESFILE "* Initial Contributors:\n");
       
   205 				print(RESFILE "* Nokia Corporation - initial contribution.\n");
       
   206 				print(RESFILE "*\n");
       
   207 				print(RESFILE "* Contributors:\n");
       
   208 				print(RESFILE "*\n");
       
   209 				print(RESFILE "* Description: PtiEngine language keymapping ecom resource file.\n");
       
   210 				print(RESFILE "*\n");
       
   211 				print(RESFILE "*/\n");
       
   212 				print(RESFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
   213 
       
   214 				print(RESFILE "#include <Eikon.rh>\n");
       
   215 				print(RESFILE "#include <ecom/RegistryInfo.rh>\n");
       
   216 				print(RESFILE "\n");
       
   217 				print(RESFILE "\n");
       
   218 				print(RESFILE "RESOURCE REGISTRY_INFO theInfo\n");
       
   219 				print(RESFILE "	{\n");
       
   220 				print(RESFILE "	dll_uid = 0x${dll_uid};\n");
       
   221 				print(RESFILE " 	interfaces = \n");
       
   222 				print(RESFILE "		{\n");
       
   223 				print(RESFILE "		INTERFACE_INFO\n");
       
   224 				print(RESFILE "			{\n");
       
   225 				print(RESFILE "			interface_uid = 0x${keymapdata_interface_uid};\n");
       
   226 				print(RESFILE "			implementations =\n");
       
   227 				print(RESFILE "				{\n");
       
   228 				print(RESFILE "				IMPLEMENTATION_INFO \n");
       
   229 				print(RESFILE "					{\n");
       
   230 				print(RESFILE "					implementation_uid = 0x${impl_uid};  // Variant $variant_name\n");
       
   231 				print(RESFILE "					version_no = 1;\n");
       
   232 				print(RESFILE "					display_name = \"PtiEngine keymappings\";\n");
       
   233 				print(RESFILE "					}\n");
       
   234 				print(RESFILE "				};\n");
       
   235 				print(RESFILE "			}\n");
       
   236 				print(RESFILE "		};\n");
       
   237 				print(RESFILE "	}\n");
       
   238 				print(RESFILE "\n");
       
   239 				print(RESFILE "// End of file\n");
       
   240 				print(RESFILE "\n");
       
   241 
       
   242 				close(RESFILE);
       
   243 
       
   244 
       
   245 				#############################################################
       
   246 				#
       
   247 				# Create MPP file.
       
   248 				#
       
   249 				##############################################################
       
   250 				unlink("${target_name}.mmp");
       
   251 				if ( ! open(MMPFILE,">${langdir}${target_name}.mmp") )
       
   252 				{
       
   253 					die "Could not create mmp file for variant $variant_name \n";
       
   254 				}
       
   255 
       
   256 				print(MMPFILE "/*\n");
       
   257 				print(MMPFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
   258 				print(MMPFILE "* All rights reserved.\n");
       
   259 				print(MMPFILE "* This component and the accompanying materials are made available\n");
       
   260 				print(MMPFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
   261 				print(MMPFILE "* which accompanies this distribution, and is available\n");
       
   262 				print(MMPFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
   263 				print(MMPFILE "*\n");
       
   264 				print(MMPFILE "* Initial Contributors:\n");
       
   265 				print(MMPFILE "* Nokia Corporation - initial contribution.\n");
       
   266 				print(MMPFILE "*\n");
       
   267 				print(MMPFILE "* Contributors:\n");
       
   268 				print(MMPFILE "*\n");
       
   269 				print(MMPFILE "* Description: Project file for $langname keymapping data dll.\n");
       
   270 				print(MMPFILE "*\n");
       
   271 				print(MMPFILE "*/\n");
       
   272 				print(MMPFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
   273 
       
   274 				print(MMPFILE "#include <platform_paths.hrh>\n");
       
   275 				print(MMPFILE "\n");
       
   276 				print(MMPFILE "TARGET       ${target_name}.dll\n");
       
   277 				print(MMPFILE "CAPABILITY   CAP_ECOM_PLUGIN\n");
       
   278 				print(MMPFILE "targettype   PLUGIN\n");
       
   279 				print(MMPFILE "UID	     0x10009D8D 0x$dll_uid \n");
       
   280 				print(MMPFILE "\n");
       
   281 				print(MMPFILE "sourcepath . \n");
       
   282 				print(MMPFILE "\n");
       
   283 				print(MMPFILE "userinclude . \n");
       
   284 				print(MMPFILE "\n");
       
   285 				print(MMPFILE "MW_LAYER_SYSTEMINCLUDE\n");
       
   286 				print(MMPFILE "\n");
       
   287 				#print(MMPFILE "systeminclude   ..\/INC\n");
       
   288 				print(MMPFILE "\n");
       
   289 				print(MMPFILE "source ${output_dll}${variant_name}.cpp\n");
       
   290 				print(MMPFILE "source PtiFactory_${variant_name}.cpp\n");
       
   291 				print(MMPFILE "\n");
       
   292 				print(MMPFILE "START RESOURCE ${dll_uid}.rss\n");
       
   293 				print(MMPFILE "TARGET ${target_name}.rsc\n");
       
   294 				print(MMPFILE "END\n");
       
   295 				print(MMPFILE "\n");
       
   296 				print(MMPFILE "library	EUSER.LIB BAFL.LIB EFSRV.LIB\n");
       
   297 				print(MMPFILE "library PtiEngine.lib\n");
       
   298 				print(MMPFILE "\n");
       
   299 				print(MMPFILE "START WINS\n");
       
   300 				print(MMPFILE "	baseaddress	0x7dd10000\n");
       
   301 				print(MMPFILE "END\n");
       
   302 				print(MMPFILE "\n");
       
   303 
       
   304 				close(MMPFILE);
       
   305 
       
   306 				#
       
   307 				# Add this mmp to bld.inf file
       
   308 				#
       
   309 				print(INFFILE "\nPRJ_MMPFILES\n");
       
   310 				if ($no_wins == 1)
       
   311 				{
       
   312 					print(INFFILE "#if !defined(WINS)\n");
       
   313 				}
       
   314 				elsif ($wins_only == 1)
       
   315 				{
       
   316 					print(INFFILE "#if defined(WINS)\n");
       
   317 				}
       
   318 
       
   319 				print(INFFILE "${target_name}.mmp\n");
       
   320 
       
   321 				if ($no_wins == 1 || $wins_only == 1)
       
   322 				{
       
   323 					print(INFFILE "#endif\n");
       
   324 				}
       
   325 
       
   326 				#############################################
       
   327 				# Create and open empty body for variantion iby-file.
       
   328 				# It will be filled later.
       
   329 				#############################################
       
   330 				$iby_file_name = $iby_file_prefix_path.$iby_file_prefix.${variant_name}."\.iby";
       
   331 				unlink("$iby_file_name");
       
   332 				if ( ! open(IBYFILE,">$iby_file_name") )
       
   333 				{
       
   334 					die "ERROR: Could not create variation iby-file\n";
       
   335 				}
       
   336 
       
   337 				print(IBYFILE "/*\n");
       
   338 				print(IBYFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
   339 				print(IBYFILE "* All rights reserved.\n");
       
   340 				print(IBYFILE "* This component and the accompanying materials are made available\n");
       
   341 				print(IBYFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
   342 				print(IBYFILE "* which accompanies this distribution, and is available\n");
       
   343 				print(IBYFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
   344 				print(IBYFILE "*\n");
       
   345 				print(IBYFILE "* Initial Contributors:\n");
       
   346 				print(IBYFILE "* Nokia Corporation - initial contribution.\n");
       
   347 				print(IBYFILE "*\n");
       
   348 				print(IBYFILE "* Contributors:\n");
       
   349 				print(IBYFILE "*\n");
       
   350 				print(IBYFILE "* Description: This iby-file was generated by VariantParser.pl\n");
       
   351 				print(IBYFILE "*\n");
       
   352 				print(IBYFILE "*/\n");
       
   353 				print(IBYFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
   354 				print(IBYFILE "#ifndef __PTI_VARIATION_${variant_name}_IBY__\n");
       
   355 				print(IBYFILE "#define __PTI_VARIATION_${variant_name}_IBY__\n");
       
   356 				print(IBYFILE "\n");
       
   357 
       
   358 				#
       
   359 				# Update iby-file
       
   360 				#
       
   361 				if ($wins_only == 0)
       
   362 				{
       
   363 					print(IBYFILE "\n");
       
   364 					print(IBYFILE "ECOM_PLUGIN(${target_name}.dll, ${impl_uid}.rsc)\n");
       
   365 					print(IBYFILE "\n");
       
   366 				}
       
   367 
       
   368 				print(IBYFILE "\n");
       
   369 				print(IBYFILE "#endif //__PTI_VARIATION_${variant_name}_IBY__\n");
       
   370 				print(IBYFILE "\n");
       
   371 				close(IBYFILE);
       
   372 				
       
   373 				if ($wins_only != 1)
       
   374 				{
       
   375 					print(INFFILE "\nPRJ_EXPORTS\n");
       
   376 					$exportpath = "\/epoc32\/rom\/include\/".$iby_file_prefix.${variant_name}."\.iby";
       
   377 					print(INFFILE "$iby_file_name    $exportpath\n");
       
   378 				}
       
   379 
       
   380 				#############################################################
       
   381 				#
       
   382 				# Create body for main CPP file.
       
   383 				#
       
   384 				#############################################################
       
   385 				unlink("${langdir}${output_dll}${variant_name}.cpp");
       
   386 				if ( ! open(CPPFILE,">${langdir}${output_dll}${variant_name}.cpp") )
       
   387 				{
       
   388 					die "Could not create main cpp file for variant ${variant_name}\n";
       
   389 				}
       
   390 
       
   391 				print(CPPFILE "/*\n");
       
   392 				print(CPPFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
   393 				print(CPPFILE "* All rights reserved.\n");
       
   394 				print(CPPFILE "* This component and the accompanying materials are made available\n");
       
   395 				print(CPPFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
   396 				print(CPPFILE "* which accompanies this distribution, and is available\n");
       
   397 				print(CPPFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
   398 				print(CPPFILE "*\n");
       
   399 				print(CPPFILE "* Initial Contributors:\n");
       
   400 				print(CPPFILE "* Nokia Corporation - initial contribution.\n");
       
   401 				print(CPPFILE "*\n");
       
   402 				print(CPPFILE "* Contributors:\n");
       
   403 				print(CPPFILE "*\n");
       
   404 				print(CPPFILE "* Description: Keymapping data implementation for ${langconstant}\n");
       
   405 				print(CPPFILE "*\n");
       
   406 				print(CPPFILE "*/\n");
       
   407 				print(CPPFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
   408 
       
   409 				print(CPPFILE "#include <PtiKeyMapData.h>\n");
       
   410 				print(CPPFILE "\n#include <Languages.hrh>\n");
       
   411 				print(CPPFILE "\n");
       
   412 				print(CPPFILE "#include \"${output_dll}${variant_name}.h\"\n");
       
   413 				print(CPPFILE "\n");
       
   414 				close(CPPFILE);
       
   415 
       
   416 				#############################################################
       
   417 				#
       
   418 				# Create body for main header file.
       
   419 				#
       
   420 				#############################################################
       
   421 				unlink("${langdir}${output_dll}${variant_name}.h");
       
   422 				if ( ! open(CHHFILE,">${langdir}${output_dll}${variant_name}.h") )
       
   423 				{
       
   424 					die "Could not create main header file for variant ${variant_name}\n";
       
   425 				}
       
   426 
       
   427 				print(CHHFILE "/*\n");
       
   428 				print(CHHFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
   429 				print(CHHFILE "* All rights reserved.\n");
       
   430 				print(CHHFILE "* This component and the accompanying materials are made available\n");
       
   431 				print(CHHFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
   432 				print(CHHFILE "* which accompanies this distribution, and is available\n");
       
   433 				print(CHHFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
   434 				print(CHHFILE "*\n");
       
   435 				print(CHHFILE "* Initial Contributors:\n");
       
   436 				print(CHHFILE "* Nokia Corporation - initial contribution.\n");
       
   437 				print(CHHFILE "*\n");
       
   438 				print(CHHFILE "* Contributors:\n");
       
   439 				print(CHHFILE "*\n");
       
   440 				print(CHHFILE "* Description: Keymapping data implementation for ${langconstant}\n");
       
   441 				print(CHHFILE "*\n");
       
   442 				print(CHHFILE "*/\n");
       
   443 				print(CHHFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
   444           
       
   445 				print(CHHFILE "#ifndef __PTI_LANGUAGES_${variant_name}_H__\n");
       
   446 				print(CHHFILE "#define __PTI_LANGUAGES_${variant_name}_H__\n");
       
   447 				print(CHHFILE "\n");
       
   448 				print(CHHFILE "#include <PtiKeyMapData.h>\n");
       
   449 				print(CHHFILE "\n");
       
   450 				close(CHHFILE);
       
   451 
       
   452 
       
   453 				#############################################################
       
   454 				#
       
   455 				# Create body for factory cpp file.
       
   456 				#
       
   457 				#############################################################
       
   458 				unlink("${langdir}PtiFactory_${variant_name}.cpp");
       
   459 				if ( ! open(CFFFILE,">${langdir}PtiFactory_${variant_name}.cpp") )
       
   460 				{
       
   461 					die "Could not create main cpp file for variant ${variant_name}\n";
       
   462 				}
       
   463 
       
   464 				print(CFFFILE "/*\n");
       
   465 				print(CFFFILE "* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies).\n");
       
   466 				print(CFFFILE "* All rights reserved.\n");
       
   467 				print(CFFFILE "* This component and the accompanying materials are made available\n");
       
   468 				print(CFFFILE "* under the terms of the License \"Eclipse Public License v1.0\"\n");
       
   469 				print(CFFFILE "* which accompanies this distribution, and is available\n");
       
   470 				print(CFFFILE "* at the URL \"http://www.eclipse.org/legal/epl-v10.html\".\n");
       
   471 				print(CFFFILE "*\n");
       
   472 				print(CFFFILE "* Initial Contributors:\n");
       
   473 				print(CFFFILE "* Nokia Corporation - initial contribution.\n");
       
   474 				print(CFFFILE "*\n");
       
   475 				print(CFFFILE "* Contributors:\n");
       
   476 				print(CFFFILE "*\n");
       
   477 				print(CFFFILE "* Description: Keymapping data implementation for ${langconstant}\n");
       
   478 				print(CFFFILE "*\n");
       
   479 				print(CFFFILE "*/\n");
       
   480 				print(CFFFILE "\n\n\n\n\n\n\n\n\n\n\n\n");
       
   481 				print(CFFFILE "#include <ECom/ImplementationProxy.h>\n");
       
   482 				print(CFFFILE "\n#include <Languages.hrh>\n");
       
   483 				print(CFFFILE "\n");
       
   484 				print(CFFFILE "#include \"${output_dll}${variant_name}.h\"\n");
       
   485 				print(CFFFILE "\n");
       
   486 
       
   487 
       
   488 				print(CFFFILE "class CPtiVariant${variant_name}DataFactory : public CPtiKeyMapDataFactory\n");
       
   489 				print(CFFFILE "    {\n");
       
   490 				print(CFFFILE "    public:\n");
       
   491 				print(CFFFILE "        CPtiVariant${variant_name}DataFactory() {}\n");
       
   492 				print(CFFFILE "        static CPtiVariant${variant_name}DataFactory* NewL();\n");
       
   493 				print(CFFFILE "        MPtiKeyMapData* KeyMapDataForLanguageL(TInt aLanguageCode);\n");
       
   494 				print(CFFFILE "        void ListLanguagesL(RArray<TInt>& aResult);\n");
       
   495 				print(CFFFILE "    };\n");
       
   496 				print(CFFFILE "\n");
       
   497 				print(CFFFILE "\n");
       
   498 				print(CFFFILE "CPtiVariant${variant_name}DataFactory* CPtiVariant${variant_name}DataFactory::NewL()\n");
       
   499 				print(CFFFILE "    {\n");
       
   500 				print(CFFFILE "    return new (ELeave) CPtiVariant${variant_name}DataFactory();\n");
       
   501 				print(CFFFILE "    }\n");
       
   502 				print(CFFFILE "\n");
       
   503 				print(CFFFILE "\n");
       
   504 				print(CFFFILE "const TImplementationProxy ImplementationTable[] =\n");
       
   505 				print(CFFFILE "    {\n");
       
   506 				print(CFFFILE "    IMPLEMENTATION_PROXY_ENTRY(0x$impl_uid, CPtiVariant${variant_name}DataFactory::NewL)\n");
       
   507 				print(CFFFILE "    };\n");
       
   508 				print(CFFFILE "\n");
       
   509 				print(CFFFILE "\n");
       
   510 				print(CFFFILE "EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)\n");
       
   511 				print(CFFFILE "    {\n");
       
   512 				print(CFFFILE "    aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy);\n");
       
   513 				print(CFFFILE "    return ImplementationTable;\n");
       
   514 				print(CFFFILE "    }\n");
       
   515 				print(CFFFILE "\n");
       
   516 				print(CFFFILE "\n");
       
   517 				print(CFFFILE "MPtiKeyMapData* CPtiVariant${variant_name}DataFactory::KeyMapDataForLanguageL(TInt aLanguageCode)\n");
       
   518 				print(CFFFILE "    {\n");
       
   519 
       
   520 			}
       
   521 			elsif (index($line, ".txt") > 0)
       
   522 			{
       
   523 				$line =~ s/<.*?>//sg;
       
   524 				@words = grep(/./,("\n",split(/[^_[:alnum:]]+/s,$line)));
       
   525 
       
   526 				$lang_name = $words[0];
       
   527 				$map_file_name = $words[1] . ".txt";
       
   528 
       
   529 				print("    Adding $map_file_name for $lang_name \n");
       
   530 
       
   531 				#check that the given file exists
       
   532 				if ( ! open(LANGFILE,"${keymapsdir}${map_file_name}") )
       
   533 				{
       
   534 					die "ERROR: Unable to locate $map_file_name \n";
       
   535 				}
       
   536 				close(LANGFILE);
       
   537 
       
   538 				push(@lang_name_array, $lang_name);
       
   539 
       
   540 				#
       
   541 				# Update factory file
       
   542 				#
       
   543 				if ($lang_name eq "Basque" || $lang_name eq "Galician")
       
   544 				{
       
   545 					print(CFFFILE "    if (aLanguageCode == KLang${lang_name})\n");
       
   546 				}
       
   547 				else
       
   548 				{
       
   549 					print(CFFFILE "    if (aLanguageCode == ELang${lang_name})\n");
       
   550 				}
       
   551 				print(CFFFILE "        {\n");
       
   552 				print(CFFFILE "        return CPtiLangDataImpl${lang_name}::NewL();\n");
       
   553 				print(CFFFILE "        }\n");
       
   554 
       
   555 				$blocks_in_use = "";
       
   556 				if ($use_block_12_key == 1)
       
   557 				{
       
   558 					$blocks_in_use = $blocks_in_use . "12-KEY_";
       
   559 				}
       
   560 				if ($use_block_qwerty_standard == 1)
       
   561 				{
       
   562 					$blocks_in_use = $blocks_in_use . "STANDARD_";
       
   563 				}
       
   564 				if ($use_block_qwerty_mini == 1)
       
   565 				{
       
   566 					$blocks_in_use = $blocks_in_use . "4X10_";
       
   567 				}
       
   568 				if ($use_block_qwerty_3x11 == 1)
       
   569 				{
       
   570 					$blocks_in_use = $blocks_in_use . "3X11_";
       
   571 				}
       
   572 				if ($use_block_qwerty_half == 1)
       
   573 				{
       
   574 					$blocks_in_use = $blocks_in_use . "HALF_";
       
   575 				}
       
   576 				if ($use_block_custom == 1)
       
   577 				{
       
   578 					$blocks_in_use = $blocks_in_use . "CUSTOM_";
       
   579 				}
       
   580 
       
   581 				if ($blocks_in_use eq "")
       
   582 				{
       
   583 					die "ERROR: No data blocks selected (see USE BLOCK keyword)\n";
       
   584 				}
       
   585 
       
   586 				system("perl KeymapBuilder2.pl $keymapsdir $map_file_name $lang_name $variant_name $blocks_in_use");
       
   587 
       
   588 				#
       
   589 				# Finalize header file.
       
   590 				#
       
   591 				if ( ! open(CHHFILE,">>${langdir}${output_dll}${variant_name}.h") )
       
   592 				{
       
   593 					die "Could not finalize header file for variant ${variant_name}\n";
       
   594 				}
       
   595 			}
       
   596 			elsif (index($line, "USE BLOCK") >= 0)
       
   597 			{
       
   598 				if (index($line, "12-KEY") >= 0)
       
   599 				{
       
   600 					$use_block_12_key = 1;
       
   601 				}
       
   602 				elsif (index($line, "QWERTY STANDARD") >= 0)
       
   603 				{
       
   604 					$use_block_qwerty_standard = 1;
       
   605 				}
       
   606 				elsif (index($line, "QWERTY 4X10") >= 0)
       
   607 				{
       
   608 					$use_block_qwerty_mini = 1;
       
   609 				}
       
   610 				elsif (index($line, "QWERTY 3X11") >= 0)
       
   611 				{
       
   612 					$use_block_qwerty_3x11 = 1;
       
   613 				}
       
   614 				elsif (index($line, "QWERTY HALF") >= 0)
       
   615 				{
       
   616 					$use_block_qwerty_half = 1;
       
   617 				}
       
   618 				elsif (index($line, "CUSTOM") >= 0)
       
   619 				{
       
   620 					$use_block_custom = 1;
       
   621 				}
       
   622 			}
       
   623 			elsif (index($line, "USE DATASET") >= 0)
       
   624 			{
       
   625 
       
   626 				chop($line);   # Remove '\n'
       
   627 				@words = split(/ +/,$line);    # Split into words.
       
   628 
       
   629 				$keymapsdir = $keymapsdirstart;
       
   630 				$keymapsdir = $keymapsdir . $words[2] . "\/";
       
   631 			}
       
   632 		}
       
   633 
       
   634 endblock:
       
   635 	}
       
   636 }
       
   637 
       
   638 
       
   639 # Close bld.inf file.
       
   640 close(INFFILE);
       
   641 
       
   642 # Finalize and close factory file for last round.
       
   643 print(CFFFILE "\n");
       
   644 print(CFFFILE "    return NULL;\n");
       
   645 print(CFFFILE "    }\n");
       
   646 print(CFFFILE "\n");
       
   647 print(CFFFILE "\n");
       
   648 print(CFFFILE "void CPtiVariant${variant_name}DataFactory::ListLanguagesL(RArray<TInt>& aResult)\n");
       
   649 print(CFFFILE "    {\n");
       
   650      
       
   651 for ($ii = 0; $ii < scalar(@lang_name_array); $ii++)
       
   652      {    
       
   653      if (@lang_name_array[$ii] eq "Basque" || @lang_name_array[$ii] eq "Galician")
       
   654             {
       
   655             print(CFFFILE "    aResult.AppendL(KLang@lang_name_array[$ii]);\n");        	                  
       
   656             }
       
   657       else
       
   658             {     
       
   659             print(CFFFILE "    aResult.AppendL(ELang@lang_name_array[$ii]);\n");
       
   660             }
       
   661      }
       
   662 
       
   663 print(CFFFILE "    }\n");
       
   664 print(CFFFILE "\n");
       
   665 print(CFFFILE "// End of file\n");
       
   666 close(CFFFILE);
       
   667 
       
   668 # Finalize and close header file for last round.
       
   669 print(CHHFILE "#endif\n");         
       
   670 print(CHHFILE "\n// End of file. \n");         
       
   671 close(CHHFILE);    
       
   672 
       
   673 #
       
   674 # Close remaining resources.
       
   675 #
       
   676 close(VARFILE);
       
   677 
       
   678 close(MASTERVARFILE);
       
   679 
       
   680 # End of file