1 #include <linux/keyboard.h>
10 /* Keysyms whose KTYP is KT_LATIN or KT_LETTER and whose KVAL is 0..127. */
12 static const char *iso646_syms[] = {
42 "Control_bracketright",
43 "Control_asciicircum",
142 /* set_charset() fills in charset dependent strings here. */
143 /* start with the latin1 defaults */
144 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
145 "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
244 /* Keysyms whose KTYP is KT_LATIN or KT_LETTER and whose KVAL is 128..255,
245 and their Unicode equivalent. */
247 static sym latin1_syms[] = {
248 { 0x00a0, "nobreakspace" },
249 { 0x00a1, "exclamdown" },
251 { 0x00a3, "sterling" },
252 { 0x00a4, "currency" },
254 { 0x00a6, "brokenbar" },
255 { 0x00a7, "section" },
256 { 0x00a8, "diaeresis" },
257 { 0x00a9, "copyright" },
258 { 0x00aa, "ordfeminine" },
259 { 0x00ab, "guillemotleft" },
260 { 0x00ac, "notsign" },
261 { 0x00ad, "hyphen" },
262 { 0x00ae, "registered" },
263 { 0x00af, "macron" },
264 { 0x00b0, "degree" },
265 { 0x00b1, "plusminus" },
266 { 0x00b2, "twosuperior" },
267 { 0x00b3, "threesuperior" },
270 { 0x00b6, "paragraph" },
271 { 0x00b7, "periodcentered" },
272 { 0x00b8, "cedilla" },
273 { 0x00b9, "onesuperior" },
274 { 0x00ba, "masculine" },
275 { 0x00bb, "guillemotright" },
276 { 0x00bc, "onequarter" },
277 { 0x00bd, "onehalf" },
278 { 0x00be, "threequarters" },
279 { 0x00bf, "questiondown" },
280 { 0x00c0, "Agrave" },
281 { 0x00c1, "Aacute" },
282 { 0x00c2, "Acircumflex" },
283 { 0x00c3, "Atilde" },
284 { 0x00c4, "Adiaeresis" },
287 { 0x00c7, "Ccedilla" },
288 { 0x00c8, "Egrave" },
289 { 0x00c9, "Eacute" },
290 { 0x00ca, "Ecircumflex" },
291 { 0x00cb, "Ediaeresis" },
292 { 0x00cc, "Igrave" },
293 { 0x00cd, "Iacute" },
294 { 0x00ce, "Icircumflex" },
295 { 0x00cf, "Idiaeresis" },
297 { 0x00d1, "Ntilde" },
298 { 0x00d2, "Ograve" },
299 { 0x00d3, "Oacute" },
300 { 0x00d4, "Ocircumflex" },
301 { 0x00d5, "Otilde" },
302 { 0x00d6, "Odiaeresis" },
303 { 0x00d7, "multiply" },
304 { 0x00d8, "Ooblique" },
305 { 0x00d9, "Ugrave" },
306 { 0x00da, "Uacute" },
307 { 0x00db, "Ucircumflex" },
308 { 0x00dc, "Udiaeresis" },
309 { 0x00dd, "Yacute" },
311 { 0x00df, "ssharp" },
312 { 0x00e0, "agrave" },
313 { 0x00e1, "aacute" },
314 { 0x00e2, "acircumflex" },
315 { 0x00e3, "atilde" },
316 { 0x00e4, "adiaeresis" },
319 { 0x00e7, "ccedilla" },
320 { 0x00e8, "egrave" },
321 { 0x00e9, "eacute" },
322 { 0x00ea, "ecircumflex" },
323 { 0x00eb, "ediaeresis" },
324 { 0x00ec, "igrave" },
325 { 0x00ed, "iacute" },
326 { 0x00ee, "icircumflex" },
327 { 0x00ef, "idiaeresis" },
329 { 0x00f1, "ntilde" },
330 { 0x00f2, "ograve" },
331 { 0x00f3, "oacute" },
332 { 0x00f4, "ocircumflex" },
333 { 0x00f5, "otilde" },
334 { 0x00f6, "odiaeresis" },
335 { 0x00f7, "division" },
336 { 0x00f8, "oslash" },
337 { 0x00f9, "ugrave" },
338 { 0x00fa, "uacute" },
339 { 0x00fb, "ucircumflex" },
340 { 0x00fc, "udiaeresis" },
341 { 0x00fd, "yacute" },
343 { 0x00ff, "ydiaeresis" }
346 static sym latin2_syms[] = {
347 { 0x00a0, "" }, /* 0240 */
348 { 0x0104, "Aogonek" },
350 { 0x0141, "Lstroke" },
352 { 0x013d, "Lcaron" },
353 { 0x015a, "Sacute" },
356 { 0x0160, "Scaron" },
357 { 0x015e, "Scedilla" },
358 { 0x0164, "Tcaron" },
359 { 0x0179, "Zacute" },
361 { 0x017d, "Zcaron" },
362 { 0x017b, "Zabovedot" },
364 { 0x0105, "aogonek" },
365 { 0x02db, "ogonek" },
366 { 0x0142, "lstroke" },
368 { 0x013e, "lcaron" },
369 { 0x015b, "sacute" },
372 { 0x0161, "scaron" },
373 { 0x015f, "scedilla" },
374 { 0x0165, "tcaron" },
375 { 0x017a, "zacute" },
376 { 0x02dd, "doubleacute" },
377 { 0x017e, "zcaron" },
378 { 0x017c, "zabovedot" },
379 { 0x0154, "Racute" }, /* 0300 */
382 { 0x0102, "Abreve" },
384 { 0x0139, "Lacute" },
385 { 0x0106, "Cacute" },
387 { 0x010c, "Ccaron" },
389 { 0x0118, "Eogonek" },
391 { 0x011a, "Ecaron" },
394 { 0x010e, "Dcaron" },
395 { 0x0110, "Dstroke" },
396 { 0x0143, "Nacute" },
397 { 0x0147, "Ncaron" },
400 { 0x0150, "Odoubleacute" },
403 { 0x0158, "Rcaron" },
406 { 0x0170, "Udoubleacute" },
409 { 0x0162, "Tcedilla" },
411 { 0x0155, "racute" },
414 { 0x0103, "abreve" },
416 { 0x013a, "lacute" },
417 { 0x0107, "cacute" },
419 { 0x010d, "ccaron" },
421 { 0x0119, "eogonek" },
423 { 0x011b, "ecaron" },
426 { 0x010f, "dcaron" },
427 { 0x0111, "dstroke" },
428 { 0x0144, "nacute" },
429 { 0x0148, "ncaron" },
432 { 0x0151, "odoubleacute" },
435 { 0x0159, "rcaron" },
438 { 0x0171, "udoubleacute" },
441 { 0x0163, "tcedilla" },
442 { 0x02d9, "abovedot" }
445 static sym mazovia_syms[] = {
446 /* as specified by Wlodek Bzyl <matwb@univ.gda.pl> */
453 { 0x0105, "aogonek" },
460 { 0x0107, "cacute" },
462 { 0x0104, "Aogonek" },
463 { 0x0118, "Eogonek" },
464 { 0x0119, "eogonek" },
465 { 0x0142, "lstroke" },
468 { 0x0106, "Cacute" },
471 { 0x015a, "Sacute" },
475 { 0x0141, "Lstroke" },
477 { 0x015b, "sacute" },
479 { 0x0179, "Zacute" },
480 { 0x017b, "Zabovedot" },
481 { 0x00f3, "oacute" },
482 { 0x00d3, "Oacute" },
483 { 0x0144, "nacute" },
484 { 0x0143, "Nacute" },
485 { 0x017a, "zacute" },
486 { 0x017c, "zabovedot" },
493 { 0x00ab, "guillemotleft" },
494 { 0x00bb, "guillemotright" },
574 { 0x201e, "quotedblbase" }
577 static sym latin3_syms[] = {
579 { 0x0126, "Hstroke" },
584 { 0x0124, "Hcircumflex" },
587 { 0x0130, "Iabovedot" },
589 { 0x011e, "Gbreve" },
590 { 0x0134, "Jcircumflex" },
595 { 0x0127, "hstroke" },
600 { 0x0125, "hcircumflex" },
603 { 0x0131, "idotless" },
605 { 0x011f, "gbreve" },
606 { 0x0135, "jcircumflex" },
615 { 0x010a, "Cabovedot" },
616 { 0x0108, "Ccircumflex" },
631 { 0x0120, "Gabovedot" },
634 { 0x011c, "Gcircumflex" },
639 { 0x016c, "Ubreve" },
640 { 0x015c, "Scircumflex" },
647 { 0x010b, "cabovedot" },
648 { 0x0109, "ccircumflex" },
663 { 0x0121, "gabovedot" },
666 { 0x011d, "gcircumflex" },
671 { 0x016d, "ubreve" },
672 { 0x015d, "scircumflex" },
676 static sym latin4_syms[] = {
680 { 0x0156, "Rcedilla" },
682 { 0x0128, "Itilde" },
683 { 0x013b, "Lcedilla" },
687 { 0x0112, "Emacron" },
688 { 0x0122, "Gcedilla" },
689 { 0x0166, "Tslash" },
696 { 0x0157, "rcedilla" },
698 { 0x0129, "itilde" },
699 { 0x013c, "lcedilla" },
703 { 0x0113, "emacron" },
704 { 0x0123, "gcedilla" },
705 { 0x0167, "tslash" },
709 { 0x0100, "Amacron" },
716 { 0x012e, "Iogonek" },
721 { 0x0116, "Eabovedot" },
724 { 0x012a, "Imacron" },
726 { 0x0145, "Ncedilla" },
727 { 0x014c, "Omacron" },
728 { 0x0136, "Kcedilla" },
734 { 0x0172, "Uogonek" },
738 { 0x0168, "Utilde" },
739 { 0x016a, "Umacron" },
741 { 0x0101, "amacron" },
748 { 0x012f, "iogonek" },
753 { 0x0117, "eabovedot" },
756 { 0x012b, "imacron" },
758 { 0x0146, "ncedilla" },
759 { 0x014d, "omacron" },
760 { 0x0137, "kcedilla" },
766 { 0x0173, "uogonek" },
770 { 0x0169, "utilde" },
771 { 0x016b, "umacron" },
775 static sym iso_8859_5_syms[] = { /* 160-255 */
776 { 0x00a0, "nobreakspace" },
777 { 0x0401, "cyrillic_capital_letter_io" },
778 { 0x0402, "serbocroatian_cyrillic_capital_letter_dje" },
779 { 0x0403, "macedonian_cyrillic_capital_letter_gje" },
780 { 0x0404, "ukrainian_cyrillic_capital_letter_ie" },
781 { 0x0405, "macedonian_cyrillic_capital_letter_dze" },
782 { 0x0406, "ukrainian_cyrillic_capital_letter_i" },
783 { 0x0407, "ukrainian_cyrillic_capital_letter_yi" },
784 { 0x0408, "cyrillic_capital_letter_je" }, /* 0250 */
785 { 0x0409, "cyrillic_capital_letter_lje" },
786 { 0x040a, "cyrillic_capital_letter_nje" },
787 { 0x040b, "serbocroatian_cyrillic_capital_letter_chje" },
788 { 0x040c, "macedonian_cyrillic_capital_letter_kje" },
789 { 0x00ad, "hyphen" },
790 { 0x040e, "bielorussian_cyrillic_capital_letter_short_u" },
791 { 0x040f, "cyrillic_capital_letter_dze" },
792 { 0x0410, "cyrillic_capital_letter_a" }, /* 0260 */
793 { 0x0411, "cyrillic_capital_letter_be" },
794 { 0x0412, "cyrillic_capital_letter_ve" },
795 { 0x0413, "cyrillic_capital_letter_ghe" },
796 { 0x0414, "cyrillic_capital_letter_de" },
797 { 0x0415, "cyrillic_capital_letter_ie" },
798 { 0x0416, "cyrillic_capital_letter_zhe" },
799 { 0x0417, "cyrillic_capital_letter_ze" },
800 { 0x0418, "cyrillic_capital_letter_i" }, /* 0270 */
801 { 0x0419, "cyrillic_capital_letter_short_i" },
802 { 0x041a, "cyrillic_capital_letter_ka" },
803 { 0x041b, "cyrillic_capital_letter_el" },
804 { 0x041c, "cyrillic_capital_letter_em" },
805 { 0x041d, "cyrillic_capital_letter_en" },
806 { 0x041e, "cyrillic_capital_letter_o" },
807 { 0x041f, "cyrillic_capital_letter_pe" },
808 { 0x0420, "cyrillic_capital_letter_er" }, /* 0300 */
809 { 0x0421, "cyrillic_capital_letter_es" },
810 { 0x0422, "cyrillic_capital_letter_te" },
811 { 0x0423, "cyrillic_capital_letter_u" },
812 { 0x0424, "cyrillic_capital_letter_ef" },
813 { 0x0425, "cyrillic_capital_letter_ha" },
814 { 0x0426, "cyrillic_capital_letter_tse" },
815 { 0x0427, "cyrillic_capital_letter_che" },
816 { 0x0428, "cyrillic_capital_letter_sha" }, /* 0310 */
817 { 0x0429, "cyrillic_capital_letter_shcha" },
818 { 0x042a, "cyrillic_capital_hard_sign" },
819 { 0x042b, "cyrillic_capital_letter_yeru" },
820 { 0x042c, "cyrillic_capital_soft_sign" },
821 { 0x042d, "cyrillic_capital_letter_e" },
822 { 0x042e, "cyrillic_capital_letter_yu" },
823 { 0x042f, "cyrillic_capital_letter_ya" },
824 { 0x0430, "cyrillic_small_letter_a" }, /* 0320 */
825 { 0x0431, "cyrillic_small_letter_be" },
826 { 0x0432, "cyrillic_small_letter_ve" },
827 { 0x0433, "cyrillic_small_letter_ghe" },
828 { 0x0434, "cyrillic_small_letter_de" },
829 { 0x0435, "cyrillic_small_letter_ie" },
830 { 0x0436, "cyrillic_small_letter_zhe" },
831 { 0x0437, "cyrillic_small_letter_ze" },
832 { 0x0438, "cyrillic_small_letter_i" }, /* 0330 */
833 { 0x0439, "cyrillic_small_letter_short_i" },
834 { 0x043a, "cyrillic_small_letter_ka" },
835 { 0x043b, "cyrillic_small_letter_el" },
836 { 0x043c, "cyrillic_small_letter_em" },
837 { 0x043d, "cyrillic_small_letter_en" },
838 { 0x043e, "cyrillic_small_letter_o" },
839 { 0x043f, "cyrillic_small_letter_pe" },
840 { 0x0440, "cyrillic_small_letter_er" }, /* 0340 */
841 { 0x0441, "cyrillic_small_letter_es" },
842 { 0x0442, "cyrillic_small_letter_te" },
843 { 0x0443, "cyrillic_small_letter_u" },
844 { 0x0444, "cyrillic_small_letter_ef" },
845 { 0x0445, "cyrillic_small_letter_ha" },
846 { 0x0446, "cyrillic_small_letter_tse" },
847 { 0x0447, "cyrillic_small_letter_che" },
848 { 0x0448, "cyrillic_small_letter_sha" }, /* 0350 */
849 { 0x0449, "cyrillic_small_letter_shcha" },
850 { 0x044a, "cyrillic_small_hard_sign" },
851 { 0x044b, "cyrillic_small_letter_yeru" },
852 { 0x044c, "cyrillic_small_soft_sign" },
853 { 0x044d, "cyrillic_small_letter_e" },
854 { 0x044e, "cyrillic_small_letter_yu" },
855 { 0x044f, "cyrillic_small_letter_ya" },
856 { 0x2116, "number_acronym" }, /* 0360 */
857 { 0x0451, "cyrillic_small_letter_io" },
858 { 0x0452, "serbocroatian_cyrillic_small_letter_dje" },
859 { 0x0453, "macedonian_cyrillic_small_letter_gje" },
860 { 0x0454, "ukrainian_cyrillic_small_letter_ie" },
861 { 0x0455, "macedonian_cyrillic_small_letter_dze" },
862 { 0x0456, "ukrainian_cyrillic_small_letter_i" },
863 { 0x0457, "ukrainian_cyrillic_small_letter_yi" },
864 { 0x0458, "cyrillic_small_letter_je" }, /* 0370 */
865 { 0x0459, "cyrillic_small_letter_lje" },
866 { 0x045a, "cyrillic_small_letter_nje" },
867 { 0x045b, "serbocroatian_cyrillic_small_letter_chje" },
868 { 0x045c, "macedonian_cyrillic_small_letter_kje" },
869 { 0x00a7, "section" },
870 { 0x045e, "bielorussian_cyrillic_small_letter_short_u" }, /* printing error in ECMA-113 */
871 { 0x045f, "cyrillic_small_letter_dze" }
874 static sym iso_8859_7_syms[] = { /* 160-255 */
876 { 0x02bd, "leftquote" },
877 { 0x02bc, "rightquote" },
895 { 0x0384, "accent" },
896 { 0x0385, "diaeresisaccent" },
897 { 0x0386, "Alphaaccent" },
899 { 0x0388, "Epsilonaccent" },
900 { 0x0389, "Etaaccent" },
901 { 0x038a, "Iotaaccent" },
902 { 0x00bb, "guillemotright" },
903 { 0x038c, "Omicronaccent" },
904 { 0x00bd, "onehalf" },
905 { 0x038e, "Upsilonaccent" },
906 { 0x038f, "Omegaaccent" },
907 { 0x0390, "iotadiaeresisaccent" },
912 { 0x0395, "Epsilon" },
918 { 0x039b, "Lamda" /*sic*/ },
922 { 0x039f, "Omicron" },
928 { 0x03a5, "Upsilon" },
933 { 0x03aa, "Iotadiaeresis" },
934 { 0x03ab, "Upsilondiaeresis" },
935 { 0x03ac, "alphaaccent" },
936 { 0x03ad, "epsilonaccent" },
937 { 0x03ae, "etaaccent" },
938 { 0x03af, "iotaaccent" },
939 { 0x03b0, "upsilondiaeresisaccent" },
944 { 0x03b5, "epsilon" },
950 { 0x03bb, "lamda" /*sic*/ },
954 { 0x03bf, "omicron" },
957 { 0x03c2, "terminalsigma" },
960 { 0x03c5, "upsilon" },
965 { 0x03ca, "iotadiaeresis" },
966 { 0x03cb, "upsilondiaeresis" },
967 { 0x03cc, "omicronaccent" },
968 { 0x03cd, "upsilonaccent" },
969 { 0x03ce, "omegaaccent" },
973 static sym iso_8859_8_syms[] = {
984 { 0x00d7, "multiply" },
989 { 0x203e, "overscore" },
1000 { 0x00f7, "division" },
1037 { 0x2017, "doubleunderscore" },
1040 { 0x05d2, "gimel" },
1041 { 0x05d3, "dalet" },
1044 { 0x05d6, "zayin" },
1048 { 0x05da, "finalkaf" },
1050 { 0x05dc, "lamed" },
1051 { 0x05dd, "finalmem" },
1053 { 0x05df, "finalnun" },
1055 { 0x05e1, "samekh" },
1057 { 0x05e3, "finalpe" },
1059 { 0x05e5, "finaltsadi" },
1060 { 0x05e6, "tsadi" },
1072 static sym iso_8859_9_syms[] = { /* latin-5 */
1073 /* Identical to latin-1, but with the 6 symbols
1074 ETH, eth, THORN, thorn, Yacute, yacute replaced by
1075 Gbreve, gbreve, Scedilla, scedilla, Idotabove, dotlessi */
1076 { 0x011e, "Gbreve" },
1089 { 0x0130, "Idotabove" },
1090 { 0x015e, "Scedilla" },
1108 { 0x011f, "gbreve" },
1121 { 0x0131, "dotlessi" },
1122 { 0x015f, "scedilla" },
1126 #include "syms.koi8.h"
1127 #include "syms.cp1250.h"
1128 #include "syms.thai.h"
1129 #include "syms.ethiopic.h"
1130 #include "syms.sami.h"
1132 static sym iso_8859_15_syms[] = {
1133 /* latin-1 with 8 changes */
1140 { 0x0160, "Scaron" },
1142 { 0x0161, "scaron" },
1154 { 0x017d, "Zcaron" },
1158 { 0x017e, "zcaron" },
1164 { 0x0178, "Ydiaeresis" },
1232 /* Keysyms whose KTYP is KT_FN. */
1234 static const char *fn_syms[] = {
1235 "F1", "F2", "F3", "F4", "F5",
1236 "F6", "F7", "F8", "F9", "F10",
1237 "F11", "F12", "F13", "F14", "F15",
1238 "F16", "F17", "F18", "F19", "F20",
1239 "Find", /* also called: "Home" */
1242 "Select", /* also called: "End" */
1243 "Prior", /* also called: "PageUp" */
1244 "Next", /* also called: "PageDown" */
1249 "F21", "F22", "F23", "F24", "F25",
1250 "F26", "F27", "F28", "F29", "F30",
1251 "F31", "F32", "F33", "F34", "F35",
1252 "F36", "F37", "F38", "F39", "F40",
1253 "F41", "F42", "F43", "F44", "F45",
1254 "F46", "F47", "F48", "F49", "F50",
1255 "F51", "F52", "F53", "F54", "F55",
1256 "F56", "F57", "F58", "F59", "F60",
1257 "F61", "F62", "F63", "F64", "F65",
1258 "F66", "F67", "F68", "F69", "F70",
1259 "F71", "F72", "F73", "F74", "F75",
1260 "F76", "F77", "F78", "F79", "F80",
1261 "F81", "F82", "F83", "F84", "F85",
1262 "F86", "F87", "F88", "F89", "F90",
1263 "F91", "F92", "F93", "F94", "F95",
1264 "F96", "F97", "F98", "F99", "F100",
1265 "F101", "F102", "F103", "F104", "F105",
1266 "F106", "F107", "F108", "F109", "F110",
1267 "F111", "F112", "F113", "F114", "F115",
1268 "F116", "F117", "F118", "F119", "F120",
1269 "F121", "F122", "F123", "F124", "F125",
1270 "F126", "F127", "F128", "F129", "F130",
1271 "F131", "F132", "F133", "F134", "F135",
1272 "F136", "F137", "F138", "F139", "F140",
1273 "F141", "F142", "F143", "F144", "F145",
1274 "F146", "F147", "F148", "F149", "F150",
1275 "F151", "F152", "F153", "F154", "F155",
1276 "F156", "F157", "F158", "F159", "F160",
1277 "F161", "F162", "F163", "F164", "F165",
1278 "F166", "F167", "F168", "F169", "F170",
1279 "F171", "F172", "F173", "F174", "F175",
1280 "F176", "F177", "F178", "F179", "F180",
1281 "F181", "F182", "F183", "F184", "F185",
1282 "F186", "F187", "F188", "F189", "F190",
1283 "F191", "F192", "F193", "F194", "F195",
1284 "F196", "F197", "F198", "F199", "F200",
1285 "F201", "F202", "F203", "F204", "F205",
1286 "F206", "F207", "F208", "F209", "F210",
1287 "F211", "F212", "F213", "F214", "F215",
1288 "F216", "F217", "F218", "F219", "F220",
1289 "F221", "F222", "F223", "F224", "F225",
1290 "F226", "F227", "F228", "F229", "F230",
1291 "F231", "F232", "F233", "F234", "F235",
1292 "F236", "F237", "F238", "F239", "F240",
1293 "F241", "F242", "F243", "F244", "F245",
1294 "F246" /* there are 10 keys named Insert etc., total 256 */
1297 /* Keysyms whose KTYP is KT_SPEC. */
1299 static const char *spec_syms[] = {
1322 /* Keysyms whose KTYP is KT_PAD. */
1324 static const char *pad_syms[] = {
1345 /* Keysyms whose KTYP is KT_DEAD. */
1347 static const char *dead_syms[] = {
1356 /* Keysyms whose KTYP is KT_CONS. */
1358 static const char *cons_syms[] = {
1424 /* Keysyms whose KTYP is KT_CUR. */
1426 static const char *cur_syms[] = {
1433 /* Keysyms whose KTYP is KT_SHIFT. */
1435 static const char *shift_syms[] = {
1447 /* Keysyms whose KTYP is KT_ASCII. */
1449 static const char *ascii_syms[] = {
1478 /* Keysyms whose KTYP is KT_LOCK. */
1480 static const char *lock_syms[] = {
1492 /* Keysyms whose KTYP is KT_SLOCK. */
1494 static const char *sticky_syms[] = {
1506 /* Keysyms whose KTYP is KT_BRL. */
1508 static const char *brl_syms[] = {
1522 #define E(x) { x, sizeof(x) / sizeof(x[0]) }
1524 syms_entry syms[] = {
1525 E(iso646_syms), /* KT_LATIN */
1526 E(fn_syms), /* KT_FN */
1527 E(spec_syms), /* KT_SPEC */
1528 E(pad_syms), /* KT_PAD */
1529 E(dead_syms), /* KT_DEAD */
1530 E(cons_syms), /* KT_CONS */
1531 E(cur_syms), /* KT_CUR */
1532 E(shift_syms), /* KT_SHIFT */
1533 { 0, 0 }, /* KT_META */
1534 E(ascii_syms), /* KT_ASCII */
1535 E(lock_syms), /* KT_LOCK */
1536 { 0, 0 }, /* KT_LETTER */
1537 E(sticky_syms), /* KT_SLOCK */
1539 E(brl_syms) /* KT_BRL */
1546 { "Control_h", "BackSpace" },
1547 { "Control_i", "Tab" },
1548 { "Control_j", "Linefeed" },
1550 /* Unfortunately Delete already denotes ASCII 0177 */
1551 /* { "Delete", "Remove" }, */
1552 { "End", "Select" },
1553 { "PageUp", "Prior" },
1554 { "PageDown", "Next" },
1555 { "multiplication", "multiply" },
1556 { "pound", "sterling" },
1557 { "pilcrow", "paragraph" },
1558 { "Oslash", "Ooblique" },
1559 { "Shift_L", "ShiftL" },
1560 { "Shift_R", "ShiftR" },
1561 { "Control_L", "CtrlL" },
1562 { "Control_R", "CtrlR" },
1564 { "AltR", "AltGr" },
1566 { "Alt_R", "AltGr" },
1567 { "AltGr_L", "Alt" },
1568 { "AltGr_R", "AltGr" },
1569 { "AltLLock", "Alt_Lock" },
1570 { "AltRLock", "AltGr_Lock" },
1571 { "SCtrl", "SControl" },
1572 { "Spawn_Console", "KeyboardSignal" },
1573 { "Uncaps_Shift", "CapsShift" },
1574 /* the names of the Greek letters are spelled differently
1575 in the iso-8859-7 and the Unicode standards */
1576 { "lambda", "lamda" },
1577 { "Lambda", "Lamda" },
1583 { "tilde", "asciitilde" },
1584 { "circumflex", "asciicircum" },
1585 /* as dead_ogonek, dead_caron, dead_breve and dead_doubleacute do not exist
1586 * (yet), I put also compose lines for use with respectively dead_cedilla,
1587 * dead_circumflex, dead_tilde and dead_tilde */
1588 { "dead_ogonek", "dead_cedilla" },
1589 { "dead_caron", "dead_circumflex" },
1590 { "dead_breve", "dead_tilde" },
1591 { "dead_doubleacute", "dead_tilde" },
1593 { "Idotabove", "Iabovedot" },
1594 { "dotlessi", "idotless" },
1596 { "no-break_space", "nobreakspace" },
1597 { "paragraph_sign", "section" },
1598 { "soft_hyphen", "hyphen" },
1599 { "bielorussian_cyrillic_capital_letter_i", "ukrainian_cyrillic_capital_letter_i" },
1600 { "cyrillic_capital_letter_kha", "cyrillic_capital_letter_ha" },
1601 { "cyrillic_capital_letter_ge", "cyrillic_capital_letter_ghe" },
1602 { "cyrillic_capital_letter_ia", "cyrillic_capital_letter_ya" },
1603 { "cyrillic_capital_letter_iu", "cyrillic_capital_letter_yu" },
1604 { "cyrillic_capital_letter_yeri", "cyrillic_capital_letter_yeru" },
1605 { "cyrillic_capital_letter_reversed_e", "cyrillic_capital_letter_e" },
1606 { "cyrillic_capital_letter_ii", "cyrillic_capital_letter_i" },
1607 { "cyrillic_capital_letter_short_ii", "cyrillic_capital_letter_short_i" },
1608 { "bielorussian_cyrillic_small_letter_i", "ukrainian_cyrillic_small_letter_i" },
1609 { "cyrillic_small_letter_kha", "cyrillic_small_letter_ha" },
1610 { "cyrillic_small_letter_ge", "cyrillic_small_letter_ghe" },
1611 { "cyrillic_small_letter_ia", "cyrillic_small_letter_ya" },
1612 { "cyrillic_small_letter_iu", "cyrillic_small_letter_yu" },
1613 { "cyrillic_small_letter_yeri", "cyrillic_small_letter_yeru" },
1614 { "cyrillic_small_letter_reversed_e", "cyrillic_small_letter_e" },
1615 { "cyrillic_small_letter_ii", "cyrillic_small_letter_i" },
1616 { "cyrillic_small_letter_short_ii", "cyrillic_small_letter_short_i" },
1618 { "rightanglequote", "guillemotright" }
1621 const unsigned int syms_size = sizeof(syms) / sizeof(syms_entry);
1622 const unsigned int syn_size = sizeof(synonyms) / sizeof(synonyms[0]);
1625 const char *charset;
1630 { "iso-8859-1", latin1_syms, 160 },
1631 { "iso-8859-2", latin2_syms, 160 },
1632 { "iso-8859-3", latin3_syms, 160 },
1633 { "iso-8859-4", latin4_syms, 160 },
1634 { "iso-8859-5", iso_8859_5_syms, 160 },
1635 { "iso-8859-7", iso_8859_7_syms, 160 },
1636 { "iso-8859-8", iso_8859_8_syms, 160 },
1637 { "iso-8859-9", iso_8859_9_syms, 208 },
1638 { "iso-8859-10", latin6_syms, 160 },
1639 { "iso-8859-15", iso_8859_15_syms, 160 },
1640 { "mazovia", mazovia_syms, 128 },
1641 { "cp-1250", cp1250_syms, 128 },
1642 { "koi8-r", koi8_syms, 128 },
1643 { "koi8-u", koi8_syms, 128 },
1644 { "tis-620", tis_620_syms, 160 }, /* thai */
1645 { "iso-10646-18", iso_10646_18_syms, 159 }, /* ethiopic */
1646 { "iso-ir-197", iso_ir_197_syms, 160 }, /* sami */
1647 { "iso-ir-209", iso_ir_209_syms, 160 }, /* sami */
1650 /* Functions for both dumpkeys and loadkeys. */
1653 list_charsets(FILE *f) {
1656 char *mm[] = { "iso-8859-", "koi8-" };
1658 for (j=0; j<sizeof(mm)/sizeof(mm[0]); j++) {
1661 fprintf(f, "%s{", mm[j]);
1663 lth = strlen(mm[j]);
1664 for(i=1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
1665 if(!strncmp(charsets[i].charset, mm[j], lth)) {
1668 fprintf(f, "%s", charsets[i].charset+lth);
1673 for(i=1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
1674 for (j=0; j<sizeof(mm)/sizeof(mm[0]); j++) {
1675 lth = strlen(mm[j]);
1676 if(!strncmp(charsets[i].charset, mm[j], lth))
1679 fprintf(f, ",%s", charsets[i].charset);
1686 set_charset(const char *charset) {
1690 for (i = 1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
1691 if (!strcasecmp(charsets[i].charset, charset)) {
1692 charsets[0].charset = charsets[i].charset;
1693 charsets[0].charnames = charsets[i].charnames;
1694 charsets[0].start = charsets[i].start;
1695 p = charsets[i].charnames;
1696 for (i = charsets[i].start; i < 256; i++,p++) {
1698 syms[0].table[i] = p->name;
1707 codetoksym(int code) {
1715 if (code < 0x1000) { /* "traditional" keysym */
1717 return iso646_syms[code];
1718 if (KTYP(code) == KT_META)
1720 if (KTYP(code) == KT_LETTER)
1721 code = K(KT_LATIN, KVAL(code));
1722 if (KTYP(code) > KT_LATIN)
1723 return syms[KTYP(code)].table[KVAL(code)];
1725 for (i = 0; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
1726 p = charsets[i].charnames;
1729 p += KVAL(code) - charsets[i].start;
1735 else { /* Unicode keysym */
1739 return iso646_syms[code];
1741 for (i = 0; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
1742 p = charsets[i].charnames;
1745 for (j = charsets[i].start; j < 256; j++, p++) {
1746 if (p->uni == code && p->name[0])
1755 /* Functions for loadkeys. */
1758 ksymtocode(struct keymap *kmap, const char *s, int direction) {
1764 if (direction == TO_AUTO)
1765 direction = kmap->prefer_unicode ? TO_UNICODE : TO_8BIT;
1767 if (!strncmp(s, "Meta_", 5)) {
1768 keycode = ksymtocode(kmap, s+5, TO_8BIT);
1769 if (KTYP(keycode) == KT_LATIN)
1770 return K(KT_META, KVAL(keycode));
1772 /* Avoid error messages for Meta_acute with UTF-8 */
1773 else if(direction == TO_UNICODE)
1776 /* fall through to error printf */
1779 for (i = 0; i < syms_size; i++) {
1780 jmax = ((i == 0 && direction == TO_UNICODE) ? 128 : syms[i].size);
1781 for (j = 0; j < jmax; j++)
1782 if (!strcmp(s,syms[i].table[j]))
1786 for (i = 0; i < syn_size; i++)
1787 if (!strcmp(s, synonyms[i].synonym))
1788 return ksymtocode(kmap, synonyms[i].official_name, direction);
1790 if (direction == TO_UNICODE) {
1791 for (i = 0; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
1792 p = charsets[i].charnames;
1793 for (j = charsets[i].start; j < 256; j++, p++)
1794 if (!strcmp(s,p->name))
1795 return (p->uni ^ 0xf000);
1797 } else /* if (!chosen_charset[0]) */ {
1798 /* note: some keymaps use latin1 but with euro,
1799 so set_charset() would fail */
1800 /* note: some keymaps with charset line still use
1801 symbols from more than one character set,
1802 so we cannot have the `if (!chosen_charset[0])' here */
1804 for (i = 0; i < 256 - 160; i++)
1805 if (!strcmp(s, latin1_syms[i].name)) {
1806 log_verbose(kmap, LOG_VERBOSE1,
1807 _("assuming iso-8859-1 %s\n"), s);
1808 return K(KT_LATIN, 160 + i);
1811 for (i = 0; i < 256 - 160; i++)
1812 if (!strcmp(s, iso_8859_15_syms[i].name)) {
1813 log_verbose(kmap, LOG_VERBOSE1,
1814 _("assuming iso-8859-15 %s\n"), s);
1815 return K(KT_LATIN, 160 + i);
1818 for (i = 0; i < 256 - 160; i++)
1819 if (!strcmp(s, latin2_syms[i].name)) {
1820 log_verbose(kmap, LOG_VERBOSE1,
1821 _("assuming iso-8859-2 %s\n"), s);
1822 return K(KT_LATIN, 160 + i);
1825 for (i = 0; i < 256 - 160; i++)
1826 if (!strcmp(s, latin3_syms[i].name)) {
1827 log_verbose(kmap, LOG_VERBOSE1,
1828 _("assuming iso-8859-3 %s\n"), s);
1829 return K(KT_LATIN, 160 + i);
1832 for (i = 0; i < 256 - 160; i++)
1833 if (!strcmp(s, latin4_syms[i].name)) {
1834 log_verbose(kmap, LOG_VERBOSE1,
1835 _("assuming iso-8859-4 %s\n"), s);
1836 return K(KT_LATIN, 160 + i);
1840 log_error(kmap, _("unknown keysym '%s'\n"), s);
1842 return CODE_FOR_UNKNOWN_KSYM;
1846 convert_code(struct keymap *kmap, int code, int direction)
1849 int unicode_forced = (direction == TO_UNICODE);
1850 int input_is_unicode = (code >= 0x1000);
1853 if (direction == TO_AUTO)
1854 direction = kmap->prefer_unicode ? TO_UNICODE : TO_8BIT;
1856 if (KTYP(code) == KT_META)
1858 else if (!input_is_unicode && code < 0x80)
1859 /* basic ASCII is fine in every situation */
1861 else if (input_is_unicode && (code ^ 0xf000) < 0x80)
1862 /* so is Unicode "Basic Latin" */
1863 return code ^ 0xf000;
1864 else if ((input_is_unicode && direction == TO_UNICODE) ||
1865 (!input_is_unicode && direction == TO_8BIT))
1866 /* no conversion necessary */
1869 /* depending on direction, this will give us either an 8-bit
1870 * K(KTYP, KVAL) or a Unicode keysym xor 0xf000 */
1871 ksym = codetoksym(code);
1873 result = ksymtocode(kmap, ksym, direction);
1878 /* if direction was TO_UNICODE from the beginning, we return the true
1879 * Unicode value (without the 0xf000 mask) */
1880 if (unicode_forced && result >= 0x1000)
1881 return result ^ 0xf000;
1887 add_capslock(struct keymap *kmap, int code)
1889 if (KTYP(code) == KT_LATIN && (!(kmap->prefer_unicode) || code < 0x80))
1890 return K(KT_LETTER, KVAL(code));
1891 else if ((code ^ 0xf000) < 0x100)
1892 /* Unicode Latin-1 Supplement */
1893 /* a bit dirty to use KT_LETTER here, but it should work */
1894 return K(KT_LETTER, code ^ 0xf000);
1896 return convert_code(kmap, code, TO_AUTO);