1 /* $NetBSD: sw-kbdmap.c,v 1.3 1996/06/08 15:28:58 is Exp $ */
4 * Copyright (c) 1993 Markus Wild
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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 Markus Wild.
18 * 4. The name of the author may not be used to endorse or promote products
19 * derived from this software without specific prior written permission
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 #include "../../../dev/kbdmap.h"
37 /* define a default keymap. This can be changed by keyboard ioctl's
40 * Modified to standard swedish keyboard layout by Stefan Pedersen
41 * di4ped@cse.hks.se 960103
45 #define S KBD_MODE_STRING
46 #define DG (KBD_MODE_DEAD | KBD_MODE_GRAVE)
47 #define DA (KBD_MODE_DEAD | KBD_MODE_ACUTE)
48 #define DC (KBD_MODE_DEAD | KBD_MODE_CIRC)
49 #define DT (KBD_MODE_DEAD | KBD_MODE_TILDE)
50 #define DD (KBD_MODE_DEAD | KBD_MODE_DIER)
51 #define C KBD_MODE_CAPS
52 #define K KBD_MODE_KPAD
54 struct kbdmap kbdmap
= {
122 0, DEL
, /* really BS, DEL & BS swapped */
125 0, '\r', /* return */
127 0, '\b', /* really DEL, BS & DEL swapped */
133 S
, 0x00, /* now it gets hairy.. CRSR UP */
134 S
, 0x04, /* CRSR DOWN */
135 S
, 0x08, /* CRSR RIGHT */
136 S
, 0x0C, /* CRSR LEFT */
137 S
, 0x10, /* 0x50 F1 */
144 S
, 0x33, /* 0x58 F8 */
221 0, DEL
, /* really BS, DEL & BS swapped */
222 S
, 0x99, /* shift TAB */
224 0, '\r', /* return */
226 0, '\b', /* really DEL, BS & DEL swapped */
232 S
, 0x47, /* shift CRSR UP */
233 S
, 0x4C, /* shift CRSR DOWN */
234 S
, 0x51, /* shift CRSR RIGHT */
235 S
, 0x57, /* shift CRSR LEFT */
236 S
, 0x5D, /* 0x50 shift F1 */
237 S
, 0x63, /* shift F2 */
238 S
, 0x69, /* shift F3 */
239 S
, 0x6F, /* shift F4 */
240 S
, 0x75, /* shift F5 */
241 S
, 0x7B, /* shift F6 */
242 S
, 0x81, /* shift F7 */
243 S
, 0x87, /* 0x58 shift F8 */
244 S
, 0x8D, /* shift F9 */
245 S
, 0x93, /* shift F10 */
250 S
, 0x42, /* HELP (no special shift code) */
321 0, DEL
, /* really BS, DEL & BS swapped */
324 0, '\r', /* return */
326 0, '\b', /* really DEL, BS & DEL swapped */
332 S
, 0x00, /* now it gets hairy.. CRSR UP */
333 S
, 0x04, /* CRSR DOWN */
334 S
, 0x08, /* CRSR RIGHT */
335 S
, 0x0C, /* CRSR LEFT */
336 S
, 0x10, /* 0x50 F1 */
343 S
, 0x33, /* 0x58 F8 */
420 0, DEL
, /* really BS, DEL & BS swapped */
423 0, '\r', /* return */
425 0, '\b', /* really DEL, BS & DEL swapped */
431 S
, 0x00, /* now it gets hairy.. CRSR UP */
432 S
, 0x04, /* CRSR DOWN */
433 S
, 0x08, /* CRSR RIGHT */
434 S
, 0x0C, /* CRSR LEFT */
435 S
, 0x10, /* 0x50 F1 */
442 S
, 0x33, /* 0x58 F8 */
453 /* string table. If there's a better way to get the offsets into the
454 above table, please tell me..
456 NOTE: save yourself and others a lot of grief by *not* using
457 CSI == 0x9b, using the two-character sequence gives
458 much less trouble, especially in GNU-Emacs.. */
460 3, ESC
, '[', 'A', /* 0x00: CRSR UP */
461 3, ESC
, '[', 'B', /* 0x04: CRSR DOWN */
462 3, ESC
, '[', 'C', /* 0x08: CRSR RIGHT */
463 3, ESC
, '[', 'D', /* 0x0C: CRSR LEFT */
464 4, ESC
, '[', '0', '~', /* 0x10: F1 */
465 4, ESC
, '[', '1', '~', /* 0x15: F2 */
466 4, ESC
, '[', '2', '~', /* 0x1A: F3 */
467 4, ESC
, '[', '3', '~', /* 0x1F: F4 */
468 4, ESC
, '[', '4', '~', /* 0x24: F5 */
469 4, ESC
, '[', '5', '~', /* 0x29: F6 */
470 4, ESC
, '[', '6', '~', /* 0x2E: F7 */
471 4, ESC
, '[', '7', '~', /* 0x33: F8 */
472 4, ESC
, '[', '8', '~', /* 0x38: F9 */
473 4, ESC
, '[', '9', '~', /* 0x3D: F10 */
474 4, ESC
, '[', '?', '~', /* 0x42: HELP */
476 4, ESC
, '[', 'T', '~', /* 0x47: shift CRSR UP */
477 4, ESC
, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
478 5, ESC
, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
479 5, ESC
, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
480 5, ESC
, '[', '1', '0', '~', /* 0x5D: shift F1 */
481 5, ESC
, '[', '1', '1', '~', /* 0x63: shift F2 */
482 5, ESC
, '[', '1', '2', '~', /* 0x69: shift F3 */
483 5, ESC
, '[', '1', '3', '~', /* 0x6F: shift F4 */
484 5, ESC
, '[', '1', '4', '~', /* 0x75: shift F5 */
485 5, ESC
, '[', '1', '5', '~', /* 0x7B: shift F6 */
486 5, ESC
, '[', '1', '6', '~', /* 0x81: shift F7 */
487 5, ESC
, '[', '1', '7', '~', /* 0x87: shift F8 */
488 5, ESC
, '[', '1', '8', '~', /* 0x8D: shift F9 */
489 5, ESC
, '[', '1', '9', '~', /* 0x93: shift F10 */
490 3, ESC
, '[', 'Z', /* 0x99: shift TAB */
491 2, ESC
, '[', /* 0x9d: alt ESC == CSI */
495 unsigned char acctable
[KBD_NUM_ACC
][64] = {
496 { "@ÀBCDÈFGHÌJKLMNÒPQRSTÙVWXYZ[\\]^_"
497 "`àbcdèfghìjklmnòpqrstùvwxyz{|}~\177"}, /* KBD_ACC_GRAVE */
499 { "@ÁBCDÉFGHÍJKLMNÓPQRSTÚVWXYZ[\\]^_"
500 "`ábcdéfghíjklmnópqrstúvwxyz{|}~\177"}, /* KBD_ACC_ACUTE */
502 { "@ÂBCDÊFGHÎJKLMNÔPQRSTÛVWXYZ[\\]^_"
503 "`âbcdêfghîjklmnôpqrstûvwxyz{|}~\177"}, /* KBD_ACC_CIRC */
505 { "@ÃBCDEFGHIJKLMÑÕPQRSTUVWXYZ[\\]^_"
506 "`ãbcdefghijklmñÕpqrstuvwxyz{|}~\177"}, /* KBD_ACC_TILDE */
508 { "@ÄBCDËFGHÏJKLMNÖPQRSTÜVWXYZ[\\]^_"
509 "`äbcdëfghïjklmnöpqrstüvwxyz{|}~\177"}, /* KBD_ACC_DIER */
515 write(1, &kbdmap
, sizeof (kbdmap
));