Home | History | Annotate | Line # | Download | only in maple
      1 /*	$NetBSD: mkbdmap.h,v 1.6 2002/07/05 14:29:06 tsutsui Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2001 Marcus Comstedt
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  * 1. Redistributions of source code must retain the above copyright
     11  *    notice, this list of conditions and the following disclaimer.
     12  * 2. Redistributions in binary form must reproduce the above copyright
     13  *    notice, this list of conditions and the following disclaimer in the
     14  *    documentation and/or other materials provided with the distribution.
     15  * 3. All advertising materials mentioning features or use of this software
     16  *    must display the following acknowledgement:
     17  *	This product includes software developed by Marcus Comstedt.
     18  * 4. Neither the name of The NetBSD Foundation nor the names of its
     19  *    contributors may be used to endorse or promote products derived
     20  *    from this software without specific prior written permission.
     21  *
     22  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     23  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     24  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     25  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     26  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     32  * POSSIBILITY OF SUCH DAMAGE.
     33  */
     34 
     35 #define KC(n) KS_KEYCODE(n)
     36 
     37 static const keysym_t mkbd_keydesc_jp[] = {
     38 /*  pos	     command		normal		shifted */
     39     KC(4),			KS_a,
     40     KC(5),			KS_b,
     41     KC(6),			KS_c,
     42     KC(7),			KS_d,
     43     KC(8),			KS_e,
     44     KC(9),			KS_f,
     45     KC(10),			KS_g,
     46     KC(11),			KS_h,
     47     KC(12),			KS_i,
     48     KC(13),			KS_j,
     49     KC(14),			KS_k,
     50     KC(15),			KS_l,
     51     KC(16),			KS_m,
     52     KC(17),			KS_n,
     53     KC(18),			KS_o,
     54     KC(19),			KS_p,
     55     KC(20),			KS_q,
     56     KC(21),			KS_r,
     57     KC(22),			KS_s,
     58     KC(23),			KS_t,
     59     KC(24),			KS_u,
     60     KC(25),			KS_v,
     61     KC(26),			KS_w,
     62     KC(27),			KS_x,
     63     KC(28),			KS_y,
     64     KC(29),			KS_z,
     65 
     66     KC(30),			KS_1,		KS_exclam,
     67     KC(31),			KS_2,		KS_quotedbl,
     68     KC(32),			KS_3,		KS_numbersign,
     69     KC(33),			KS_4,		KS_dollar,
     70     KC(34),			KS_5,		KS_percent,
     71     KC(35),			KS_6,		KS_ampersand,
     72     KC(36),			KS_7,		KS_apostrophe,
     73     KC(37),			KS_8,		KS_parenleft,
     74     KC(38),			KS_9,		KS_parenright,
     75     KC(39),			KS_0,		KS_asciitilde,
     76 
     77     KC(40),			KS_Return,
     78     KC(41),  KS_Cmd_Debugger,	KS_Escape,
     79     KC(42),			KS_BackSpace,
     80     KC(43),			KS_Tab,
     81     KC(44),			KS_space,
     82 
     83     KC(45),			KS_minus,	KS_equal,
     84     KC(46),			KS_asciicircum,	KS_macron,
     85     KC(47),			KS_at,		KS_grave,
     86     KC(48),			KS_bracketleft,	KS_braceleft,
     87     /* no 49 */
     88     KC(50),			KS_bracketright,KS_braceright,
     89     KC(51),			KS_semicolon,	KS_plus,
     90     KC(52),			KS_colon,	KS_asterisk,
     91     KC(53),			KS_Zenkaku_Hankaku,
     92     KC(54),			KS_comma,	KS_less,
     93     KC(55),			KS_period,	KS_greater,
     94     KC(56),			KS_slash,	KS_question,
     95 
     96     KC(57),			KS_Caps_Lock,
     97 
     98     KC(58),  KS_Cmd_Screen0,	KS_f1,
     99     KC(59),  KS_Cmd_Screen1,	KS_f2,
    100     KC(60),  KS_Cmd_Screen2,	KS_f3,
    101     KC(61),  KS_Cmd_Screen3,	KS_f4,
    102     KC(62),  KS_Cmd_Screen4,	KS_f5,
    103     KC(63),  KS_Cmd_Screen5,	KS_f6,
    104     KC(64),  KS_Cmd_Screen6,	KS_f7,
    105     KC(65),  KS_Cmd_Screen7,	KS_f8,
    106     KC(66),  KS_Cmd_Screen8,	KS_f9,
    107     KC(67),  KS_Cmd_Screen9,	KS_f10,
    108     KC(68),			KS_f11,
    109     KC(69),			KS_f12,
    110 
    111     KC(70),			KS_Print_Screen,
    112     KC(71),			KS_Hold_Screen,
    113     KC(72),			KS_Pause,
    114     KC(73),			KS_Insert,
    115     KC(74),			KS_Home,
    116     KC(75),			KS_Prior,
    117     KC(76),			KS_Delete,
    118     KC(77),			KS_End,
    119     KC(78),			KS_Next,
    120     KC(79),			KS_Right,
    121     KC(80),			KS_Left,
    122     KC(81),			KS_Down,
    123     KC(82),			KS_Up,
    124 
    125     /* 83-99 is numeric keypad */
    126 
    127     /* 100 is european keyboard only */
    128 
    129     KC(101),			KS_Help,
    130 
    131     /* no 102-134 */
    132 
    133     KC(135),			KS_backslash,	KS_underscore,
    134     KC(136),			KS_Hiragana_Katakana,
    135     KC(137),			KS_yen,		KS_bar,
    136     KC(138),			KS_Henkan_Mode,
    137     KC(139),			KS_Muhenkan,
    138 
    139     KC(224),  KS_Cmd1,		KS_Control_L,
    140     KC(225),			KS_Shift_L,
    141     KC(226),  KS_Cmd2,		KS_Alt_L,
    142     KC(227),			KS_Meta_L,
    143     KC(228),			KS_Control_R,
    144     KC(229),			KS_Shift_R,
    145     KC(230),			KS_Alt_R,	KS_Multi_key,
    146     KC(231),			KS_Meta_R,
    147 };
    148 
    149 
    150 static const keysym_t mkbd_keydesc_uk[] = {
    151 /*  pos	     command		normal		shifted */
    152 
    153     KC(32),			KS_3,		KS_sterling,
    154 
    155     KC(35),			KS_6,		KS_asciicircum,
    156     KC(36),			KS_7,		KS_ampersand,
    157     KC(37),			KS_8,		KS_asterisk,
    158     KC(38),			KS_9,		KS_parenleft,
    159     KC(39),			KS_0,		KS_parenright,
    160 
    161     KC(45),			KS_minus,	KS_underscore,
    162     KC(46),			KS_equal,	KS_plus,
    163     KC(47),			KS_bracketleft,	KS_braceleft,
    164     KC(48),			KS_bracketright,KS_braceright,
    165 
    166     KC(50),			KS_numbersign,	KS_asciitilde,
    167     KC(51),			KS_semicolon,	KS_colon,
    168     KC(52),			KS_apostrophe,	KS_at,
    169     KC(53),			KS_grave,	KS_notsign,	KS_brokenbar,
    170 
    171     KC(83),			KS_Num_Lock,
    172     KC(84),			KS_KP_Divide,
    173     KC(85),			KS_KP_Multiply,
    174     KC(86),			KS_KP_Subtract,
    175     KC(87),			KS_KP_Add,
    176     KC(88),			KS_KP_Enter,
    177     KC(89),			KS_KP_1,
    178     KC(90),			KS_KP_2,
    179     KC(91),			KS_KP_3,
    180     KC(92),			KS_KP_4,
    181     KC(93),			KS_KP_5,
    182     KC(94),			KS_KP_6,
    183     KC(95),			KS_KP_7,
    184     KC(96),			KS_KP_8,
    185     KC(97),			KS_KP_9,
    186     KC(98),			KS_KP_0,
    187     KC(99),			KS_KP_Decimal,
    188 
    189     KC(100),			KS_backslash,	KS_bar,
    190 };
    191 
    192 static const keysym_t mkbd_keydesc_us[] = {
    193 /*  pos	     command		normal		shifted */
    194 
    195     KC(31),			KS_2,		KS_at,
    196 
    197     KC(35),			KS_6,		KS_asciicircum,
    198     KC(36),			KS_7,		KS_ampersand,
    199     KC(37),			KS_8,		KS_asterisk,
    200     KC(38),			KS_9,		KS_parenleft,
    201     KC(39),			KS_0,		KS_parenright,
    202 
    203     KC(45),			KS_minus,	KS_underscore,
    204     KC(46),			KS_equal,	KS_plus,
    205     KC(47),			KS_bracketleft,	KS_braceleft,
    206     KC(48),			KS_bracketright,KS_braceright,
    207     KC(49),			KS_backslash,	KS_bar,
    208 
    209     KC(51),			KS_semicolon,	KS_colon,
    210     KC(52),			KS_apostrophe,	KS_quotedbl,
    211     KC(53),			KS_grave,	KS_asciitilde,
    212 
    213     KC(83),			KS_Num_Lock,
    214     KC(84),			KS_KP_Divide,
    215     KC(85),			KS_KP_Multiply,
    216     KC(86),			KS_KP_Subtract,
    217     KC(87),			KS_KP_Add,
    218     KC(88),			KS_KP_Enter,
    219     KC(89),			KS_KP_1,
    220     KC(90),			KS_KP_2,
    221     KC(91),			KS_KP_3,
    222     KC(92),			KS_KP_4,
    223     KC(93),			KS_KP_5,
    224     KC(94),			KS_KP_6,
    225     KC(95),			KS_KP_7,
    226     KC(96),			KS_KP_8,
    227     KC(97),			KS_KP_9,
    228     KC(98),			KS_KP_0,
    229     KC(99),			KS_KP_Decimal,
    230 };
    231 
    232 static const keysym_t mkbd_keydesc_swapctrlcaps[] = {
    233 /*  pos	     command		normal		shifted */
    234     KC(57),  KS_Cmd1,		KS_Control_L,
    235     KC(224),			KS_Caps_Lock,
    236 };
    237 
    238 #define KBD_MAP(name, base, map) \
    239 			{ name, base, sizeof(map)/sizeof(keysym_t), map }
    240 
    241 static const struct wscons_keydesc mkbd_keydesctab[] = {
    242 	KBD_MAP(KB_JP,			0,	mkbd_keydesc_jp),
    243 	KBD_MAP(KB_UK,		    KB_JP,	mkbd_keydesc_uk),
    244 	KBD_MAP(KB_US,		    KB_JP,	mkbd_keydesc_us),
    245 	KBD_MAP(KB_JP | KB_SWAPCTRLCAPS, KB_JP,	mkbd_keydesc_swapctrlcaps),
    246 	KBD_MAP(KB_UK | KB_SWAPCTRLCAPS, KB_UK,	mkbd_keydesc_swapctrlcaps),
    247 	KBD_MAP(KB_US | KB_SWAPCTRLCAPS, KB_US,	mkbd_keydesc_swapctrlcaps),
    248 	{0, 0, 0, 0}
    249 };
    250 
    251 #undef KBD_MAP
    252 #undef KC
    253