omap3530/beagle_drivers/keytran/keymap.cpp
changeset 0 6663340f3fc9
child 25 524118fd998f
equal deleted inserted replaced
-1:000000000000 0:6663340f3fc9
       
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // omap3530/beagle_drivers/keytran/keymap.cpp
       
    15 // This file is part of the Beagle Base port
       
    16 // The keyboard lookup tables giving the function to be carried out
       
    17 // and the new state of the keyboard
       
    18 //
       
    19 
       
    20 
       
    21 #include <k32keys.h>
       
    22 
       
    23 #define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
       
    24 
       
    25 
       
    26 //
       
    27 // Scancode conversion tables
       
    28 // --------------------------
       
    29 // The scancode conversion is arranged as a tree of tables which are used to
       
    30 // convert a scancode to a keycode, taking into account the modifier state
       
    31 // (shift, control, fn)
       
    32 //
       
    33 // How the tables work:
       
    34 // --------------------
       
    35 // Firstly, there is a distinction between the "scancodes" used in scanning
       
    36 // the keyboard, and the "scancodes" used in this files.
       
    37 //
       
    38 // Typically the keyboard driver already contains a table to convert hardware
       
    39 // key location codes produced during keyboard scanning into EPOC "scancodes".
       
    40 // EPOC scancodes are defined for "standard" keys like shift, backspace,
       
    41 // escape, in the TStdScanCode enum (see E32KEYS.H), and should be ASCII codes
       
    42 // for normal characters. The keyboard driver should add these EPOC scancodes
       
    43 // to the event queue, not hardware-dependant key locations.
       
    44 //
       
    45 // For now on "scancode" refers to EPOC scancodes:
       
    46 //
       
    47 // The keyboard is divided into a number of "blocks" of contiguous scancodes
       
    48 //
       
    49 // Blocks map to keycodes in a keycode table, and several blocks can be
       
    50 // grouped and map to a single keycode table. Blocks map into the keycode
       
    51 // table in the order they are declared. For example, if two scancode blocks
       
    52 // with a range of 5 scancodes map to a single 10-entry keycode table, scancodes
       
    53 // which fall in the first block will map to the first 5 entries in the keycode
       
    54 // table, scancodes falling in the second block map the the next 5 entries in
       
    55 // the keycode table.
       
    56 //
       
    57 // In theory it is possible to have multiple [keycode,scancode blocks] groups
       
    58 // but there is little point doing this - grouping all the scancode blocks
       
    59 // with a single keycode table holding all possible keycode values is usually
       
    60 // sufficient (and simpler). However, there are some special cases where this
       
    61 // is useful - the most obvious example is handling of shift and caps lock.
       
    62 // The shift key implies everything that the caps-lock key does (upper case
       
    63 // letters) plus some shifted characters for other keys. This is done by 
       
    64 // defining two tables - the first handles only caps-lock (upper case), the 
       
    65 // second handles all other keys that are affected only by shift. If caps-
       
    66 // lock is active, only the caps-lock table is used. If shift is pressed both
       
    67 // the caps-lock and shift tables are scanned for the conversion. This allows
       
    68 // a base table to be extended with "extras", much like deriving a class from
       
    69 // base class and extending it.
       
    70 //
       
    71 //
       
    72 // There is one or more [keycode table, scancode blocks] group for each
       
    73 // modifier state - e.g. a lower-case table, upper-case, ctrl, ctrl-shift.
       
    74 // This is the root of the table.
       
    75 //
       
    76 // When converting a scancode the key translator first obtains the correct
       
    77 // conversion tables for the modifier state. It then traverses all the scancode
       
    78 // blocks looking for one which contains the scancode being converted. Once
       
    79 // a matching scancode range is located, the key translator maps this into
       
    80 // its position in the associated keycode table to obtain the converted keycode.
       
    81 //
       
    82 // The key tables below appear more complicated than they really are because of
       
    83 // the intermediate structures that hold pointers to other structures. The
       
    84 // important structures are:
       
    85 //		SScanCodeBlock - contains a "start" and "end" for a scancode range
       
    86 //		SConvSubTable - groups a number of scanode blocks with a keycode table
       
    87 //		SConvTableNode - points to SConvSubTables for each modifier state
       
    88 //		SConvTable - the root of the translation table - points to 1..n SConvTableNode
       
    89 //
       
    90 // The keycode tables are just an array of TUint16.
       
    91 //
       
    92 
       
    93 
       
    94 //
       
    95 // TO DO: (optional)
       
    96 //
       
    97 // Keys which are not affected by modifier state
       
    98 //
       
    99 
       
   100 //
       
   101 // This is a simple example of scancode to keycode mapping. The first block
       
   102 // in scanCodeBlock_unmodifiable is a range of several scancodes, so maps to
       
   103 // several entries in the keycode table convKeyCodes_unmodifiable.
       
   104 //		EStdKeyLeftShift -> maps to -> EKeyLeftShift
       
   105 //		EStdKeyRightShift -> maps to -> EKeyRightShift
       
   106 //		...
       
   107 //		EStdKeyScrollLock -> maps to -> EKeyScrollLock
       
   108 //
       
   109 LOCAL_D const SScanCodeBlock scanCodeBlock_unmodifiable[]=
       
   110 	{
       
   111 	{EStdKeyLeftShift, EStdKeyScrollLock},	// range 1: left shift to scroll lock
       
   112 	};
       
   113 
       
   114 LOCAL_D const TUint16 convKeyCodes_unmodifiable[]=
       
   115 	{
       
   116 	EKeyLeftShift,
       
   117 	EKeyRightShift,
       
   118 	EKeyLeftAlt,
       
   119 	EKeyRightAlt,
       
   120 	EKeyLeftCtrl,
       
   121 	EKeyRightCtrl,
       
   122 	EKeyLeftFunc,
       
   123 	EKeyRightFunc,
       
   124 	EKeyCapsLock,
       
   125 	EKeyNumLock,
       
   126 	EKeyScrollLock
       
   127 	};
       
   128 
       
   129 
       
   130 
       
   131 //
       
   132 // TO DO: (optional)
       
   133 //
       
   134 // Base conversion table
       
   135 // this table traps all of the keyboard's scanCodes except those in
       
   136 // convKeyCodes_unmodifiable. It appears last in the top-level table and
       
   137 // is used to convert any scancode that is not converted by any of the
       
   138 // other tables
       
   139 //
       
   140 LOCAL_D const SScanCodeBlock scanCodeBlock_base[]=
       
   141 	{
       
   142 	{EStdKeyNull, EStdKeyDownArrow},		// scancode range 1
       
   143 	{'0', '9'},								// scancode range 2
       
   144 	{'A', 'Z'},								// scancode range 3
       
   145 	{EStdKeyF1, EStdKeyDictaphoneRecord},	// scancode range 4
       
   146 	};
       
   147 
       
   148 LOCAL_D const TUint16 convKeyCodes_base[]=
       
   149 	{
       
   150 	EKeyNull,				// scancode range 1 mapping starts here
       
   151 	EKeyBackspace,
       
   152 	EKeyTab,
       
   153 	EKeyEnter,
       
   154 	EKeyEscape,
       
   155 	' ',
       
   156 	EKeyPrintScreen,
       
   157 	EKeyPause,
       
   158 	EKeyHome,
       
   159 	EKeyEnd,
       
   160 	EKeyPageUp,
       
   161 	EKeyPageDown,
       
   162 	EKeyInsert,
       
   163 	EKeyDelete,
       
   164 	EKeyLeftArrow,
       
   165 	EKeyRightArrow,
       
   166 	EKeyUpArrow,
       
   167 	EKeyDownArrow,
       
   168 	'0',					// scancode range 2 mapping starts here
       
   169 	'1',
       
   170 	'2',
       
   171 	'3',
       
   172 	'4',
       
   173 	'5',
       
   174 	'6',
       
   175 	'7',
       
   176 	'8',
       
   177 	'9',
       
   178 	'a',					// scancode range 3 mapping starts here
       
   179 	'b',
       
   180 	'c',
       
   181 	'd',
       
   182 	'e',
       
   183 	'f',
       
   184 	'g',
       
   185 	'h',
       
   186 	'i',
       
   187 	'j',
       
   188 	'k',
       
   189 	'l',
       
   190 	'm',
       
   191 	'n',
       
   192 	'o',
       
   193 	'p',
       
   194 	'q',
       
   195 	'r',
       
   196 	's',
       
   197 	't',
       
   198 	'u',
       
   199 	'v',
       
   200 	'w',
       
   201 	'x',
       
   202 	'y',
       
   203 	'z',
       
   204 	EKeyF1,						// scancode range 4 mapping starts here
       
   205 	EKeyF2,
       
   206 	EKeyF3,
       
   207 	EKeyF4,
       
   208 	EKeyF5,
       
   209 	EKeyF6,
       
   210 	EKeyF7,
       
   211 	EKeyF8,
       
   212 	EKeyF9,
       
   213 	EKeyF10,
       
   214 	EKeyF11,
       
   215 	EKeyF12,
       
   216 	EKeyF13,
       
   217 	EKeyF14,
       
   218 	EKeyF15,
       
   219 	EKeyF16,
       
   220 	EKeyF17,
       
   221 	EKeyF18,
       
   222 	EKeyF19,
       
   223 	EKeyF20,
       
   224 	EKeyF21,
       
   225 	EKeyF22,
       
   226 	EKeyF23,
       
   227 	EKeyF24,
       
   228 	'`',
       
   229 	',',
       
   230 	'.',
       
   231 	'/',
       
   232 	'\\',
       
   233 	';',
       
   234 	'\'',
       
   235 	'#',
       
   236 	'[',
       
   237 	']',
       
   238 	'-',
       
   239 	'=',
       
   240 	'/',
       
   241 	'*',
       
   242 	'-',
       
   243 	'+',
       
   244 	EKeyEnter,
       
   245 	EKeyEnd,
       
   246 	EKeyDownArrow,
       
   247 	EKeyPageDown,
       
   248 	EKeyLeftArrow,
       
   249 	EKeyNull, // numeric keypad '5'
       
   250 	EKeyRightArrow,
       
   251 	EKeyHome,
       
   252 	EKeyUpArrow,
       
   253 	EKeyPageUp,
       
   254 	EKeyInsert,
       
   255 	EKeyDelete,
       
   256 	EKeyMenu,
       
   257 	EKeyBacklightOn,
       
   258 	EKeyBacklightOff,
       
   259 	EKeyBacklightToggle,
       
   260 	EKeyIncContrast,
       
   261 	EKeyDecContrast,
       
   262 	EKeySliderDown,
       
   263 	EKeySliderUp,
       
   264 	EKeyDictaphonePlay,
       
   265 	EKeyDictaphoneStop,
       
   266 	EKeyDictaphoneRecord
       
   267 	};
       
   268 
       
   269 
       
   270 //
       
   271 // TO DO: (optional)
       
   272 //	
       
   273 // caps-lock: this table traps those scanCodes which are affected by caps-lock
       
   274 //
       
   275 LOCAL_D const SScanCodeBlock scanCodeBlock_capsLock[]=
       
   276 	{
       
   277 	{'A', 'Z'}			// only alpha keys are affected by caps-lock
       
   278 	};
       
   279 
       
   280 LOCAL_D const TUint16 convKeyCodes_capsLock[]=
       
   281 	{
       
   282 	'A',
       
   283 	'B',
       
   284 	'C',
       
   285 	'D',
       
   286 	'E',
       
   287 	'F',
       
   288 	'G',
       
   289 	'H',
       
   290 	'I',
       
   291 	'J',
       
   292 	'K',
       
   293 	'L',
       
   294 	'M',
       
   295 	'N',
       
   296 	'O',
       
   297 	'P',
       
   298 	'Q',
       
   299 	'R',
       
   300 	'S',
       
   301 	'T',
       
   302 	'U',
       
   303 	'V',
       
   304 	'W',
       
   305 	'X',
       
   306 	'Y',
       
   307 	'Z'
       
   308 	};
       
   309 
       
   310 //
       
   311 // TO DO: (optional)
       
   312 //
       
   313 // shift: this table traps those scanCodes which are affected
       
   314 // by normal shift key EXCEPT for those scanCodes affected by caps-lock
       
   315 //
       
   316 
       
   317 LOCAL_D const SScanCodeBlock scanCodeBlock_shift[]=
       
   318 	{
       
   319 	{'0', '9'},
       
   320 	{EStdKeyXXX, EStdKeyEquals},
       
   321 	};
       
   322 
       
   323 LOCAL_D const TUint16 convKeyCodes_shift[]=
       
   324 	{
       
   325 	')',
       
   326 	'!',
       
   327 	'@',/*'"',*/
       
   328 	'#',			/*ELatin1Pound,*/
       
   329 	'$',
       
   330 	'%',
       
   331 	'^',
       
   332 	'&',
       
   333 	'*',
       
   334 	'(',
       
   335 	'~',   /*ELatin1LogicNot,*/
       
   336 	'<',
       
   337 	'>',
       
   338 	'?',
       
   339 	'|',
       
   340 	':',
       
   341 	'"',
       
   342 	'|', /*'~',*/
       
   343 	'{',
       
   344 	'}',
       
   345 	'_',
       
   346 	'+'
       
   347 	};
       
   348 
       
   349 //
       
   350 // TO DO: (optional)
       
   351 //
       
   352 // func: this table traps those scanCodes which are affected
       
   353 // by the func key but not shift
       
   354 //
       
   355 LOCAL_D const SScanCodeBlock scanCodeBlock_func[]=
       
   356 	{
       
   357     {EStdKeyEscape, EStdKeyEscape},
       
   358     {'M', 'M'},
       
   359     {EStdKeyComma, EStdKeyComma},
       
   360     {EStdKeyLeftArrow, EStdKeyDownArrow},
       
   361 	};
       
   362 
       
   363 LOCAL_D const TUint16 convKeyCodes_func[]=
       
   364 	{
       
   365     EKeyOff,
       
   366     EKeyDecContrast,
       
   367     EKeyIncContrast,
       
   368     EKeyHome,
       
   369     EKeyEnd,
       
   370     EKeyPageUp,
       
   371     EKeyPageDown,
       
   372 	};
       
   373 
       
   374 //
       
   375 // TO DO: (optional)
       
   376 //
       
   377 // func: this table traps those scanCodes which are affected
       
   378 // by func and shift - this is for func pressed, shift not pressed
       
   379 //
       
   380 //LOCAL_D const SScanCodeBlock scanCodeBlock_funcUnshifted[]=
       
   381 //	{
       
   382 //	{'E', 'E'},
       
   383 //	};
       
   384 
       
   385 //LOCAL_D const TUint16 convKeyCodes_funcUnshifted[]=
       
   386 //	{
       
   387 //	ELatin1LcEacute,
       
   388 //	};
       
   389 
       
   390 //
       
   391 // TO DO: (optional)
       
   392 //
       
   393 // func: this table traps those scanCodes which are affected
       
   394 // by func and shift - this is for func and shift both pressed
       
   395 //
       
   396 //LOCAL_D const SScanCodeBlock scanCodeBlock_funcShifted[]=
       
   397 //	{
       
   398 //	{'E', 'E'},
       
   399 //	};
       
   400 
       
   401 //LOCAL_D const TUint16 convKeyCodes_funcShifted[]=
       
   402 //	{
       
   403 //	ELatin1UcEacute,
       
   404 //	};
       
   405 
       
   406 //
       
   407 // TO DO: (optional)
       
   408 //
       
   409 // ctrl: this table traps those scanCodes which are affected by ctrl
       
   410 //
       
   411 LOCAL_D const SScanCodeBlock scanCodeBlock_ctrl[]=
       
   412 	{
       
   413 	//
       
   414 	// NOTE: The space key gets handled elsewhere, otherwise it gets
       
   415 	// thrown away as a NULL key
       
   416 	//	{EStdKeySpace, EStdKeySpace},
       
   417 
       
   418 	{'A', 'Z'},
       
   419     {EStdKeyComma, EStdKeyComma},
       
   420 	};
       
   421 
       
   422 LOCAL_D const TUint16 convKeyCodes_ctrl[]=
       
   423 	{
       
   424 //	0,
       
   425 	1,
       
   426 	2,
       
   427 	3,
       
   428 	4,
       
   429 	5,
       
   430 	6,
       
   431 	7,
       
   432 	8,
       
   433 	9,
       
   434 	10,
       
   435 	11,
       
   436 	12,
       
   437 	13,
       
   438 	14,
       
   439 	15,
       
   440 	16,
       
   441 	17,
       
   442 	18,
       
   443 	19,
       
   444 	20,
       
   445 	21,
       
   446 	22,
       
   447 	23,
       
   448 	24,
       
   449 	25,
       
   450 	26,
       
   451 	',',
       
   452 	};
       
   453 
       
   454 
       
   455 
       
   456 //
       
   457 // TO DO: (optional)
       
   458 //
       
   459 // Each set of scancode+keycode tables must be grouped into a SConvSubTable.
       
   460 // The lines below define a number of SConvSubTables for each of the groups
       
   461 // above.
       
   462 //
       
   463 LOCAL_D const SConvSubTable
       
   464 	convSubTable_unmodifiable=							// table for unmodifiable keys
       
   465 		{
       
   466 		&convKeyCodes_unmodifiable[0],					// the keycode table
       
   467 			{
       
   468 			ARRAY_LENGTH(scanCodeBlock_unmodifiable),	// number of scancode blocks
       
   469 			&scanCodeBlock_unmodifiable[0]				// pointer to scancode blocks
       
   470 			}
       
   471 		},
       
   472 	convSubTable_base=									// table for base keys
       
   473 		{
       
   474 		&convKeyCodes_base[0],							// keycode table
       
   475 			{
       
   476 			ARRAY_LENGTH(scanCodeBlock_base),			// number of scancode blocks
       
   477 			&scanCodeBlock_base[0]						// pointer to scancode blocks
       
   478 			}
       
   479 		},
       
   480 	convSubTable_capsLock=
       
   481 		{
       
   482 		&convKeyCodes_capsLock[0],
       
   483 			{
       
   484 			ARRAY_LENGTH(scanCodeBlock_capsLock),
       
   485 			&scanCodeBlock_capsLock[0]
       
   486 			}
       
   487 		},
       
   488 	convSubTable_shift=
       
   489 		{
       
   490 		&convKeyCodes_shift[0],
       
   491 			{
       
   492 			ARRAY_LENGTH(scanCodeBlock_shift),
       
   493 			&scanCodeBlock_shift[0]
       
   494 			}
       
   495 		},
       
   496 	convSubTable_func=
       
   497 		{
       
   498 		&convKeyCodes_func[0],
       
   499 			{
       
   500 			ARRAY_LENGTH(scanCodeBlock_func),
       
   501 			&scanCodeBlock_func[0]
       
   502 			}
       
   503 		},
       
   504 //	convSubTable_funcUnshifted=
       
   505 //		{
       
   506 //		&convKeyCodes_funcUnshifted[0],
       
   507 //			{
       
   508 //			ARRAY_LENGTH(scanCodeBlock_funcUnshifted),
       
   509 //			&scanCodeBlock_funcUnshifted[0]
       
   510 //			}
       
   511 //		},
       
   512 //	convSubTable_funcShifted=
       
   513 //		{
       
   514 //		&convKeyCodes_funcShifted[0],
       
   515 //			{
       
   516 //			ARRAY_LENGTH(scanCodeBlock_funcShifted),
       
   517 //			&scanCodeBlock_funcShifted[0]
       
   518 //			}
       
   519 //		},
       
   520 	convSubTable_ctrl=
       
   521 		{
       
   522 		&convKeyCodes_ctrl[0],
       
   523 			{
       
   524 			ARRAY_LENGTH(scanCodeBlock_ctrl),
       
   525 			&scanCodeBlock_ctrl[0]
       
   526 			}
       
   527 		};
       
   528 
       
   529 //
       
   530 // TO DO: (optional)
       
   531 //
       
   532 // We need to declare arrays of SConvSubTable for each modifier state we
       
   533 // are going to handle. As mentioned above, it is possible to have several
       
   534 // [keycode table, scancode blocks] groups scanned for each keyboard state.
       
   535 //
       
   536 // Some modifier states use more than one conversion group. The simple example
       
   537 // is handling of caps-lock and shift. 
       
   538 //
       
   539 // Caps-lock means all letters are upper-case
       
   540 // shift means all letters are upper case AND some other keys return control characters
       
   541 //
       
   542 // Obviously the shift key means everything cpas-lock means PLUS a bit more. So
       
   543 // we define two tables, the caps-lock table defines only the uppercase conversion,
       
   544 // and the shift table defines all OTHER shifted keys not already handled by
       
   545 // caps-lock. The caps-lock modifier state then only scans the caps-lock table, and
       
   546 // the shift state scans both tables.
       
   547 //
       
   548 LOCAL_D const SConvSubTable
       
   549 	* const convSubTableArray_unmodifiable[]={&convSubTable_unmodifiable},
       
   550 	* const convSubTableArray_base[]={&convSubTable_base},
       
   551 
       
   552 	//
       
   553 	// The caps-lock state scans only the caps-lock table, to handle
       
   554 	// conversion to upper case
       
   555 	//
       
   556 	* const convSubTableArray_capsLock[]={&convSubTable_capsLock},
       
   557 	//
       
   558 	// The shift table scans the caps-lock table to handle upper case, 
       
   559 	// and also the shift table which handles some keys that are not affected
       
   560 	// by caps lock (such as 0-9).
       
   561 	//
       
   562 	* const convSubTableArray_shift[]={&convSubTable_capsLock, &convSubTable_shift},
       
   563 	//
       
   564 	// Pressing shift with caps-lock active reverts to lower-case letters,
       
   565 	// but other keys remain shifted. This time we only scan the shift table
       
   566 	// so only the non-alpha keys will be shifted
       
   567 	//
       
   568 	* const convSubTableArray_capsLockShift[]={&convSubTable_shift},
       
   569 
       
   570 	//
       
   571 	// Like the shift/caps-lock situation, the function key has two states,
       
   572 	// shifted and unshifted. Also, some keys may be independant of whether
       
   573 	// the shift key is pressed. So there are three tables defined. One declares
       
   574 	// all keys that are independant of shift state, the other two tables handle
       
   575 	// shifted and unshifted func.
       
   576 	//
       
   577 	// Unshifted func uses the independant set + funcUnshifted
       
   578 	//
       
   579 	//	* const convSubTableArray_func[]={&convSubTable_func, &convSubTable_funcUnshifted},
       
   580 	* const convSubTableArray_func[]={&convSubTable_func},
       
   581 	//
       
   582 	// Shifted func uses the independant set + funcShifted
       
   583 	//
       
   584 	//	* const convSubTableArray_funcShift[]={&convSubTable_func,&convSubTable_funcShifted},
       
   585 	//
       
   586 	// This keyboard table makes control independant of func and shift
       
   587 	//
       
   588 	* const convSubTableArray_ctrl[]={&convSubTable_ctrl};
       
   589 
       
   590 //
       
   591 // TO DO: (optional)
       
   592 //
       
   593 // This is the top of the scancode conversion tree. It is a set of pointers
       
   594 // to the SConvSubTable arrays declared above.
       
   595 //
       
   596 // The order of these nodes is VITAL, as the scanCode/modifiers are
       
   597 // searched for a match in this order
       
   598 //
       
   599 // The modifier state is matched by using a mask and a compare value. This is
       
   600 // used as follows:
       
   601 //
       
   602 //	match is true if ( (modifierState & mask) == compareValue
       
   603 //
       
   604 // For example, if the mask is (EModifierFunc|EModifierShift) and the
       
   605 // compare value is EModifierFunc, this will match ANY combination of
       
   606 // modifiers that has func pressed and shift not pressed
       
   607 //
       
   608 LOCAL_D const SConvTableNode convTableNodes[]=
       
   609 	{
       
   610 		{
       
   611 			{
       
   612 			0,		// modifier mask = no modifiers
       
   613 			0		// modifier compare = no modifiers
       
   614 			},
       
   615 		ARRAY_LENGTH(convSubTableArray_unmodifiable),	// number of SConvSubTables
       
   616 		&convSubTableArray_unmodifiable[0]				// pointer to SConvSubTable array
       
   617 		},
       
   618 		{
       
   619 			{
       
   620 			EModifierCtrl,	// modifier mask = check for ctrl
       
   621 			EModifierCtrl	// modifier compare = anything with ctrl pressed
       
   622 			},
       
   623 		ARRAY_LENGTH(convSubTableArray_ctrl),
       
   624 		&convSubTableArray_ctrl[0]
       
   625 		},
       
   626 		{
       
   627 			{
       
   628 			//
       
   629 			// Check for Func pressed
       
   630 			//
       
   631 			EModifierFunc,
       
   632 			EModifierFunc
       
   633 			},
       
   634 		ARRAY_LENGTH(convSubTableArray_func),
       
   635 		&convSubTableArray_func[0]
       
   636 		},
       
   637 		{
       
   638 			{
       
   639 			//
       
   640 			// Check for caps-lock pressed, shift not pressed
       
   641 			//
       
   642 			EModifierCapsLock|EModifierShift,
       
   643 			EModifierCapsLock
       
   644 			},
       
   645 		ARRAY_LENGTH(convSubTableArray_capsLock),
       
   646 		&convSubTableArray_capsLock[0]
       
   647 		},
       
   648 		{
       
   649 			{
       
   650 			//
       
   651 			// Check for caps-lock not pressed, shift pressed
       
   652 			//
       
   653 			EModifierShift|EModifierCapsLock,
       
   654 			EModifierShift
       
   655 			},
       
   656 		ARRAY_LENGTH(convSubTableArray_shift),
       
   657 		&convSubTableArray_shift[0]
       
   658 		},
       
   659 		{
       
   660 			{
       
   661 			//
       
   662 			// Check for caps-lock pressed, shift pressed
       
   663 			//
       
   664 			EModifierCapsLock|EModifierShift,
       
   665 			EModifierCapsLock|EModifierShift
       
   666 			},
       
   667 		ARRAY_LENGTH(convSubTableArray_capsLockShift),
       
   668 		&convSubTableArray_capsLockShift[0]
       
   669 		},
       
   670 		{
       
   671 		//
       
   672 		// This is the base table. It must appear last so that it can
       
   673 		// provide a default conversion for any scancodes that are not
       
   674 		// handled by any of the tables above
       
   675 		//
       
   676 			{
       
   677 			0,
       
   678 			0
       
   679 			},
       
   680 		ARRAY_LENGTH(convSubTableArray_base),
       
   681 		&convSubTableArray_base[0]
       
   682 		}
       
   683 	};
       
   684 
       
   685 //
       
   686 // The top-level exported data structure of all the conversion tables
       
   687 // This just points to the SConvTableNodes above
       
   688 //
       
   689 LOCAL_D const SConvTable ConvTable=
       
   690 	{
       
   691 	ARRAY_LENGTH(convTableNodes),
       
   692 	&convTableNodes[0]
       
   693 	};
       
   694 
       
   695 // The list of scan-codes on the numeric keypad
       
   696 LOCAL_D const SScanCodeBlock keypadScanCodeBlockArray[]=
       
   697 	{
       
   698 	{EStdKeyNumLock, EStdKeyNumLock},
       
   699 	{EStdKeyNkpForwardSlash, EStdKeyNkpFullStop}
       
   700 	};
       
   701 
       
   702 LOCAL_D const SScanCodeBlockList ConvTableKeypadScanCodes=
       
   703 	{
       
   704 	ARRAY_LENGTH(keypadScanCodeBlockArray),
       
   705 	&keypadScanCodeBlockArray[0]
       
   706 	};
       
   707 
       
   708 //
       
   709 // TO DO: (optional)
       
   710 //
       
   711 // List of keycodes that do not autorepeat
       
   712 //
       
   713 // These are usually control keys like shift, ctrl, escape
       
   714 //
       
   715 LOCAL_D const TUint16 nonAutorepKeyCodeArray[]=
       
   716 	{
       
   717 	EKeyEscape,
       
   718 	EKeyPrintScreen,
       
   719 	EKeyPause,
       
   720 	EKeyInsert,
       
   721 	EKeyLeftShift,
       
   722 	EKeyRightShift,
       
   723 	EKeyLeftAlt,
       
   724 	EKeyRightAlt,
       
   725 	EKeyLeftCtrl,
       
   726 	EKeyRightCtrl,
       
   727 	EKeyLeftFunc,
       
   728 	EKeyRightFunc,
       
   729 	EKeyCapsLock,
       
   730 	EKeyNumLock,
       
   731 	EKeyScrollLock,
       
   732 	EKeyMenu,
       
   733 	EKeyDictaphonePlay,
       
   734 	EKeyDictaphoneStop,
       
   735 	EKeyDictaphoneRecord
       
   736 	};
       
   737 
       
   738 //
       
   739 // TO DO: (optional)
       
   740 //
       
   741 // Declare blocks of non-autorepeating keycodes
       
   742 //
       
   743 LOCAL_D const SKeyCodeList ConvTableNonAutorepKeyCodes=
       
   744 	{
       
   745 	ARRAY_LENGTH(nonAutorepKeyCodeArray),	// number of keycode arrays
       
   746 	&nonAutorepKeyCodeArray[0]				// pointer to arrays
       
   747 	};
       
   748 
       
   749 
       
   750 
       
   751 
       
   752 
       
   753 
       
   754 /////////////////////////////////////////////////////////////////////
       
   755 // Keyboard state tables
       
   756 //
       
   757 
       
   758 // What these tables do
       
   759 // --------------------
       
   760 //
       
   761 // These tables control the way "special" keystrokes modify the behaviour
       
   762 // of the keyboard. There are two major uses for this:
       
   763 //
       
   764 //	- handling modifier keys e.g. caps-lock, shift, alt, fn and defining
       
   765 //		what modifier flags are affected by these keypresses
       
   766 //
       
   767 //	- switching the keyboard into special states (see below)
       
   768 //
       
   769 // Keyboard states
       
   770 // ---------------
       
   771 // 
       
   772 // Keyboard states are used to switch the keyboard into a special mode where it
       
   773 // can be used to enter unusual characters. There are two uses for this:
       
   774 //
       
   775 // - entering numeric codes, by pressing ctrl and typing the decimal code
       
   776 // - entering accented characters by pressing a key combination which
       
   777 //		enters "accented mode" then pressing a key. There can be multiple
       
   778 //		accented modes.
       
   779 //
       
   780 // You can see an example of accented modes on a Psion Series 5 by
       
   781 // pressing Fn+Z, followed by A - this will produce an a with an umlaut (ä)
       
   782 //
       
   783 // These tables are also used to select simpler states such as caps-lock
       
   784 // and num-lock.
       
   785 //
       
   786 //
       
   787 // The main data structure is a SFuncTableEntry. Each of these contains
       
   788 // three fields:
       
   789 //
       
   790 // 1. modifier match - this works the same way as the scancode conversion
       
   791 //     tables above, there is a mask and a compare value
       
   792 //
       
   793 // 2. a keycode patters - this is used to match with the keycode or keycodes
       
   794 //     that the state should respond to. This is a TKeyCodePattern structure
       
   795 //     which defines what sort of match should be performed.
       
   796 //
       
   797 // 3. a function and state change structure, SFuncAndState. This defines the
       
   798 //     state to change to, the function to perform, and a parameter for the
       
   799 //     function if required.
       
   800 //
       
   801 // TKeyCodePattern structures have two fields. The first is a keycode value
       
   802 // and is only used for some match types. The second field select the type
       
   803 // of match to perform:
       
   804 //
       
   805 //	EAnyKey - match any key
       
   806 //	EAnyAlphaNumeric - match any alpha or numeric key
       
   807 //	EAnyAlpha - match any alpha key
       
   808 //	EAnyAlphaLowerCase - match any lower-case key
       
   809 //	EAnyAlphaUpperCase - match any upper-case key
       
   810 //	EAnyDecimalDigit - match any decimal digit
       
   811 //	EAnyModifierKey - match any modifier key (e.g. alt, fn, ctrl)
       
   812 //	EMatchKey - match if equal to keycode value in first field
       
   813 //	EMatchLeftOrRight - match if equal to keycode value or (keycode value + 1)
       
   814 //	EMatchKeyCaseInsens - like EMatchKey but perform case-insensitive comparison
       
   815 //
       
   816 //
       
   817 
       
   818 // the "array" parameter must be a true array and not a pointer
       
   819 #define ARRAY_LENGTH(array) (sizeof(array)/sizeof(array[0]))
       
   820 
       
   821 #define TABLE_ENTRY_ANOTHER_CTRL_DIGIT					\
       
   822 	{  													\
       
   823 		{												\
       
   824 		EModifierKeyUp|EModifierFunc,					\
       
   825 		0												\
       
   826 		},												\
       
   827 		{												\
       
   828 		EKeyNull,										\
       
   829 		EAnyDigitGivenRadix								\
       
   830 		},												\
       
   831 		{												\
       
   832 		EStateCtrlDigits,								\
       
   833 		EAddOnCtrlDigit,								\
       
   834 		0												\
       
   835 		}												\
       
   836 	}
       
   837 
       
   838 //
       
   839 // TO DO: (optional)
       
   840 //
       
   841 // This table is searched for a match if a match has not been
       
   842 // found in the current state's table
       
   843 //
       
   844 
       
   845 LOCAL_D const SFuncTableEntry defaultTable[]=
       
   846 	{
       
   847 		{ 
       
   848 		//
       
   849 		// prevent key up events generating keycodes
       
   850 		//
       
   851 			{
       
   852 			EModifierKeyUp,		// mask = key up
       
   853 			EModifierKeyUp		// match = key up - i.e. accept any key up event
       
   854 			},
       
   855 			{
       
   856 			EKeyNull,			// dummy value, not used
       
   857 			EAnyKey				// accept any key
       
   858 			},
       
   859 			{
       
   860 			EStateUnchanged,	// state will not change
       
   861 			EDoNothing,			// no action to perform
       
   862 			0
       
   863 			}
       
   864 		},
       
   865 		{ 
       
   866 		//
       
   867 		// prevent any modifier key (e.g. shift, ctrl) from changing state
       
   868 		//
       
   869 			{
       
   870 			0,					// match any modifier state
       
   871 			0
       
   872 			},
       
   873 			{
       
   874 			EKeyNull,			// dummy value
       
   875 			EAnyModifierKey		// match any modifier key
       
   876 			},
       
   877 			{
       
   878 			EStateUnchanged,	// don't change state
       
   879 			EDoNothing,			// nothing to do
       
   880 			0
       
   881 			}
       
   882 		},
       
   883 		{ 
       
   884 		//
       
   885 		// filter out any unprocessed codes
       
   886 		//
       
   887 			{
       
   888 			0,					// match any modifier state
       
   889 			0
       
   890 			},
       
   891 			{
       
   892 			EKeyNull,			// dummy value
       
   893 			EAnyKey				// match any key
       
   894 			},
       
   895 			{
       
   896 			EStateNormal,		// switch back to normal keyboard state
       
   897 			EDoNothing,			// nothing to do
       
   898 			0
       
   899 			}
       
   900 		}
       
   901 	};
       
   902 
       
   903 //
       
   904 // TO DO: (optional)
       
   905 //
       
   906 // This table controls which keys change which modifiers;
       
   907 // NOTE: the state field in this table is ignored
       
   908 //
       
   909 
       
   910 LOCAL_D const SFuncTableEntry modifierTable[]=
       
   911 	{
       
   912 		{
       
   913 			{
       
   914 			EModifierKeyUp,		// check key-up modifier flag
       
   915 			0					// make sure it's zero (i.e. ignore key-up events)
       
   916 			},
       
   917 			{
       
   918 			//
       
   919 			// Here we want to match only the caps-lock key. We specify the
       
   920 			// keycode we are looking for in the first field, and EMatchKey
       
   921 			// in the second field
       
   922 			//
       
   923 			EKeyCapsLock,		// we want to respond to caps-lock key
       
   924 			EMatchKey			// match caps-lock only
       
   925 			},
       
   926 			{
       
   927 			EStateUnchanged,	// ignored
       
   928 			EToggleModifier,	// function = toggle modifier state
       
   929 			EModifierCapsLock	// this is the modifier to toggle
       
   930 			}
       
   931 		},
       
   932 		{
       
   933 			{
       
   934 			EModifierKeyUp,
       
   935 			0
       
   936 			},
       
   937 			{
       
   938 			EKeyNumLock,		// this one matched num-lock
       
   939 			EMatchKey			// match only num-lock
       
   940 			},
       
   941 			{
       
   942 			EStateUnchanged,	// ignored
       
   943 			EToggleModifier,	// function = toggle modifier state
       
   944 			EModifierNumLock	// this is the modifier to toggle
       
   945 			}
       
   946 		},
       
   947 		{
       
   948 			{
       
   949 			EModifierKeyUp,
       
   950 			0
       
   951 			},
       
   952 			{
       
   953 			EKeyScrollLock,		// match scroll-lock key
       
   954 			EMatchKey
       
   955 			},
       
   956 			{
       
   957 			EStateUnchanged,
       
   958 			EToggleModifier,	// function = toggle modifier
       
   959 			EModifierScrollLock	// modifier to toggle
       
   960 			}
       
   961 		},
       
   962 		{
       
   963 			{
       
   964 			EModifierKeyUp,
       
   965 			0
       
   966 			},
       
   967 			{
       
   968 			EKeyLeftAlt,		// match left alt key
       
   969 			EMatchKey
       
   970 			},
       
   971 			{
       
   972 			EStateUnchanged,	// ignored
       
   973 			ETurnOnModifier,	// function = turn on a modifier
       
   974 			EModifierAlt|EModifierLeftAlt	// alt turns on this modifier combination
       
   975 			}
       
   976 		},
       
   977 		{
       
   978 			{
       
   979 			EModifierKeyUp,		// goes with previous table, this handles the alt
       
   980 			EModifierKeyUp		// key being released
       
   981 			},
       
   982 			{
       
   983 			EKeyLeftAlt,		// match left alt key again
       
   984 			EMatchKey
       
   985 			},
       
   986 			{
       
   987 			EStateUnchanged,
       
   988 			ETurnOffModifier,	// function = turn off the modifier
       
   989 			EModifierLeftAlt	// modifier to turn off
       
   990 			}
       
   991 		},
       
   992 		{
       
   993 			{
       
   994 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
   995 			0
       
   996 			},
       
   997 			{
       
   998 			EKeyLeftFunc,		// match left fn key
       
   999 			EMatchKey
       
  1000 			},
       
  1001 			{
       
  1002 			EStateUnchanged,	// ignored
       
  1003 			ETurnOnModifier,	// function = turn on modifier
       
  1004 			EModifierFunc|EModifierLeftFunc	// modifier combination to turn on
       
  1005 			}
       
  1006 		},
       
  1007 		{
       
  1008 			{
       
  1009 			EModifierKeyUp,		// goes with above table, this matched the
       
  1010 			EModifierKeyUp		// left-fn key up event
       
  1011 			},
       
  1012 			{
       
  1013 			EKeyLeftFunc,		// match left fn key
       
  1014 			EMatchKey
       
  1015 			},
       
  1016 			{
       
  1017 			EStateUnchanged,	// ignored
       
  1018 			ETurnOffModifier,	// function = turn off modifier
       
  1019 			EModifierLeftFunc	// modifier to turn off
       
  1020 			}
       
  1021 		},
       
  1022 		{
       
  1023 			{
       
  1024 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
  1025 			0
       
  1026 			},
       
  1027 			{
       
  1028 			EKeyLeftShift,		// match left shift key
       
  1029 			EMatchKey
       
  1030 			},
       
  1031 			{
       
  1032 			EStateUnchanged,	// ignored
       
  1033 			ETurnOnModifier,	// function = turn on modifier
       
  1034 			EModifierShift|EModifierLeftShift	// modifier combination to turn on
       
  1035 			}
       
  1036 		},
       
  1037 		{
       
  1038 			{
       
  1039 			EModifierKeyUp,		// goes with above table, matches left shift
       
  1040 			EModifierKeyUp		// key up event
       
  1041 			},
       
  1042 			{
       
  1043 			EKeyLeftShift,		// match left shift key
       
  1044 			EMatchKey
       
  1045 			},
       
  1046 			{
       
  1047 			EStateUnchanged,	// ignored
       
  1048 			ETurnOffModifier,	// turn off modifier
       
  1049 			EModifierLeftShift	// modifier to turn off
       
  1050 			}
       
  1051 		},
       
  1052 		{
       
  1053 			{
       
  1054 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
  1055 			0
       
  1056 			},
       
  1057 			{
       
  1058 			EKeyLeftCtrl,		// match left ctrl key
       
  1059 			EMatchKey
       
  1060 			},
       
  1061 			{
       
  1062 			EStateUnchanged,	// ignored
       
  1063 			ETurnOnModifier,	// function = turn on modifier
       
  1064 			EModifierCtrl|EModifierLeftCtrl	// modifier combination to turn on
       
  1065 			}
       
  1066 		},
       
  1067 		{
       
  1068 			{
       
  1069 			EModifierKeyUp,		// goes with above table, matches left ctrl
       
  1070 			EModifierKeyUp		// key up event
       
  1071 			},
       
  1072 			{
       
  1073 			EKeyLeftCtrl,		// match left ctrl key
       
  1074 			EMatchKey
       
  1075 			},
       
  1076 			{
       
  1077 			EStateUnchanged,	// ignored
       
  1078 			ETurnOffModifier,	// function = turn off modifier
       
  1079 			EModifierLeftCtrl	// modifier to turn off
       
  1080 			}
       
  1081 		},
       
  1082 		{
       
  1083 			{
       
  1084 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
  1085 			0
       
  1086 			},
       
  1087 			{
       
  1088 			EKeyRightAlt,		// match right alt key
       
  1089 			EMatchKey
       
  1090 			},
       
  1091 			{
       
  1092 			EStateUnchanged,	// ignored
       
  1093 			ETurnOnModifier,	// function = turn on modifier
       
  1094 			EModifierAlt|EModifierRightAlt	// modifier combination to turn on
       
  1095 			}
       
  1096 		},
       
  1097 		{
       
  1098 			{
       
  1099 			EModifierKeyUp,		// goes with above table, matches right alt
       
  1100 			EModifierKeyUp		// key up event
       
  1101 			},
       
  1102 			{
       
  1103 			EKeyRightAlt,		// match right alt key
       
  1104 			EMatchKey
       
  1105 			},
       
  1106 			{
       
  1107 			EStateUnchanged,	// ignored
       
  1108 			ETurnOffModifier,	// function = turn off modifier
       
  1109 			EModifierRightAlt	// modifier to turn off
       
  1110 			}
       
  1111 		},
       
  1112 		{
       
  1113 			{
       
  1114 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
  1115 			0
       
  1116 			},
       
  1117 			{
       
  1118 			EKeyRightFunc,		// match right fn key
       
  1119 			EMatchKey
       
  1120 			},
       
  1121 			{
       
  1122 			EStateUnchanged,	// ignored
       
  1123 			ETurnOnModifier,	// function = turn on modifier
       
  1124 			EModifierFunc|EModifierRightFunc	// modifier combination to turn on
       
  1125 			}
       
  1126 		},
       
  1127 		{
       
  1128 			{
       
  1129 			EModifierKeyUp,		// goes with above table, matches right fn
       
  1130 			EModifierKeyUp		// key up event
       
  1131 			},
       
  1132 			{
       
  1133 			EKeyRightFunc,		// match right fn key
       
  1134 			EMatchKey
       
  1135 			},
       
  1136 			{
       
  1137 			EStateUnchanged,	// ignored
       
  1138 			ETurnOffModifier,	// function = turn off modifier
       
  1139 			EModifierRightFunc	// modifier to turn off
       
  1140 			}
       
  1141 		},
       
  1142 		{
       
  1143 			{
       
  1144 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
  1145 			0
       
  1146 			},
       
  1147 			{
       
  1148 			EKeyRightShift,		// match right shift key
       
  1149 			EMatchKey
       
  1150 			},
       
  1151 			{
       
  1152 			EStateUnchanged,	// ignored
       
  1153 			ETurnOnModifier,	// function = turn on modifier
       
  1154 			EModifierShift|EModifierRightShift	// modifier combinatoin to turn on
       
  1155 			}
       
  1156 		},
       
  1157 		{
       
  1158 			{
       
  1159 			EModifierKeyUp,		// goes with above table, handles right shift
       
  1160 			EModifierKeyUp		// key up event
       
  1161 			},
       
  1162 			{
       
  1163 			EKeyRightShift,		// match right shift key
       
  1164 			EMatchKey
       
  1165 			},
       
  1166 			{
       
  1167 			EStateUnchanged,	// ignored
       
  1168 			ETurnOffModifier,	// function = turn off modifier
       
  1169 			EModifierRightShift	// modifier to turn off
       
  1170 			}
       
  1171 		},
       
  1172 		{
       
  1173 			{
       
  1174 			EModifierKeyUp,		// key down event (key-up flag == 0)
       
  1175 			0
       
  1176 			},
       
  1177 			{
       
  1178 			EKeyRightCtrl,		// match right ctrl key
       
  1179 			EMatchKey
       
  1180 			},
       
  1181 			{
       
  1182 			EStateUnchanged,	// ignored
       
  1183 			ETurnOnModifier,	// function = turn on modifier
       
  1184 			EModifierCtrl|EModifierRightCtrl	// modifier combination to turn on
       
  1185 			}
       
  1186 		},
       
  1187 		{
       
  1188 			{
       
  1189 			EModifierKeyUp,		// goes with above table, matched right ctrl
       
  1190 			EModifierKeyUp		// key up event
       
  1191 			},
       
  1192 			{
       
  1193 			EKeyRightCtrl,		// match right ctrl key
       
  1194 			EMatchKey
       
  1195 			},
       
  1196 			{
       
  1197 			EStateUnchanged,	// ignored
       
  1198 			ETurnOffModifier,	// function = turn off modifier
       
  1199 			EModifierRightCtrl	// modifier to turn off
       
  1200 			}
       
  1201 		}
       
  1202 	};
       
  1203 
       
  1204 
       
  1205 //
       
  1206 // TO DO: (optional)
       
  1207 //
       
  1208 // Tables corresponding to keyboard states.
       
  1209 //
       
  1210 // There are 13 keyboard states. States 0 to 9 can be used to create alternative
       
  1211 // keyboard layouts for entering accented or unusual characters. Switching into
       
  1212 // these states is done by a keypress. Implementation of the states is optional
       
  1213 // depending on how many special state you want - you may implement 10 states,
       
  1214 // you might decide not to implement any.
       
  1215 //
       
  1216 // State 10 is the normal state. The table for state 10 defines which keypresses
       
  1217 // change to other states.
       
  1218 //
       
  1219 // States 11 and 12 are used when entering the numeric code of a character. State
       
  1220 // 11 is for entering a specific number of digits. State 12 is for accepting
       
  1221 // digits until Ctrl is released.
       
  1222 //	
       
  1223 //
       
  1224 // As before, each SFuncTableEntry entry defines:
       
  1225 //	- modifier conditions that must be matched
       
  1226 //	- a keycode match pattern (typically an exact key match)
       
  1227 //	- the function to perform and new state
       
  1228 //
       
  1229 // Switching into states 0..9,11,12 is done by entries in table10
       
  1230 //
       
  1231 
       
  1232 //LOCAL_D const SFuncTableEntry table0[]=
       
  1233 //	{
       
  1234 //	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1235 //	};
       
  1236 
       
  1237 LOCAL_D const SFuncTableEntry table1[]=
       
  1238 	{
       
  1239 	//
       
  1240 	// Table for special keyboard state 1
       
  1241 	// This state is entered by pressing Fn+q (see table10)
       
  1242 	//
       
  1243 	// The table makes certain keys return accented characters
       
  1244 	//
       
  1245 		{
       
  1246 			{
       
  1247 			//
       
  1248 			// Function must be release, and this must be a key down event
       
  1249 			//
       
  1250 			EModifierFunc|EModifierKeyUp,
       
  1251 			0
       
  1252 			},
       
  1253 			{
       
  1254 			//
       
  1255 			// match an 'e' keypress, convert to an ae ligature (æ)
       
  1256 			//
       
  1257 			'e',
       
  1258 			EMatchKeyCaseInsens
       
  1259 			},
       
  1260 			{
       
  1261 			EStateNormal,			// switch back to state normal (table10)
       
  1262 			EPassSpecialKeyThru,	// turn keypress into a special character
       
  1263 			ELatin1LcAe				// this is the character to pass on
       
  1264 			}
       
  1265 		},
       
  1266 		{
       
  1267 			{
       
  1268 			EModifierFunc|EModifierKeyUp,
       
  1269 			0
       
  1270 			},
       
  1271 			{
       
  1272 			'c',
       
  1273 			EMatchKeyCaseInsens
       
  1274 			},
       
  1275 			{
       
  1276 			EStateNormal,
       
  1277 			EPassSpecialKeyThru,
       
  1278 			ELatin1LcCcedilla
       
  1279 			}
       
  1280 		},
       
  1281 		{
       
  1282 			{
       
  1283 			EModifierFunc|EModifierKeyUp,
       
  1284 			0
       
  1285 			},
       
  1286 			{
       
  1287 			's',
       
  1288 			EMatchKeyCaseInsens
       
  1289 			},
       
  1290 			{
       
  1291 			EStateNormal,
       
  1292 			EPassSpecialKeyThru,
       
  1293 			ELatin1EsTset
       
  1294 			}
       
  1295 		},
       
  1296 		{
       
  1297 			{
       
  1298 			EModifierFunc|EModifierKeyUp,
       
  1299 			0
       
  1300 			},
       
  1301 			{
       
  1302 			'o',
       
  1303 			EMatchKeyCaseInsens
       
  1304 			},
       
  1305 			{
       
  1306 			EStateNormal,
       
  1307 			EPassSpecialKeyThru,
       
  1308 			ELatin1LcOslash
       
  1309 			}
       
  1310 		},
       
  1311 		{
       
  1312 			{
       
  1313 			EModifierFunc|EModifierKeyUp,
       
  1314 			0
       
  1315 			},
       
  1316 			{
       
  1317 			'd',
       
  1318 			EMatchKeyCaseInsens
       
  1319 			},
       
  1320 			{
       
  1321 			EStateNormal,
       
  1322 			EPassSpecialKeyThru,
       
  1323 			ELatin1LcThorn
       
  1324 			}
       
  1325 		},
       
  1326 		{
       
  1327 			{
       
  1328 			EModifierFunc|EModifierKeyUp,
       
  1329 			0
       
  1330 			},
       
  1331 			{
       
  1332 			't',
       
  1333 			EMatchKeyCaseInsens
       
  1334 			},
       
  1335 			{
       
  1336 			EStateNormal,
       
  1337 			EPassSpecialKeyThru,
       
  1338 			ELatin1LcSoftTh
       
  1339 			}
       
  1340 		},
       
  1341 		{
       
  1342 			{
       
  1343 			EModifierFunc|EModifierKeyUp,
       
  1344 			0
       
  1345 			},
       
  1346 			{
       
  1347 			'l',
       
  1348 			EMatchKeyCaseInsens
       
  1349 			},
       
  1350 			{
       
  1351 			EStateNormal,
       
  1352 			EPassSpecialKeyThru,
       
  1353 			ELatin1LeftChevron
       
  1354 			}
       
  1355 		},
       
  1356 		{
       
  1357 			{
       
  1358 			EModifierFunc|EModifierKeyUp,
       
  1359 			0
       
  1360 			},
       
  1361 			{
       
  1362 			'r',
       
  1363 			EMatchKeyCaseInsens
       
  1364 			},
       
  1365 			{
       
  1366 			EStateNormal,
       
  1367 			EPassSpecialKeyThru,
       
  1368 			ELatin1RightChevron
       
  1369 			}
       
  1370 		},
       
  1371 		{
       
  1372 			{
       
  1373 			EModifierFunc|EModifierKeyUp,
       
  1374 			0
       
  1375 			},
       
  1376 			{
       
  1377 			'x',
       
  1378 			EMatchKeyCaseInsens
       
  1379 			},
       
  1380 			{
       
  1381 			EStateNormal,
       
  1382 			EPassSpecialKeyThru,
       
  1383 			ELatin1InvExclam
       
  1384 			}
       
  1385 		},
       
  1386 		{
       
  1387 			{
       
  1388 			EModifierFunc|EModifierKeyUp,
       
  1389 			0
       
  1390 			},
       
  1391 			{
       
  1392 			'q',
       
  1393 			EMatchKeyCaseInsens
       
  1394 			},
       
  1395 			{
       
  1396 			EStateNormal,
       
  1397 			EPassSpecialKeyThru,
       
  1398 			ELatin1InvQuest
       
  1399 			}
       
  1400 		},
       
  1401 		{
       
  1402 			{
       
  1403 			EModifierFunc|EModifierKeyUp,
       
  1404 			0
       
  1405 			},
       
  1406 			{
       
  1407 			'a',
       
  1408 			EMatchKeyCaseInsens
       
  1409 			},
       
  1410 			{
       
  1411 			EStateNormal,
       
  1412 			EPassSpecialKeyThru,
       
  1413 			ELatin1LcAo
       
  1414 			}
       
  1415 		},
       
  1416 		{
       
  1417 			{
       
  1418 			EModifierFunc|EModifierKeyUp,
       
  1419 			0
       
  1420 			},
       
  1421 			{
       
  1422 			'p',
       
  1423 			EMatchKeyCaseInsens
       
  1424 			},
       
  1425 			{
       
  1426 			EStateNormal,
       
  1427 			EPassSpecialKeyThru,
       
  1428 			ELatin1Pound
       
  1429 			}
       
  1430 		},
       
  1431 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1432 	};
       
  1433 
       
  1434 LOCAL_D const SFuncTableEntry table2[]=
       
  1435 	{
       
  1436 	//
       
  1437 	// Table for special keyboard state 2
       
  1438 	// This state is entered by pressing Fn+z (see table10)
       
  1439 	//
       
  1440 	// The table makes certain keys return accented characters
       
  1441 	// See table1 for an explanation of the contents
       
  1442 	//
       
  1443 		{
       
  1444 			{
       
  1445 			EModifierFunc|EModifierKeyUp,
       
  1446 			0
       
  1447 			},
       
  1448 			{
       
  1449 			'a',
       
  1450 			EMatchKeyCaseInsens
       
  1451 			},
       
  1452 			{
       
  1453 			EStateNormal,
       
  1454 			EPassSpecialKeyThru,
       
  1455 			ELatin1LcAumlaut
       
  1456 			}
       
  1457 		},
       
  1458 		{
       
  1459 			{
       
  1460 			EModifierFunc|EModifierKeyUp,
       
  1461 			0
       
  1462 			},
       
  1463 			{
       
  1464 			'e',
       
  1465 			EMatchKeyCaseInsens
       
  1466 			},
       
  1467 			{
       
  1468 			EStateNormal,
       
  1469 			EPassSpecialKeyThru,
       
  1470 			ELatin1LcEumlaut
       
  1471 			}
       
  1472 		},
       
  1473 		{
       
  1474 			{
       
  1475 			EModifierFunc|EModifierKeyUp,
       
  1476 			0
       
  1477 			},
       
  1478 			{
       
  1479 			'i',
       
  1480 			EMatchKeyCaseInsens
       
  1481 			},
       
  1482 			{
       
  1483 			EStateNormal,
       
  1484 			EPassSpecialKeyThru,
       
  1485 			ELatin1LcIumlaut
       
  1486 			}
       
  1487 		},
       
  1488 		{
       
  1489 			{
       
  1490 			EModifierFunc|EModifierKeyUp,
       
  1491 			0
       
  1492 			},
       
  1493 			{
       
  1494 			'o',
       
  1495 			EMatchKeyCaseInsens
       
  1496 			},
       
  1497 			{
       
  1498 			EStateNormal,
       
  1499 			EPassSpecialKeyThru,
       
  1500 			ELatin1LcOumlaut
       
  1501 			}
       
  1502 		},
       
  1503 		{
       
  1504 			{
       
  1505 			EModifierFunc|EModifierKeyUp,
       
  1506 			0
       
  1507 			},
       
  1508 			{
       
  1509 			'u',
       
  1510 			EMatchKeyCaseInsens
       
  1511 			},
       
  1512 			{
       
  1513 			EStateNormal,
       
  1514 			EPassSpecialKeyThru,
       
  1515 			ELatin1LcUumlaut
       
  1516 			}
       
  1517 		},
       
  1518 		{
       
  1519 			{
       
  1520 			EModifierFunc|EModifierKeyUp,
       
  1521 			0
       
  1522 			},
       
  1523 			{
       
  1524 			'y',
       
  1525 			EMatchKeyCaseInsens
       
  1526 			},
       
  1527 			{
       
  1528 			EStateNormal,
       
  1529 			EPassSpecialKeyThru,
       
  1530 			ELatin1LcYumlaut
       
  1531 			}
       
  1532 		},
       
  1533 		{
       
  1534 			{
       
  1535 			EModifierFunc|EModifierKeyUp,
       
  1536 			0
       
  1537 			},
       
  1538 			{
       
  1539 			' ',
       
  1540 			EMatchKey
       
  1541 			},
       
  1542 			{
       
  1543 			EStateNormal,
       
  1544 			EPassSpecialKeyThru,
       
  1545 			ELatin1SpaceUmlaut
       
  1546 			}
       
  1547 		},
       
  1548 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1549 	};
       
  1550 
       
  1551 LOCAL_D const SFuncTableEntry table3[]=
       
  1552 	{
       
  1553 	//
       
  1554 	// Table for special keyboard state 3
       
  1555 	// This state is entered by pressing Fn+x (see table10)
       
  1556 	//
       
  1557 	// The table makes certain keys return accented characters
       
  1558 	//
       
  1559 		{
       
  1560 			{
       
  1561 			EModifierFunc|EModifierKeyUp,
       
  1562 			0
       
  1563 			},
       
  1564 			{
       
  1565 			'a',
       
  1566 			EMatchKeyCaseInsens
       
  1567 			},
       
  1568 			{
       
  1569 			EStateNormal,
       
  1570 			EPassSpecialKeyThru,
       
  1571 			ELatin1LcAgrave
       
  1572 			}
       
  1573 		},
       
  1574 		{
       
  1575 			{
       
  1576 			EModifierFunc|EModifierKeyUp,
       
  1577 			0
       
  1578 			},
       
  1579 			{
       
  1580 			'e',
       
  1581 			EMatchKeyCaseInsens
       
  1582 			},
       
  1583 			{
       
  1584 			EStateNormal,
       
  1585 			EPassSpecialKeyThru,
       
  1586 			ELatin1LcEgrave
       
  1587 			}
       
  1588 		},
       
  1589 		{
       
  1590 			{
       
  1591 			EModifierFunc|EModifierKeyUp,
       
  1592 			0
       
  1593 			},
       
  1594 			{
       
  1595 			'i',
       
  1596 			EMatchKeyCaseInsens
       
  1597 			},
       
  1598 			{
       
  1599 			EStateNormal,
       
  1600 			EPassSpecialKeyThru,
       
  1601 			ELatin1LcIgrave
       
  1602 			}
       
  1603 		},
       
  1604 		{
       
  1605 			{
       
  1606 			EModifierFunc|EModifierKeyUp,
       
  1607 			0
       
  1608 			},
       
  1609 			{
       
  1610 			'o',
       
  1611 			EMatchKeyCaseInsens
       
  1612 			},
       
  1613 			{
       
  1614 			EStateNormal,
       
  1615 			EPassSpecialKeyThru,
       
  1616 			ELatin1LcOgrave
       
  1617 			}
       
  1618 		},
       
  1619 		{
       
  1620 			{
       
  1621 			EModifierFunc|EModifierKeyUp,
       
  1622 			0
       
  1623 			},
       
  1624 			{
       
  1625 			'u',
       
  1626 			EMatchKeyCaseInsens
       
  1627 			},
       
  1628 			{
       
  1629 			EStateNormal,
       
  1630 			EPassSpecialKeyThru,
       
  1631 			ELatin1LcUgrave
       
  1632 			}
       
  1633 		},
       
  1634 		{
       
  1635 			{
       
  1636 			EModifierFunc|EModifierKeyUp,
       
  1637 			0
       
  1638 			},
       
  1639 			{
       
  1640 			' ',
       
  1641 			EMatchKey
       
  1642 			},
       
  1643 			{
       
  1644 			EStateNormal,
       
  1645 			EPassSpecialKeyThru,
       
  1646 			ELatin1SpaceGrave
       
  1647 			}
       
  1648 		},
       
  1649 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1650 	};
       
  1651 
       
  1652 LOCAL_D const SFuncTableEntry table4[]=
       
  1653 	{
       
  1654 	//
       
  1655 	// Table for special keyboard state 4
       
  1656 	// This state is entered by pressing Fn+c (see table10)
       
  1657 	//
       
  1658 	// The table makes certain keys return accented characters
       
  1659 	//
       
  1660 		{
       
  1661 			{
       
  1662 			EModifierFunc|EModifierKeyUp,
       
  1663 			0
       
  1664 			},
       
  1665 			{
       
  1666 			'a',
       
  1667 			EMatchKeyCaseInsens
       
  1668 			},
       
  1669 			{
       
  1670 			EStateNormal,
       
  1671 			EPassSpecialKeyThru,
       
  1672 			ELatin1LcAacute
       
  1673 			}
       
  1674 		},
       
  1675 		{
       
  1676 			{
       
  1677 			EModifierFunc|EModifierKeyUp,
       
  1678 			0
       
  1679 			},
       
  1680 			{
       
  1681 			'e',
       
  1682 			EMatchKeyCaseInsens
       
  1683 			},
       
  1684 			{
       
  1685 			EStateNormal,
       
  1686 			EPassSpecialKeyThru,
       
  1687 			ELatin1LcEacute
       
  1688 			}
       
  1689 		},
       
  1690 		{
       
  1691 			{
       
  1692 			EModifierFunc|EModifierKeyUp,
       
  1693 			0
       
  1694 			},
       
  1695 			{
       
  1696 			'i',
       
  1697 			EMatchKeyCaseInsens
       
  1698 			},
       
  1699 			{
       
  1700 			EStateNormal,
       
  1701 			EPassSpecialKeyThru,
       
  1702 			ELatin1LcIacute
       
  1703 			}
       
  1704 		},
       
  1705 		{
       
  1706 			{
       
  1707 			EModifierFunc|EModifierKeyUp,
       
  1708 			0
       
  1709 			},
       
  1710 			{
       
  1711 			'o',
       
  1712 			EMatchKeyCaseInsens
       
  1713 			},
       
  1714 			{
       
  1715 			EStateNormal,
       
  1716 			EPassSpecialKeyThru,
       
  1717 			ELatin1LcOacute
       
  1718 			}
       
  1719 		},
       
  1720 		{
       
  1721 			{
       
  1722 			EModifierFunc|EModifierKeyUp,
       
  1723 			0
       
  1724 			},
       
  1725 			{
       
  1726 			'u',
       
  1727 			EMatchKeyCaseInsens
       
  1728 			},
       
  1729 			{
       
  1730 			EStateNormal,
       
  1731 			EPassSpecialKeyThru,
       
  1732 			ELatin1LcUacute
       
  1733 			}
       
  1734 		},
       
  1735 		{
       
  1736 			{
       
  1737 			EModifierFunc|EModifierKeyUp,
       
  1738 			0
       
  1739 			},
       
  1740 			{
       
  1741 			'y',
       
  1742 			EMatchKeyCaseInsens
       
  1743 			},
       
  1744 			{
       
  1745 			EStateNormal,
       
  1746 			EPassSpecialKeyThru,
       
  1747 			ELatin1LcYacute
       
  1748 			}
       
  1749 		},
       
  1750 		{
       
  1751 			{
       
  1752 			EModifierFunc|EModifierKeyUp,
       
  1753 			0
       
  1754 			},
       
  1755 			{
       
  1756 			' ',
       
  1757 			EMatchKey
       
  1758 			},
       
  1759 			{
       
  1760 			EStateNormal,
       
  1761 			EPassSpecialKeyThru,
       
  1762 			ELatin1LcSpaceAcute
       
  1763 			}
       
  1764 		},
       
  1765 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1766 	};
       
  1767 
       
  1768 LOCAL_D const SFuncTableEntry table5[]=
       
  1769 	{
       
  1770 	//
       
  1771 	// Table for special keyboard state 5
       
  1772 	// This state is entered by pressing Fn+v (see table10)
       
  1773 	//
       
  1774 	// The table makes certain keys return accented characters
       
  1775 	//
       
  1776 		{
       
  1777 			{
       
  1778 			EModifierFunc|EModifierKeyUp,
       
  1779 			0
       
  1780 			},
       
  1781 			{
       
  1782 			'a',
       
  1783 			EMatchKeyCaseInsens
       
  1784 			},
       
  1785 			{
       
  1786 			EStateNormal,
       
  1787 			EPassSpecialKeyThru,
       
  1788 			ELatin1LcAtilde
       
  1789 			}
       
  1790 		},
       
  1791 		{
       
  1792 			{
       
  1793 			EModifierFunc|EModifierKeyUp,
       
  1794 			0
       
  1795 			},
       
  1796 			{
       
  1797 			'n',
       
  1798 			EMatchKeyCaseInsens
       
  1799 			},
       
  1800 			{
       
  1801 			EStateNormal,
       
  1802 			EPassSpecialKeyThru,
       
  1803 			ELatin1LcNtilde
       
  1804 			}
       
  1805 		},
       
  1806 		{
       
  1807 			{
       
  1808 			EModifierFunc|EModifierKeyUp,
       
  1809 			0
       
  1810 			},
       
  1811 			{
       
  1812 			'o',
       
  1813 			EMatchKeyCaseInsens
       
  1814 			},
       
  1815 			{
       
  1816 			EStateNormal,
       
  1817 			EPassSpecialKeyThru,
       
  1818 			ELatin1LcOtilde
       
  1819 			}
       
  1820 		},
       
  1821 		{
       
  1822 			{
       
  1823 			EModifierFunc|EModifierKeyUp,
       
  1824 			0
       
  1825 			},
       
  1826 			{
       
  1827 			' ',
       
  1828 			EMatchKey
       
  1829 			},
       
  1830 			{
       
  1831 			EStateNormal,
       
  1832 			EPassSpecialKeyThru,
       
  1833 			ELatin1LcSpaceTilde
       
  1834 			}
       
  1835 		},
       
  1836 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1837 	};
       
  1838 
       
  1839 LOCAL_D const SFuncTableEntry table6[]=
       
  1840 	{
       
  1841 	//
       
  1842 	// Table for special keyboard state 6
       
  1843 	// This state is entered by pressing Fn+b (see table6)
       
  1844 	//
       
  1845 	// The table makes certain keys return accented characters
       
  1846 	//
       
  1847 		{
       
  1848 			{
       
  1849 			EModifierFunc|EModifierKeyUp,
       
  1850 			0
       
  1851 			},
       
  1852 			{
       
  1853 			'a',
       
  1854 			EMatchKeyCaseInsens
       
  1855 			},
       
  1856 			{
       
  1857 			EStateNormal,
       
  1858 			EPassSpecialKeyThru,
       
  1859 			ELatin1LcAcirc
       
  1860 			}
       
  1861 		},
       
  1862 		{
       
  1863 			{
       
  1864 			EModifierFunc|EModifierKeyUp,
       
  1865 			0
       
  1866 			},
       
  1867 			{
       
  1868 			'e',
       
  1869 			EMatchKeyCaseInsens
       
  1870 			},
       
  1871 			{
       
  1872 			EStateNormal,
       
  1873 			EPassSpecialKeyThru,
       
  1874 			ELatin1LcEcirc
       
  1875 			}
       
  1876 		},
       
  1877 		{
       
  1878 			{
       
  1879 			EModifierFunc|EModifierKeyUp,
       
  1880 			0
       
  1881 			},
       
  1882 			{
       
  1883 			'i',
       
  1884 			EMatchKeyCaseInsens
       
  1885 			},
       
  1886 			{
       
  1887 			EStateNormal,
       
  1888 			EPassSpecialKeyThru,
       
  1889 			ELatin1LcIcirc
       
  1890 			}
       
  1891 		},
       
  1892 		{
       
  1893 			{
       
  1894 			EModifierFunc|EModifierKeyUp,
       
  1895 			0
       
  1896 			},
       
  1897 			{
       
  1898 			'o',
       
  1899 			EMatchKeyCaseInsens
       
  1900 			},
       
  1901 			{
       
  1902 			EStateNormal,
       
  1903 			EPassSpecialKeyThru,
       
  1904 			ELatin1LcOcirc
       
  1905 			}
       
  1906 		},
       
  1907 		{
       
  1908 			{
       
  1909 			EModifierFunc|EModifierKeyUp,
       
  1910 			0
       
  1911 			},
       
  1912 			{
       
  1913 			'u',
       
  1914 			EMatchKeyCaseInsens
       
  1915 			},
       
  1916 			{
       
  1917 			EStateNormal,
       
  1918 			EPassSpecialKeyThru,
       
  1919 			ELatin1LcUcirc
       
  1920 			}
       
  1921 		},
       
  1922 		{
       
  1923 			{
       
  1924 			EModifierFunc|EModifierKeyUp,
       
  1925 			0
       
  1926 			},
       
  1927 			{
       
  1928 			' ',
       
  1929 			EMatchKey
       
  1930 			},
       
  1931 			{
       
  1932 			EStateNormal,
       
  1933 			EPassSpecialKeyThru,
       
  1934 			ELatin1LcSpaceCirc
       
  1935 			}
       
  1936 		},
       
  1937 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1938 	};
       
  1939 
       
  1940 //
       
  1941 // TO DO: (optional)
       
  1942 //
       
  1943 // State 7,8,9 aren't used in this example.
       
  1944 // You can implement them if you want more special states
       
  1945 //
       
  1946 
       
  1947 //LOCAL_D const SFuncTableEntry table7[]=
       
  1948 //	{
       
  1949 //	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1950 //	};
       
  1951 
       
  1952 //LOCAL_D const SFuncTableEntry table8[]=
       
  1953 //	{
       
  1954 //	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1955 //	};
       
  1956 
       
  1957 //LOCAL_D const SFuncTableEntry table9[]=
       
  1958 //	{
       
  1959 //	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  1960 //	};
       
  1961 
       
  1962 
       
  1963 LOCAL_D const SFuncTableEntry table10[]=
       
  1964 	{
       
  1965 	//
       
  1966 	// TO DO: (optional)
       
  1967 	//
       
  1968 	// Table keyboard state 10 - the normal state
       
  1969 	//
       
  1970 	// This table controls which keys switch into the special states
       
  1971 	// 0-9, 11 and 12.
       
  1972 	//
       
  1973 
       
  1974 		{ 
       
  1975 		//
       
  1976 		// Make sure key-up events are ignored by handling them first and
       
  1977 		// doing nothing
       
  1978 		//
       
  1979 			{
       
  1980 			EModifierKeyUp,
       
  1981 			EModifierKeyUp
       
  1982 			},
       
  1983 			{
       
  1984 			EKeyNull,
       
  1985 			EAnyKey
       
  1986 			},
       
  1987 			{
       
  1988 			EStateUnchanged,
       
  1989 			EDoNothing,
       
  1990 			0
       
  1991 			}
       
  1992 		},
       
  1993 		{ 
       
  1994 		//
       
  1995 		// Check for ctrl-number presses
       
  1996 		// This will enter state EStateCtrlDigits (state 12) which allows
       
  1997 		// entry of a numeric keycode
       
  1998 		//
       
  1999 			{
       
  2000 			EModifierCtrl|EModifierFunc|EModifierKeyUp,
       
  2001 			EModifierCtrl
       
  2002 			},
       
  2003 			{
       
  2004 			EKeyNull,
       
  2005 			EAnyDecimalDigit
       
  2006 			},
       
  2007 			{
       
  2008 			EStateDerivedFromDigitEntered,
       
  2009 			EAddOnCtrlDigit,
       
  2010 			0
       
  2011 			}
       
  2012 		},
       
  2013 		{
       
  2014 		//
       
  2015 		// Any other key events that have not been trapped are just
       
  2016 		// passed through unchanged
       
  2017 		//
       
  2018 			{
       
  2019 			0,
       
  2020 			0
       
  2021 			},
       
  2022 			{
       
  2023 			EKeyNull,
       
  2024 			EAnyKey
       
  2025 			},
       
  2026 			{
       
  2027 			EStateUnchanged,
       
  2028 			EPassKeyThru,
       
  2029 			0
       
  2030 			}
       
  2031 		}
       
  2032 	};
       
  2033 
       
  2034 //LOCAL_D const SFuncTableEntry table11[]=
       
  2035 //	{
       
  2036 //	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  2037 //	};
       
  2038 
       
  2039 LOCAL_D const SFuncTableEntry table12[]=
       
  2040 	{
       
  2041 	//
       
  2042 	// Table 12 handles entring digit codes. The keyboard will remain in this
       
  2043 	// state until the Ctrl key is released
       
  2044 	//
       
  2045 		{
       
  2046 			{
       
  2047 			//
       
  2048 			// Look for a key up event
       
  2049 			//
       
  2050 			EModifierKeyUp,
       
  2051 			EModifierKeyUp
       
  2052 			},
       
  2053 			{
       
  2054 			// 
       
  2055 			// Match either left or right Ctrl key (i.e. this matches a Ctrl key release)
       
  2056 			//
       
  2057 			EKeyLeftCtrl,
       
  2058 			EMatchLeftOrRight
       
  2059 			},
       
  2060 			{
       
  2061 			EStateNormal,			// return to normal state (table10)
       
  2062 			EPassCtrlDigitsThru,	// and pass through the numeric code we have accumulated
       
  2063 			0
       
  2064 			}
       
  2065 		},
       
  2066 	TABLE_ENTRY_ANOTHER_CTRL_DIGIT
       
  2067 	};
       
  2068 
       
  2069 
       
  2070 //
       
  2071 // TO DO: (optional)
       
  2072 //
       
  2073 // Array of state control tables above. If a state is not used set the array 
       
  2074 // size to zero and the pointer to NULL
       
  2075 //
       
  2076 // The tables must be declared here in order from table 0 to table 12
       
  2077 //
       
  2078 LOCAL_D const SFuncTable genFuncTables[]=
       
  2079 	{
       
  2080 		{
       
  2081 		//
       
  2082 		// state 0
       
  2083 		//
       
  2084 		0,			// state 0 not used, size = 0
       
  2085 		NULL		// state 0 not used, pointer = NULL
       
  2086 		},
       
  2087 		{
       
  2088 		//
       
  2089 		// state 1
       
  2090 		//
       
  2091 		ARRAY_LENGTH(table1),		// size of table 1
       
  2092 		&table1[0]					// pointer to table 1
       
  2093 		},
       
  2094 		{
       
  2095 		//
       
  2096 		// state 2
       
  2097 		//
       
  2098 		ARRAY_LENGTH(table2),
       
  2099 		&table2[0]
       
  2100 		},
       
  2101 		{
       
  2102 		//
       
  2103 		// state 3
       
  2104 		//
       
  2105 		ARRAY_LENGTH(table3),
       
  2106 		&table3[0]
       
  2107 		},
       
  2108 		{
       
  2109 		//
       
  2110 		// state 4
       
  2111 		//
       
  2112 		ARRAY_LENGTH(table4),
       
  2113 		&table4[0]
       
  2114 		},
       
  2115 		{
       
  2116 		//
       
  2117 		// state 5
       
  2118 		//
       
  2119 		ARRAY_LENGTH(table5),
       
  2120 		&table5[0]
       
  2121 		},
       
  2122 		{
       
  2123 		//
       
  2124 		// state 6
       
  2125 		//
       
  2126 		ARRAY_LENGTH(table6),
       
  2127 		&table6[0]
       
  2128 		},
       
  2129 		{
       
  2130 		//
       
  2131 		// state 7
       
  2132 		//
       
  2133 		0,
       
  2134 		NULL
       
  2135 		},
       
  2136 		{
       
  2137 		//
       
  2138 		// state 8
       
  2139 		//
       
  2140 		0,
       
  2141 		NULL
       
  2142 		},
       
  2143 		{
       
  2144 		//
       
  2145 		// state 9
       
  2146 		//
       
  2147 		0,
       
  2148 		NULL
       
  2149 		},
       
  2150 		{
       
  2151 		//
       
  2152 		// state 10
       
  2153 		//
       
  2154 		ARRAY_LENGTH(table10),
       
  2155 		&table10[0]
       
  2156 		},
       
  2157 		{
       
  2158 		//
       
  2159 		// state 11
       
  2160 		//
       
  2161 		0,
       
  2162 		NULL
       
  2163 		},
       
  2164 		{
       
  2165 		//
       
  2166 		// state 12
       
  2167 		//
       
  2168 		ARRAY_LENGTH(table12),
       
  2169 		&table12[0]
       
  2170 		}
       
  2171 	};
       
  2172 
       
  2173 
       
  2174 //
       
  2175 // Root of the state modifier tables
       
  2176 //
       
  2177 LOCAL_D const SFuncTables FuncTables=
       
  2178 	{
       
  2179 		{
       
  2180 		//
       
  2181 		// The default processing table
       
  2182 		//
       
  2183 		ARRAY_LENGTH(defaultTable),
       
  2184 		&defaultTable[0]
       
  2185 		},
       
  2186 		{
       
  2187 		//
       
  2188 		// The modifier control table
       
  2189 		//
       
  2190 		ARRAY_LENGTH(modifierTable),
       
  2191 		&modifierTable[0]
       
  2192 		},
       
  2193 	//
       
  2194 	// The state control tables
       
  2195 	//
       
  2196 	ARRAY_LENGTH(genFuncTables),
       
  2197 	&genFuncTables[0]
       
  2198 	};
       
  2199 
       
  2200 
       
  2201 //
       
  2202 // The following exported functions give the key translator access to
       
  2203 // the control tables above
       
  2204 //
       
  2205 EXPORT_C void KeyDataSettings(TRadix &aRadix,TCtrlDigitsTermination &aCtrlDigitsTermination,TInt &aDefaultCtrlDigitsMaxCount,
       
  2206 							  TInt &aMaximumCtrlDigitsMaxCount)
       
  2207 	{
       
  2208 	aRadix=EDecimal;
       
  2209 	aCtrlDigitsTermination=ETerminationByCtrlUp;
       
  2210 	aDefaultCtrlDigitsMaxCount=3;
       
  2211 	aMaximumCtrlDigitsMaxCount=10;
       
  2212 	}
       
  2213 
       
  2214 EXPORT_C void KeyDataFuncTable(SFuncTables &aFuncTables)
       
  2215 	{
       
  2216 	aFuncTables=FuncTables;
       
  2217 	}
       
  2218 
       
  2219 EXPORT_C void KeyDataConvTable(SConvTable &aConvTable, TUint &aConvTableFirstScanCode,TUint &aConvTableLastScanCode,
       
  2220 							 SScanCodeBlockList &aKeypadScanCode,SKeyCodeList &aNonAutorepKeyCodes)
       
  2221 	{
       
  2222 	aConvTable=ConvTable;
       
  2223 	aConvTableFirstScanCode=scanCodeBlock_base[0].firstScanCode;
       
  2224 	aConvTableLastScanCode=scanCodeBlock_base[ARRAY_LENGTH(scanCodeBlock_base)-1].lastScanCode;
       
  2225 	aKeypadScanCode=ConvTableKeypadScanCodes;
       
  2226 	aNonAutorepKeyCodes=ConvTableNonAutorepKeyCodes;
       
  2227 	}