xref: /original-bsd/sys/hp/dev/hil_keymaps.c (revision bacd16ee)
1 /*
2  * Copyright (c) 1988 University of Utah.
3  * Copyright (c) 1990, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * This code is derived from software contributed to Berkeley by
7  * the Systems Programming Group of the University of Utah Computer
8  * Science Department.
9  *
10  * %sccs.include.redist.c%
11  *
12  * from: Utah $Hdr: hil_keymaps.c 1.1 90/07/09$
13  *
14  *	@(#)hil_keymaps.c	8.1 (Berkeley) 06/10/93
15  */
16 
17 /*
18  * Keymaps for various HP-HIL keyboard layouts.  These tables apply only to
19  * keyboards in "cooked" mode.  Currently only one is supported as an ITE
20  * keyboard.
21  *
22  * Maps are indexed by cooked keycode and contain the ASCII character for
23  * that keycode.  The map-set used depends on the keyboard "language".  The
24  * map used within that set depends on the shift/control status that is
25  * returned by the hardware along with the keycode.  If an entry is NULL for
26  * a key in the appropriate unshifted, shifted, control, or control-shifted
27  * table, then a single "string" table is consulted.  In this fashion, a
28  * multi- character sequence can be returned for a key press.  Note that
29  * control/shift status have no effect on multi-character lookup (i.e. there
30  * is only one string table per set, not four).
31  *
32  * Someday we could allow user-definable keymaps, but we would have to come up
33  * with a better format (at least externally).  This format takes up lots of
34  * space.  Having keymaps for all 18 or so HP supported layouts would be bad
35  * news.
36  */
37 #include <sys/param.h>
38 #include <hp/dev/kbdmap.h>
39 
40 char	us_keymap[] = {
41 	NULL,	'`',	'\\',	ESC,	NULL,	DEL,	NULL,	NULL,
42 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
43 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
44 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
45 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
46 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	'\b',	NULL,
47 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
48 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
49 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
50 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'^',
51 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
52 	'9',	'0',	'-',	'=',	'[',	']',	';',	'\'',
53 	',',	'.',	'/',	'\040',	'o',	'p',	'k',	'l',
54 	'q',	'w',	'e',	'r',	't',	'y',	'u',	'i',
55 	'a',	's',	'd',	'f',	'g',	'h',	'j',	'm',
56 	'z',	'x',	'c',	'v',	'b',	'n',	NULL,	NULL
57 };
58 
59 char	us_shiftmap[] = {
60 	NULL,	'~',	'|',	DEL,	NULL,	DEL,	NULL,	NULL,
61 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
62 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
63 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
64 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
65 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	DEL,	NULL,
66 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
67 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
68 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
69 	'7',	'8',	'9',	'/',	'`',	'|',	'\\',	'~',
70 	'!',	'@',	'#',	'$',	'%',	'^',	'&',	'*',
71 	'(',	')',	'_',	'+',	'{',	'}',	':',	'\"',
72 	'<',	'>',	'?',	'\040',	'O',	'P',	'K',	'L',
73 	'Q',	'W',	'E',	'R',	'T',	'Y',	'U',	'I',
74 	'A',	'S',	'D',	'F',	'G',	'H',	'J',	'M',
75 	'Z',	'X',	'C',	'V',	'B',	'N',	NULL,	NULL
76 };
77 
78 char	us_ctrlmap[] = {
79 	NULL,	'`',	'\034',	ESC,	NULL,	DEL,	NULL,	NULL,
80 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
81 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
82 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
83 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
84 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	'\b',	NULL,
85 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
86 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
87 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
88 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'\036',
89 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
90 	'9',	'0',	'-',	'=',	'\033',	'\035',	';',	'\'',
91 	',',	'.',	'/',	'\040',	'\017',	'\020',	'\013',	'\014',
92 	'\021',	'\027',	'\005',	'\022',	'\024',	'\031',	'\025',	'\011',
93 	'\001',	'\023',	'\004',	'\006',	'\007',	'\010',	'\012',	'\015',
94 	'\032',	'\030',	'\003',	'\026',	'\002',	'\016',	NULL,	NULL
95 };
96 
97 char	us_ctrlshiftmap[] = {
98 	NULL,	'~',	'|',	DEL,	NULL,	DEL,	NULL,	NULL,
99 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
100 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
101 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
102 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
103 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	DEL,	NULL,
104 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
105 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
106 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
107 	'7',	'8',	'9',	'/',	'`',	'|',	'\034',	'~',
108 	'!',	'\000',	'#',	'$',	'%',	'\036',	'&',	'*',
109 	'(',	')',	'\037',	'+',	'{',	'}',	':',	'\"',
110 	'<',	'>',	'?',	'\040',	'\017',	'\020',	'\013',	'\014',
111 	'\021',	'\027',	'\005',	'\022',	'\024',	'\031',	'\025',	'\011',
112 	'\001',	'\023',	'\004',	'\006',	'\007',	'\010',	'\012',	'\015',
113 	'\032',	'\030',	'\003',	'\026',	'\002',	'\016',	NULL,	NULL
114 };
115 
116 char	*us_stringmap[] = {
117 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
118 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	"\033V","\033h",
119 	"\033U",NULL,	NULL,	NULL,	NULL,	NULL,	"\033K","\033J",
120 	NULL,	NULL,	NULL,	"\033p","\033q","\033t","\033u","\033v",
121 	"\033r","\033s","\033B","\033A","\033w",NULL,	"\033D","\033C",
122 	"\033L","\033M",NULL,	NULL,	"\033P",NULL,	NULL,	NULL,
123 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
124 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
125 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
126 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
127 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
128 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
129 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
130 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
131 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
132 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL
133 };
134 
135 #ifdef UK_KEYBOARD
136 char	uk_keymap[] = {
137 	NULL,	'`',	'<',	ESC,	NULL,	DEL,	NULL,	NULL,
138 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
139 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
140 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
141 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
142 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	'\b',	NULL,
143 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
144 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
145 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
146 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'^',
147 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
148 	'9',	'0',	'+',	'\'',	'[',	']',	'*',	'\\',
149 	',',	'.',	'-',	'\040',	'o',	'p',	'k',	'l',
150 	'q',	'w',	'e',	'r',	't',	'y',	'u',	'i',
151 	'a',	's',	'd',	'f',	'g',	'h',	'j',	'm',
152 	'z',	'x',	'c',	'v',	'b',	'n',	NULL,	NULL
153 };
154 
155 char	uk_shiftmap[] = {
156 	NULL,	'~',	'>',	DEL,	NULL,	DEL,	NULL,	NULL,
157 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
158 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
159 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
160 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
161 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	DEL,	NULL,
162 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
163 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
164 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
165 	'7',	'8',	'9',	'/',	'`',	'|',	'\\',	'~',
166 	'!',	'\"',	'#',	'$',	'%',	'&',	'^',	'(',
167 	')',	'=',	'?',	'/',	'{',	'}',	'@',	'|',
168 	';',	':',	'_',	'\040',	'O',	'P',	'K',	'L',
169 	'Q',	'W',	'E',	'R',	'T',	'Y',	'U',	'I',
170 	'A',	'S',	'D',	'F',	'G',	'H',	'J',	'M',
171 	'Z',	'X',	'C',	'V',	'B',	'N',	NULL,	NULL
172 };
173 
174 char	uk_ctrlmap[] = {
175 	NULL,	'`',	'<',	ESC,	NULL,	DEL,	NULL,	NULL,
176 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
177 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
178 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
179 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
180 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	'\b',	NULL,
181 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
182 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
183 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
184 	'7',	'8',	'9',	'/',	'E',	'(',	')',	'\036',
185 	'1',	'2',	'3',	'4',	'5',	'6',	'7',	'8',
186 	'9',	'0',	'+',	'\'',	'\033',	'\035',	'*',	'\034',
187 	',',	'.',	'/',	'\040',	'\017',	'\020',	'\013',	'\014',
188 	'\021',	'\027',	'\005',	'\022',	'\024',	'\031',	'\025',	'\011',
189 	'\001',	'\023',	'\004',	'\006',	'\007',	'\010',	'\012',	'\015',
190 	'\032',	'\030',	'\003',	'\026',	'\002',	'\016',	NULL,	NULL
191 };
192 
193 char	uk_ctrlshiftmap[] = {
194 	NULL,	'~',	'>',	DEL,	NULL,	DEL,	NULL,	NULL,
195 	'\n',	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
196 	NULL,	'\n',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
197 	NULL,	'\t',	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
198 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
199 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	DEL,	NULL,
200 	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,	NULL,
201 	ESC,	'\r',	NULL,	'\n',	'0',	'.',	',',	'+',
202 	'1',	'2',	'3',	'-',	'4',	'5',	'6',	'*',
203 	'7',	'8',	'9',	'/',	'`',	'|',	'\034',	'~',
204 	'!',	'\"',	'#',	'$',	'%',	'&',	'\036',	'(',
205 	')',	'=',	'?',	'/',	'{',	'}',	'\000',	'|',
206 	';',	':',	'\037',	'\040',	'\017',	'\020',	'\013',	'\014',
207 	'\021',	'\027',	'\005',	'\022',	'\024',	'\031',	'\025',	'\011',
208 	'\001',	'\023',	'\004',	'\006',	'\007',	'\010',	'\012',	'\015',
209 	'\032',	'\030',	'\003',	'\026',	'\002',	'\016',	NULL,	NULL
210 };
211 #endif
212 
213 /*
214  * The keyboard map table.
215  * Lookup is by hardware returned language code.
216  */
217 struct kbdmap kbd_map[] = {
218 	KBD_US,		"US ASCII",
219 	us_keymap,	us_shiftmap,	us_ctrlmap,	us_ctrlshiftmap,
220 	us_stringmap,
221 
222 #ifdef UK_KEYBOARD
223 	KBD_UK,		"United Kingdom",
224 	uk_keymap,	uk_shiftmap,	uk_ctrlmap,	uk_ctrlshiftmap,
225 	us_stringmap,
226 #endif
227 
228 	0,		NULL,
229 	NULL,		NULL,		NULL,		NULL,
230 	NULL,
231 };
232