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