1 /* $NetBSD: fr-kbdmap.c,v 1.2 2000/09/27 08:28:36 aymeric Exp $ */
2
3 /*
4 * Copyright (c) 1993 Markus Wild
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 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
20 *
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.
31 */
32
33 /*
34 * Modified to standard french keyboard layout by Eric Delcamp
35 * Based on ../../../dev/kbdmap.c, some comments are in french (sorry).
36 * edelcamp@easynet.fr 970717
37 */
38
39 #include <unistd.h>
40
41 #include "../../../dev/kbdmap.h"
42
43 /* define a default keymap. This can be changed by keyboard ioctl's
44 (later at least..) */
45
46 /* mode shortcuts: */
47 #define S KBD_MODE_STRING
48 #define DG (KBD_MODE_DEAD | KBD_MODE_GRAVE)
49 #define DA (KBD_MODE_DEAD | KBD_MODE_ACUTE)
50 #define DC (KBD_MODE_DEAD | KBD_MODE_CIRC)
51 #define DT (KBD_MODE_DEAD | KBD_MODE_TILDE)
52 #define DD (KBD_MODE_DEAD | KBD_MODE_DIER)
53 #define C KBD_MODE_CAPS
54 #define K KBD_MODE_KPAD
55
56 struct kbdmap kbdmap = {
57 /* normal map */
58 {
59 { 0, '`' }, /* 0x00 */
60 { 0, '&' },
61 { 0, '\xe9' }, /* e accent aigu (e acute) */
62 { 0, '"' },
63 { 0, '\'' },
64 { 0, '(' },
65 { 0, '\xa7' }, /* symbole paragraphe */
66 { 0, '\xe8' }, /* e accent grave */
67 { 0, '!' }, /* 0x08 */
68 { 0, '\xe7' }, /* c cedille */
69 { 0, '\xe0' }, /* a accent grave */
70 { 0, ')' },
71 { 0, '-' },
72 { 0, '\\' },
73 { 0, 0 },
74 { K, '0' },
75 { C, 'a' }, /* 0x10 */
76 { C, 'z' },
77 { C, 'e' },
78 { C, 'r' },
79 { C, 't' },
80 { C, 'y' },
81 { C, 'u' },
82 { C, 'i' },
83 { C, 'o' }, /* 0x18 */
84 { C, 'p' },
85 { DC,'^' },
86 { 0, '$' },
87 { 0, 0 },
88 { K, '1' },
89 { K, '2' },
90 { K, '3' },
91 { C, 'q' }, /* 0x20 */
92 { C, 's' },
93 { C, 'd' },
94 { C, 'f' },
95 { C, 'g' },
96 { C, 'h' },
97 { C, 'j' },
98 { C, 'k' },
99 { C, 'l' }, /* 0x28 */
100 { C, 'm' },
101 { 0, '\xd9' }, /* u accent grave */
102 { 0, '\xb5' }, /* mu (micron) */
103 { 0, 0 },
104 { K, '4' },
105 { K, '5' },
106 { K, '6' },
107 { 0, '<' }, /* 0x30 */
108 { C, 'w' },
109 { C, 'x' },
110 { C, 'c' },
111 { C, 'v' },
112 { C, 'b' },
113 { C, 'n' },
114 { 0, ',' },
115 { 0, ';' }, /* 0x38 */
116 { 0, ':' },
117 { 0, '=' },
118 { 0, 0 },
119 { K, '.' },
120 { K, '7' },
121 { K, '8' },
122 { K, '9' },
123 { 0, ' ' }, /* 0x40 */
124 { 0, DEL }, /* really BS, DEL & BS swapped */
125 { 0, '\t' },
126 { K, '\r' }, /* enter */
127 { 0, '\r' }, /* return */
128 { 0, ESC },
129 { 0, '\b' }, /* really DEL, BS & DEL swapped */
130 { 0, 0 },
131 { 0, 0 }, /* 0x48 */
132 { 0, 0 },
133 { K, '-' },
134 { 0, 0 },
135 { S, 0x00 }, /* now it gets hairy.. CRSR UP */
136 { S, 0x04 }, /* CRSR DOWN */
137 { S, 0x08 }, /* CRSR RIGHT */
138 { S, 0x0C }, /* CRSR LEFT */
139 { S, 0x10 }, /* 0x50 F1 */
140 { S, 0x15 }, /* F2 */
141 { S, 0x1A }, /* F3 */
142 { S, 0x1F }, /* F4 */
143 { S, 0x24 }, /* F5 */
144 { S, 0x29 }, /* F6 */
145 { S, 0x2E }, /* F7 */
146 { S, 0x33 }, /* 0x58 F8 */
147 { S, 0x38 }, /* F9 */
148 { S, 0x3D }, /* F10 */
149 { K, '[' },
150 { K, ']' },
151 { K, '/' },
152 { K, '*' },
153 { S, 0x42 } /* HELP */
154 },
155
156 /* shifted map */
157 {
158 { 0, '~' }, /* 0x00 */
159 { 0, '1' },
160 { 0, '2' },
161 { 0, '3' },
162 { 0, '4' },
163 { 0, '5' },
164 { 0, '6' },
165 { 0, '7' },
166 { 0, '8' }, /* 0x08 */
167 { 0, '9' },
168 { 0, '0' },
169 { 0, '\xb0' }, /* symbole numero (degree) */
170 { 0, '_' },
171 { 0, '|' },
172 { 0, 0 },
173 { K, '0' },
174 { C, 'A' }, /* 0x10 */
175 { C, 'Z' },
176 { C, 'E' },
177 { C, 'R' },
178 { C, 'T' },
179 { C, 'Y' },
180 { C, 'U' },
181 { C, 'I' },
182 { C, 'O' }, /* 0x18 */
183 { C, 'P' },
184 { DD, '\xa8' }, /* 0xEA or 0xA8 ? */
185 { 0, '*' },
186 { 0, 0 },
187 { K, '1' },
188 { K, '2' },
189 { K, '3' },
190 { C, 'Q' }, /* 0x20 */
191 { C, 'S' },
192 { C, 'D' },
193 { C, 'F' },
194 { C, 'G' },
195 { C, 'H' },
196 { C, 'J' },
197 { C, 'K' },
198 { C, 'L' }, /* 0x28 */
199 { C, 'M' },
200 { 0, '%' },
201 { 0, '\xa3' }, /* livre sterling */
202 { 0, 0 },
203 { K, '4' },
204 { K, '5' },
205 { K, '6' },
206 { 0, '>' }, /* 0x30 */
207 { C, 'W' },
208 { C, 'X' },
209 { C, 'C' },
210 { C, 'V' },
211 { C, 'B' },
212 { C, 'N' },
213 { 0, '?' },
214 { 0, '.' }, /* 0x38 */
215 { 0, '/' },
216 { 0, '+' },
217 { 0, 0 },
218 { K, '.' },
219 { K, '7' },
220 { K, '#' },
221 { K, '^' },
222 { 0, ' ' }, /* 0x40 */
223 { 0, DEL }, /* really BS, DEL & BS swapped */
224 { S, 0x99 }, /* shift TAB */
225 { K, '\r' }, /* enter */
226 { 0, '\r' }, /* return */
227 { 0, ESC },
228 { 0, '\b' }, /* really DEL, BS & DEL swapped */
229 { 0, 0 },
230 { 0, 0 }, /* 0x48 */
231 { 0, 0 },
232 { K, '-' },
233 { 0, 0 },
234 { S, 0x47 }, /* shift CRSR UP */
235 { S, 0x4C }, /* shift CRSR DOWN */
236 { S, 0x51 }, /* shift CRSR RIGHT */
237 { S, 0x57 }, /* shift CRSR LEFT */
238 { S, 0x5D }, /* 0x50 shift F1 */
239 { S, 0x63 }, /* shift F2 */
240 { S, 0x69 }, /* shift F3 */
241 { S, 0x6F }, /* shift F4 */
242 { S, 0x75 }, /* shift F5 */
243 { S, 0x7B }, /* shift F6 */
244 { S, 0x81 }, /* shift F7 */
245 { S, 0x87 }, /* 0x58 shift F8 */
246 { S, 0x8D }, /* shift F9 */
247 { S, 0x93 }, /* shift F10 */
248 { K, '{' },
249 { K, '}' },
250 { K, '/' },
251 { K, '*' },
252 { S, 0x42 } /* HELP (no special shift code) */
253 },
254
255
256 /* alt map */
257 {
258 { 0, '`' }, /* 0x00 */
259 { 0, '�' },
260 { 0, '\xb2' },
261 { 0, '\xb3' },
262 { 0, '�' },
263 { 0, '�' },
264 { 0, '�' },
265 { 0, '�' },
266 { 0, '�' }, /* 0x08 */
267 { 0, '�' },
268 { 0, '�' },
269 { 0, '-' },
270 { 0, '=' },
271 { 0, '\\' },
272 { 0, 0 },
273 { K, '0' },
274 { C, '�' }, /* 0x10 */
275 { 0, '�' },
276 { 0, '�' },
277 { 0, '�' },
278 { C, '�' },
279 { 0, '�' },
280 { 0, '�' },
281 { 0, '�' },
282 { C, '�' }, /* 0x18 */
283 { 0, '�' },
284 { 0, '[' },
285 { 0, ']' },
286 { 0, 0 },
287 { K, '1' },
288 { K, '2' },
289 { K, '3' },
290 { C, '�' }, /* 0x20 */
291 { 0, '�' },
292 { C, '�' },
293 { DA, '�' },
294 { DG, '`' },
295 { DC, '^' },
296 { DT, '~' },
297 { DD, '�' },
298 { 0, '�' }, /* 0x28 */
299 { 0, ';' },
300 { 0, '\'' },
301 { 0, '�' },
302 { 0, 0 },
303 { K, '4' },
304 { K, '5' },
305 { K, '6' },
306 { 0, '<' }, /* 0x30 */
307 { 0, '�' },
308 { 0, '�' },
309 { C, '�' },
310 { 0, '�' },
311 { 0, '�' },
312 { 0, '�' },
313 { 0, '�' },
314 { 0, ',' }, /* 0x38 */
315 { 0, '.' },
316 { 0, '/' },
317 { 0, 0 },
318 { K, '.' },
319 { K, '7' },
320 { K, '8' },
321 { K, '9' },
322 { 0, ' ' }, /* 0x40 */
323 { 0, DEL }, /* really BS, DEL & BS swapped */
324 { 0, '\t' },
325 { K, '\r' }, /* enter */
326 { 0, '\r' }, /* return */
327 { S, 0x9d }, /* CSI */
328 { 0, '\b' }, /* really DEL, BS & DEL swapped */
329 { 0, 0 },
330 { 0, 0 }, /* 0x48 */
331 { 0, 0 },
332 { K, '-' },
333 { 0, 0 },
334 { S, 0x00 }, /* now it gets hairy.. CRSR UP */
335 { S, 0x04 }, /* CRSR DOWN */
336 { S, 0x08 }, /* CRSR RIGHT */
337 { S, 0x0C }, /* CRSR LEFT */
338 { S, 0x10 }, /* 0x50 F1 */
339 { S, 0x15 }, /* F2 */
340 { S, 0x1A }, /* F3 */
341 { S, 0x1F }, /* F4 */
342 { S, 0x24 }, /* F5 */
343 { S, 0x29 }, /* F6 */
344 { S, 0x2E }, /* F7 */
345 { S, 0x33 }, /* 0x58 F8 */
346 { S, 0x38 }, /* F9 */
347 { S, 0x3D }, /* F10 */
348 { K, '(' },
349 { K, ')' },
350 { K, '/' },
351 { K, '*' },
352 { S, 0x42 } /* HELP */
353 },
354
355 /* shift alt map */
356 {
357 { 0, '~' }, /* 0x00 */
358 { 0, '!' },
359 { 0, '@' },
360 { 0, '#' },
361 { 0, '$' },
362 { 0, '%' },
363 { 0, '^' },
364 { 0, '&' },
365 { 0, '*' }, /* 0x08 */
366 { 0, '(' },
367 { 0, ')' },
368 { 0, '_' },
369 { 0, '+' },
370 { 0, '|' },
371 { 0, 0 },
372 { K, '0' },
373 { C, '�' }, /* 0x10 */
374 { 0, '�' },
375 { 0, '�' },
376 { 0, '�' },
377 { C, '�' },
378 { 0, '�' },
379 { 0, '�' },
380 { 0, '�' },
381 { C, '�' }, /* 0x18 */
382 { 0, '�' },
383 { 0, '{' },
384 { 0, '}' },
385 { 0, 0 },
386 { K, '1' },
387 { K, '2' },
388 { K, '3' },
389 { C, '�' }, /* 0x20 */
390 { 0, '�' },
391 { C, '�' },
392 { DA, '�' },
393 { DG, '`' },
394 { DC, '^' },
395 { DT, '~' },
396 { DD, '�' },
397 { 0, '�' }, /* 0x28 */
398 { 0, ';' },
399 { 0, '"' },
400 { 0, '�' },
401 { 0, 0 },
402 { K, '4' },
403 { K, '5' },
404 { K, '6' },
405 { 0, '>' }, /* 0x30 */
406 { 0, '\xac' },
407 { 0, '\xf7' },
408 { 0, '\xc7' },
409 { 0, '�' },
410 { 0, '�' },
411 { 0, '\xaf' },
412 { 0, '\xbf' },
413 { 0, '<' }, /* 0x38 */
414 { 0, '>' },
415 { 0, '?' },
416 { 0, 0 },
417 { K, '.' },
418 { K, '7' },
419 { K, '8' },
420 { K, '9' },
421 { 0, ' ' }, /* 0x40 */
422 { 0, DEL }, /* really BS, DEL & BS swapped */
423 { 0, '\t' },
424 { K, '\r' }, /* enter */
425 { 0, '\r' }, /* return */
426 { S, 0x9d }, /* CSI */
427 { 0, '\b' }, /* really DEL, BS & DEL swapped */
428 { 0, 0 },
429 { 0, 0 }, /* 0x48 */
430 { 0, 0 },
431 { K, '-' },
432 { 0, 0 },
433 { S, 0x00 }, /* now it gets hairy.. CRSR UP */
434 { S, 0x04 }, /* CRSR DOWN */
435 { S, 0x08 }, /* CRSR RIGHT */
436 { S, 0x0C }, /* CRSR LEFT */
437 { S, 0x10 }, /* 0x50 F1 */
438 { S, 0x15 }, /* F2 */
439 { S, 0x1A }, /* F3 */
440 { S, 0x1F }, /* F4 */
441 { S, 0x24 }, /* F5 */
442 { S, 0x29 }, /* F6 */
443 { S, 0x2E }, /* F7 */
444 { S, 0x33 }, /* 0x58 F8 */
445 { S, 0x38 }, /* F9 */
446 { S, 0x3D }, /* F10 */
447 { K, '(' },
448 { K, ')' },
449 { K, '/' },
450 { K, '*' },
451 { S, 0x42 } /* HELP */
452 },
453
454 {
455 /* string table. If there's a better way to get the offsets into the
456 above table, please tell me..
457
458 NOTE: save yourself and others a lot of grief by *not* using
459 CSI == 0x9b, using the two-character sequence gives
460 much less trouble, especially in GNU-Emacs.. */
461
462 3, ESC, '[', 'A', /* 0x00: CRSR UP */
463 3, ESC, '[', 'B', /* 0x04: CRSR DOWN */
464 3, ESC, '[', 'C', /* 0x08: CRSR RIGHT */
465 3, ESC, '[', 'D', /* 0x0C: CRSR LEFT */
466 4, ESC, '[', '0', '~', /* 0x10: F1 */
467 4, ESC, '[', '1', '~', /* 0x15: F2 */
468 4, ESC, '[', '2', '~', /* 0x1A: F3 */
469 4, ESC, '[', '3', '~', /* 0x1F: F4 */
470 4, ESC, '[', '4', '~', /* 0x24: F5 */
471 4, ESC, '[', '5', '~', /* 0x29: F6 */
472 4, ESC, '[', '6', '~', /* 0x2E: F7 */
473 4, ESC, '[', '7', '~', /* 0x33: F8 */
474 4, ESC, '[', '8', '~', /* 0x38: F9 */
475 4, ESC, '[', '9', '~', /* 0x3D: F10 */
476 4, ESC, '[', '?', '~', /* 0x42: HELP */
477
478 4, ESC, '[', 'T', '~', /* 0x47: shift CRSR UP */
479 4, ESC, '[', 'S', '~', /* 0x4C: shift CRSR DOWN */
480 5, ESC, '[', ' ', '@', '~', /* 0x51: shift CRSR RIGHT */
481 5, ESC, '[', ' ', 'A', '~', /* 0x57: shift CRSR LEFT */
482 5, ESC, '[', '1', '0', '~', /* 0x5D: shift F1 */
483 5, ESC, '[', '1', '1', '~', /* 0x63: shift F2 */
484 5, ESC, '[', '1', '2', '~', /* 0x69: shift F3 */
485 5, ESC, '[', '1', '3', '~', /* 0x6F: shift F4 */
486 5, ESC, '[', '1', '4', '~', /* 0x75: shift F5 */
487 5, ESC, '[', '1', '5', '~', /* 0x7B: shift F6 */
488 5, ESC, '[', '1', '6', '~', /* 0x81: shift F7 */
489 5, ESC, '[', '1', '7', '~', /* 0x87: shift F8 */
490 5, ESC, '[', '1', '8', '~', /* 0x8D: shift F9 */
491 5, ESC, '[', '1', '9', '~', /* 0x93: shift F10 */
492 3, ESC, '[', 'Z', /* 0x99: shift TAB */
493 2, ESC, '[', /* 0x9d: alt ESC == CSI */
494 },
495 };
496
497 unsigned char acctable[KBD_NUM_ACC][64] = {
498 { "@�BCD�FGH�JKLMN�PQRST�VWXYZ[\\]^_"
499 "`�bcd�fgh�jklmn�pqrst�vwxyz{|}~\177"}, /* KBD_ACC_GRAVE */
500
501 { "@�BCD�FGH�JKLMN�PQRST�VWXYZ[\\]^_"
502 "`�bcd�fgh�jklmn�pqrst�vwxyz{|}~\177"}, /* KBD_ACC_ACUTE */
503
504 { "@�BCD�FGH�JKLMN�PQRST�VWXYZ[\\]^_"
505 "`�bcd�fgh�jklmn�pqrst�vwxyz{|}~\177"}, /* KBD_ACC_CIRC */
506
507 { "@�BCDEFGHIJKLM��PQRSTUVWXYZ[\\]^_"
508 "`�bcdefghijklm��pqrstuvwxyz{|}~\177"}, /* KBD_ACC_TILDE */
509
510 { "@�BCD�FGH�JKLMN�PQRST�VWXYZ[\\]^_"
511 "`�bcd�fgh�jklmn�pqrst�vwxyz{|}~\177"}, /* KBD_ACC_DIER */
512 };
513
514 int
main(void)515 main(void) {
516 write(1, &kbdmap, sizeof(kbdmap));
517
518 return 0;
519 }
520