os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/specific/keymap.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/bsptemplate/asspandvariant/template_variant/specific/keymap.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2228 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// template\template_variant\specific\keymap.cpp
    1.18 +// This file is part of the Template Base port
    1.19 +// The keyboard lookup tables giving the function to be carried out
    1.20 +// and the new state of the keyboard
    1.21 +// 
    1.22 +//
    1.23 +
    1.24 +
    1.25 +#include <k32keys.h>
    1.26 +
    1.27 +#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
    1.28 +
    1.29 +
    1.30 +//
    1.31 +// Scancode conversion tables
    1.32 +// --------------------------
    1.33 +// The scancode conversion is arranged as a tree of tables which are used to
    1.34 +// convert a scancode to a keycode, taking into account the modifier state
    1.35 +// (shift, control, fn)
    1.36 +//
    1.37 +// How the tables work:
    1.38 +// --------------------
    1.39 +// Firstly, there is a distinction between the "scancodes" used in scanning
    1.40 +// the keyboard, and the "scancodes" used in this files.
    1.41 +//
    1.42 +// Typically the keyboard driver already contains a table to convert hardware
    1.43 +// key location codes produced during keyboard scanning into EPOC "scancodes".
    1.44 +// EPOC scancodes are defined for "standard" keys like shift, backspace,
    1.45 +// escape, in the TStdScanCode enum (see E32KEYS.H), and should be ASCII codes
    1.46 +// for normal characters. The keyboard driver should add these EPOC scancodes
    1.47 +// to the event queue, not hardware-dependant key locations.
    1.48 +//
    1.49 +// For now on "scancode" refers to EPOC scancodes:
    1.50 +//
    1.51 +// The keyboard is divided into a number of "blocks" of contiguous scancodes
    1.52 +//
    1.53 +// Blocks map to keycodes in a keycode table, and several blocks can be
    1.54 +// grouped and map to a single keycode table. Blocks map into the keycode
    1.55 +// table in the order they are declared. For example, if two scancode blocks
    1.56 +// with a range of 5 scancodes map to a single 10-entry keycode table, scancodes
    1.57 +// which fall in the first block will map to the first 5 entries in the keycode
    1.58 +// table, scancodes falling in the second block map the the next 5 entries in
    1.59 +// the keycode table.
    1.60 +//
    1.61 +// In theory it is possible to have multiple [keycode,scancode blocks] groups
    1.62 +// but there is little point doing this - grouping all the scancode blocks
    1.63 +// with a single keycode table holding all possible keycode values is usually
    1.64 +// sufficient (and simpler). However, there are some special cases where this
    1.65 +// is useful - the most obvious example is handling of shift and caps lock.
    1.66 +// The shift key implies everything that the caps-lock key does (upper case
    1.67 +// letters) plus some shifted characters for other keys. This is done by 
    1.68 +// defining two tables - the first handles only caps-lock (upper case), the 
    1.69 +// second handles all other keys that are affected only by shift. If caps-
    1.70 +// lock is active, only the caps-lock table is used. If shift is pressed both
    1.71 +// the caps-lock and shift tables are scanned for the conversion. This allows
    1.72 +// a base table to be extended with "extras", much like deriving a class from
    1.73 +// base class and extending it.
    1.74 +//
    1.75 +//
    1.76 +// There is one or more [keycode table, scancode blocks] group for each
    1.77 +// modifier state - e.g. a lower-case table, upper-case, ctrl, ctrl-shift.
    1.78 +// This is the root of the table.
    1.79 +//
    1.80 +// When converting a scancode the key translator first obtains the correct
    1.81 +// conversion tables for the modifier state. It then traverses all the scancode
    1.82 +// blocks looking for one which contains the scancode being converted. Once
    1.83 +// a matching scancode range is located, the key translator maps this into
    1.84 +// its position in the associated keycode table to obtain the converted keycode.
    1.85 +//
    1.86 +// The key tables below appear more complicated than they really are because of
    1.87 +// the intermediate structures that hold pointers to other structures. The
    1.88 +// important structures are:
    1.89 +//		SScanCodeBlock - contains a "start" and "end" for a scancode range
    1.90 +//		SConvSubTable - groups a number of scanode blocks with a keycode table
    1.91 +//		SConvTableNode - points to SConvSubTables for each modifier state
    1.92 +//		SConvTable - the root of the translation table - points to 1..n SConvTableNode
    1.93 +//
    1.94 +// The keycode tables are just an array of TUint16.
    1.95 +//
    1.96 +
    1.97 +
    1.98 +//
    1.99 +// TO DO: (optional)
   1.100 +//
   1.101 +// Keys which are not affected by modifier state
   1.102 +//
   1.103 +
   1.104 +//
   1.105 +// This is a simple example of scancode to keycode mapping. The first block
   1.106 +// in scanCodeBlock_unmodifiable is a range of several scancodes, so maps to
   1.107 +// several entries in the keycode table convKeyCodes_unmodifiable.
   1.108 +//		EStdKeyLeftShift -> maps to -> EKeyLeftShift
   1.109 +//		EStdKeyRightShift -> maps to -> EKeyRightShift
   1.110 +//		...
   1.111 +//		EStdKeyScrollLock -> maps to -> EKeyScrollLock
   1.112 +//
   1.113 +LOCAL_D const SScanCodeBlock scanCodeBlock_unmodifiable[]=
   1.114 +	{
   1.115 +	{EStdKeyLeftShift, EStdKeyScrollLock},	// range 1: left shift to scroll lock
   1.116 +	};
   1.117 +
   1.118 +LOCAL_D const TUint16 convKeyCodes_unmodifiable[]=
   1.119 +	{
   1.120 +	EKeyLeftShift,
   1.121 +	EKeyRightShift,
   1.122 +	EKeyLeftAlt,
   1.123 +	EKeyRightAlt,
   1.124 +	EKeyLeftCtrl,
   1.125 +	EKeyRightCtrl,
   1.126 +	EKeyLeftFunc,
   1.127 +	EKeyRightFunc,
   1.128 +	EKeyCapsLock,
   1.129 +	EKeyNumLock,
   1.130 +	EKeyScrollLock
   1.131 +	};
   1.132 +
   1.133 +
   1.134 +
   1.135 +//
   1.136 +// TO DO: (optional)
   1.137 +//
   1.138 +// Base conversion table
   1.139 +// this table traps all of the keyboard's scanCodes except those in
   1.140 +// convKeyCodes_unmodifiable. It appears last in the top-level table and
   1.141 +// is used to convert any scancode that is not converted by any of the
   1.142 +// other tables
   1.143 +//
   1.144 +LOCAL_D const SScanCodeBlock scanCodeBlock_base[]=
   1.145 +	{
   1.146 +	{EStdKeyNull, EStdKeyDownArrow},		// scancode range 1
   1.147 +	{'0', '9'},								// scancode range 2
   1.148 +	{'A', 'Z'},								// scancode range 3
   1.149 +	{EStdKeyF1, EStdKeyDictaphoneRecord},	// scancode range 4
   1.150 +	};
   1.151 +
   1.152 +LOCAL_D const TUint16 convKeyCodes_base[]=
   1.153 +	{
   1.154 +	EKeyNull,				// scancode range 1 mapping starts here
   1.155 +	EKeyBackspace,
   1.156 +	EKeyTab,
   1.157 +	EKeyEnter,
   1.158 +	EKeyEscape,
   1.159 +	' ',
   1.160 +	EKeyPrintScreen,
   1.161 +	EKeyPause,
   1.162 +	EKeyHome,
   1.163 +	EKeyEnd,
   1.164 +	EKeyPageUp,
   1.165 +	EKeyPageDown,
   1.166 +	EKeyInsert,
   1.167 +	EKeyDelete,
   1.168 +	EKeyLeftArrow,
   1.169 +	EKeyRightArrow,
   1.170 +	EKeyUpArrow,
   1.171 +	EKeyDownArrow,
   1.172 +	'0',					// scancode range 2 mapping starts here
   1.173 +	'1',
   1.174 +	'2',
   1.175 +	'3',
   1.176 +	'4',
   1.177 +	'5',
   1.178 +	'6',
   1.179 +	'7',
   1.180 +	'8',
   1.181 +	'9',
   1.182 +	'a',					// scancode range 3 mapping starts here
   1.183 +	'b',
   1.184 +	'c',
   1.185 +	'd',
   1.186 +	'e',
   1.187 +	'f',
   1.188 +	'g',
   1.189 +	'h',
   1.190 +	'i',
   1.191 +	'j',
   1.192 +	'k',
   1.193 +	'l',
   1.194 +	'm',
   1.195 +	'n',
   1.196 +	'o',
   1.197 +	'p',
   1.198 +	'q',
   1.199 +	'r',
   1.200 +	's',
   1.201 +	't',
   1.202 +	'u',
   1.203 +	'v',
   1.204 +	'w',
   1.205 +	'x',
   1.206 +	'y',
   1.207 +	'z',
   1.208 +	EKeyF1,						// scancode range 4 mapping starts here
   1.209 +	EKeyF2,
   1.210 +	EKeyF3,
   1.211 +	EKeyF4,
   1.212 +	EKeyF5,
   1.213 +	EKeyF6,
   1.214 +	EKeyF7,
   1.215 +	EKeyF8,
   1.216 +	EKeyF9,
   1.217 +	EKeyF10,
   1.218 +	EKeyF11,
   1.219 +	EKeyF12,
   1.220 +	EKeyF13,
   1.221 +	EKeyF14,
   1.222 +	EKeyF15,
   1.223 +	EKeyF16,
   1.224 +	EKeyF17,
   1.225 +	EKeyF18,
   1.226 +	EKeyF19,
   1.227 +	EKeyF20,
   1.228 +	EKeyF21,
   1.229 +	EKeyF22,
   1.230 +	EKeyF23,
   1.231 +	EKeyF24,
   1.232 +	'`',
   1.233 +	',',
   1.234 +	'.',
   1.235 +	'/',
   1.236 +	'\\',
   1.237 +	';',
   1.238 +	'\'',
   1.239 +	'#',
   1.240 +	'[',
   1.241 +	']',
   1.242 +	'-',
   1.243 +	'=',
   1.244 +	'/',
   1.245 +	'*',
   1.246 +	'-',
   1.247 +	'+',
   1.248 +	EKeyEnter,
   1.249 +	EKeyEnd,
   1.250 +	EKeyDownArrow,
   1.251 +	EKeyPageDown,
   1.252 +	EKeyLeftArrow,
   1.253 +	EKeyNull, // numeric keypad '5'
   1.254 +	EKeyRightArrow,
   1.255 +	EKeyHome,
   1.256 +	EKeyUpArrow,
   1.257 +	EKeyPageUp,
   1.258 +	EKeyInsert,
   1.259 +	EKeyDelete,
   1.260 +	EKeyMenu,
   1.261 +	EKeyBacklightOn,
   1.262 +	EKeyBacklightOff,
   1.263 +	EKeyBacklightToggle,
   1.264 +	EKeyIncContrast,
   1.265 +	EKeyDecContrast,
   1.266 +	EKeySliderDown,
   1.267 +	EKeySliderUp,
   1.268 +	EKeyDictaphonePlay,
   1.269 +	EKeyDictaphoneStop,
   1.270 +	EKeyDictaphoneRecord
   1.271 +	};
   1.272 +
   1.273 +
   1.274 +//
   1.275 +// TO DO: (optional)
   1.276 +//	
   1.277 +// caps-lock: this table traps those scanCodes which are affected by caps-lock
   1.278 +//
   1.279 +LOCAL_D const SScanCodeBlock scanCodeBlock_capsLock[]=
   1.280 +	{
   1.281 +	{'A', 'Z'}			// only alpha keys are affected by caps-lock
   1.282 +	};
   1.283 +
   1.284 +LOCAL_D const TUint16 convKeyCodes_capsLock[]=
   1.285 +	{
   1.286 +	'A',
   1.287 +	'B',
   1.288 +	'C',
   1.289 +	'D',
   1.290 +	'E',
   1.291 +	'F',
   1.292 +	'G',
   1.293 +	'H',
   1.294 +	'I',
   1.295 +	'J',
   1.296 +	'K',
   1.297 +	'L',
   1.298 +	'M',
   1.299 +	'N',
   1.300 +	'O',
   1.301 +	'P',
   1.302 +	'Q',
   1.303 +	'R',
   1.304 +	'S',
   1.305 +	'T',
   1.306 +	'U',
   1.307 +	'V',
   1.308 +	'W',
   1.309 +	'X',
   1.310 +	'Y',
   1.311 +	'Z'
   1.312 +	};
   1.313 +
   1.314 +//
   1.315 +// TO DO: (optional)
   1.316 +//
   1.317 +// shift: this table traps those scanCodes which are affected
   1.318 +// by normal shift key EXCEPT for those scanCodes affected by caps-lock
   1.319 +//
   1.320 +
   1.321 +LOCAL_D const SScanCodeBlock scanCodeBlock_shift[]=
   1.322 +	{
   1.323 +	{'0', '9'},
   1.324 +	{EStdKeyXXX, EStdKeyEquals},
   1.325 +	};
   1.326 +
   1.327 +LOCAL_D const TUint16 convKeyCodes_shift[]=
   1.328 +	{
   1.329 +	')',
   1.330 +	'!',
   1.331 +	'@',/*'"',*/
   1.332 +	'#',			/*ELatin1Pound,*/
   1.333 +	'$',
   1.334 +	'%',
   1.335 +	'^',
   1.336 +	'&',
   1.337 +	'*',
   1.338 +	'(',
   1.339 +	'~',   /*ELatin1LogicNot,*/
   1.340 +	'<',
   1.341 +	'>',
   1.342 +	'?',
   1.343 +	'|',
   1.344 +	':',
   1.345 +	'"',
   1.346 +	'|', /*'~',*/
   1.347 +	'{',
   1.348 +	'}',
   1.349 +	'_',
   1.350 +	'+'
   1.351 +	};
   1.352 +
   1.353 +//
   1.354 +// TO DO: (optional)
   1.355 +//
   1.356 +// func: this table traps those scanCodes which are affected
   1.357 +// by the func key but not shift
   1.358 +//
   1.359 +LOCAL_D const SScanCodeBlock scanCodeBlock_func[]=
   1.360 +	{
   1.361 +    {EStdKeyEscape, EStdKeyEscape},
   1.362 +    {'M', 'M'},
   1.363 +    {EStdKeyComma, EStdKeyComma},
   1.364 +    {EStdKeyLeftArrow, EStdKeyDownArrow},
   1.365 +	};
   1.366 +
   1.367 +LOCAL_D const TUint16 convKeyCodes_func[]=
   1.368 +	{
   1.369 +    EKeyOff,
   1.370 +    EKeyDecContrast,
   1.371 +    EKeyIncContrast,
   1.372 +    EKeyHome,
   1.373 +    EKeyEnd,
   1.374 +    EKeyPageUp,
   1.375 +    EKeyPageDown,
   1.376 +	};
   1.377 +
   1.378 +//
   1.379 +// TO DO: (optional)
   1.380 +//
   1.381 +// func: this table traps those scanCodes which are affected
   1.382 +// by func and shift - this is for func pressed, shift not pressed
   1.383 +//
   1.384 +//LOCAL_D const SScanCodeBlock scanCodeBlock_funcUnshifted[]=
   1.385 +//	{
   1.386 +//	{'E', 'E'},
   1.387 +//	};
   1.388 +
   1.389 +//LOCAL_D const TUint16 convKeyCodes_funcUnshifted[]=
   1.390 +//	{
   1.391 +//	ELatin1LcEacute,
   1.392 +//	};
   1.393 +
   1.394 +//
   1.395 +// TO DO: (optional)
   1.396 +//
   1.397 +// func: this table traps those scanCodes which are affected
   1.398 +// by func and shift - this is for func and shift both pressed
   1.399 +//
   1.400 +//LOCAL_D const SScanCodeBlock scanCodeBlock_funcShifted[]=
   1.401 +//	{
   1.402 +//	{'E', 'E'},
   1.403 +//	};
   1.404 +
   1.405 +//LOCAL_D const TUint16 convKeyCodes_funcShifted[]=
   1.406 +//	{
   1.407 +//	ELatin1UcEacute,
   1.408 +//	};
   1.409 +
   1.410 +//
   1.411 +// TO DO: (optional)
   1.412 +//
   1.413 +// ctrl: this table traps those scanCodes which are affected by ctrl
   1.414 +//
   1.415 +LOCAL_D const SScanCodeBlock scanCodeBlock_ctrl[]=
   1.416 +	{
   1.417 +	//
   1.418 +	// NOTE: The space key gets handled elsewhere, otherwise it gets
   1.419 +	// thrown away as a NULL key
   1.420 +	//	{EStdKeySpace, EStdKeySpace},
   1.421 +
   1.422 +	{'A', 'Z'},
   1.423 +    {EStdKeyComma, EStdKeyComma},
   1.424 +	};
   1.425 +
   1.426 +LOCAL_D const TUint16 convKeyCodes_ctrl[]=
   1.427 +	{
   1.428 +//	0,
   1.429 +	1,
   1.430 +	2,
   1.431 +	3,
   1.432 +	4,
   1.433 +	5,
   1.434 +	6,
   1.435 +	7,
   1.436 +	8,
   1.437 +	9,
   1.438 +	10,
   1.439 +	11,
   1.440 +	12,
   1.441 +	13,
   1.442 +	14,
   1.443 +	15,
   1.444 +	16,
   1.445 +	17,
   1.446 +	18,
   1.447 +	19,
   1.448 +	20,
   1.449 +	21,
   1.450 +	22,
   1.451 +	23,
   1.452 +	24,
   1.453 +	25,
   1.454 +	26,
   1.455 +	',',
   1.456 +	};
   1.457 +
   1.458 +
   1.459 +
   1.460 +//
   1.461 +// TO DO: (optional)
   1.462 +//
   1.463 +// Each set of scancode+keycode tables must be grouped into a SConvSubTable.
   1.464 +// The lines below define a number of SConvSubTables for each of the groups
   1.465 +// above.
   1.466 +//
   1.467 +LOCAL_D const SConvSubTable
   1.468 +	convSubTable_unmodifiable=							// table for unmodifiable keys
   1.469 +		{
   1.470 +		&convKeyCodes_unmodifiable[0],					// the keycode table
   1.471 +			{
   1.472 +			ARRAY_LENGTH(scanCodeBlock_unmodifiable),	// number of scancode blocks
   1.473 +			&scanCodeBlock_unmodifiable[0]				// pointer to scancode blocks
   1.474 +			}
   1.475 +		},
   1.476 +	convSubTable_base=									// table for base keys
   1.477 +		{
   1.478 +		&convKeyCodes_base[0],							// keycode table
   1.479 +			{
   1.480 +			ARRAY_LENGTH(scanCodeBlock_base),			// number of scancode blocks
   1.481 +			&scanCodeBlock_base[0]						// pointer to scancode blocks
   1.482 +			}
   1.483 +		},
   1.484 +	convSubTable_capsLock=
   1.485 +		{
   1.486 +		&convKeyCodes_capsLock[0],
   1.487 +			{
   1.488 +			ARRAY_LENGTH(scanCodeBlock_capsLock),
   1.489 +			&scanCodeBlock_capsLock[0]
   1.490 +			}
   1.491 +		},
   1.492 +	convSubTable_shift=
   1.493 +		{
   1.494 +		&convKeyCodes_shift[0],
   1.495 +			{
   1.496 +			ARRAY_LENGTH(scanCodeBlock_shift),
   1.497 +			&scanCodeBlock_shift[0]
   1.498 +			}
   1.499 +		},
   1.500 +	convSubTable_func=
   1.501 +		{
   1.502 +		&convKeyCodes_func[0],
   1.503 +			{
   1.504 +			ARRAY_LENGTH(scanCodeBlock_func),
   1.505 +			&scanCodeBlock_func[0]
   1.506 +			}
   1.507 +		},
   1.508 +//	convSubTable_funcUnshifted=
   1.509 +//		{
   1.510 +//		&convKeyCodes_funcUnshifted[0],
   1.511 +//			{
   1.512 +//			ARRAY_LENGTH(scanCodeBlock_funcUnshifted),
   1.513 +//			&scanCodeBlock_funcUnshifted[0]
   1.514 +//			}
   1.515 +//		},
   1.516 +//	convSubTable_funcShifted=
   1.517 +//		{
   1.518 +//		&convKeyCodes_funcShifted[0],
   1.519 +//			{
   1.520 +//			ARRAY_LENGTH(scanCodeBlock_funcShifted),
   1.521 +//			&scanCodeBlock_funcShifted[0]
   1.522 +//			}
   1.523 +//		},
   1.524 +	convSubTable_ctrl=
   1.525 +		{
   1.526 +		&convKeyCodes_ctrl[0],
   1.527 +			{
   1.528 +			ARRAY_LENGTH(scanCodeBlock_ctrl),
   1.529 +			&scanCodeBlock_ctrl[0]
   1.530 +			}
   1.531 +		};
   1.532 +
   1.533 +//
   1.534 +// TO DO: (optional)
   1.535 +//
   1.536 +// We need to declare arrays of SConvSubTable for each modifier state we
   1.537 +// are going to handle. As mentioned above, it is possible to have several
   1.538 +// [keycode table, scancode blocks] groups scanned for each keyboard state.
   1.539 +//
   1.540 +// Some modifier states use more than one conversion group. The simple example
   1.541 +// is handling of caps-lock and shift. 
   1.542 +//
   1.543 +// Caps-lock means all letters are upper-case
   1.544 +// shift means all letters are upper case AND some other keys return control characters
   1.545 +//
   1.546 +// Obviously the shift key means everything cpas-lock means PLUS a bit more. So
   1.547 +// we define two tables, the caps-lock table defines only the uppercase conversion,
   1.548 +// and the shift table defines all OTHER shifted keys not already handled by
   1.549 +// caps-lock. The caps-lock modifier state then only scans the caps-lock table, and
   1.550 +// the shift state scans both tables.
   1.551 +//
   1.552 +LOCAL_D const SConvSubTable
   1.553 +	* const convSubTableArray_unmodifiable[]={&convSubTable_unmodifiable},
   1.554 +	* const convSubTableArray_base[]={&convSubTable_base},
   1.555 +
   1.556 +	//
   1.557 +	// The caps-lock state scans only the caps-lock table, to handle
   1.558 +	// conversion to upper case
   1.559 +	//
   1.560 +	* const convSubTableArray_capsLock[]={&convSubTable_capsLock},
   1.561 +	//
   1.562 +	// The shift table scans the caps-lock table to handle upper case, 
   1.563 +	// and also the shift table which handles some keys that are not affected
   1.564 +	// by caps lock (such as 0-9).
   1.565 +	//
   1.566 +	* const convSubTableArray_shift[]={&convSubTable_capsLock, &convSubTable_shift},
   1.567 +	//
   1.568 +	// Pressing shift with caps-lock active reverts to lower-case letters,
   1.569 +	// but other keys remain shifted. This time we only scan the shift table
   1.570 +	// so only the non-alpha keys will be shifted
   1.571 +	//
   1.572 +	* const convSubTableArray_capsLockShift[]={&convSubTable_shift},
   1.573 +
   1.574 +	//
   1.575 +	// Like the shift/caps-lock situation, the function key has two states,
   1.576 +	// shifted and unshifted. Also, some keys may be independant of whether
   1.577 +	// the shift key is pressed. So there are three tables defined. One declares
   1.578 +	// all keys that are independant of shift state, the other two tables handle
   1.579 +	// shifted and unshifted func.
   1.580 +	//
   1.581 +	// Unshifted func uses the independant set + funcUnshifted
   1.582 +	//
   1.583 +	//	* const convSubTableArray_func[]={&convSubTable_func, &convSubTable_funcUnshifted},
   1.584 +	* const convSubTableArray_func[]={&convSubTable_func},
   1.585 +	//
   1.586 +	// Shifted func uses the independant set + funcShifted
   1.587 +	//
   1.588 +	//	* const convSubTableArray_funcShift[]={&convSubTable_func,&convSubTable_funcShifted},
   1.589 +	//
   1.590 +	// This keyboard table makes control independant of func and shift
   1.591 +	//
   1.592 +	* const convSubTableArray_ctrl[]={&convSubTable_ctrl};
   1.593 +
   1.594 +//
   1.595 +// TO DO: (optional)
   1.596 +//
   1.597 +// This is the top of the scancode conversion tree. It is a set of pointers
   1.598 +// to the SConvSubTable arrays declared above.
   1.599 +//
   1.600 +// The order of these nodes is VITAL, as the scanCode/modifiers are
   1.601 +// searched for a match in this order
   1.602 +//
   1.603 +// The modifier state is matched by using a mask and a compare value. This is
   1.604 +// used as follows:
   1.605 +//
   1.606 +//	match is true if ( (modifierState & mask) == compareValue
   1.607 +//
   1.608 +// For example, if the mask is (EModifierFunc|EModifierShift) and the
   1.609 +// compare value is EModifierFunc, this will match ANY combination of
   1.610 +// modifiers that has func pressed and shift not pressed
   1.611 +//
   1.612 +LOCAL_D const SConvTableNode convTableNodes[]=
   1.613 +	{
   1.614 +		{
   1.615 +			{
   1.616 +			0,		// modifier mask = no modifiers
   1.617 +			0		// modifier compare = no modifiers
   1.618 +			},
   1.619 +		ARRAY_LENGTH(convSubTableArray_unmodifiable),	// number of SConvSubTables
   1.620 +		&convSubTableArray_unmodifiable[0]				// pointer to SConvSubTable array
   1.621 +		},
   1.622 +		{
   1.623 +			{
   1.624 +			EModifierCtrl,	// modifier mask = check for ctrl
   1.625 +			EModifierCtrl	// modifier compare = anything with ctrl pressed
   1.626 +			},
   1.627 +		ARRAY_LENGTH(convSubTableArray_ctrl),
   1.628 +		&convSubTableArray_ctrl[0]
   1.629 +		},
   1.630 +		{
   1.631 +			{
   1.632 +			//
   1.633 +			// Check for Func pressed
   1.634 +			//
   1.635 +			EModifierFunc,
   1.636 +			EModifierFunc
   1.637 +			},
   1.638 +		ARRAY_LENGTH(convSubTableArray_func),
   1.639 +		&convSubTableArray_func[0]
   1.640 +		},
   1.641 +		{
   1.642 +			{
   1.643 +			//
   1.644 +			// Check for caps-lock pressed, shift not pressed
   1.645 +			//
   1.646 +			EModifierCapsLock|EModifierShift,
   1.647 +			EModifierCapsLock
   1.648 +			},
   1.649 +		ARRAY_LENGTH(convSubTableArray_capsLock),
   1.650 +		&convSubTableArray_capsLock[0]
   1.651 +		},
   1.652 +		{
   1.653 +			{
   1.654 +			//
   1.655 +			// Check for caps-lock not pressed, shift pressed
   1.656 +			//
   1.657 +			EModifierShift|EModifierCapsLock,
   1.658 +			EModifierShift
   1.659 +			},
   1.660 +		ARRAY_LENGTH(convSubTableArray_shift),
   1.661 +		&convSubTableArray_shift[0]
   1.662 +		},
   1.663 +		{
   1.664 +			{
   1.665 +			//
   1.666 +			// Check for caps-lock pressed, shift pressed
   1.667 +			//
   1.668 +			EModifierCapsLock|EModifierShift,
   1.669 +			EModifierCapsLock|EModifierShift
   1.670 +			},
   1.671 +		ARRAY_LENGTH(convSubTableArray_capsLockShift),
   1.672 +		&convSubTableArray_capsLockShift[0]
   1.673 +		},
   1.674 +		{
   1.675 +		//
   1.676 +		// This is the base table. It must appear last so that it can
   1.677 +		// provide a default conversion for any scancodes that are not
   1.678 +		// handled by any of the tables above
   1.679 +		//
   1.680 +			{
   1.681 +			0,
   1.682 +			0
   1.683 +			},
   1.684 +		ARRAY_LENGTH(convSubTableArray_base),
   1.685 +		&convSubTableArray_base[0]
   1.686 +		}
   1.687 +	};
   1.688 +
   1.689 +//
   1.690 +// The top-level exported data structure of all the conversion tables
   1.691 +// This just points to the SConvTableNodes above
   1.692 +//
   1.693 +LOCAL_D const SConvTable ConvTable=
   1.694 +	{
   1.695 +	ARRAY_LENGTH(convTableNodes),
   1.696 +	&convTableNodes[0]
   1.697 +	};
   1.698 +
   1.699 +// The list of scan-codes on the numeric keypad
   1.700 +LOCAL_D const SScanCodeBlock keypadScanCodeBlockArray[]=
   1.701 +	{
   1.702 +	{EStdKeyNumLock, EStdKeyNumLock},
   1.703 +	{EStdKeyNkpForwardSlash, EStdKeyNkpFullStop}
   1.704 +	};
   1.705 +
   1.706 +LOCAL_D const SScanCodeBlockList ConvTableKeypadScanCodes=
   1.707 +	{
   1.708 +	ARRAY_LENGTH(keypadScanCodeBlockArray),
   1.709 +	&keypadScanCodeBlockArray[0]
   1.710 +	};
   1.711 +
   1.712 +//
   1.713 +// TO DO: (optional)
   1.714 +//
   1.715 +// List of keycodes that do not autorepeat
   1.716 +//
   1.717 +// These are usually control keys like shift, ctrl, escape
   1.718 +//
   1.719 +LOCAL_D const TUint16 nonAutorepKeyCodeArray[]=
   1.720 +	{
   1.721 +	EKeyEscape,
   1.722 +	EKeyPrintScreen,
   1.723 +	EKeyPause,
   1.724 +	EKeyInsert,
   1.725 +	EKeyLeftShift,
   1.726 +	EKeyRightShift,
   1.727 +	EKeyLeftAlt,
   1.728 +	EKeyRightAlt,
   1.729 +	EKeyLeftCtrl,
   1.730 +	EKeyRightCtrl,
   1.731 +	EKeyLeftFunc,
   1.732 +	EKeyRightFunc,
   1.733 +	EKeyCapsLock,
   1.734 +	EKeyNumLock,
   1.735 +	EKeyScrollLock,
   1.736 +	EKeyMenu,
   1.737 +	EKeyDictaphonePlay,
   1.738 +	EKeyDictaphoneStop,
   1.739 +	EKeyDictaphoneRecord
   1.740 +	};
   1.741 +
   1.742 +//
   1.743 +// TO DO: (optional)
   1.744 +//
   1.745 +// Declare blocks of non-autorepeating keycodes
   1.746 +//
   1.747 +LOCAL_D const SKeyCodeList ConvTableNonAutorepKeyCodes=
   1.748 +	{
   1.749 +	ARRAY_LENGTH(nonAutorepKeyCodeArray),	// number of keycode arrays
   1.750 +	&nonAutorepKeyCodeArray[0]				// pointer to arrays
   1.751 +	};
   1.752 +
   1.753 +
   1.754 +
   1.755 +
   1.756 +
   1.757 +
   1.758 +/////////////////////////////////////////////////////////////////////
   1.759 +// Keyboard state tables
   1.760 +//
   1.761 +
   1.762 +// What these tables do
   1.763 +// --------------------
   1.764 +//
   1.765 +// These tables control the way "special" keystrokes modify the behaviour
   1.766 +// of the keyboard. There are two major uses for this:
   1.767 +//
   1.768 +//	- handling modifier keys e.g. caps-lock, shift, alt, fn and defining
   1.769 +//		what modifier flags are affected by these keypresses
   1.770 +//
   1.771 +//	- switching the keyboard into special states (see below)
   1.772 +//
   1.773 +// Keyboard states
   1.774 +// ---------------
   1.775 +// 
   1.776 +// Keyboard states are used to switch the keyboard into a special mode where it
   1.777 +// can be used to enter unusual characters. There are two uses for this:
   1.778 +//
   1.779 +// - entering numeric codes, by pressing ctrl and typing the decimal code
   1.780 +// - entering accented characters by pressing a key combination which
   1.781 +//		enters "accented mode" then pressing a key. There can be multiple
   1.782 +//		accented modes.
   1.783 +//
   1.784 +// You can see an example of accented modes on a Psion Series 5 by
   1.785 +// pressing Fn+Z, followed by A - this will produce an a with an umlaut (ä)
   1.786 +//
   1.787 +// These tables are also used to select simpler states such as caps-lock
   1.788 +// and num-lock.
   1.789 +//
   1.790 +//
   1.791 +// The main data structure is a SFuncTableEntry. Each of these contains
   1.792 +// three fields:
   1.793 +//
   1.794 +// 1. modifier match - this works the same way as the scancode conversion
   1.795 +//     tables above, there is a mask and a compare value
   1.796 +//
   1.797 +// 2. a keycode patters - this is used to match with the keycode or keycodes
   1.798 +//     that the state should respond to. This is a TKeyCodePattern structure
   1.799 +//     which defines what sort of match should be performed.
   1.800 +//
   1.801 +// 3. a function and state change structure, SFuncAndState. This defines the
   1.802 +//     state to change to, the function to perform, and a parameter for the
   1.803 +//     function if required.
   1.804 +//
   1.805 +// TKeyCodePattern structures have two fields. The first is a keycode value
   1.806 +// and is only used for some match types. The second field select the type
   1.807 +// of match to perform:
   1.808 +//
   1.809 +//	EAnyKey - match any key
   1.810 +//	EAnyAlphaNumeric - match any alpha or numeric key
   1.811 +//	EAnyAlpha - match any alpha key
   1.812 +//	EAnyAlphaLowerCase - match any lower-case key
   1.813 +//	EAnyAlphaUpperCase - match any upper-case key
   1.814 +//	EAnyDecimalDigit - match any decimal digit
   1.815 +//	EAnyModifierKey - match any modifier key (e.g. alt, fn, ctrl)
   1.816 +//	EMatchKey - match if equal to keycode value in first field
   1.817 +//	EMatchLeftOrRight - match if equal to keycode value or (keycode value + 1)
   1.818 +//	EMatchKeyCaseInsens - like EMatchKey but perform case-insensitive comparison
   1.819 +//
   1.820 +//
   1.821 +
   1.822 +// the "array" parameter must be a true array and not a pointer
   1.823 +#define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
   1.824 +
   1.825 +#define TABLE_ENTRY_ANOTHER_CTRL_DIGIT					\
   1.826 +	{  													\
   1.827 +		{												\
   1.828 +		EModifierKeyUp|EModifierFunc,					\
   1.829 +		0												\
   1.830 +		},												\
   1.831 +		{												\
   1.832 +		EKeyNull,										\
   1.833 +		EAnyDigitGivenRadix								\
   1.834 +		},												\
   1.835 +		{												\
   1.836 +		EStateCtrlDigits,								\
   1.837 +		EAddOnCtrlDigit,								\
   1.838 +		0												\
   1.839 +		}												\
   1.840 +	}
   1.841 +
   1.842 +//
   1.843 +// TO DO: (optional)
   1.844 +//
   1.845 +// This table is searched for a match if a match has not been
   1.846 +// found in the current state's table
   1.847 +//
   1.848 +
   1.849 +LOCAL_D const SFuncTableEntry defaultTable[]=
   1.850 +	{
   1.851 +		{ 
   1.852 +		//
   1.853 +		// prevent key up events generating keycodes
   1.854 +		//
   1.855 +			{
   1.856 +			EModifierKeyUp,		// mask = key up
   1.857 +			EModifierKeyUp		// match = key up - i.e. accept any key up event
   1.858 +			},
   1.859 +			{
   1.860 +			EKeyNull,			// dummy value, not used
   1.861 +			EAnyKey				// accept any key
   1.862 +			},
   1.863 +			{
   1.864 +			EStateUnchanged,	// state will not change
   1.865 +			EDoNothing,			// no action to perform
   1.866 +			0
   1.867 +			}
   1.868 +		},
   1.869 +		{ 
   1.870 +		//
   1.871 +		// prevent any modifier key (e.g. shift, ctrl) from changing state
   1.872 +		//
   1.873 +			{
   1.874 +			0,					// match any modifier state
   1.875 +			0
   1.876 +			},
   1.877 +			{
   1.878 +			EKeyNull,			// dummy value
   1.879 +			EAnyModifierKey		// match any modifier key
   1.880 +			},
   1.881 +			{
   1.882 +			EStateUnchanged,	// don't change state
   1.883 +			EDoNothing,			// nothing to do
   1.884 +			0
   1.885 +			}
   1.886 +		},
   1.887 +		{ 
   1.888 +		//
   1.889 +		// filter out any unprocessed codes
   1.890 +		//
   1.891 +			{
   1.892 +			0,					// match any modifier state
   1.893 +			0
   1.894 +			},
   1.895 +			{
   1.896 +			EKeyNull,			// dummy value
   1.897 +			EAnyKey				// match any key
   1.898 +			},
   1.899 +			{
   1.900 +			EStateNormal,		// switch back to normal keyboard state
   1.901 +			EDoNothing,			// nothing to do
   1.902 +			0
   1.903 +			}
   1.904 +		}
   1.905 +	};
   1.906 +
   1.907 +//
   1.908 +// TO DO: (optional)
   1.909 +//
   1.910 +// This table controls which keys change which modifiers;
   1.911 +// NOTE: the state field in this table is ignored
   1.912 +//
   1.913 +
   1.914 +LOCAL_D const SFuncTableEntry modifierTable[]=
   1.915 +	{
   1.916 +		{
   1.917 +			{
   1.918 +			EModifierKeyUp,		// check key-up modifier flag
   1.919 +			0					// make sure it's zero (i.e. ignore key-up events)
   1.920 +			},
   1.921 +			{
   1.922 +			//
   1.923 +			// Here we want to match only the caps-lock key. We specify the
   1.924 +			// keycode we are looking for in the first field, and EMatchKey
   1.925 +			// in the second field
   1.926 +			//
   1.927 +			EKeyCapsLock,		// we want to respond to caps-lock key
   1.928 +			EMatchKey			// match caps-lock only
   1.929 +			},
   1.930 +			{
   1.931 +			EStateUnchanged,	// ignored
   1.932 +			EToggleModifier,	// function = toggle modifier state
   1.933 +			EModifierCapsLock	// this is the modifier to toggle
   1.934 +			}
   1.935 +		},
   1.936 +		{
   1.937 +			{
   1.938 +			EModifierKeyUp,
   1.939 +			0
   1.940 +			},
   1.941 +			{
   1.942 +			EKeyNumLock,		// this one matched num-lock
   1.943 +			EMatchKey			// match only num-lock
   1.944 +			},
   1.945 +			{
   1.946 +			EStateUnchanged,	// ignored
   1.947 +			EToggleModifier,	// function = toggle modifier state
   1.948 +			EModifierNumLock	// this is the modifier to toggle
   1.949 +			}
   1.950 +		},
   1.951 +		{
   1.952 +			{
   1.953 +			EModifierKeyUp,
   1.954 +			0
   1.955 +			},
   1.956 +			{
   1.957 +			EKeyScrollLock,		// match scroll-lock key
   1.958 +			EMatchKey
   1.959 +			},
   1.960 +			{
   1.961 +			EStateUnchanged,
   1.962 +			EToggleModifier,	// function = toggle modifier
   1.963 +			EModifierScrollLock	// modifier to toggle
   1.964 +			}
   1.965 +		},
   1.966 +		{
   1.967 +			{
   1.968 +			EModifierKeyUp,
   1.969 +			0
   1.970 +			},
   1.971 +			{
   1.972 +			EKeyLeftAlt,		// match left alt key
   1.973 +			EMatchKey
   1.974 +			},
   1.975 +			{
   1.976 +			EStateUnchanged,	// ignored
   1.977 +			ETurnOnModifier,	// function = turn on a modifier
   1.978 +			EModifierAlt|EModifierLeftAlt	// alt turns on this modifier combination
   1.979 +			}
   1.980 +		},
   1.981 +		{
   1.982 +			{
   1.983 +			EModifierKeyUp,		// goes with previous table, this handles the alt
   1.984 +			EModifierKeyUp		// key being released
   1.985 +			},
   1.986 +			{
   1.987 +			EKeyLeftAlt,		// match left alt key again
   1.988 +			EMatchKey
   1.989 +			},
   1.990 +			{
   1.991 +			EStateUnchanged,
   1.992 +			ETurnOffModifier,	// function = turn off the modifier
   1.993 +			EModifierLeftAlt	// modifier to turn off
   1.994 +			}
   1.995 +		},
   1.996 +		{
   1.997 +			{
   1.998 +			EModifierKeyUp,		// key down event (key-up flag == 0)
   1.999 +			0
  1.1000 +			},
  1.1001 +			{
  1.1002 +			EKeyLeftFunc,		// match left fn key
  1.1003 +			EMatchKey
  1.1004 +			},
  1.1005 +			{
  1.1006 +			EStateUnchanged,	// ignored
  1.1007 +			ETurnOnModifier,	// function = turn on modifier
  1.1008 +			EModifierFunc|EModifierLeftFunc	// modifier combination to turn on
  1.1009 +			}
  1.1010 +		},
  1.1011 +		{
  1.1012 +			{
  1.1013 +			EModifierKeyUp,		// goes with above table, this matched the
  1.1014 +			EModifierKeyUp		// left-fn key up event
  1.1015 +			},
  1.1016 +			{
  1.1017 +			EKeyLeftFunc,		// match left fn key
  1.1018 +			EMatchKey
  1.1019 +			},
  1.1020 +			{
  1.1021 +			EStateUnchanged,	// ignored
  1.1022 +			ETurnOffModifier,	// function = turn off modifier
  1.1023 +			EModifierLeftFunc	// modifier to turn off
  1.1024 +			}
  1.1025 +		},
  1.1026 +		{
  1.1027 +			{
  1.1028 +			EModifierKeyUp,		// key down event (key-up flag == 0)
  1.1029 +			0
  1.1030 +			},
  1.1031 +			{
  1.1032 +			EKeyLeftShift,		// match left shift key
  1.1033 +			EMatchKey
  1.1034 +			},
  1.1035 +			{
  1.1036 +			EStateUnchanged,	// ignored
  1.1037 +			ETurnOnModifier,	// function = turn on modifier
  1.1038 +			EModifierShift|EModifierLeftShift	// modifier combination to turn on
  1.1039 +			}
  1.1040 +		},
  1.1041 +		{
  1.1042 +			{
  1.1043 +			EModifierKeyUp,		// goes with above table, matches left shift
  1.1044 +			EModifierKeyUp		// key up event
  1.1045 +			},
  1.1046 +			{
  1.1047 +			EKeyLeftShift,		// match left shift key
  1.1048 +			EMatchKey
  1.1049 +			},
  1.1050 +			{
  1.1051 +			EStateUnchanged,	// ignored
  1.1052 +			ETurnOffModifier,	// turn off modifier
  1.1053 +			EModifierLeftShift	// modifier to turn off
  1.1054 +			}
  1.1055 +		},
  1.1056 +		{
  1.1057 +			{
  1.1058 +			EModifierKeyUp,		// key down event (key-up flag == 0)
  1.1059 +			0
  1.1060 +			},
  1.1061 +			{
  1.1062 +			EKeyLeftCtrl,		// match left ctrl key
  1.1063 +			EMatchKey
  1.1064 +			},
  1.1065 +			{
  1.1066 +			EStateUnchanged,	// ignored
  1.1067 +			ETurnOnModifier,	// function = turn on modifier
  1.1068 +			EModifierCtrl|EModifierLeftCtrl	// modifier combination to turn on
  1.1069 +			}
  1.1070 +		},
  1.1071 +		{
  1.1072 +			{
  1.1073 +			EModifierKeyUp,		// goes with above table, matches left ctrl
  1.1074 +			EModifierKeyUp		// key up event
  1.1075 +			},
  1.1076 +			{
  1.1077 +			EKeyLeftCtrl,		// match left ctrl key
  1.1078 +			EMatchKey
  1.1079 +			},
  1.1080 +			{
  1.1081 +			EStateUnchanged,	// ignored
  1.1082 +			ETurnOffModifier,	// function = turn off modifier
  1.1083 +			EModifierLeftCtrl	// modifier to turn off
  1.1084 +			}
  1.1085 +		},
  1.1086 +		{
  1.1087 +			{
  1.1088 +			EModifierKeyUp,		// key down event (key-up flag == 0)
  1.1089 +			0
  1.1090 +			},
  1.1091 +			{
  1.1092 +			EKeyRightAlt,		// match right alt key
  1.1093 +			EMatchKey
  1.1094 +			},
  1.1095 +			{
  1.1096 +			EStateUnchanged,	// ignored
  1.1097 +			ETurnOnModifier,	// function = turn on modifier
  1.1098 +			EModifierAlt|EModifierRightAlt	// modifier combination to turn on
  1.1099 +			}
  1.1100 +		},
  1.1101 +		{
  1.1102 +			{
  1.1103 +			EModifierKeyUp,		// goes with above table, matches right alt
  1.1104 +			EModifierKeyUp		// key up event
  1.1105 +			},
  1.1106 +			{
  1.1107 +			EKeyRightAlt,		// match right alt key
  1.1108 +			EMatchKey
  1.1109 +			},
  1.1110 +			{
  1.1111 +			EStateUnchanged,	// ignored
  1.1112 +			ETurnOffModifier,	// function = turn off modifier
  1.1113 +			EModifierRightAlt	// modifier to turn off
  1.1114 +			}
  1.1115 +		},
  1.1116 +		{
  1.1117 +			{
  1.1118 +			EModifierKeyUp,		// key down event (key-up flag == 0)
  1.1119 +			0
  1.1120 +			},
  1.1121 +			{
  1.1122 +			EKeyRightFunc,		// match right fn key
  1.1123 +			EMatchKey
  1.1124 +			},
  1.1125 +			{
  1.1126 +			EStateUnchanged,	// ignored
  1.1127 +			ETurnOnModifier,	// function = turn on modifier
  1.1128 +			EModifierFunc|EModifierRightFunc	// modifier combination to turn on
  1.1129 +			}
  1.1130 +		},
  1.1131 +		{
  1.1132 +			{
  1.1133 +			EModifierKeyUp,		// goes with above table, matches right fn
  1.1134 +			EModifierKeyUp		// key up event
  1.1135 +			},
  1.1136 +			{
  1.1137 +			EKeyRightFunc,		// match right fn key
  1.1138 +			EMatchKey
  1.1139 +			},
  1.1140 +			{
  1.1141 +			EStateUnchanged,	// ignored
  1.1142 +			ETurnOffModifier,	// function = turn off modifier
  1.1143 +			EModifierRightFunc	// modifier to turn off
  1.1144 +			}
  1.1145 +		},
  1.1146 +		{
  1.1147 +			{
  1.1148 +			EModifierKeyUp,		// key down event (key-up flag == 0)
  1.1149 +			0
  1.1150 +			},
  1.1151 +			{
  1.1152 +			EKeyRightShift,		// match right shift key
  1.1153 +			EMatchKey
  1.1154 +			},
  1.1155 +			{
  1.1156 +			EStateUnchanged,	// ignored
  1.1157 +			ETurnOnModifier,	// function = turn on modifier
  1.1158 +			EModifierShift|EModifierRightShift	// modifier combinatoin to turn on
  1.1159 +			}
  1.1160 +		},
  1.1161 +		{
  1.1162 +			{
  1.1163 +			EModifierKeyUp,		// goes with above table, handles right shift
  1.1164 +			EModifierKeyUp		// key up event
  1.1165 +			},
  1.1166 +			{
  1.1167 +			EKeyRightShift,		// match right shift key
  1.1168 +			EMatchKey
  1.1169 +			},
  1.1170 +			{
  1.1171 +			EStateUnchanged,	// ignored
  1.1172 +			ETurnOffModifier,	// function = turn off modifier
  1.1173 +			EModifierRightShift	// modifier to turn off
  1.1174 +			}
  1.1175 +		},
  1.1176 +		{
  1.1177 +			{
  1.1178 +			EModifierKeyUp,		// key down event (key-up flag == 0)
  1.1179 +			0
  1.1180 +			},
  1.1181 +			{
  1.1182 +			EKeyRightCtrl,		// match right ctrl key
  1.1183 +			EMatchKey
  1.1184 +			},
  1.1185 +			{
  1.1186 +			EStateUnchanged,	// ignored
  1.1187 +			ETurnOnModifier,	// function = turn on modifier
  1.1188 +			EModifierCtrl|EModifierRightCtrl	// modifier combination to turn on
  1.1189 +			}
  1.1190 +		},
  1.1191 +		{
  1.1192 +			{
  1.1193 +			EModifierKeyUp,		// goes with above table, matched right ctrl
  1.1194 +			EModifierKeyUp		// key up event
  1.1195 +			},
  1.1196 +			{
  1.1197 +			EKeyRightCtrl,		// match right ctrl key
  1.1198 +			EMatchKey
  1.1199 +			},
  1.1200 +			{
  1.1201 +			EStateUnchanged,	// ignored
  1.1202 +			ETurnOffModifier,	// function = turn off modifier
  1.1203 +			EModifierRightCtrl	// modifier to turn off
  1.1204 +			}
  1.1205 +		}
  1.1206 +	};
  1.1207 +
  1.1208 +
  1.1209 +//
  1.1210 +// TO DO: (optional)
  1.1211 +//
  1.1212 +// Tables corresponding to keyboard states.
  1.1213 +//
  1.1214 +// There are 13 keyboard states. States 0 to 9 can be used to create alternative
  1.1215 +// keyboard layouts for entering accented or unusual characters. Switching into
  1.1216 +// these states is done by a keypress. Implementation of the states is optional
  1.1217 +// depending on how many special state you want - you may implement 10 states,
  1.1218 +// you might decide not to implement any.
  1.1219 +//
  1.1220 +// State 10 is the normal state. The table for state 10 defines which keypresses
  1.1221 +// change to other states.
  1.1222 +//
  1.1223 +// States 11 and 12 are used when entering the numeric code of a character. State
  1.1224 +// 11 is for entering a specific number of digits. State 12 is for accepting
  1.1225 +// digits until Ctrl is released.
  1.1226 +//	
  1.1227 +//
  1.1228 +// As before, each SFuncTableEntry entry defines:
  1.1229 +//	- modifier conditions that must be matched
  1.1230 +//	- a keycode match pattern (typically an exact key match)
  1.1231 +//	- the function to perform and new state
  1.1232 +//
  1.1233 +// Switching into states 0..9,11,12 is done by entries in table10
  1.1234 +//
  1.1235 +
  1.1236 +//LOCAL_D const SFuncTableEntry table0[]=
  1.1237 +//	{
  1.1238 +//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1239 +//	};
  1.1240 +
  1.1241 +LOCAL_D const SFuncTableEntry table1[]=
  1.1242 +	{
  1.1243 +	//
  1.1244 +	// Table for special keyboard state 1
  1.1245 +	// This state is entered by pressing Fn+q (see table10)
  1.1246 +	//
  1.1247 +	// The table makes certain keys return accented characters
  1.1248 +	//
  1.1249 +		{
  1.1250 +			{
  1.1251 +			//
  1.1252 +			// Function must be release, and this must be a key down event
  1.1253 +			//
  1.1254 +			EModifierFunc|EModifierKeyUp,
  1.1255 +			0
  1.1256 +			},
  1.1257 +			{
  1.1258 +			//
  1.1259 +			// match an 'e' keypress, convert to an ae ligature (æ)
  1.1260 +			//
  1.1261 +			'e',
  1.1262 +			EMatchKeyCaseInsens
  1.1263 +			},
  1.1264 +			{
  1.1265 +			EStateNormal,			// switch back to state normal (table10)
  1.1266 +			EPassSpecialKeyThru,	// turn keypress into a special character
  1.1267 +			ELatin1LcAe				// this is the character to pass on
  1.1268 +			}
  1.1269 +		},
  1.1270 +		{
  1.1271 +			{
  1.1272 +			EModifierFunc|EModifierKeyUp,
  1.1273 +			0
  1.1274 +			},
  1.1275 +			{
  1.1276 +			'c',
  1.1277 +			EMatchKeyCaseInsens
  1.1278 +			},
  1.1279 +			{
  1.1280 +			EStateNormal,
  1.1281 +			EPassSpecialKeyThru,
  1.1282 +			ELatin1LcCcedilla
  1.1283 +			}
  1.1284 +		},
  1.1285 +		{
  1.1286 +			{
  1.1287 +			EModifierFunc|EModifierKeyUp,
  1.1288 +			0
  1.1289 +			},
  1.1290 +			{
  1.1291 +			's',
  1.1292 +			EMatchKeyCaseInsens
  1.1293 +			},
  1.1294 +			{
  1.1295 +			EStateNormal,
  1.1296 +			EPassSpecialKeyThru,
  1.1297 +			ELatin1EsTset
  1.1298 +			}
  1.1299 +		},
  1.1300 +		{
  1.1301 +			{
  1.1302 +			EModifierFunc|EModifierKeyUp,
  1.1303 +			0
  1.1304 +			},
  1.1305 +			{
  1.1306 +			'o',
  1.1307 +			EMatchKeyCaseInsens
  1.1308 +			},
  1.1309 +			{
  1.1310 +			EStateNormal,
  1.1311 +			EPassSpecialKeyThru,
  1.1312 +			ELatin1LcOslash
  1.1313 +			}
  1.1314 +		},
  1.1315 +		{
  1.1316 +			{
  1.1317 +			EModifierFunc|EModifierKeyUp,
  1.1318 +			0
  1.1319 +			},
  1.1320 +			{
  1.1321 +			'd',
  1.1322 +			EMatchKeyCaseInsens
  1.1323 +			},
  1.1324 +			{
  1.1325 +			EStateNormal,
  1.1326 +			EPassSpecialKeyThru,
  1.1327 +			ELatin1LcThorn
  1.1328 +			}
  1.1329 +		},
  1.1330 +		{
  1.1331 +			{
  1.1332 +			EModifierFunc|EModifierKeyUp,
  1.1333 +			0
  1.1334 +			},
  1.1335 +			{
  1.1336 +			't',
  1.1337 +			EMatchKeyCaseInsens
  1.1338 +			},
  1.1339 +			{
  1.1340 +			EStateNormal,
  1.1341 +			EPassSpecialKeyThru,
  1.1342 +			ELatin1LcSoftTh
  1.1343 +			}
  1.1344 +		},
  1.1345 +		{
  1.1346 +			{
  1.1347 +			EModifierFunc|EModifierKeyUp,
  1.1348 +			0
  1.1349 +			},
  1.1350 +			{
  1.1351 +			'l',
  1.1352 +			EMatchKeyCaseInsens
  1.1353 +			},
  1.1354 +			{
  1.1355 +			EStateNormal,
  1.1356 +			EPassSpecialKeyThru,
  1.1357 +			ELatin1LeftChevron
  1.1358 +			}
  1.1359 +		},
  1.1360 +		{
  1.1361 +			{
  1.1362 +			EModifierFunc|EModifierKeyUp,
  1.1363 +			0
  1.1364 +			},
  1.1365 +			{
  1.1366 +			'r',
  1.1367 +			EMatchKeyCaseInsens
  1.1368 +			},
  1.1369 +			{
  1.1370 +			EStateNormal,
  1.1371 +			EPassSpecialKeyThru,
  1.1372 +			ELatin1RightChevron
  1.1373 +			}
  1.1374 +		},
  1.1375 +		{
  1.1376 +			{
  1.1377 +			EModifierFunc|EModifierKeyUp,
  1.1378 +			0
  1.1379 +			},
  1.1380 +			{
  1.1381 +			'x',
  1.1382 +			EMatchKeyCaseInsens
  1.1383 +			},
  1.1384 +			{
  1.1385 +			EStateNormal,
  1.1386 +			EPassSpecialKeyThru,
  1.1387 +			ELatin1InvExclam
  1.1388 +			}
  1.1389 +		},
  1.1390 +		{
  1.1391 +			{
  1.1392 +			EModifierFunc|EModifierKeyUp,
  1.1393 +			0
  1.1394 +			},
  1.1395 +			{
  1.1396 +			'q',
  1.1397 +			EMatchKeyCaseInsens
  1.1398 +			},
  1.1399 +			{
  1.1400 +			EStateNormal,
  1.1401 +			EPassSpecialKeyThru,
  1.1402 +			ELatin1InvQuest
  1.1403 +			}
  1.1404 +		},
  1.1405 +		{
  1.1406 +			{
  1.1407 +			EModifierFunc|EModifierKeyUp,
  1.1408 +			0
  1.1409 +			},
  1.1410 +			{
  1.1411 +			'a',
  1.1412 +			EMatchKeyCaseInsens
  1.1413 +			},
  1.1414 +			{
  1.1415 +			EStateNormal,
  1.1416 +			EPassSpecialKeyThru,
  1.1417 +			ELatin1LcAo
  1.1418 +			}
  1.1419 +		},
  1.1420 +		{
  1.1421 +			{
  1.1422 +			EModifierFunc|EModifierKeyUp,
  1.1423 +			0
  1.1424 +			},
  1.1425 +			{
  1.1426 +			'p',
  1.1427 +			EMatchKeyCaseInsens
  1.1428 +			},
  1.1429 +			{
  1.1430 +			EStateNormal,
  1.1431 +			EPassSpecialKeyThru,
  1.1432 +			ELatin1Pound
  1.1433 +			}
  1.1434 +		},
  1.1435 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1436 +	};
  1.1437 +
  1.1438 +LOCAL_D const SFuncTableEntry table2[]=
  1.1439 +	{
  1.1440 +	//
  1.1441 +	// Table for special keyboard state 2
  1.1442 +	// This state is entered by pressing Fn+z (see table10)
  1.1443 +	//
  1.1444 +	// The table makes certain keys return accented characters
  1.1445 +	// See table1 for an explanation of the contents
  1.1446 +	//
  1.1447 +		{
  1.1448 +			{
  1.1449 +			EModifierFunc|EModifierKeyUp,
  1.1450 +			0
  1.1451 +			},
  1.1452 +			{
  1.1453 +			'a',
  1.1454 +			EMatchKeyCaseInsens
  1.1455 +			},
  1.1456 +			{
  1.1457 +			EStateNormal,
  1.1458 +			EPassSpecialKeyThru,
  1.1459 +			ELatin1LcAumlaut
  1.1460 +			}
  1.1461 +		},
  1.1462 +		{
  1.1463 +			{
  1.1464 +			EModifierFunc|EModifierKeyUp,
  1.1465 +			0
  1.1466 +			},
  1.1467 +			{
  1.1468 +			'e',
  1.1469 +			EMatchKeyCaseInsens
  1.1470 +			},
  1.1471 +			{
  1.1472 +			EStateNormal,
  1.1473 +			EPassSpecialKeyThru,
  1.1474 +			ELatin1LcEumlaut
  1.1475 +			}
  1.1476 +		},
  1.1477 +		{
  1.1478 +			{
  1.1479 +			EModifierFunc|EModifierKeyUp,
  1.1480 +			0
  1.1481 +			},
  1.1482 +			{
  1.1483 +			'i',
  1.1484 +			EMatchKeyCaseInsens
  1.1485 +			},
  1.1486 +			{
  1.1487 +			EStateNormal,
  1.1488 +			EPassSpecialKeyThru,
  1.1489 +			ELatin1LcIumlaut
  1.1490 +			}
  1.1491 +		},
  1.1492 +		{
  1.1493 +			{
  1.1494 +			EModifierFunc|EModifierKeyUp,
  1.1495 +			0
  1.1496 +			},
  1.1497 +			{
  1.1498 +			'o',
  1.1499 +			EMatchKeyCaseInsens
  1.1500 +			},
  1.1501 +			{
  1.1502 +			EStateNormal,
  1.1503 +			EPassSpecialKeyThru,
  1.1504 +			ELatin1LcOumlaut
  1.1505 +			}
  1.1506 +		},
  1.1507 +		{
  1.1508 +			{
  1.1509 +			EModifierFunc|EModifierKeyUp,
  1.1510 +			0
  1.1511 +			},
  1.1512 +			{
  1.1513 +			'u',
  1.1514 +			EMatchKeyCaseInsens
  1.1515 +			},
  1.1516 +			{
  1.1517 +			EStateNormal,
  1.1518 +			EPassSpecialKeyThru,
  1.1519 +			ELatin1LcUumlaut
  1.1520 +			}
  1.1521 +		},
  1.1522 +		{
  1.1523 +			{
  1.1524 +			EModifierFunc|EModifierKeyUp,
  1.1525 +			0
  1.1526 +			},
  1.1527 +			{
  1.1528 +			'y',
  1.1529 +			EMatchKeyCaseInsens
  1.1530 +			},
  1.1531 +			{
  1.1532 +			EStateNormal,
  1.1533 +			EPassSpecialKeyThru,
  1.1534 +			ELatin1LcYumlaut
  1.1535 +			}
  1.1536 +		},
  1.1537 +		{
  1.1538 +			{
  1.1539 +			EModifierFunc|EModifierKeyUp,
  1.1540 +			0
  1.1541 +			},
  1.1542 +			{
  1.1543 +			' ',
  1.1544 +			EMatchKey
  1.1545 +			},
  1.1546 +			{
  1.1547 +			EStateNormal,
  1.1548 +			EPassSpecialKeyThru,
  1.1549 +			ELatin1SpaceUmlaut
  1.1550 +			}
  1.1551 +		},
  1.1552 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1553 +	};
  1.1554 +
  1.1555 +LOCAL_D const SFuncTableEntry table3[]=
  1.1556 +	{
  1.1557 +	//
  1.1558 +	// Table for special keyboard state 3
  1.1559 +	// This state is entered by pressing Fn+x (see table10)
  1.1560 +	//
  1.1561 +	// The table makes certain keys return accented characters
  1.1562 +	//
  1.1563 +		{
  1.1564 +			{
  1.1565 +			EModifierFunc|EModifierKeyUp,
  1.1566 +			0
  1.1567 +			},
  1.1568 +			{
  1.1569 +			'a',
  1.1570 +			EMatchKeyCaseInsens
  1.1571 +			},
  1.1572 +			{
  1.1573 +			EStateNormal,
  1.1574 +			EPassSpecialKeyThru,
  1.1575 +			ELatin1LcAgrave
  1.1576 +			}
  1.1577 +		},
  1.1578 +		{
  1.1579 +			{
  1.1580 +			EModifierFunc|EModifierKeyUp,
  1.1581 +			0
  1.1582 +			},
  1.1583 +			{
  1.1584 +			'e',
  1.1585 +			EMatchKeyCaseInsens
  1.1586 +			},
  1.1587 +			{
  1.1588 +			EStateNormal,
  1.1589 +			EPassSpecialKeyThru,
  1.1590 +			ELatin1LcEgrave
  1.1591 +			}
  1.1592 +		},
  1.1593 +		{
  1.1594 +			{
  1.1595 +			EModifierFunc|EModifierKeyUp,
  1.1596 +			0
  1.1597 +			},
  1.1598 +			{
  1.1599 +			'i',
  1.1600 +			EMatchKeyCaseInsens
  1.1601 +			},
  1.1602 +			{
  1.1603 +			EStateNormal,
  1.1604 +			EPassSpecialKeyThru,
  1.1605 +			ELatin1LcIgrave
  1.1606 +			}
  1.1607 +		},
  1.1608 +		{
  1.1609 +			{
  1.1610 +			EModifierFunc|EModifierKeyUp,
  1.1611 +			0
  1.1612 +			},
  1.1613 +			{
  1.1614 +			'o',
  1.1615 +			EMatchKeyCaseInsens
  1.1616 +			},
  1.1617 +			{
  1.1618 +			EStateNormal,
  1.1619 +			EPassSpecialKeyThru,
  1.1620 +			ELatin1LcOgrave
  1.1621 +			}
  1.1622 +		},
  1.1623 +		{
  1.1624 +			{
  1.1625 +			EModifierFunc|EModifierKeyUp,
  1.1626 +			0
  1.1627 +			},
  1.1628 +			{
  1.1629 +			'u',
  1.1630 +			EMatchKeyCaseInsens
  1.1631 +			},
  1.1632 +			{
  1.1633 +			EStateNormal,
  1.1634 +			EPassSpecialKeyThru,
  1.1635 +			ELatin1LcUgrave
  1.1636 +			}
  1.1637 +		},
  1.1638 +		{
  1.1639 +			{
  1.1640 +			EModifierFunc|EModifierKeyUp,
  1.1641 +			0
  1.1642 +			},
  1.1643 +			{
  1.1644 +			' ',
  1.1645 +			EMatchKey
  1.1646 +			},
  1.1647 +			{
  1.1648 +			EStateNormal,
  1.1649 +			EPassSpecialKeyThru,
  1.1650 +			ELatin1SpaceGrave
  1.1651 +			}
  1.1652 +		},
  1.1653 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1654 +	};
  1.1655 +
  1.1656 +LOCAL_D const SFuncTableEntry table4[]=
  1.1657 +	{
  1.1658 +	//
  1.1659 +	// Table for special keyboard state 4
  1.1660 +	// This state is entered by pressing Fn+c (see table10)
  1.1661 +	//
  1.1662 +	// The table makes certain keys return accented characters
  1.1663 +	//
  1.1664 +		{
  1.1665 +			{
  1.1666 +			EModifierFunc|EModifierKeyUp,
  1.1667 +			0
  1.1668 +			},
  1.1669 +			{
  1.1670 +			'a',
  1.1671 +			EMatchKeyCaseInsens
  1.1672 +			},
  1.1673 +			{
  1.1674 +			EStateNormal,
  1.1675 +			EPassSpecialKeyThru,
  1.1676 +			ELatin1LcAacute
  1.1677 +			}
  1.1678 +		},
  1.1679 +		{
  1.1680 +			{
  1.1681 +			EModifierFunc|EModifierKeyUp,
  1.1682 +			0
  1.1683 +			},
  1.1684 +			{
  1.1685 +			'e',
  1.1686 +			EMatchKeyCaseInsens
  1.1687 +			},
  1.1688 +			{
  1.1689 +			EStateNormal,
  1.1690 +			EPassSpecialKeyThru,
  1.1691 +			ELatin1LcEacute
  1.1692 +			}
  1.1693 +		},
  1.1694 +		{
  1.1695 +			{
  1.1696 +			EModifierFunc|EModifierKeyUp,
  1.1697 +			0
  1.1698 +			},
  1.1699 +			{
  1.1700 +			'i',
  1.1701 +			EMatchKeyCaseInsens
  1.1702 +			},
  1.1703 +			{
  1.1704 +			EStateNormal,
  1.1705 +			EPassSpecialKeyThru,
  1.1706 +			ELatin1LcIacute
  1.1707 +			}
  1.1708 +		},
  1.1709 +		{
  1.1710 +			{
  1.1711 +			EModifierFunc|EModifierKeyUp,
  1.1712 +			0
  1.1713 +			},
  1.1714 +			{
  1.1715 +			'o',
  1.1716 +			EMatchKeyCaseInsens
  1.1717 +			},
  1.1718 +			{
  1.1719 +			EStateNormal,
  1.1720 +			EPassSpecialKeyThru,
  1.1721 +			ELatin1LcOacute
  1.1722 +			}
  1.1723 +		},
  1.1724 +		{
  1.1725 +			{
  1.1726 +			EModifierFunc|EModifierKeyUp,
  1.1727 +			0
  1.1728 +			},
  1.1729 +			{
  1.1730 +			'u',
  1.1731 +			EMatchKeyCaseInsens
  1.1732 +			},
  1.1733 +			{
  1.1734 +			EStateNormal,
  1.1735 +			EPassSpecialKeyThru,
  1.1736 +			ELatin1LcUacute
  1.1737 +			}
  1.1738 +		},
  1.1739 +		{
  1.1740 +			{
  1.1741 +			EModifierFunc|EModifierKeyUp,
  1.1742 +			0
  1.1743 +			},
  1.1744 +			{
  1.1745 +			'y',
  1.1746 +			EMatchKeyCaseInsens
  1.1747 +			},
  1.1748 +			{
  1.1749 +			EStateNormal,
  1.1750 +			EPassSpecialKeyThru,
  1.1751 +			ELatin1LcYacute
  1.1752 +			}
  1.1753 +		},
  1.1754 +		{
  1.1755 +			{
  1.1756 +			EModifierFunc|EModifierKeyUp,
  1.1757 +			0
  1.1758 +			},
  1.1759 +			{
  1.1760 +			' ',
  1.1761 +			EMatchKey
  1.1762 +			},
  1.1763 +			{
  1.1764 +			EStateNormal,
  1.1765 +			EPassSpecialKeyThru,
  1.1766 +			ELatin1LcSpaceAcute
  1.1767 +			}
  1.1768 +		},
  1.1769 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1770 +	};
  1.1771 +
  1.1772 +LOCAL_D const SFuncTableEntry table5[]=
  1.1773 +	{
  1.1774 +	//
  1.1775 +	// Table for special keyboard state 5
  1.1776 +	// This state is entered by pressing Fn+v (see table10)
  1.1777 +	//
  1.1778 +	// The table makes certain keys return accented characters
  1.1779 +	//
  1.1780 +		{
  1.1781 +			{
  1.1782 +			EModifierFunc|EModifierKeyUp,
  1.1783 +			0
  1.1784 +			},
  1.1785 +			{
  1.1786 +			'a',
  1.1787 +			EMatchKeyCaseInsens
  1.1788 +			},
  1.1789 +			{
  1.1790 +			EStateNormal,
  1.1791 +			EPassSpecialKeyThru,
  1.1792 +			ELatin1LcAtilde
  1.1793 +			}
  1.1794 +		},
  1.1795 +		{
  1.1796 +			{
  1.1797 +			EModifierFunc|EModifierKeyUp,
  1.1798 +			0
  1.1799 +			},
  1.1800 +			{
  1.1801 +			'n',
  1.1802 +			EMatchKeyCaseInsens
  1.1803 +			},
  1.1804 +			{
  1.1805 +			EStateNormal,
  1.1806 +			EPassSpecialKeyThru,
  1.1807 +			ELatin1LcNtilde
  1.1808 +			}
  1.1809 +		},
  1.1810 +		{
  1.1811 +			{
  1.1812 +			EModifierFunc|EModifierKeyUp,
  1.1813 +			0
  1.1814 +			},
  1.1815 +			{
  1.1816 +			'o',
  1.1817 +			EMatchKeyCaseInsens
  1.1818 +			},
  1.1819 +			{
  1.1820 +			EStateNormal,
  1.1821 +			EPassSpecialKeyThru,
  1.1822 +			ELatin1LcOtilde
  1.1823 +			}
  1.1824 +		},
  1.1825 +		{
  1.1826 +			{
  1.1827 +			EModifierFunc|EModifierKeyUp,
  1.1828 +			0
  1.1829 +			},
  1.1830 +			{
  1.1831 +			' ',
  1.1832 +			EMatchKey
  1.1833 +			},
  1.1834 +			{
  1.1835 +			EStateNormal,
  1.1836 +			EPassSpecialKeyThru,
  1.1837 +			ELatin1LcSpaceTilde
  1.1838 +			}
  1.1839 +		},
  1.1840 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1841 +	};
  1.1842 +
  1.1843 +LOCAL_D const SFuncTableEntry table6[]=
  1.1844 +	{
  1.1845 +	//
  1.1846 +	// Table for special keyboard state 6
  1.1847 +	// This state is entered by pressing Fn+b (see table6)
  1.1848 +	//
  1.1849 +	// The table makes certain keys return accented characters
  1.1850 +	//
  1.1851 +		{
  1.1852 +			{
  1.1853 +			EModifierFunc|EModifierKeyUp,
  1.1854 +			0
  1.1855 +			},
  1.1856 +			{
  1.1857 +			'a',
  1.1858 +			EMatchKeyCaseInsens
  1.1859 +			},
  1.1860 +			{
  1.1861 +			EStateNormal,
  1.1862 +			EPassSpecialKeyThru,
  1.1863 +			ELatin1LcAcirc
  1.1864 +			}
  1.1865 +		},
  1.1866 +		{
  1.1867 +			{
  1.1868 +			EModifierFunc|EModifierKeyUp,
  1.1869 +			0
  1.1870 +			},
  1.1871 +			{
  1.1872 +			'e',
  1.1873 +			EMatchKeyCaseInsens
  1.1874 +			},
  1.1875 +			{
  1.1876 +			EStateNormal,
  1.1877 +			EPassSpecialKeyThru,
  1.1878 +			ELatin1LcEcirc
  1.1879 +			}
  1.1880 +		},
  1.1881 +		{
  1.1882 +			{
  1.1883 +			EModifierFunc|EModifierKeyUp,
  1.1884 +			0
  1.1885 +			},
  1.1886 +			{
  1.1887 +			'i',
  1.1888 +			EMatchKeyCaseInsens
  1.1889 +			},
  1.1890 +			{
  1.1891 +			EStateNormal,
  1.1892 +			EPassSpecialKeyThru,
  1.1893 +			ELatin1LcIcirc
  1.1894 +			}
  1.1895 +		},
  1.1896 +		{
  1.1897 +			{
  1.1898 +			EModifierFunc|EModifierKeyUp,
  1.1899 +			0
  1.1900 +			},
  1.1901 +			{
  1.1902 +			'o',
  1.1903 +			EMatchKeyCaseInsens
  1.1904 +			},
  1.1905 +			{
  1.1906 +			EStateNormal,
  1.1907 +			EPassSpecialKeyThru,
  1.1908 +			ELatin1LcOcirc
  1.1909 +			}
  1.1910 +		},
  1.1911 +		{
  1.1912 +			{
  1.1913 +			EModifierFunc|EModifierKeyUp,
  1.1914 +			0
  1.1915 +			},
  1.1916 +			{
  1.1917 +			'u',
  1.1918 +			EMatchKeyCaseInsens
  1.1919 +			},
  1.1920 +			{
  1.1921 +			EStateNormal,
  1.1922 +			EPassSpecialKeyThru,
  1.1923 +			ELatin1LcUcirc
  1.1924 +			}
  1.1925 +		},
  1.1926 +		{
  1.1927 +			{
  1.1928 +			EModifierFunc|EModifierKeyUp,
  1.1929 +			0
  1.1930 +			},
  1.1931 +			{
  1.1932 +			' ',
  1.1933 +			EMatchKey
  1.1934 +			},
  1.1935 +			{
  1.1936 +			EStateNormal,
  1.1937 +			EPassSpecialKeyThru,
  1.1938 +			ELatin1LcSpaceCirc
  1.1939 +			}
  1.1940 +		},
  1.1941 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1942 +	};
  1.1943 +
  1.1944 +//
  1.1945 +// TO DO: (optional)
  1.1946 +//
  1.1947 +// State 7,8,9 aren't used in this example.
  1.1948 +// You can implement them if you want more special states
  1.1949 +//
  1.1950 +
  1.1951 +//LOCAL_D const SFuncTableEntry table7[]=
  1.1952 +//	{
  1.1953 +//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1954 +//	};
  1.1955 +
  1.1956 +//LOCAL_D const SFuncTableEntry table8[]=
  1.1957 +//	{
  1.1958 +//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1959 +//	};
  1.1960 +
  1.1961 +//LOCAL_D const SFuncTableEntry table9[]=
  1.1962 +//	{
  1.1963 +//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.1964 +//	};
  1.1965 +
  1.1966 +
  1.1967 +LOCAL_D const SFuncTableEntry table10[]=
  1.1968 +	{
  1.1969 +	//
  1.1970 +	// TO DO: (optional)
  1.1971 +	//
  1.1972 +	// Table keyboard state 10 - the normal state
  1.1973 +	//
  1.1974 +	// This table controls which keys switch into the special states
  1.1975 +	// 0-9, 11 and 12.
  1.1976 +	//
  1.1977 +
  1.1978 +		{ 
  1.1979 +		//
  1.1980 +		// Make sure key-up events are ignored by handling them first and
  1.1981 +		// doing nothing
  1.1982 +		//
  1.1983 +			{
  1.1984 +			EModifierKeyUp,
  1.1985 +			EModifierKeyUp
  1.1986 +			},
  1.1987 +			{
  1.1988 +			EKeyNull,
  1.1989 +			EAnyKey
  1.1990 +			},
  1.1991 +			{
  1.1992 +			EStateUnchanged,
  1.1993 +			EDoNothing,
  1.1994 +			0
  1.1995 +			}
  1.1996 +		},
  1.1997 +		{ 
  1.1998 +		//
  1.1999 +		// Check for ctrl-number presses
  1.2000 +		// This will enter state EStateCtrlDigits (state 12) which allows
  1.2001 +		// entry of a numeric keycode
  1.2002 +		//
  1.2003 +			{
  1.2004 +			EModifierCtrl|EModifierFunc|EModifierKeyUp,
  1.2005 +			EModifierCtrl
  1.2006 +			},
  1.2007 +			{
  1.2008 +			EKeyNull,
  1.2009 +			EAnyDecimalDigit
  1.2010 +			},
  1.2011 +			{
  1.2012 +			EStateDerivedFromDigitEntered,
  1.2013 +			EAddOnCtrlDigit,
  1.2014 +			0
  1.2015 +			}
  1.2016 +		},
  1.2017 +		{
  1.2018 +		//
  1.2019 +		// Any other key events that have not been trapped are just
  1.2020 +		// passed through unchanged
  1.2021 +		//
  1.2022 +			{
  1.2023 +			0,
  1.2024 +			0
  1.2025 +			},
  1.2026 +			{
  1.2027 +			EKeyNull,
  1.2028 +			EAnyKey
  1.2029 +			},
  1.2030 +			{
  1.2031 +			EStateUnchanged,
  1.2032 +			EPassKeyThru,
  1.2033 +			0
  1.2034 +			}
  1.2035 +		}
  1.2036 +	};
  1.2037 +
  1.2038 +//LOCAL_D const SFuncTableEntry table11[]=
  1.2039 +//	{
  1.2040 +//	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.2041 +//	};
  1.2042 +
  1.2043 +LOCAL_D const SFuncTableEntry table12[]=
  1.2044 +	{
  1.2045 +	//
  1.2046 +	// Table 12 handles entring digit codes. The keyboard will remain in this
  1.2047 +	// state until the Ctrl key is released
  1.2048 +	//
  1.2049 +		{
  1.2050 +			{
  1.2051 +			//
  1.2052 +			// Look for a key up event
  1.2053 +			//
  1.2054 +			EModifierKeyUp,
  1.2055 +			EModifierKeyUp
  1.2056 +			},
  1.2057 +			{
  1.2058 +			// 
  1.2059 +			// Match either left or right Ctrl key (i.e. this matches a Ctrl key release)
  1.2060 +			//
  1.2061 +			EKeyLeftCtrl,
  1.2062 +			EMatchLeftOrRight
  1.2063 +			},
  1.2064 +			{
  1.2065 +			EStateNormal,			// return to normal state (table10)
  1.2066 +			EPassCtrlDigitsThru,	// and pass through the numeric code we have accumulated
  1.2067 +			0
  1.2068 +			}
  1.2069 +		},
  1.2070 +	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
  1.2071 +	};
  1.2072 +
  1.2073 +
  1.2074 +//
  1.2075 +// TO DO: (optional)
  1.2076 +//
  1.2077 +// Array of state control tables above. If a state is not used set the array 
  1.2078 +// size to zero and the pointer to NULL
  1.2079 +//
  1.2080 +// The tables must be declared here in order from table 0 to table 12
  1.2081 +//
  1.2082 +LOCAL_D const SFuncTable genFuncTables[]=
  1.2083 +	{
  1.2084 +		{
  1.2085 +		//
  1.2086 +		// state 0
  1.2087 +		//
  1.2088 +		0,			// state 0 not used, size = 0
  1.2089 +		NULL		// state 0 not used, pointer = NULL
  1.2090 +		},
  1.2091 +		{
  1.2092 +		//
  1.2093 +		// state 1
  1.2094 +		//
  1.2095 +		ARRAY_LENGTH(table1),		// size of table 1
  1.2096 +		&table1[0]					// pointer to table 1
  1.2097 +		},
  1.2098 +		{
  1.2099 +		//
  1.2100 +		// state 2
  1.2101 +		//
  1.2102 +		ARRAY_LENGTH(table2),
  1.2103 +		&table2[0]
  1.2104 +		},
  1.2105 +		{
  1.2106 +		//
  1.2107 +		// state 3
  1.2108 +		//
  1.2109 +		ARRAY_LENGTH(table3),
  1.2110 +		&table3[0]
  1.2111 +		},
  1.2112 +		{
  1.2113 +		//
  1.2114 +		// state 4
  1.2115 +		//
  1.2116 +		ARRAY_LENGTH(table4),
  1.2117 +		&table4[0]
  1.2118 +		},
  1.2119 +		{
  1.2120 +		//
  1.2121 +		// state 5
  1.2122 +		//
  1.2123 +		ARRAY_LENGTH(table5),
  1.2124 +		&table5[0]
  1.2125 +		},
  1.2126 +		{
  1.2127 +		//
  1.2128 +		// state 6
  1.2129 +		//
  1.2130 +		ARRAY_LENGTH(table6),
  1.2131 +		&table6[0]
  1.2132 +		},
  1.2133 +		{
  1.2134 +		//
  1.2135 +		// state 7
  1.2136 +		//
  1.2137 +		0,
  1.2138 +		NULL
  1.2139 +		},
  1.2140 +		{
  1.2141 +		//
  1.2142 +		// state 8
  1.2143 +		//
  1.2144 +		0,
  1.2145 +		NULL
  1.2146 +		},
  1.2147 +		{
  1.2148 +		//
  1.2149 +		// state 9
  1.2150 +		//
  1.2151 +		0,
  1.2152 +		NULL
  1.2153 +		},
  1.2154 +		{
  1.2155 +		//
  1.2156 +		// state 10
  1.2157 +		//
  1.2158 +		ARRAY_LENGTH(table10),
  1.2159 +		&table10[0]
  1.2160 +		},
  1.2161 +		{
  1.2162 +		//
  1.2163 +		// state 11
  1.2164 +		//
  1.2165 +		0,
  1.2166 +		NULL
  1.2167 +		},
  1.2168 +		{
  1.2169 +		//
  1.2170 +		// state 12
  1.2171 +		//
  1.2172 +		ARRAY_LENGTH(table12),
  1.2173 +		&table12[0]
  1.2174 +		}
  1.2175 +	};
  1.2176 +
  1.2177 +
  1.2178 +//
  1.2179 +// Root of the state modifier tables
  1.2180 +//
  1.2181 +LOCAL_D const SFuncTables FuncTables=
  1.2182 +	{
  1.2183 +		{
  1.2184 +		//
  1.2185 +		// The default processing table
  1.2186 +		//
  1.2187 +		ARRAY_LENGTH(defaultTable),
  1.2188 +		&defaultTable[0]
  1.2189 +		},
  1.2190 +		{
  1.2191 +		//
  1.2192 +		// The modifier control table
  1.2193 +		//
  1.2194 +		ARRAY_LENGTH(modifierTable),
  1.2195 +		&modifierTable[0]
  1.2196 +		},
  1.2197 +	//
  1.2198 +	// The state control tables
  1.2199 +	//
  1.2200 +	ARRAY_LENGTH(genFuncTables),
  1.2201 +	&genFuncTables[0]
  1.2202 +	};
  1.2203 +
  1.2204 +
  1.2205 +//
  1.2206 +// The following exported functions give the key translator access to
  1.2207 +// the control tables above
  1.2208 +//
  1.2209 +EXPORT_C void KeyDataSettings(TRadix &aRadix,TCtrlDigitsTermination &aCtrlDigitsTermination,TInt &aDefaultCtrlDigitsMaxCount,
  1.2210 +							  TInt &aMaximumCtrlDigitsMaxCount)
  1.2211 +	{
  1.2212 +	aRadix=EDecimal;
  1.2213 +	aCtrlDigitsTermination=ETerminationByCtrlUp;
  1.2214 +	aDefaultCtrlDigitsMaxCount=3;
  1.2215 +	aMaximumCtrlDigitsMaxCount=10;
  1.2216 +	}
  1.2217 +
  1.2218 +EXPORT_C void KeyDataFuncTable(SFuncTables &aFuncTables)
  1.2219 +	{
  1.2220 +	aFuncTables=FuncTables;
  1.2221 +	}
  1.2222 +
  1.2223 +EXPORT_C void KeyDataConvTable(SConvTable &aConvTable, TUint &aConvTableFirstScanCode,TUint &aConvTableLastScanCode,
  1.2224 +							 SScanCodeBlockList &aKeypadScanCode,SKeyCodeList &aNonAutorepKeyCodes)
  1.2225 +	{
  1.2226 +	aConvTable=ConvTable;
  1.2227 +	aConvTableFirstScanCode=scanCodeBlock_base[0].firstScanCode;
  1.2228 +	aConvTableLastScanCode=scanCodeBlock_base[ARRAY_LENGTH(scanCodeBlock_base)-1].lastScanCode;
  1.2229 +	aKeypadScanCode=ConvTableKeypadScanCodes;
  1.2230 +	aNonAutorepKeyCodes=ConvTableNonAutorepKeyCodes;
  1.2231 +	}