Import upstream u-boot 1.1.4
[u-boot.git] / board / MAI / bios_emulator / scitech / src / pm / codepage / us_eng.c
1 /****************************************************************************
2 *
3 *                   SciTech OS Portability Manager Library
4 *
5 *  ========================================================================
6 *
7 *    The contents of this file are subject to the SciTech MGL Public
8 *    License Version 1.0 (the "License"); you may not use this file
9 *    except in compliance with the License. You may obtain a copy of
10 *    the License at http://www.scitechsoft.com/mgl-license.txt
11 *
12 *    Software distributed under the License is distributed on an
13 *    "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
14 *    implied. See the License for the specific language governing
15 *    rights and limitations under the License.
16 *
17 *    The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
18 *
19 *    The Initial Developer of the Original Code is SciTech Software, Inc.
20 *    All Rights Reserved.
21 *
22 *  ========================================================================
23 *
24 * Language:     ANSI C
25 * Environment:  Any
26 *
27 * Description:  Keyboard translation code pages for US English keyboards.
28 *
29 ****************************************************************************/
30
31 #include "event.h"
32
33 /*--------------------------- Global variables ----------------------------*/
34
35 /* This table is used for all normal key translations, and is the fallback
36  * table if the key is not found in any of the other translation tables.
37  * If the code is not found in this table, the ASCII code is set to 0 to
38  * indicate that there is no ASCII code equivalent for this key.
39  */
40 static codepage_entry_t US_normal[] = {
41     {0x01,  0x1B},
42     {0x02,  '1'},
43     {0x03,  '2'},
44     {0x04,  '3'},
45     {0x05,  '4'},
46     {0x06,  '5'},
47     {0x07,  '6'},
48     {0x08,  '7'},
49     {0x09,  '8'},
50     {0x0A,  '9'},
51     {0x0B,  '0'},
52     {0x0C,  '-'},
53     {0x0D,  '='},
54     {0x0E,  0x08},
55     {0x0F,  0x09},
56     {0x10,  'q'},
57     {0x11,  'w'},
58     {0x12,  'e'},
59     {0x13,  'r'},
60     {0x14,  't'},
61     {0x15,  'y'},
62     {0x16,  'u'},
63     {0x17,  'i'},
64     {0x18,  'o'},
65     {0x19,  'p'},
66     {0x1A,  '['},
67     {0x1B,  ']'},
68     {0x1C,  0x0D},
69     {0x1E,  'a'},
70     {0x1F,  's'},
71     {0x20,  'd'},
72     {0x21,  'f'},
73     {0x22,  'g'},
74     {0x23,  'h'},
75     {0x24,  'j'},
76     {0x25,  'k'},
77     {0x26,  'l'},
78     {0x27,  ';'},
79     {0x28,  '\''},
80     {0x29,  '`'},
81     {0x2B,  '\\'},
82     {0x2C,  'z'},
83     {0x2D,  'x'},
84     {0x2E,  'c'},
85     {0x2F,  'v'},
86     {0x30,  'b'},
87     {0x31,  'n'},
88     {0x32,  'm'},
89     {0x33,  ','},
90     {0x34,  '.'},
91     {0x35,  '/'},
92     {0x37,  '*'},           /* Keypad */
93     {0x39,  ' '},
94     {0x4A,  '-'},           /* Keypad */
95     {0x4E,  '+'},           /* Keypad */
96     {0x60,  0x0D},          /* Keypad */
97     {0x61,  '/'},           /* Keypad */
98     };
99
100 /* This table is used for when CAPSLOCK is active and the shift or ctrl
101  * keys are not down. If the code is not found in this table, the normal
102  * table above is then searched.
103  */
104 static codepage_entry_t US_caps[] = {
105     {0x10,  'Q'},
106     {0x11,  'W'},
107     {0x12,  'E'},
108     {0x13,  'R'},
109     {0x14,  'T'},
110     {0x15,  'Y'},
111     {0x16,  'U'},
112     {0x17,  'I'},
113     {0x18,  'O'},
114     {0x19,  'P'},
115     {0x1E,  'A'},
116     {0x1F,  'S'},
117     {0x20,  'D'},
118     {0x21,  'F'},
119     {0x22,  'G'},
120     {0x23,  'H'},
121     {0x24,  'J'},
122     {0x25,  'K'},
123     {0x26,  'L'},
124     {0x2C,  'Z'},
125     {0x2D,  'X'},
126     {0x2E,  'C'},
127     {0x2F,  'V'},
128     {0x30,  'B'},
129     {0x31,  'N'},
130     {0x32,  'M'},
131     };
132
133 /* This table is used for when shift key is down, but the ctrl key is not
134  * down and CAPSLOCK is not active. If the code is not found in this table,
135  * the normal table above is then searched.
136  */
137 static codepage_entry_t US_shift[] = {
138     {0x02,  '!'},
139     {0x03,  '@'},
140     {0x04,  '#'},
141     {0x05,  '$'},
142     {0x06,  '%'},
143     {0x07,  '^'},
144     {0x08,  '&'},
145     {0x09,  '*'},
146     {0x0A,  '('},
147     {0x0B,  ')'},
148     {0x0C,  '_'},
149     {0x0D,  '+'},
150     {0x10,  'Q'},
151     {0x11,  'W'},
152     {0x12,  'E'},
153     {0x13,  'R'},
154     {0x14,  'T'},
155     {0x15,  'Y'},
156     {0x16,  'U'},
157     {0x17,  'I'},
158     {0x18,  'O'},
159     {0x19,  'P'},
160     {0x1A,  '{'},
161     {0x1B,  '}'},
162     {0x1E,  'A'},
163     {0x1F,  'S'},
164     {0x20,  'D'},
165     {0x21,  'F'},
166     {0x22,  'G'},
167     {0x23,  'H'},
168     {0x24,  'J'},
169     {0x25,  'K'},
170     {0x26,  'L'},
171     {0x27,  ':'},
172     {0x28,  '"'},
173     {0x29,  '~'},
174     {0x2B,  '|'},
175     {0x2C,  'Z'},
176     {0x2D,  'X'},
177     {0x2E,  'C'},
178     {0x2F,  'V'},
179     {0x30,  'B'},
180     {0x31,  'N'},
181     {0x32,  'M'},
182     {0x33,  '<'},
183     {0x34,  '>'},
184     {0x35,  '?'},
185     };
186
187 /* This table is used for when CAPSLOCK is active and the shift key is
188  * down, but the ctrl key is not. If the code is not found in this table,
189  * the shift table above is then searched.
190  */
191 static codepage_entry_t US_shiftCaps[] = {
192     {0x10,  'q'},
193     {0x11,  'w'},
194     {0x12,  'e'},
195     {0x13,  'r'},
196     {0x14,  't'},
197     {0x15,  'y'},
198     {0x16,  'u'},
199     {0x17,  'i'},
200     {0x18,  'o'},
201     {0x19,  'p'},
202     {0x1E,  'a'},
203     {0x1F,  's'},
204     {0x20,  'd'},
205     {0x21,  'f'},
206     {0x22,  'g'},
207     {0x23,  'h'},
208     {0x24,  'j'},
209     {0x25,  'k'},
210     {0x26,  'l'},
211     {0x2C,  'z'},
212     {0x2D,  'x'},
213     {0x2E,  'c'},
214     {0x2F,  'v'},
215     {0x30,  'b'},
216     {0x31,  'n'},
217     {0x32,  'm'},
218     };
219
220 /* This table is used for all key translations when the ctrl key is down,
221  * regardless of the state of the shift key and CAPSLOCK. If the code is
222  * not found in this table, the ASCII code is set to 0 to indicate that
223  * there is no ASCII code equivalent for this key.
224  */
225 static codepage_entry_t US_ctrl[] = {
226     {0x01,  0x1B},
227     {0x06,  0x1E},
228     {0x0C,  0x1F},
229     {0x0E,  0x7F},
230     {0x10,  0x11},
231     {0x11,  0x17},
232     {0x12,  0x05},
233     {0x13,  0x12},
234     {0x14,  0x14},
235     {0x15,  0x19},
236     {0x16,  0x16},
237     {0x17,  0x09},
238     {0x18,  0x0F},
239     {0x19,  0x10},
240     {0x1A,  0x1B},
241     {0x1B,  0x1D},
242     {0x1C,  0x0A},
243     {0x1E,  0x01},
244     {0x1F,  0x13},
245     {0x20,  0x04},
246     {0x21,  0x06},
247     {0x22,  0x07},
248     {0x23,  0x08},
249     {0x24,  0x0A},
250     {0x25,  0x0B},
251     {0x26,  0x0C},
252     {0x2B,  0x1C},
253     {0x2C,  0x1A},
254     {0x2D,  0x18},
255     {0x2E,  0x03},
256     {0x2F,  0x16},
257     {0x30,  0x02},
258     {0x31,  0x0E},
259     {0x32,  0x0D},
260     {0x39,  ' '},
261     };
262
263 static codepage_entry_t US_numPad[] = {
264     {0x4C,  '5'},
265     {0x62,  '4'},
266     {0x63,  '6'},
267     {0x64,  '8'},
268     {0x65,  '2'},
269     {0x66,  '0'},
270     {0x67,  '.'},
271     {0x68,  '7'},
272     {0x69,  '1'},
273     {0x6A,  '9'},
274     {0x6B,  '3'},
275     };
276
277 codepage_t _CP_US_English = {
278     "US English",
279     US_normal,      EVT_ARR_SIZE(US_normal),
280     US_caps,        EVT_ARR_SIZE(US_caps),
281     US_shift,       EVT_ARR_SIZE(US_shift),
282     US_shiftCaps,   EVT_ARR_SIZE(US_shiftCaps),
283     US_ctrl,        EVT_ARR_SIZE(US_ctrl),
284     US_numPad,      EVT_ARR_SIZE(US_numPad),
285     };