textinput/ptienginev2/tools/KeymapBuilder2.pl
changeset 0 eb1f2e154e89
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:   Builds a keymap code file from given keymapping data file.
       
    15 #
       
    16 ($time_second, $time_minute, $time_hour,          # time/date
       
    17     $date_day, $date_month, $date_year,
       
    18     $day_week, $day_year, $isdst) = localtime(time);
       
    19 
       
    20 if ($date_year < 70) {$date_year += 2000;}        # add century
       
    21     else {$date_year += 1900;}
       
    22 				   	                			      			 	                                                     			  
       
    23 #
       
    24 # Variables for qwerty data handling
       
    25 #
       
    26 $has_qwerty_data = 0;
       
    27 $has_deadkey_data = 0;
       
    28 
       
    29 $custom_matrix_width = 0;
       
    30 $custom_matrix_height = 0;
       
    31 
       
    32 #
       
    33 # Qwerty keyboard type
       
    34 #
       
    35 $current_keyboard_data_block = "";
       
    36 
       
    37 #
       
    38 # Variants for numeric key mapping definition handling
       
    39 #
       
    40 $numkeyscount = 22;
       
    41 @numkeynames = ("+","*","#","p","w","1","2","3","4","5","6","7","8","9","0",";",".",",","-","E","?","/"); 
       
    42 
       
    43 ###########################################################
       
    44 #
       
    45 # Default scan code <-> coordinate bindings for 12-key
       
    46 # (these can be overrided with scan_binding keyword).
       
    47 #
       
    48 ###########################################################
       
    49 $scan_bind{'12-KEY 1 1'} = "EPtiKey1";
       
    50 $scan_bind{'12-KEY 1 2'} = "EPtiKey2";
       
    51 $scan_bind{'12-KEY 1 3'} = "EPtiKey3";
       
    52 $scan_bind{'12-KEY 2 1'} = "EPtiKey4";
       
    53 $scan_bind{'12-KEY 2 2'} = "EPtiKey5";
       
    54 $scan_bind{'12-KEY 2 3'} = "EPtiKey6";
       
    55 $scan_bind{'12-KEY 3 1'} = "EPtiKey7";
       
    56 $scan_bind{'12-KEY 3 2'} = "EPtiKey8";
       
    57 $scan_bind{'12-KEY 3 3'} = "EPtiKey9";
       
    58 $scan_bind{'12-KEY 4 1'} = "EPtiKeyStar";
       
    59 $scan_bind{'12-KEY 4 2'} = "EPtiKey0";
       
    60 $scan_bind{'12-KEY 4 3'} = "EPtiKeyHash";
       
    61 
       
    62 ###########################################################
       
    63 #
       
    64 # Default scan code <-> coordinate bindings for std qwerty
       
    65 # (these can be overrided with scan_binding keyword).
       
    66 #
       
    67 ###########################################################
       
    68 # no binding for (1 1), it is backlight key in E70
       
    69 $scan_bind{'QWERTY STANDARD 1 2'} = "EPtiKeyQwerty1";
       
    70 $scan_bind{'QWERTY STANDARD 1 3'} = "EPtiKeyQwerty2";
       
    71 $scan_bind{'QWERTY STANDARD 1 4'} = "EPtiKeyQwerty3";
       
    72 $scan_bind{'QWERTY STANDARD 1 5'} = "EPtiKeyQwerty4";
       
    73 $scan_bind{'QWERTY STANDARD 1 6'} = "EPtiKeyQwerty5";
       
    74 $scan_bind{'QWERTY STANDARD 1 7'} = "EPtiKeyQwerty6";
       
    75 $scan_bind{'QWERTY STANDARD 1 8'} = "EPtiKeyQwerty7";
       
    76 $scan_bind{'QWERTY STANDARD 1 9'} = "EPtiKeyQwerty8";
       
    77 $scan_bind{'QWERTY STANDARD 1 10'} = "EPtiKeyQwerty9";
       
    78 $scan_bind{'QWERTY STANDARD 1 11'} = "EPtiKeyQwerty0";
       
    79 # no binding for (1 12), it is backspace in E70
       
    80 
       
    81 $scan_bind{'QWERTY STANDARD 2 1'} = "EPtiKeyQwertyPlus";
       
    82 $scan_bind{'QWERTY STANDARD 2 2'} = "EPtiKeyQwertyQ";
       
    83 $scan_bind{'QWERTY STANDARD 2 3'} = "EPtiKeyQwertyW";
       
    84 $scan_bind{'QWERTY STANDARD 2 4'} = "EPtiKeyQwertyE";
       
    85 $scan_bind{'QWERTY STANDARD 2 5'} = "EPtiKeyQwertyR";
       
    86 $scan_bind{'QWERTY STANDARD 2 6'} = "EPtiKeyQwertyT";
       
    87 $scan_bind{'QWERTY STANDARD 2 7'} = "EPtiKeyQwertyY";
       
    88 $scan_bind{'QWERTY STANDARD 2 8'} = "EPtiKeyQwertyU";
       
    89 $scan_bind{'QWERTY STANDARD 2 9'} = "EPtiKeyQwertyI";
       
    90 $scan_bind{'QWERTY STANDARD 2 10'} = "EPtiKeyQwertyO";
       
    91 $scan_bind{'QWERTY STANDARD 2 11'} = "EPtiKeyQwertyP";
       
    92 $scan_bind{'QWERTY STANDARD 2 12'} = "EPtiKeyQwertyMinus";
       
    93 
       
    94 $scan_bind{'QWERTY STANDARD 3 1'} = "EPtiKeyQwertyHash";
       
    95 $scan_bind{'QWERTY STANDARD 3 2'} = "EPtiKeyQwertyA";
       
    96 $scan_bind{'QWERTY STANDARD 3 3'} = "EPtiKeyQwertyS";
       
    97 $scan_bind{'QWERTY STANDARD 3 4'} = "EPtiKeyQwertyD";
       
    98 $scan_bind{'QWERTY STANDARD 3 5'} = "EPtiKeyQwertyF";
       
    99 $scan_bind{'QWERTY STANDARD 3 6'} = "EPtiKeyQwertyG";
       
   100 $scan_bind{'QWERTY STANDARD 3 7'} = "EPtiKeyQwertyH";
       
   101 $scan_bind{'QWERTY STANDARD 3 8'} = "EPtiKeyQwertyJ";
       
   102 $scan_bind{'QWERTY STANDARD 3 9'} = "EPtiKeyQwertyK";
       
   103 $scan_bind{'QWERTY STANDARD 3 10'} = "EPtiKeyQwertyL";
       
   104 $scan_bind{'QWERTY STANDARD 3 11'} = "EPtiKeyQwertySemicolon";
       
   105 $scan_bind{'QWERTY STANDARD 3 12'} = "EPtiKeyQwertyApostrophe";
       
   106 
       
   107 # no binding for (4 1)
       
   108 $scan_bind{'QWERTY STANDARD 4 2'} = "EPtiKeyQwertyZ";
       
   109 $scan_bind{'QWERTY STANDARD 4 3'} = "EPtiKeyQwertyX";
       
   110 $scan_bind{'QWERTY STANDARD 4 4'} = "EPtiKeyQwertyC";
       
   111 $scan_bind{'QWERTY STANDARD 4 5'} = "EPtiKeyQwertyV";
       
   112 $scan_bind{'QWERTY STANDARD 4 6'} = "EPtiKeyQwertyB";
       
   113 $scan_bind{'QWERTY STANDARD 4 7'} = "EPtiKeyQwertyN";
       
   114 $scan_bind{'QWERTY STANDARD 4 8'} = "EPtiKeyQwertyM";
       
   115 $scan_bind{'QWERTY STANDARD 4 9'} = "EPtiKeyQwertyComma";
       
   116 $scan_bind{'QWERTY STANDARD 4 10'} = "EPtiKeyQwertyFullstop";
       
   117 $scan_bind{'QWERTY STANDARD 4 11'} = "EPtiKeyQwertySlash";
       
   118 # no binding for (4 12), it is enter in E70
       
   119 
       
   120 ###########################################################
       
   121 #
       
   122 # Default scan code <-> coordinate bindings for 4x10 qwerty
       
   123 # (these can be overrided with scan_binding keyword).
       
   124 #
       
   125 ###########################################################
       
   126 $scan_bind{'QWERTY 4X10 1 1'} = "EPtiKeyQwerty1";
       
   127 $scan_bind{'QWERTY 4X10 1 2'} = "EPtiKeyQwerty2";
       
   128 $scan_bind{'QWERTY 4X10 1 3'} = "EPtiKeyQwerty3";
       
   129 $scan_bind{'QWERTY 4X10 1 4'} = "EPtiKeyQwerty4";
       
   130 $scan_bind{'QWERTY 4X10 1 5'} = "EPtiKeyQwerty5";
       
   131 $scan_bind{'QWERTY 4X10 1 6'} = "EPtiKeyQwerty6";
       
   132 $scan_bind{'QWERTY 4X10 1 7'} = "EPtiKeyQwerty7";
       
   133 $scan_bind{'QWERTY 4X10 1 8'} = "EPtiKeyQwerty8";
       
   134 $scan_bind{'QWERTY 4X10 1 9'} = "EPtiKeyQwerty9";
       
   135 $scan_bind{'QWERTY 4X10 1 10'} = "EPtiKeyQwerty0";
       
   136 
       
   137 $scan_bind{'QWERTY 4X10 2 1'} = "EPtiKeyQwertyA";
       
   138 $scan_bind{'QWERTY 4X10 2 2'} = "EPtiKeyQwertyS";
       
   139 $scan_bind{'QWERTY 4X10 2 3'} = "EPtiKeyQwertyD";
       
   140 $scan_bind{'QWERTY 4X10 2 4'} = "EPtiKeyQwertyF";
       
   141 $scan_bind{'QWERTY 4X10 2 5'} = "EPtiKeyQwertyG";
       
   142 $scan_bind{'QWERTY 4X10 2 6'} = "EPtiKeyQwertyH";
       
   143 $scan_bind{'QWERTY 4X10 2 7'} = "EPtiKeyQwertyJ";
       
   144 $scan_bind{'QWERTY 4X10 2 8'} = "EPtiKeyQwertyK";
       
   145 $scan_bind{'QWERTY 4X10 2 9'} = "EPtiKeyQwertyL";
       
   146 # No binding for (2 10), it is backspace
       
   147 
       
   148 $scan_bind{'QWERTY 4X10 3 1'} = "EPtiKeyQwertyZ";
       
   149 $scan_bind{'QWERTY 4X10 3 2'} = "EPtiKeyQwertyX";
       
   150 $scan_bind{'QWERTY 4X10 3 3'} = "EPtiKeyQwertyC";
       
   151 $scan_bind{'QWERTY 4X10 3 4'} = "EPtiKeyQwertyV";
       
   152 $scan_bind{'QWERTY 4X10 3 5'} = "EPtiKeyQwertyB";
       
   153 $scan_bind{'QWERTY 4X10 3 6'} = "EPtiKeyQwertyN";
       
   154 $scan_bind{'QWERTY 4X10 3 7'} = "EPtiKeyQwertyM";
       
   155 $scan_bind{'QWERTY 4X10 3 8'} = "EPtiKeyQwertyComma";
       
   156 $scan_bind{'QWERTY 4X10 3 9'} = "EPtiKeyQwertyFullstop";
       
   157 # No binding for (3 10), it is enter
       
   158 
       
   159 # No binding for (4 1)
       
   160 # No binding for (4 2), it is shift
       
   161 #$scan_bind{'QWERTY 4X10 4 3'} = "EPtiKeyQwertySlash";
       
   162 $scan_bind{'QWERTY 4X10 4 4'} = "EStdKeySquareBracketRight";
       
   163 #$scan_bind{'QWERTY 4X10 4 5'} = "EStdKeySpace";
       
   164 #$scan_bind{'QWERTY 4X10 4 6'} = "EStdKeySpace";
       
   165 # No binding for (4 5), it is space
       
   166 # No binding for (4 6), it is space
       
   167 $scan_bind{'QWERTY 4X10 4 7'} = "EStdKeySquareBracketLeft";
       
   168 $scan_bind{'QWERTY 4X10 4 8'} = "EStdKeySingleQuote";
       
   169 # No binding for (4 8), it is ctrl;
       
   170 # No binding for (4 9), it is shift
       
   171 # No binding for (4 10), it is chr
       
   172 
       
   173 ###########################################################
       
   174 #
       
   175 # Default scan code <-> coordinate bindings for 3x11 qwerty
       
   176 # (these can be overrided with scan_binding keyword).
       
   177 #
       
   178 ###########################################################
       
   179 $scan_bind{'QWERTY 3X11 1 1'} = "EPtiKeyQwertyQ";
       
   180 $scan_bind{'QWERTY 3X11 1 2'} = "EPtiKeyQwertyW";
       
   181 $scan_bind{'QWERTY 3X11 1 3'} = "EPtiKeyQwertyE";
       
   182 $scan_bind{'QWERTY 3X11 1 4'} = "EPtiKeyQwertyR";
       
   183 $scan_bind{'QWERTY 3X11 1 5'} = "EPtiKeyQwertyT";
       
   184 $scan_bind{'QWERTY 3X11 1 6'} = "EPtiKeyQwertyY";
       
   185 $scan_bind{'QWERTY 3X11 1 7'} = "EPtiKeyQwertyU";
       
   186 $scan_bind{'QWERTY 3X11 1 8'} = "EPtiKeyQwertyI";
       
   187 $scan_bind{'QWERTY 3X11 1 9'} = "EPtiKeyQwertyO";
       
   188 $scan_bind{'QWERTY 3X11 1 10'} = "EPtiKeyQwertyP";
       
   189 # no binding for (3 11), it is backspace
       
   190 
       
   191 $scan_bind{'QWERTY 3X11 2 1'} = "EPtiKeyQwertyA";
       
   192 $scan_bind{'QWERTY 3X11 2 2'} = "EPtiKeyQwertyS";
       
   193 $scan_bind{'QWERTY 3X11 2 3'} = "EPtiKeyQwertyD";
       
   194 $scan_bind{'QWERTY 3X11 2 4'} = "EPtiKeyQwertyF";
       
   195 $scan_bind{'QWERTY 3X11 2 5'} = "EPtiKeyQwertyG";
       
   196 $scan_bind{'QWERTY 3X11 2 6'} = "EPtiKeyQwertyH";
       
   197 $scan_bind{'QWERTY 3X11 2 7'} = "EPtiKeyQwertyJ";
       
   198 $scan_bind{'QWERTY 3X11 2 8'} = "EPtiKeyQwertyK";
       
   199 $scan_bind{'QWERTY 3X11 2 9'} = "EPtiKeyQwertyL";
       
   200 $scan_bind{'QWERTY 3X11 2 10'} = "EPtiKeyQwertyComma";
       
   201 # No binding for (2 11), it is enter
       
   202 
       
   203 # No binding for (3 1), it is shift
       
   204 $scan_bind{'QWERTY 3X11 3 2'} = "EPtiKeyQwertyZ";
       
   205 $scan_bind{'QWERTY 3X11 3 3'} = "EPtiKeyQwertyX";
       
   206 $scan_bind{'QWERTY 3X11 3 4'} = "EPtiKeyQwertyC";
       
   207 $scan_bind{'QWERTY 3X11 3 5'} = "EPtiKeyQwertyV";
       
   208 $scan_bind{'QWERTY 3X11 3 6'} = "EPtiKeyQwertyB";
       
   209 $scan_bind{'QWERTY 3X11 3 7'} = "EPtiKeyQwertyN";
       
   210 $scan_bind{'QWERTY 3X11 3 8'} = "EPtiKeyQwertyM";
       
   211 $scan_bind{'QWERTY 3X11 3 9'} = "EStdKeySpace";
       
   212 # No binding for (3 10), it is space
       
   213 # No binding for (3 11), it is fn
       
   214 
       
   215 ###########################################################
       
   216 #
       
   217 # Default scan code <-> coordinate bindings for half qwerty
       
   218 # (these can be overrided with scan_binding keyword). 
       
   219 #
       
   220 ###########################################################
       
   221 # TO BE DEFINED (these are working asumptions).
       
   222 $scan_bind{'QWERTY HALF 1 1'} = "EPtiKeyQwertyQ"; 
       
   223 $scan_bind{'QWERTY HALF 1 2'} = "EPtiKeyQwerty1";
       
   224 $scan_bind{'QWERTY HALF 1 3'} = "EPtiKeyQwerty2";
       
   225 $scan_bind{'QWERTY HALF 1 4'} = "EPtiKeyQwerty3";
       
   226 $scan_bind{'QWERTY HALF 1 5'} = "EPtiKeyQwertyO";
       
   227 
       
   228 $scan_bind{'QWERTY HALF 2 1'} = "EPtiKeyQwertyA";
       
   229 $scan_bind{'QWERTY HALF 2 2'} = "EPtiKeyQwerty4";
       
   230 $scan_bind{'QWERTY HALF 2 3'} = "EPtiKeyQwerty5";
       
   231 $scan_bind{'QWERTY HALF 2 4'} = "EPtiKeyQwerty6";
       
   232 $scan_bind{'QWERTY HALF 2 5'} = "EPtiKeyQwertyL";
       
   233 
       
   234 $scan_bind{'QWERTY HALF 3 1'} = "EPtiKeyQwertyZ";
       
   235 $scan_bind{'QWERTY HALF 3 2'} = "EPtiKeyQwerty7";
       
   236 $scan_bind{'QWERTY HALF 3 3'} = "EPtiKeyQwerty8";
       
   237 $scan_bind{'QWERTY HALF 3 4'} = "EPtiKeyQwerty9";
       
   238 $scan_bind{'QWERTY HALF 3 5'} = "EPtiKeyQwertyFullstop";
       
   239 
       
   240 # No binding
       
   241 $scan_bind{'QWERTY HALF 4 2'} = "EPtiKeyQwertyChr";
       
   242 $scan_bind{'QWERTY HALF 4 3'} = "EPtiKeyQwertySpace";
       
   243 $scan_bind{'QWERTY HALF 4 4'} = "EPtiKeyQwertyLeftShift";
       
   244 # No binding, it is enter
       
   245 
       
   246 #
       
   247 # Global variables.
       
   248 #
       
   249 $inputpath = shift(@ARGV);
       
   250 $filename  = shift(@ARGV);
       
   251 $langname = shift(@ARGV);
       
   252 $variant_name = shift(@ARGV);
       
   253 $blocks_in_use = shift(@ARGV);
       
   254 $inputfile = $inputpath . $filename; 
       
   255 
       
   256 $langconstant = "ELang${langname}";
       
   257 
       
   258 if ($langname eq "Galician")
       
   259     {
       
   260     $langconstant = "KLangGalician";	
       
   261     }
       
   262 if ($langname eq "Basque")
       
   263     {
       
   264     $langconstant = "KLangBasque";	
       
   265     }
       
   266 
       
   267 
       
   268 $output_dll = "PtiKeymappings_";
       
   269 $outputdir = "..\/languages\/";
       
   270 $mmpext = ".mmp";
       
   271 $dlluid = $langdll{$langname};
       
   272 $impluid = $langimpl{$langname};
       
   273 $mtindex = 0;
       
   274 $print_not_latin_language = 0;
       
   275 
       
   276 $has_numeric_mode_data = 0;
       
   277 
       
   278 $for_zhuyin_tag_value = "0x2462";
       
   279 $for_pinyin_tag_value = "0x2460";
       
   280 $for_stroke_tag_value = "0x2461";
       
   281 $for_cangjie_tag_value = "0x2463";
       
   282 $get_all_marker_value = "0x2464";
       
   283 
       
   284 $qwerty_num_keys = 48;
       
   285 
       
   286 #############################################################
       
   287 #
       
   288 # Subrountine for counting characters in data row
       
   289 #
       
   290 #############################################################
       
   291 sub countchars {
       
   292      ($instr)=@_; 
       
   293      @details=split /,/, $instr;	
       
   294      $numchars = $#details + 1;
       
   295    }
       
   296 
       
   297 ##############################################################   
       
   298 #
       
   299 # Subroutine for converting qwerty key cordinates into 
       
   300 # EPtiKey constants.
       
   301 #   
       
   302 ##############################################################
       
   303 sub convert_coordinates
       
   304     {
       
   305 	$converted_coordinates = $scan_bind{$_[0]};	
       
   306     }  
       
   307 
       
   308 ##############################################################
       
   309 #
       
   310 # Subroutine print_data_block for exporting a data block.
       
   311 # Parameters: boardname constant
       
   312 #             number of rows in keyboard matrix 
       
   313 #             number of collumns in keyboard matrix
       
   314 #             data block name
       
   315 #
       
   316 ##############################################################
       
   317 sub print_data_block
       
   318     {
       
   319     my $boardname = shift;
       
   320     my $rows = shift;
       
   321     my $cols = shift;
       
   322     my $blockname = shift;
       
   323             
       
   324     print(OUTFILE "//\n");	
       
   325     print(OUTFILE "// $boardname keymap data table\n");	
       
   326     print(OUTFILE "//\n");		
       
   327     print(OUTFILE "const TUint16 ${boardname}Data_table_${langname}[] =\n");
       
   328     print(OUTFILE "    {\n");
       
   329 
       
   330     $mtindex = 0;
       
   331 
       
   332     for ($i = 1; $i <= $rows; $i++)
       
   333        {            
       
   334        for ($j = 1; $j <= $cols; $j++)
       
   335            { 
       
   336            $keyname = "$blockname $i $j";                 
       
   337            &countchars($keys{$keyname});
       
   338            $bindnumchrs{$keyname} = $numchars;
       
   339            $bindindex{$keyname} = $mtindex;
       
   340            $mtindex = $mtindex + $bindnumchrs{$keyname};
       
   341            if ($numchars > 0)
       
   342                {	              
       
   343                print(OUTFILE "    $keys{$keyname},\n");	
       
   344                }
       
   345            }
       
   346        }  
       
   347    
       
   348     for ($i=1; $i <= $rows; $i++)
       
   349         {
       
   350         for ($j = 1; $j <= $cols; $j++)
       
   351             {
       
   352             $keyname = "$blockname $i $j";                       
       
   353             &countchars($keys_u{$keyname});
       
   354             $bindnumchrs_u{$keyname} = $numchars;
       
   355             $bindindex_u{$keyname} = $mtindex;
       
   356             $mtindex = $mtindex + $bindnumchrs_u{$keyname};
       
   357             if ($numchars > 0)
       
   358                 {            
       
   359                 print(OUTFILE "    $keys_u{$keyname},\n");	
       
   360                 }
       
   361             }
       
   362         }
       
   363 	if ($has_chr_keys{$blockname} == 1)
       
   364         {    
       
   365         for ($i = 1; $i <= $rows; $i++)
       
   366             {
       
   367             for ($j = 1; $j <= $cols; $j++)
       
   368                 {
       
   369                 $keyname = "$blockname $i $j";
       
   370                 &countchars($keys_chr{$keyname});
       
   371                 $chr_bindnumchrs{$keyname} = $numchars;
       
   372                 $chr_bindindex{$keyname} = $mtindex;
       
   373                 $mtindex = $mtindex + $chr_bindnumchrs{$keyname};
       
   374                 if ($numchars > 0)
       
   375                     {	
       
   376                     print(OUTFILE "    $keys_chr{$keyname},\n");	
       
   377                     }
       
   378                 }
       
   379             }
       
   380 
       
   381         for ($i = 1; $i <= $rows; $i++)
       
   382             {
       
   383             for ($j = 1; $j <= $cols; $j++)
       
   384                 {            
       
   385                 $keyname = "$blockname $i $j"; 
       
   386                 &countchars($keys_chr_u{$keyname});
       
   387                 $chr_bindnumchrs_u{$keyname} = $numchars;
       
   388                 $chr_bindindex_u{$keyname} = $mtindex;
       
   389                 $mtindex = $mtindex + $chr_bindnumchrs_u{$keyname};
       
   390                 if ($numchars > 0)
       
   391                     {
       
   392                     print(OUTFILE "    $keys_chr_u{$keyname},\n");	
       
   393                     }    
       
   394                 }            
       
   395             }                            
       
   396         }  
       
   397     if ($has_fn_keys{$blockname} == 1)
       
   398         {    
       
   399         for ($i = 1; $i <= $rows; $i++)
       
   400             {
       
   401             for ($j = 1; $j <= $cols; $j++)
       
   402                 {
       
   403                 $keyname = "$blockname $i $j";
       
   404                 &countchars($keys_fn{$keyname});
       
   405                 $fn_bindnumchrs{$keyname} = $numchars;
       
   406                 $fn_bindindex{$keyname} = $mtindex;
       
   407                 $mtindex = $mtindex + $fn_bindnumchrs{$keyname};
       
   408                 if ($numchars > 0)
       
   409                     {	
       
   410                     print(OUTFILE "    $keys_fn{$keyname},\n");	
       
   411                     }
       
   412                 }
       
   413             }
       
   414 
       
   415         for ($i = 1; $i <= $rows; $i++)
       
   416             {
       
   417             for ($j = 1; $j <= $cols; $j++)
       
   418                 {            
       
   419                 $keyname = "$blockname $i $j"; 
       
   420                 &countchars($keys_fn_u{$keyname});
       
   421                 $fn_bindnumchrs_u{$keyname} = $numchars;
       
   422                 $fn_bindindex_u{$keyname} = $mtindex;
       
   423                 $mtindex = $mtindex + $fn_bindnumchrs_u{$keyname};
       
   424                 if ($numchars > 0)
       
   425                     {
       
   426                     print(OUTFILE "    $keys_fn_u{$keyname},\n");	
       
   427                     }    
       
   428                 }            
       
   429             }                            
       
   430         }
       
   431         
       
   432     print(OUTFILE "    };\n");    
       
   433     print(OUTFILE "\n");
       
   434     print(OUTFILE "const TInt K${boardname}DataSize_${langname} = $mtindex;\n");  
       
   435     print(OUTFILE "\n");
       
   436     
       
   437     my $keybindingsize = 0;
       
   438 
       
   439     print(OUTFILE "\n");
       
   440     print(OUTFILE "const TPtiKeyBinding ${boardname}KeyBindings_table_${langname}[] =\n");
       
   441     print(OUTFILE "    {\n");     
       
   442   
       
   443     for ($i = 1; $i <= $rows; $i++)
       
   444        {
       
   445        for ($j = 1; $j <= $cols; $j++)
       
   446            {           
       
   447            $keyname = "$blockname $i $j";                
       
   448            $scanbindname = $scan_bind{$keyname};
       
   449            if (length($scanbindname) > 0)
       
   450                {
       
   451                print(OUTFILE "        {$scanbindname, EPtiCaseLower, $bindindex{$keyname}, $bindnumchrs{$keyname}},\n");                
       
   452                $keybindingsize++;
       
   453                }
       
   454            }
       
   455        }
       
   456 
       
   457     for ($i = 1; $i <= $rows; $i++)
       
   458         {
       
   459         for ($j = 1; $j <= $cols; $j++)
       
   460             {
       
   461             $keyname = "$blockname $i $j";  
       
   462             $scanbindname = $scan_bind{$keyname};                          
       
   463             if (length($scanbindname) > 0)
       
   464                {            
       
   465                print(OUTFILE "        {$scanbindname, EPtiCaseUpper, $bindindex_u{$keyname}, $bindnumchrs_u{$keyname}},\n");
       
   466                $keybindingsize++;
       
   467                }
       
   468             }
       
   469         }
       
   470     if ($has_chr_keys{$blockname} == 1)
       
   471            {      
       
   472            for ($i = 1; $i <= $rows; $i++)
       
   473                {
       
   474                for ($j = 1; $j <= $cols; $j++)
       
   475                    {
       
   476                    $keyname = "$blockname $i $j";  
       
   477                    $scanbindname = $scan_bind{$keyname}; 
       
   478                    if (length($scanbindname) > 0 && $chr_bindnumchrs{$keyname} > 0)
       
   479                        {                                                   
       
   480                        print(OUTFILE "        {$scanbindname, EPtiCaseChrLower, $chr_bindindex{$keyname}, $chr_bindnumchrs{$keyname}},\n"); 
       
   481                        $keybindingsize++;
       
   482                        }
       
   483                    }
       
   484                }           
       
   485            
       
   486            for ($i = 1; $i <= $rows; $i++)
       
   487                {
       
   488                for ($j = 1; $j <= $cols; $j++)
       
   489                    {
       
   490                    $keyname = "$blockname $i $j";                
       
   491                    $scanbindname = $scan_bind{$keyname};               
       
   492                    if (length($scanbindname) > 0 && $chr_bindnumchrs_u{$keyname} > 0)
       
   493                        {    
       
   494                        print(OUTFILE "        {$scanbindname, EPtiCaseChrUpper, $chr_bindindex_u{$keyname}, $chr_bindnumchrs_u{$keyname}},\n"); 
       
   495                        $keybindingsize++;
       
   496                        }
       
   497                    }
       
   498                }                                                  
       
   499            }                    
       
   500     if ($has_fn_keys{$blockname} == 1)
       
   501            {      
       
   502            for ($i = 1; $i <= $rows; $i++)
       
   503                {
       
   504                for ($j = 1; $j <= $cols; $j++)
       
   505                    {
       
   506                    $keyname = "$blockname $i $j";  
       
   507                    $scanbindname = $scan_bind{$keyname}; 
       
   508                    if (length($scanbindname) > 0 && $fn_bindnumchrs{$keyname} > 0)
       
   509                        {                                                   
       
   510                        print(OUTFILE "        {$scanbindname, EPtiCaseFnLower, $fn_bindindex{$keyname}, $fn_bindnumchrs{$keyname}},\n"); 
       
   511                        $keybindingsize++;
       
   512                        }
       
   513                    }
       
   514                }           
       
   515            
       
   516            for ($i = 1; $i <= $rows; $i++)
       
   517                {
       
   518                for ($j = 1; $j <= $cols; $j++)
       
   519                    {
       
   520                    $keyname = "$blockname $i $j";                
       
   521                    $scanbindname = $scan_bind{$keyname};               
       
   522                    if (length($scanbindname) > 0 && $fn_bindnumchrs_u{$keyname} > 0)
       
   523                        {    
       
   524                        print(OUTFILE "        {$scanbindname, EPtiCaseFnUpper, $fn_bindindex_u{$keyname}, $fn_bindnumchrs_u{$keyname}},\n"); 
       
   525                        $keybindingsize++;
       
   526                        }
       
   527                    }
       
   528                }                                                  
       
   529            }
       
   530 
       
   531     print(OUTFILE "    };\n");    
       
   532     print(OUTFILE "\n");
       
   533 
       
   534     print(OUTFILE "const TInt KMax${boardname}Index_${langname} = ${keybindingsize};\n");      
       
   535     
       
   536     print(OUTFILE "\n");   
       
   537 
       
   538     #
       
   539     # Add data table for dead keys
       
   540     #
       
   541     if ($has_deadkeys{$blockname} == 1)
       
   542 	    {
       
   543         print(OUTFILE "\n");
       
   544         print(OUTFILE "//\n");	
       
   545         print(OUTFILE "// Dead key data table for ${boardname}\n");	
       
   546         print(OUTFILE "//\n");		
       
   547         print(OUTFILE "const TUint16 ${boardname}DeadKeyData_table_${langname}[] =\n");	
       
   548         print(OUTFILE "    {\n");
       
   549 
       
   550         $dead_key_table_rows = 0;
       
   551         $dead_index = 0;
       
   552         for ($i = 1; $i <= $rows; $i++)
       
   553             {
       
   554             for ($j = 1; $j <= $cols; $j++)
       
   555                 {
       
   556                 $keyname = "$blockname $i $j";                 
       
   557            			&countchars($keys{$keyname});
       
   558                 if ( $numchars > 0 )
       
   559                 		{
       
   560                 		&countchars($deadkeys{$keyname});
       
   561                 		if ($numchars > 0)
       
   562                     		{   
       
   563 							print(OUTFILE "    $dead_index, $deadkeys{$keyname},\n");	
       
   564                 			$dead_key_table_rows++;
       
   565                     		}
       
   566                 		$dead_index++;
       
   567                     }
       
   568                 }
       
   569             }
       
   570   
       
   571        for ($i = 1; $i <= $rows; $i++)
       
   572            {
       
   573            for ($j = 1; $j <= $cols; $j++)
       
   574                {
       
   575                $keyname = "$blockname $i $j";                 
       
   576                &countchars($keys{$keyname});
       
   577 							 if ( $numchars > 0 )
       
   578                 		{
       
   579                			$keyname = "$blockname $i $j";                     
       
   580                			&countchars($deadkeys_u{$keyname});
       
   581                			if ($numchars > 0)
       
   582                    			{
       
   583                    			print(OUTFILE "    $dead_index, $deadkeys_u{$keyname},\n");	
       
   584 	               			$dead_key_table_rows++;
       
   585                    			}
       
   586                      	$dead_index++;
       
   587                			}
       
   588                }
       
   589            }
       
   590            
       
   591     print(OUTFILE "    };\n");
       
   592     print(OUTFILE "\n");	
       
   593     print(OUTFILE "const TInt K${boardname}DeadKeyTableRows_${langname} = $dead_key_table_rows;\n");	
       
   594     print(OUTFILE "\n");	
       
   595 	}       
       
   596 	   	   
       
   597     #	
       
   598     # Add data table for numeric mode keys
       
   599     #	
       
   600     if ($has_numeric_data{$blockname} == 1)
       
   601 	    {	
       
   602         print(OUTFILE "\n//\n");	
       
   603         print(OUTFILE "// Numeric key data table for ${boardname}\n");	
       
   604         print(OUTFILE "//\n");		
       
   605         print(OUTFILE "const TPtiNumericKeyBinding ${boardname}NumericKeysData_table_${langname}[] =\n");
       
   606         print(OUTFILE "	{\n");
       
   607 
       
   608         $countnumericentries = 0;
       
   609         for ($aaa = 0; $aaa < $numkeyscount; $aaa++)
       
   610 	        {	
       
   611 	        $keystr = "$blockname $numkeynames[$aaa]";
       
   612             if (index ($numeric_mode_key{$keystr}, "(") >= 0)
       
   613 		        {			
       
   614 		        print(OUTFILE "	{");
       
   615 		
       
   616 		        $leftind = index($numeric_mode_key{$keystr}, "(");
       
   617     	        $rightind = index($numeric_mode_key{$keystr}, ")");
       
   618     	        $keyname = substr($numeric_mode_key{$keystr}, $leftind + 1, $rightind - $leftind - 1); 			
       
   619 
       
   620 		        &convert_coordinates("$blockname $keyname");
       
   621 		        if (index($converted_coordinates, "EPti") >= 0)
       
   622 			        {
       
   623 			        print(OUTFILE "\'$numkeynames[$aaa]\',");
       
   624 			        print(OUTFILE "$converted_coordinates,");
       
   625   		            if (index($numeric_mode_key{$keystr}, "fn_upper") >= 0)
       
   626 				        {
       
   627 				        print(OUTFILE "EPtiCaseFnUpper");							
       
   628 				        }
       
   629   		            elsif (index($numeric_mode_key{$keystr}, "fn_lower") >= 0)
       
   630 				        {
       
   631 				        print(OUTFILE "EPtiCaseFnLower");							
       
   632 				        }            				        
       
   633 			        elsif (index($numeric_mode_key{$keystr}, "upper") >= 0)
       
   634 				        {
       
   635 				        print(OUTFILE "EPtiCaseUpper");							
       
   636 				        }
       
   637 			        elsif (index($numeric_mode_key{$keystr}, "chr_lower") >= 0)
       
   638 				        {
       
   639 				        print(OUTFILE "EPtiCaseChrLower");							
       
   640 				        }				        				        
       
   641 			        elsif (index($numeric_mode_key{$keystr}, "chr_upper") >= 0)
       
   642 				        {
       
   643 				        print(OUTFILE "EPtiCaseChrUpper");							
       
   644 				        }				        				        				        
       
   645 			        else
       
   646 				        {
       
   647 				        print(OUTFILE "EPtiCaseLower");											
       
   648 				        }							
       
   649 			        }
       
   650 		        else
       
   651 			        {
       
   652 			        die ("ERROR: Invalid numeric key coordinates for $langname\n");
       
   653 			        }	
       
   654 		
       
   655 		        print(OUTFILE "},\n");
       
   656 		        $countnumericentries++;	
       
   657 		        }
       
   658 		    }
       
   659 		    		    
       
   660         print(OUTFILE "	};\n");	
       
   661         print(OUTFILE "\nconst TInt KNum${boardname}NumericKeysEntries_${langname} = $countnumericentries;\n");				    	
       
   662 	    }	   
       
   663 	   	   
       
   664     #	
       
   665     # Add data table for vietnamese vowel sequences
       
   666     #		
       
   667     if (index($langname, "Vietnamese") >= 0 && ( $blockname eq "QWERTY STANDARD" || $blockname eq "QWERTY 4X10" || $blockname eq "QWERTY 3X11") )
       
   668 	    {
       
   669         print(OUTFILE "\n");	
       
   670         # Vietnamese vowel sequence data is currently statically defined here. 
       
   671         # Parser section for it can be implemented later if needed.
       
   672         print(OUTFILE "const TVowelSequence ${boardname}VowelSeq_table_${langname}[] =\n");
       
   673         print(OUTFILE "	{\n");
       
   674 
       
   675 		print(OUTFILE "	{TPtiKey(0x0041), TPtiKey(0x01AF), {0x0103, 0x0102}},\n");
       
   676         print(OUTFILE "	{TPtiKey(0x0041), TPtiKey(0x0041), {0x00e2, 0x00c2}},\n");
       
   677         print(OUTFILE "	{TPtiKey(0x0045), TPtiKey(0x0045), {0x00ea, 0x00ca}},\n");
       
   678         print(OUTFILE "	{TPtiKey(0x004F), TPtiKey(0x01AF), {0x01a1, 0x01a0}},\n");
       
   679         print(OUTFILE "	{TPtiKey(0x004F), TPtiKey(0x004F), {0x00f4, 0x00d4}},\n");
       
   680         print(OUTFILE "	{TPtiKey(0x0055), TPtiKey(0x01AF), {0x01b0, 0x01af}},\n");
       
   681         print(OUTFILE "	{TPtiKey(0x0044), TPtiKey(0x0044), {0x0111, 0x0110}},\n");
       
   682         print(OUTFILE "	{TPtiKey(0x01AF), TPtiKey(0x01AF), {0x0077, 0x0057}}\n");
       
   683         
       
   684         print(OUTFILE "	};\n");	
       
   685         print(OUTFILE "\nconst TInt KNum${boardname}VowelSeqEntries_${langname} = 8;\n");	
       
   686 	    }			   	   	    
       
   687    }      
       
   688 
       
   689 #
       
   690 # print_data_block ends
       
   691 #
       
   692 
       
   693 
       
   694 ##############################################################
       
   695 #
       
   696 # Parse file and fill tables.
       
   697 #
       
   698 ##############################################################
       
   699 
       
   700 # Open cscan binding file if present
       
   701 if ( ! open(SCANBINDINGFILE,"${inputpath}scan_binding.txt") )
       
   702 {
       
   703 	#print("\nINFORMATION: No scan binding file found\n");
       
   704 }
       
   705 
       
   706 $line_number = 1;
       
   707 @master_raw_data=<SCANBINDINGFILE>;
       
   708 foreach $line (@master_raw_data)
       
   709 {
       
   710 	if ((index($line, "#") >= 0))
       
   711 	{
       
   712 		# Comment line, just skip
       
   713 	}
       
   714 	elsif (index($line, "[KEYBOARD BLOCK") >= 0)
       
   715 	{
       
   716 		# New qwerty keyboard data block is starting.
       
   717 		if (index($line, "QWERTY STANDARD]") >= 0)
       
   718 		{
       
   719 			$current_keyboard_data_block = "QWERTY STANDARD";
       
   720 		}
       
   721 		elsif (index($line, "12-KEY]") >= 0)
       
   722 		{
       
   723 			$current_keyboard_data_block = "12-KEY";
       
   724 		}
       
   725 		elsif (index($line, "QWERTY 4X10") >= 0)
       
   726 		{
       
   727 			$current_keyboard_data_block = "QWERTY 4X10";
       
   728 		}
       
   729 		elsif (index($line, "QWERTY 3X11") >= 0)
       
   730 		{
       
   731 			$current_keyboard_data_block = "QWERTY 3X11";
       
   732 		}
       
   733 		elsif (index($line, "QWERTY HALF") >= 0)
       
   734 		{
       
   735 			$current_keyboard_data_block = "QWERTY HALF";
       
   736 		}
       
   737 		elsif (index($line, "QWERTY CUSTOM") >= 0)
       
   738 		{
       
   739 			$current_keyboard_data_block = "QWERTY CUSTOM";
       
   740 		}
       
   741 		else
       
   742 		{
       
   743 			die "Syntax error: Unknown keyboard data block in file ${inputpath}scan_binding.txt line ${line_number}\n";
       
   744 		}
       
   745 	}
       
   746 	else
       
   747 	{
       
   748 		if (index($line, "scan_binding") >= 0)
       
   749 		{
       
   750 			# Parse coordinates
       
   751 			$leftind = index($line, "(");
       
   752 			$rightind = index($line, ")");
       
   753 
       
   754 			if ($leftind < 0 || $rightind < 0 || $rightind <= $leftind)
       
   755 			{
       
   756 				die ("Syntax error in ${inputpath}scan_binding.txt line ${line_number}\n");
       
   757 			}
       
   758 
       
   759 			$keyname = substr($line, $leftind + 1, $rightind - $leftind - 1);
       
   760 			$full_key_name = "$current_keyboard_data_block $keyname";
       
   761 
       
   762 			$scan_bind{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);
       
   763 		}
       
   764 	}
       
   765 	$line_number = $line_number + 1;
       
   766 }
       
   767 close(SCANBINDINGFILE);
       
   768 
       
   769 if ( ! open(INFILE, "${inputfile}") )
       
   770     {
       
   771     die "Could not open input file ${inputfile}"; 	
       
   772     }
       
   773 
       
   774 $line_number = 1;
       
   775 
       
   776 #
       
   777 # The main parser loop
       
   778 #
       
   779 @raw_data=<INFILE>;
       
   780 foreach $line (@raw_data)
       
   781 	{
       
   782 	if ((index($line, "#") >= 0) && (index($line, "numeric_mode_key") < 0))
       
   783 	    {
       
   784 	    # Comment line, just skip
       
   785 	    }	    	    
       
   786 	elsif (index($line, "[KEYBOARD BLOCK") >= 0)	
       
   787         {
       
   788          # New qwerty keyboard data block is starting.
       
   789         if (index($line, "QWERTY STANDARD]") >= 0)
       
   790             {
       
   791             $current_keyboard_data_block = "QWERTY STANDARD"; 
       
   792             $has_data{"QWERTY STANDARD"} = 1;                                                                 
       
   793 	        $has_qwerty_data = 1;	                        
       
   794             }
       
   795         elsif (index($line, "12-KEY]") >= 0)
       
   796             {
       
   797            	$has_data{"12-KEY"} = 1;		
       
   798             $current_keyboard_data_block = "12-KEY";           	
       
   799             }            
       
   800         elsif (index($line, "QWERTY 4X10") >= 0)
       
   801             {
       
   802             $current_keyboard_data_block = "QWERTY 4X10";    
       
   803             $has_data{"QWERTY 4X10"} = 1;                                 	
       
   804             $has_qwerty_data = 1;                                        
       
   805             } 
       
   806         elsif (index($line, "QWERTY 3X11") >= 0)
       
   807             {
       
   808             $current_keyboard_data_block = "QWERTY 3X11";    
       
   809             $has_data{"QWERTY 3X11"} = 1;                                 	
       
   810             $has_qwerty_data = 1;                                        
       
   811             }             
       
   812         elsif (index($line, "QWERTY HALF") >= 0)
       
   813             {
       
   814             $current_keyboard_data_block = "QWERTY HALF";
       
   815             $has_data{"QWERTY HALF"} = 1;                        	                                     
       
   816             $has_qwerty_data = 1;
       
   817             }    
       
   818         elsif (index($line, "QWERTY CUSTOM") >= 0)
       
   819             {
       
   820             $current_keyboard_data_block = "QWERTY CUSTOM";
       
   821             $has_data{"QWERTY CUSTOM"} = 1;                        	                                     
       
   822             $has_qwerty_data = 1;            
       
   823             }            
       
   824         else
       
   825             {    
       
   826             die "Syntax error: Unknown keyboard data block in file ${inputfile} line ${line_number}\n";
       
   827             }
       
   828         }
       
   829     else
       
   830         {            
       
   831         #
       
   832         # Convert special tags.
       
   833         #
       
   834         while (index($line, "ForZhuyin") >= 0)
       
   835         	{        	
       
   836         	substr($line, index($line, "ForZhuyin"), 9) = $for_zhuyin_tag_value;          	
       
   837         	}
       
   838 
       
   839         while (index($line, "ForPinyin") >= 0)
       
   840         	{
       
   841         	substr($line, index($line, "ForPinyin"), 9) = $for_pinyin_tag_value;          	
       
   842         	}
       
   843         	
       
   844  		while (index($line, "ForStroke") >= 0)
       
   845         	{
       
   846         	substr($line, index($line, "ForStroke"), 9) = $for_stroke_tag_value;          	
       
   847         	}        	
       
   848         	
       
   849  		while (index($line, "ForCangjie") >= 0)
       
   850         	{
       
   851         	substr($line, index($line, "ForCangjie"), 10) = $for_cangjie_tag_value;          	
       
   852         	}        	      
       
   853         	
       
   854  		while (index($line, "GetAllMarker") >= 0)
       
   855         	{        	
       
   856         	substr($line, index($line, "GetAllMarker"), 12) = $get_all_marker_value;          	
       
   857         	}  
       
   858         	
       
   859         #
       
   860         # Convert hexdecimal formats to C-format.
       
   861         #	      	      
       
   862  		while (index($line, "\\U") >= 0)
       
   863         	{
       
   864         	substr($line, index($line, "\\U"), 2) = "0x";          	
       
   865         	}  
       
   866                	
       
   867 		while (index($line, "U+") >= 0)
       
   868         	{
       
   869         	substr($line, index($line, "U+"), 2) = "0x";          	
       
   870         	}   
       
   871         	
       
   872 		#
       
   873 		# Parse possible language code
       
   874 		#        	        	      		
       
   875 		if (index($line, "language_code") >= 0)
       
   876 			{		
       
   877 			$langconstant = substr($line, 13, length($line) - 14);
       
   878 			}        	
       
   879                	           
       
   880 		#            
       
   881         # Parse key data.
       
   882         #  
       
   883 		if ((index($line, "key") >= 0) && (index($line, "numeric_mode") < 0) && (index($line, "dead_key_data") < 0) && (index($line, "deadkeydata") < 0))
       
   884 		    {
       
   885 		    if ($current_keyboard_data_block eq "")
       
   886 		        {      
       
   887 		        die "ERROR: No keyboard block was specified in file ${inputfile} line ${line_number}\n";
       
   888 		        }
       
   889 		    
       
   890 		    # Parse coordinates
       
   891 	        $leftind = index($line, "(");
       
   892 		    $rightind = index($line, ")");			
       
   893 		    		
       
   894 	        if ($leftind < 0 || $rightind < 0 || $rightind <= $leftind)
       
   895 		       	{
       
   896 		    	die ("Syntax error in ${inputfile} line ${line_number}\n");
       
   897 		       	}		
       
   898 		       	
       
   899 	        $keyname = substr($line, $leftind + 1, $rightind - $leftind - 1); 			       	    		
       
   900             $full_key_name = "$current_keyboard_data_block $keyname";	        
       
   901 		    	
       
   902 	        if (index($line, "fn_upper") > 3)			
       
   903 			    {
       
   904                 if ($current_keyboard_data_block eq "12-KEY")
       
   905                     {	                  
       
   906            	        die "ERROR: Fn-keys not supported for given keyboard block in file ${inputfile} line ${line_number}\n"; 		        	                            	    	
       
   907 		    	   	}
       
   908                 else
       
   909                     {                               
       
   910                     $has_fn_keys{$current_keyboard_data_block} = 1;
       
   911    		    	   	$keys_fn_u{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);		                                            
       
   912                     }		    	   			    	   	          		    
       
   913 			    }
       
   914             elsif (index($line, "fn_lower") > 3)
       
   915                 {
       
   916                 if ($current_keyboard_data_block eq "12-KEY")
       
   917                     {	                  
       
   918            	        die "ERROR: Fn-keys not supported for given keyboard block in file ${inputfile} line ${line_number}\n"; 		        	                            	    	
       
   919 		    	   	}
       
   920                 else
       
   921                     {                               
       
   922                     $has_fn_keys{$current_keyboard_data_block} = 1;
       
   923    		    	   	$keys_fn{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);		                                            
       
   924                     }		    	                                      
       
   925                 }
       
   926 			elsif (index($line, "chr_lower") > 3)
       
   927                 {
       
   928                 if ($current_keyboard_data_block eq "12-KEY")
       
   929                     {	                  
       
   930            	        die "ERROR: chr-keys not supported for given keyboard block in file ${inputfile} line ${line_number}\n"; 		        	                            	    	
       
   931 		    	   	}
       
   932                 else
       
   933                     {                               
       
   934                     $has_chr_keys{$current_keyboard_data_block} = 1;
       
   935    		    	   	$keys_chr{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);
       
   936                     }		    	                                      
       
   937                 }
       
   938             elsif (index($line, "chr_upper") > 3)
       
   939                 {
       
   940                 if ($current_keyboard_data_block eq "12-KEY")
       
   941                     {	                  
       
   942            	        die "ERROR: chr-keys not supported for given keyboard block in file ${inputfile} line ${line_number}\n"; 		        	                            	    	
       
   943 		    	   	}
       
   944                 else
       
   945                     {                               
       
   946                     $has_chr_keys{$current_keyboard_data_block} = 1;
       
   947    		    	   	$keys_chr_u{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);
       
   948                     }		    	                                      
       
   949                 }        			    			  		    		    
       
   950 			elsif (index($line, "upper") > 3)
       
   951 		        {	
       
   952 	    	   	$keys_u{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);				        	    					    		    	        		  		    			    	                  
       
   953 		        }		  			    
       
   954 			else  # has to be lower   
       
   955 				{	
       
   956                 $keys{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);		                        								    		        		    	   		    			    			    			    			    							
       
   957 				}		        		    		 		  		    
       
   958  		    }
       
   959  		    
       
   960 		if (index($line, "latin_like_language") >= 0)
       
   961 		    {
       
   962             $print_not_latin_language = 0;
       
   963      		if (index($line, " no") >= 0 or index($line, "=no") >= 0)
       
   964 	            {
       
   965                 $print_not_latin_language = 1;				
       
   966 			    }
       
   967             }
       
   968             
       
   969 		if (index($line, "numeric_mode_key") >= 0)
       
   970 		    {
       
   971 		    $has_numeric_mode_data = 1;	
       
   972 		    $has_numeric_data{$current_keyboard_data_block} = 1;	        
       
   973 			$leftind = index($line, "(");
       
   974 			$rightind = index($line, ")");
       
   975 			
       
   976 		    if ($leftind < 0 || $rightind < 0 || $rightind <= $leftind)
       
   977 		       	{
       
   978 		    	die ("Syntax error in file ${inputfile} line ${line_number}\n");
       
   979 		       	}	
       
   980 		       	
       
   981             $numeric_mode_key_name = substr($line, 17, 1); 		       		    
       
   982 		    $full_numeric_mode_key_name = "$current_keyboard_data_block $numeric_mode_key_name";
       
   983             $numeric_mode_key{$full_numeric_mode_key_name} = substr($line, 19);		    		    		       	           			       	
       
   984             }
       
   985             	           	 
       
   986         if (index($line, "dead_key_data") >= 0 || index($line, "deadkeydata") >= 0)
       
   987         	{        	        	
       
   988 			$has_deadkey_data = 1;
       
   989 			$has_deadkeys{$current_keyboard_data_block} = 1;	
       
   990 			
       
   991     		$leftind = index($line, "(");
       
   992 	    	$rightind = index($line, ")");
       
   993 
       
   994 	    	if ($leftind < 0 || $rightind < 0 || $rightind <= $leftind)
       
   995 	        	{
       
   996 	    		die ("Syntax error in file ${inputfile} line ${line_number}\n");
       
   997 	        	}
       
   998 
       
   999 	        $keyname = substr($line, $leftind + 1, $rightind - $leftind - 1); 
       
  1000             $full_key_name = "$current_keyboard_data_block $keyname";	   	        
       
  1001 	        				    	        
       
  1002 			if (index($line, "upper") > 4)
       
  1003 		        {	
       
  1004     	    	$deadkeys_u{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);		                        		        	  			        		        	    
       
  1005 		        }
       
  1006 			else
       
  1007 				{
       
  1008 	    	    $deadkeys{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);		                        		        	  			        		        	    		 														    							
       
  1009 				}		        		           	
       
  1010         	}    
       
  1011         	
       
  1012         if (index($line, "matrix") >= 0)
       
  1013             {
       
  1014             if ($current_keyboard_data_block eq "QWERTY CUSTOM")
       
  1015                 {               
       
  1016                 @parts = split(/ /, $line);
       
  1017                 $custom_matrix_width = $parts[1];
       
  1018                 $custom_matrix_height = $parts[2];                                                
       
  1019                 }
       
  1020             else
       
  1021                 {    
       
  1022                 die "ERROR: Custom matrix supported only by custom block in file ${inputfile} line ${line_number}\n"; 
       
  1023                 }
       
  1024             } 
       
  1025             
       
  1026         if (index($line, "scan_binding") >= 0)
       
  1027             {
       
  1028             # Parse coordinates
       
  1029 	        $leftind = index($line, "(");
       
  1030 		    $rightind = index($line, ")");			
       
  1031 		    		
       
  1032 	        if ($leftind < 0 || $rightind < 0 || $rightind <= $leftind)
       
  1033 		       	{
       
  1034 		    	die ("Syntax error in ${inputfile} line ${line_number}\n");
       
  1035 		       	}		
       
  1036 		       	
       
  1037 	        $keyname = substr($line, $leftind + 1, $rightind - $leftind - 1); 			       	    		
       
  1038             $full_key_name = "$current_keyboard_data_block $keyname";	                  
       
  1039             
       
  1040             $scan_bind{$full_key_name} = substr($line, $rightind + 1, length($line) - $rightind - 2);            
       
  1041             }                   	        	
       
  1042         }
       
  1043     
       
  1044     $line_number = $line_number + 1;
       
  1045 	}
       
  1046 	
       
  1047 # All done, close the file and handle the results.	
       
  1048 close(INFILE);
       
  1049 
       
  1050 
       
  1051 ##############################################################
       
  1052 #
       
  1053 # Open output cpp-file
       
  1054 #
       
  1055 ##############################################################
       
  1056 
       
  1057 if ( ! open(OUTFILE, ">>${outputdir}${output_dll}${variant_name}.cpp") )
       
  1058     {
       
  1059     die "Could not open input file ${output_dll}${variant_name}.cpp\n"; 	
       
  1060     }
       
  1061 
       
  1062 
       
  1063 ##############################################################
       
  1064 #
       
  1065 # Open output h-file
       
  1066 #
       
  1067 ##############################################################
       
  1068 
       
  1069 if ( ! open(HEADER, ">>${outputdir}${output_dll}${variant_name}.h") )
       
  1070     {
       
  1071     die "Could not open input file ${output_dll}${variant_name}.h\n"; 	
       
  1072     }
       
  1073 
       
  1074 ##############################################################
       
  1075 #
       
  1076 # Allow config-file to cut off data blocks
       
  1077 #
       
  1078 ##############################################################
       
  1079 
       
  1080 if (index($blocks_in_use, "12-KEY") < 0)
       
  1081     {
       
  1082     $has_data{"12-KEY"} = 0;
       
  1083     }
       
  1084 if (index($blocks_in_use, "STANDARD") < 0)
       
  1085     {
       
  1086     $has_data{"QWERTY STANDARD"} = 0;
       
  1087     $has_deadkeys{"QWERTY STANDARD"} = 0; 
       
  1088     $has_numeric_data{"QWERTY STANDARD"} = 0;      
       
  1089     }
       
  1090 if (index($blocks_in_use, "4X10") < 0)
       
  1091     {
       
  1092     $has_data{"QWERTY 4X10"} = 0;
       
  1093     $has_deadkeys{"QWERTY 4X10"} = 0;        
       
  1094     $has_numeric_data{"QWERTY 4X10"} = 0;   
       
  1095     }
       
  1096 if (index($blocks_in_use, "3X11") < 0)
       
  1097     {
       
  1098     $has_data{"QWERTY 3X11"} = 0;
       
  1099     $has_deadkeys{"QWERTY 3X11"} = 0;        
       
  1100     $has_numeric_data{"QWERTY 3X11"} = 0;   
       
  1101     }    
       
  1102 if (index($blocks_in_use, "HALF") < 0)
       
  1103     {
       
  1104     $has_data{"QWERTY HALF"} = 0;
       
  1105     $has_deadkeys{"QWERTY HALF"} = 0;        
       
  1106     $has_numeric_data{"QWERTY HALF"} = 0;   
       
  1107     }
       
  1108 if (index($blocks_in_use, "CUSTOM") < 0)
       
  1109     {
       
  1110     $has_data{"QWERTY CUSTOM"} = 0;
       
  1111     $has_deadkeys{"QWERTY CUSTOM"} = 0;        
       
  1112     $has_numeric_data{"QWERTY CUSTOM"} = 0;   
       
  1113     }        
       
  1114 
       
  1115 ##############################################################
       
  1116 #
       
  1117 # Add data tables for multittapping keymap data.
       
  1118 #
       
  1119 ##############################################################
       
  1120 if ($has_data{"12-KEY"} == 1)
       
  1121     {
       
  1122     &print_data_block("Multitap", 4, 3, "12-KEY");
       
  1123     }
       
  1124 
       
  1125 ##############################################################
       
  1126 #
       
  1127 # Add data tables for standard 4x12 qwerty mapping data.
       
  1128 #
       
  1129 ##############################################################
       
  1130 if ($has_data{"QWERTY STANDARD"} == 1)
       
  1131     {
       
  1132     &print_data_block("StandardQwerty", 4, 12, "QWERTY STANDARD");    	
       
  1133     }  
       
  1134 
       
  1135 ##############################################################
       
  1136 #
       
  1137 # Add data tables for 4x10 qwerty mapping data.
       
  1138 #
       
  1139 ##############################################################
       
  1140 if ($has_data{"QWERTY 4X10"} == 1)
       
  1141     {
       
  1142     &print_data_block("MiniQwerty", 4, 10, "QWERTY 4X10");  
       
  1143     }   
       
  1144 
       
  1145 ##############################################################
       
  1146 #
       
  1147 # Add data tables for 3x11 qwerty mapping data.
       
  1148 #
       
  1149 ##############################################################
       
  1150 if ($has_data{"QWERTY 3X11"} == 1)
       
  1151     {
       
  1152     &print_data_block("MiniQwerty3x11", 3, 11, "QWERTY 3X11");  
       
  1153     }   
       
  1154                                
       
  1155 ##############################################################
       
  1156 #
       
  1157 # Add data table for half qwerty mapping data.
       
  1158 #
       
  1159 ##############################################################
       
  1160 if ($has_data{"QWERTY HALF"} == 1)
       
  1161     {
       
  1162     &print_data_block("HalfQwerty", 4, 5, "QWERTY HALF");      
       
  1163     }    
       
  1164     
       
  1165 ##############################################################
       
  1166 #
       
  1167 # Add data table for custom qwerty mapping data.
       
  1168 #
       
  1169 ##############################################################
       
  1170 if ($has_data{"QWERTY CUSTOM"} == 1 && $custom_matrix_width > 0)
       
  1171     {
       
  1172     &print_data_block("CustomQwerty", $custom_matrix_width, $custom_matrix_height, "QWERTY CUSTOM");  
       
  1173     }        
       
  1174     
       
  1175 ##############################################################    
       
  1176 #    
       
  1177 # Add class declaration to header file
       
  1178 #   
       
  1179 ##############################################################
       
  1180 print(HEADER "\n//\n"); 
       
  1181 print(HEADER "// Class declaration for language $langname \n"); 
       
  1182 print(HEADER "//\n");
       
  1183 print(HEADER "class CPtiLangDataImpl${langname} : public CPtiKeyMapData\n");
       
  1184 print(HEADER "    {\n");
       
  1185 print(HEADER "    public:\n");
       
  1186 print(HEADER "        static CPtiLangDataImpl${langname}* NewL();\n");
       
  1187 print(HEADER "        TInt LanguageCode() const;\n");
       
  1188 print(HEADER "        const TUint16* KeyData(TPtiKeyboardType aKeyboardType, TInt& aDataSize) const;\n"); 
       
  1189 print(HEADER "        const TPtiKeyBinding* KeyBindingTable(TPtiKeyboardType aKeyboardType, TInt& aNumItems) const;\n");
       
  1190 if ($has_deadkey_data == 1)
       
  1191 	{
       
  1192 # There is dead key data, add a method for dead key data table.	
       
  1193 print(HEADER "        const TUint16* DeadKeyDataArray(TPtiKeyboardType aKeyboardType, TInt& aNumRowsInArray) const;\n");
       
  1194 	}
       
  1195 		
       
  1196 if ($has_numeric_mode_data == 1)
       
  1197 	{
       
  1198 # There is numeric data, add a method for numeric data table.	
       
  1199 print(HEADER "        const TPtiNumericKeyBinding* NumericModeKeysTable(TPtiKeyboardType aKeyboardType, TInt& aNumEntries) const;\n");        	
       
  1200 	}	
       
  1201 	
       
  1202 if (index($langname, "Vietnamese") >= 0)
       
  1203 	{
       
  1204 print(HEADER "        const TVowelSequence* VowelSequenceTable(TPtiKeyboardType aKeyboardType, TInt& aNumEntries) const;\n");
       
  1205 	}
       
  1206    
       
  1207 if ($print_not_latin_language == 1) {
       
  1208 print(HEADER "        TBool SuitableForLatinOnlyMode() const;\n");
       
  1209    }
       
  1210 print(HEADER "    };\n");
       
  1211 print(HEADER "\n");
       
  1212 
       
  1213 ###################################################
       
  1214 #
       
  1215 # Add function bodies
       
  1216 #
       
  1217 ###################################################
       
  1218 
       
  1219 print(OUTFILE "//\n"); 
       
  1220 print(OUTFILE "// Class implementation.\n"); 
       
  1221 print(OUTFILE "//\n");
       
  1222 print(OUTFILE "\n");
       
  1223 
       
  1224 #
       
  1225 # Create body for NewL
       
  1226 #
       
  1227 print(OUTFILE "CPtiLangDataImpl${langname}* CPtiLangDataImpl${langname}::NewL()\n");
       
  1228 print(OUTFILE "    {\n");
       
  1229 print(OUTFILE "    return new (ELeave) CPtiLangDataImpl${langname}();\n");
       
  1230 print(OUTFILE "    }\n");
       
  1231 print(OUTFILE "\n");
       
  1232 print(OUTFILE "\n");
       
  1233 
       
  1234 #
       
  1235 # Create body for CPtiLangDataImpl::LanguageCode()
       
  1236 #
       
  1237 print(OUTFILE "TInt CPtiLangDataImpl${langname}::LanguageCode() const\n");
       
  1238 print(OUTFILE "    {\n");
       
  1239 print(OUTFILE "    return ${langconstant};\n");
       
  1240 print(OUTFILE "    }\n");
       
  1241 print(OUTFILE "\n");
       
  1242 print(OUTFILE "\n");
       
  1243 		
       
  1244 #
       
  1245 # Create body for CPtiLangDataImpl::KeyData()
       
  1246 #	
       
  1247 print(OUTFILE "const TUint16* CPtiLangDataImpl${langname}::KeyData(TPtiKeyboardType aKeyboardType, TInt& aDataSize) const\n");
       
  1248 print(OUTFILE "    {\n");
       
  1249 
       
  1250 if ($has_data{"12-KEY"} == 1)
       
  1251     {
       
  1252     print(OUTFILE "    if (aKeyboardType == EPtiKeyboard12Key)\n");
       
  1253     print(OUTFILE "        {\n");
       
  1254     print(OUTFILE "        aDataSize = KMultitapDataSize_${langname};\n");
       
  1255     print(OUTFILE "        return MultitapData_table_${langname};\n");	
       
  1256     print(OUTFILE "        }\n");
       
  1257     }
       
  1258     
       
  1259 if ($has_data{"QWERTY STANDARD"} == 1)
       
  1260     {
       
  1261     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x12)\n");
       
  1262     print(OUTFILE "        {\n");
       
  1263     print(OUTFILE "        aDataSize = KStandardQwertyDataSize_${langname};\n");
       
  1264     print(OUTFILE "        return StandardQwertyData_table_${langname};\n");
       
  1265     print(OUTFILE "        }\n");
       
  1266     print(OUTFILE "\n");        
       
  1267     }
       
  1268     
       
  1269 if ($has_data{"QWERTY 4X10"} == 1)
       
  1270     {
       
  1271     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x10)\n");
       
  1272     print(OUTFILE "        {\n");
       
  1273     print(OUTFILE "        aDataSize = KMiniQwertyDataSize_${langname};\n");
       
  1274     print(OUTFILE "        return MiniQwertyData_table_${langname};\n");
       
  1275     print(OUTFILE "        }\n");
       
  1276     print(OUTFILE "\n");        
       
  1277     }    
       
  1278         
       
  1279 if ($has_data{"QWERTY 3X11"} == 1)
       
  1280     {
       
  1281     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty3x11)\n");
       
  1282     print(OUTFILE "        {\n");
       
  1283     print(OUTFILE "        aDataSize = KMiniQwerty3x11DataSize_${langname};\n");
       
  1284     print(OUTFILE "        return MiniQwerty3x11Data_table_${langname};\n");
       
  1285     print(OUTFILE "        }\n");
       
  1286     print(OUTFILE "\n");        
       
  1287     }            
       
  1288         
       
  1289 if ($has_data{"QWERTY HALF"} == 1)
       
  1290     {
       
  1291     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardHalfQwerty)\n");
       
  1292     print(OUTFILE "        {\n");
       
  1293     print(OUTFILE "        aDataSize = KHalfQwertyDataSize_${langname};\n");
       
  1294     print(OUTFILE "        return HalfQwertyData_table_${langname};\n");
       
  1295     print(OUTFILE "        }\n");
       
  1296     print(OUTFILE "\n");        
       
  1297     }  
       
  1298     
       
  1299 if ($has_data{"QWERTY CUSTOM"} == 1)
       
  1300     {
       
  1301     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardCustomQwerty)\n");
       
  1302     print(OUTFILE "        {\n");
       
  1303     print(OUTFILE "        aDataSize = KCustomQwertyDataSize_${langname};\n");
       
  1304     print(OUTFILE "        return CustomQwertyData_table_${langname};\n");
       
  1305     print(OUTFILE "        }\n");
       
  1306     print(OUTFILE "\n");        
       
  1307     }        
       
  1308             
       
  1309 print(OUTFILE "    aDataSize = 0;\n");
       
  1310 print(OUTFILE "    return NULL;\n");	
       
  1311 print(OUTFILE "    }\n");
       
  1312 
       
  1313 #
       
  1314 # Create body for CPtiLangDataImpl::KeyBindingTable()
       
  1315 #
       
  1316 print(OUTFILE "\n");	
       
  1317 print(OUTFILE "\n");						
       
  1318 print(OUTFILE "const TPtiKeyBinding* CPtiLangDataImpl${langname}::KeyBindingTable(TPtiKeyboardType aKeyboardType, TInt& aNumItems) const\n");
       
  1319 print(OUTFILE "    {\n");
       
  1320 
       
  1321 if ($has_data{"12-KEY"} == 1)
       
  1322     {
       
  1323     print(OUTFILE "    if (aKeyboardType == EPtiKeyboard12Key)\n");
       
  1324     print(OUTFILE "        {\n");    
       
  1325     print(OUTFILE "        aNumItems = KMaxMultitapIndex_${langname};\n");
       
  1326     print(OUTFILE "        return MultitapKeyBindings_table_${langname};\n");			
       
  1327     print(OUTFILE "        }\n");
       
  1328     }
       
  1329     
       
  1330 if ($has_data{"QWERTY STANDARD"} == 1)
       
  1331     {    
       
  1332     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x12)\n");
       
  1333     print(OUTFILE "        {\n");
       
  1334     print(OUTFILE "        aNumItems = KMaxStandardQwertyIndex_${langname};\n");
       
  1335     print(OUTFILE "        return StandardQwertyKeyBindings_table_${langname};\n");
       
  1336     print(OUTFILE "        }\n");
       
  1337     }
       
  1338     
       
  1339 if ($has_data{"QWERTY 4X10"} == 1)
       
  1340     {    
       
  1341     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x10)\n");
       
  1342     print(OUTFILE "        {\n");
       
  1343     print(OUTFILE "        aNumItems = KMaxMiniQwertyIndex_${langname};\n");
       
  1344     print(OUTFILE "        return MiniQwertyKeyBindings_table_${langname};\n");
       
  1345     print(OUTFILE "        }\n");
       
  1346     }    
       
  1347     
       
  1348 if ($has_data{"QWERTY 3X11"} == 1)
       
  1349     {    
       
  1350     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty3x11)\n");
       
  1351     print(OUTFILE "        {\n");
       
  1352     print(OUTFILE "        aNumItems = KMaxMiniQwerty3x11Index_${langname};\n");
       
  1353     print(OUTFILE "        return MiniQwerty3x11KeyBindings_table_${langname};\n");
       
  1354     print(OUTFILE "        }\n");
       
  1355     }        
       
  1356     
       
  1357 if ($has_data{"QWERTY HALF"} == 1)
       
  1358     {    
       
  1359     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardHalfQwerty)\n");
       
  1360     print(OUTFILE "        {\n");
       
  1361     print(OUTFILE "        aNumItems = KMaxHalfQwertyIndex_${langname};\n");
       
  1362     print(OUTFILE "        return HalfQwertyKeyBindings_table_${langname};\n");
       
  1363     print(OUTFILE "        }\n");
       
  1364     }        
       
  1365     
       
  1366 if ($has_data{"QWERTY CUSTOM"} == 1)
       
  1367     {    
       
  1368     print(OUTFILE "    if (aKeyboardType == EPtiKeyboardCustomQwerty)\n");
       
  1369     print(OUTFILE "        {\n");
       
  1370     print(OUTFILE "        aNumItems = KMaxCustomQwertyIndex_${langname};\n");
       
  1371     print(OUTFILE "        return CustomQwertyKeyBindings_table_${langname};\n");
       
  1372     print(OUTFILE "        }\n");
       
  1373     }                
       
  1374     
       
  1375 print(OUTFILE "\n");            
       
  1376 print(OUTFILE "    aNumItems = 0;\n");
       
  1377 print(OUTFILE "    return NULL;\n");	    
       
  1378 print(OUTFILE "    }\n");
       
  1379   
       
  1380   
       
  1381 if ($has_qwerty_data == 1) {
       
  1382 print(OUTFILE "\n");
       
  1383 print(OUTFILE "\n");
       
  1384 				
       
  1385 #
       
  1386 # Add body for dead key data table method.
       
  1387 #
       
  1388 if ($has_deadkey_data == 1)
       
  1389 	{						
       
  1390     print(OUTFILE "const TUint16* CPtiLangDataImpl${langname}::DeadKeyDataArray(TPtiKeyboardType aKeyboardType, TInt& aNumRowsInArray) const\n");
       
  1391     print(OUTFILE "    {\n");
       
  1392 
       
  1393     if ($has_deadkeys{"QWERTY STANDARD"} == 1)
       
  1394         {
       
  1395         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x12)\n");
       
  1396         print(OUTFILE "        {\n");
       
  1397         print(OUTFILE "        aNumRowsInArray = KStandardQwertyDeadKeyTableRows_${langname};\n");
       
  1398         print(OUTFILE "        return StandardQwertyDeadKeyData_table_${langname};\n");
       
  1399         print(OUTFILE "        }\n");
       
  1400         print(OUTFILE "\n");
       
  1401         }
       
  1402     
       
  1403     if ($has_deadkeys{"QWERTY 4X10"} == 1)
       
  1404         {
       
  1405         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x10)\n");
       
  1406         print(OUTFILE "        {\n");
       
  1407         print(OUTFILE "        aNumRowsInArray = KMiniQwertyDeadKeyTableRows_${langname};\n");
       
  1408         print(OUTFILE "        return MiniQwertyDeadKeyData_table_${langname};\n");
       
  1409         print(OUTFILE "        }\n");
       
  1410         print(OUTFILE "\n");
       
  1411         }    
       
  1412         
       
  1413     if ($has_deadkeys{"QWERTY 3X11"} == 1)
       
  1414         {
       
  1415         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty3x11)\n");
       
  1416         print(OUTFILE "        {\n");
       
  1417         print(OUTFILE "        aNumRowsInArray = KMiniQwerty3x11DeadKeyTableRows_${langname};\n");
       
  1418         print(OUTFILE "        return MiniQwerty3x11DeadKeyData_table_${langname};\n");
       
  1419         print(OUTFILE "        }\n");
       
  1420         print(OUTFILE "\n");
       
  1421         }            
       
  1422     
       
  1423     if ($has_deadkeys{"QWERTY CUSTOM"} == 1)
       
  1424         {
       
  1425         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardCustomQwerty)\n");
       
  1426         print(OUTFILE "        {\n");
       
  1427         print(OUTFILE "        aNumRowsInArray = KCustomQwertyDeadKeyTableRows_${langname};\n");
       
  1428         print(OUTFILE "        return CustomQwertyDeadKeyData_table_${langname};\n");
       
  1429         print(OUTFILE "        }\n");
       
  1430         print(OUTFILE "\n");
       
  1431         }        
       
  1432     
       
  1433     print(OUTFILE "    aNumRowsInArray = 0;\n");
       
  1434     print(OUTFILE "    return NULL;\n");		
       
  1435     print(OUTFILE "    }\n");
       
  1436     print(OUTFILE "\n");	
       
  1437     print(OUTFILE "\n");
       
  1438     }
       
  1439 
       
  1440 #
       
  1441 # Add body for numeric mode data table method.
       
  1442 #
       
  1443 if ($has_numeric_mode_data == 1)
       
  1444 	{						
       
  1445     print(OUTFILE "const TPtiNumericKeyBinding* CPtiLangDataImpl${langname}::NumericModeKeysTable(TPtiKeyboardType aKeyboardType, TInt& aNumEntries) const\n");
       
  1446     print(OUTFILE "    {\n");
       
  1447 
       
  1448     if ($has_numeric_data{"QWERTY STANDARD"} == 1)
       
  1449         {
       
  1450         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x12)\n");
       
  1451         print(OUTFILE "        {\n");
       
  1452         print(OUTFILE "        aNumEntries = KNumStandardQwertyNumericKeysEntries_${langname};\n");
       
  1453         print(OUTFILE "        return StandardQwertyNumericKeysData_table_${langname};\n");
       
  1454         print(OUTFILE "        }\n");
       
  1455         print(OUTFILE "\n");
       
  1456         }
       
  1457     
       
  1458     if ($has_numeric_data{"QWERTY 4X10"} == 1)
       
  1459         {
       
  1460         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x10)\n");
       
  1461         print(OUTFILE "        {\n");
       
  1462         print(OUTFILE "        aNumEntries = KNumMiniQwertyNumericKeysEntries_${langname};\n");
       
  1463         print(OUTFILE "        return MiniQwertyNumericKeysData_table_${langname};\n");
       
  1464         print(OUTFILE "        }\n");
       
  1465         print(OUTFILE "\n");
       
  1466         }    
       
  1467         
       
  1468     if ($has_numeric_data{"QWERTY 3X11"} == 1)
       
  1469         {
       
  1470         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty3x11)\n");
       
  1471         print(OUTFILE "        {\n");
       
  1472         print(OUTFILE "        aNumEntries = KNumMiniQwerty3x11NumericKeysEntries_${langname};\n");
       
  1473         print(OUTFILE "        return MiniQwerty3x11NumericKeysData_table_${langname};\n");
       
  1474         print(OUTFILE "        }\n");
       
  1475         print(OUTFILE "\n");
       
  1476         }            
       
  1477     
       
  1478     if ($has_numeric_data{"QWERTY CUSTOM"} == 1)
       
  1479         {
       
  1480         print(OUTFILE "    if (aKeyboardType == EPtiKeyboardCustomQwerty)\n");
       
  1481         print(OUTFILE "        {\n");
       
  1482         print(OUTFILE "        aNumEntries = KNumCustomQwertyNumericKeysEntries_${langname};\n");
       
  1483         print(OUTFILE "        return CustomQwertyNumericKeysData_table_${langname};\n");
       
  1484         print(OUTFILE "        }\n");
       
  1485         print(OUTFILE "\n");
       
  1486         }        
       
  1487     
       
  1488     print(OUTFILE "    aNumEntries = 0;\n");
       
  1489     print(OUTFILE "    return NULL;\n");		
       
  1490     print(OUTFILE "    }\n");
       
  1491     print(OUTFILE "\n");	
       
  1492     print(OUTFILE "\n");
       
  1493 	}	
       
  1494 
       
  1495 #    
       
  1496 # Add body for vowel sequence data table.   
       
  1497 #    
       
  1498 if (index($langname, "Vietnamese") >= 0)
       
  1499 	{						
       
  1500 print(OUTFILE "const TVowelSequence* CPtiLangDataImpl${langname}::VowelSequenceTable(TPtiKeyboardType aKeyboardType, TInt& aNumEntries) const\n");
       
  1501 print(OUTFILE "    {\n");
       
  1502 
       
  1503 if ($has_data{"QWERTY STANDARD"} == 1)
       
  1504     {
       
  1505 print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x12)\n");
       
  1506 print(OUTFILE "        {\n");
       
  1507 print(OUTFILE "        aNumEntries = KNumStandardQwertyVowelSeqEntries_${langname};\n");
       
  1508 print(OUTFILE "        return StandardQwertyVowelSeq_table_${langname};\n");
       
  1509 print(OUTFILE "        }\n");
       
  1510 print(OUTFILE "\n");
       
  1511     }
       
  1512 
       
  1513 if ($has_data{"QWERTY 4X10"} == 1)
       
  1514 	{
       
  1515 print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty4x10)\n");
       
  1516 print(OUTFILE "        {\n");
       
  1517 print(OUTFILE "        aNumEntries = KNumMiniQwertyVowelSeqEntries_${langname};\n");
       
  1518 print(OUTFILE "        return MiniQwertyVowelSeq_table_${langname};\n");
       
  1519 print(OUTFILE "        }\n");
       
  1520 print(OUTFILE "\n");
       
  1521     }       
       
  1522 
       
  1523 if ($has_data{"QWERTY 3X11"} == 1)
       
  1524 	{
       
  1525 print(OUTFILE "    if (aKeyboardType == EPtiKeyboardQwerty3x11)\n");
       
  1526 print(OUTFILE "        {\n");
       
  1527 print(OUTFILE "        aNumEntries = KNumMiniQwerty3x11VowelSeqEntries_${langname};\n");
       
  1528 print(OUTFILE "        return MiniQwerty3x11VowelSeq_table_${langname};\n");
       
  1529 print(OUTFILE "        }\n");
       
  1530 print(OUTFILE "\n");
       
  1531     }  
       
  1532 print(OUTFILE "    aNumEntries = 0;\n");
       
  1533 print(OUTFILE "    return NULL;\n");			
       
  1534 print(OUTFILE "    }\n");		
       
  1535 print(OUTFILE "\n");	
       
  1536 print(OUTFILE "\n");
       
  1537 	}    
       
  1538   }
       
  1539 
       
  1540 if ($print_not_latin_language == 1) {
       
  1541 print(OUTFILE "\nTBool CPtiLangDataImpl${langname}::SuitableForLatinOnlyMode() const\n");
       
  1542 print(OUTFILE "    {\n");
       
  1543 print(OUTFILE "    return EFalse;\n");
       
  1544 print(OUTFILE "    }\n");
       
  1545 print(OUTFILE "\n");
       
  1546 print(OUTFILE "\n");
       
  1547    }
       
  1548 
       
  1549 close(OUTFILE);
       
  1550 
       
  1551 # End of file