kbdcontrol.c (6378775666543dbab8aedabfcb67bc289d1aefde) kbdcontrol.c (a926a37b0ad77a73724d63b08fc62640608f6117)
1/*-
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
1/*-
2 * Copyright (c) 1994-1995 S�ren Schmidt
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
9 * notice, this list of conditions and the following disclaimer,
10 * in this position and unchanged.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software withough specific prior written permission
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software withough specific prior written permission
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
27 * $Id: kbdcontrol.c,v 1.2 1994/10/25 20:50:41 swallace Exp $
28 * $Id: kbdcontrol.c,v 1.3 1995/01/12 11:44:42 sos Exp $
28 */
29
30#include <ctype.h>
31#include <stdio.h>
32#include <string.h>
33#include <machine/console.h>
34#include "path.h"
35#include "lex.h"
36
37char ctrl_names[32][4] = {
38 "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
39 "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ",
40 "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb",
41 "can", "em ", "sub", "esc", "fs ", "gs ", "rs ", "ns "
42 };
43
29 */
30
31#include <ctype.h>
32#include <stdio.h>
33#include <string.h>
34#include <machine/console.h>
35#include "path.h"
36#include "lex.h"
37
38char ctrl_names[32][4] = {
39 "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel",
40 "bs ", "ht ", "nl ", "vt ", "ff ", "cr ", "so ", "si ",
41 "dle", "dc1", "dc2", "dc3", "dc4", "nak", "syn", "etb",
42 "can", "em ", "sub", "esc", "fs ", "gs ", "rs ", "ns "
43 };
44
44char fkey_table[60][MAXFK] = {
45/* 00-03 */ "\033[M", "\033[N", "\033[O", "\033[P",
46/* 04-07 */ "\033[Q", "\033[R", "\033[S", "\033[T",
47/* 08-0B */ "\033[U", "\033[V", "\033[W", "\033[X",
48/* 0C-0F */ "\033[W", "\033[X", "\033[Y", "\033[Z",
49/* 10-13 */ "\033[a", "\033[b", "\033[c", "\033[d",
50/* 14-17 */ "\033[e", "\033[f", "\033[g", "\033[h",
51/* 18-1B */ "\033[g", "\033[h", "\033[i", "\033[j",
52/* 1C-1F */ "\033[k", "\033[l", "\033[m", "\033[n",
53/* 20-23 */ "\033[o", "\033[p", "\033[q", "\033[r",
54/* 24-27 */ "\033[g", "\033[h", "\033[i", "\033[j",
55/* 28-2B */ "\033[k", "\033[l", "\033[m", "\033[n",
56/* 2C-2F */ "\033[o", "\033[p", "\033[q", "\033[r",
57/* 30-33 */ "\033[H", "\033[A", "\033[I", "-" ,
58/* 34-37 */ "\033[D", "\177" , "\033[C", "+" ,
59/* 38-3B */ "\033[F", "\033[B", "\033[G", "\033[L"
45char fkey_table[96][MAXFK] = {
46/* 01-04 */ "\033[M", "\033[N", "\033[O", "\033[P",
47/* 05-08 */ "\033[Q", "\033[R", "\033[S", "\033[T",
48/* 09-12 */ "\033[U", "\033[V", "\033[W", "\033[X",
49/* 13-16 */ "\033[Y", "\033[Z", "\033[a", "\033[b",
50/* 17-20 */ "\033[c", "\033[d", "\033[e", "\033[f",
51/* 21-24 */ "\033[g", "\033[h", "\033[i", "\033[j",
52/* 25-28 */ "\033[k", "\033[l", "\033[m", "\033[n",
53/* 29-32 */ "\033[o", "\033[p", "\033[q", "\033[r",
54/* 33-36 */ "\033[s", "\033[t", "\033[u", "\033[v",
55/* 37-40 */ "\033[w", "\033[x", "\033[y", "\033[z",
56/* 41-44 */ "\033[@", "\033[[", "\033[\\","\033[]",
57/* 45-48 */ "\033[^", "\033[_", "\033[`", "\033[",
58/* 49-52 */ "\033[H", "\033[A", "\033[I", "-" ,
59/* 53-56 */ "\033[D", "\033[E", "\033[C", "+" ,
60/* 57-60 */ "\033[F", "\033[B", "\033[G", "\033[L",
61/* 61-64 */ "\033[J", "\033[K", "\033[}", "" ,
62/* 65-68 */ "" , "" , "" , "" ,
63/* 69-72 */ "" , "" , "" , "" ,
64/* 73-76 */ "" , "" , "" , "" ,
65/* 77-80 */ "" , "" , "" , "" ,
66/* 81-84 */ "" , "" , "" , "" ,
67/* 85-88 */ "" , "" , "" , "" ,
68/* 89-92 */ "" , "" , "" , "" ,
69/* 93-96 */ "" , "" , "" , "" ,
60 };
61
62const int delays[] = {250, 500, 750, 1000};
63const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63,
64 68, 76, 84, 92, 100, 110, 118, 126,
65 136, 152, 168, 184, 200, 220, 236, 252,
66 272, 304, 336, 368, 400, 440, 472, 504};
67const int ndelays = (sizeof(delays) / sizeof(int));

--- 74 unchanged lines hidden (view full) ---

142 case TASH:
143 return ASH | 0x100;
144 case TMETA:
145 return META | 0x100;
146 case TRBT:
147 return RBT | 0x100;
148 case TDBG:
149 return DBG | 0x100;
70 };
71
72const int delays[] = {250, 500, 750, 1000};
73const int repeats[] = { 34, 38, 42, 46, 50, 55, 59, 63,
74 68, 76, 84, 92, 100, 110, 118, 126,
75 136, 152, 168, 184, 200, 220, 236, 252,
76 272, 304, 336, 368, 400, 440, 472, 504};
77const int ndelays = (sizeof(delays) / sizeof(int));

--- 74 unchanged lines hidden (view full) ---

152 case TASH:
153 return ASH | 0x100;
154 case TMETA:
155 return META | 0x100;
156 case TRBT:
157 return RBT | 0x100;
158 case TDBG:
159 return DBG | 0x100;
160 case TSUSP:
161 return SUSP | 0x100;
150 case TFUNC:
151 if (F(number) > L_FN)
152 return -1;
153 return F(number) | 0x100;
154 case TSCRN:
155 if (S(number) > L_SCR)
156 return -1;
157 return S(number) | 0x100;

--- 418 unchanged lines hidden ---
162 case TFUNC:
163 if (F(number) > L_FN)
164 return -1;
165 return F(number) | 0x100;
166 case TSCRN:
167 if (S(number) > L_SCR)
168 return -1;
169 return S(number) | 0x100;

--- 418 unchanged lines hidden ---