Commit | Line | Data |
---|---|---|
c2ecccb2 GM |
1 | /* |
2 | * This program scans a file which describes a keyboard. The output | |
3 | * of the program is a series of 'C' declarations which describe a | |
4 | * mapping between (scancode, shiftstate, altstate) and 3270 functions, | |
5 | * characters, and AIDs. | |
6 | * | |
7 | * The format of the input file is as follows: | |
8 | * | |
9 | * keynumber [ scancode [ unshifted [ shifted [ alted [ shiftalted ] ] ] ] ] | |
10 | * | |
11 | * keynumber is in decimal, and starts in column 1. | |
12 | * scancode is hexadecimal. | |
13 | * unshifted, etc. - these are either a single ascii character, | |
14 | * or the name of a function or an AID-generating key. | |
15 | * | |
16 | * all fields are separated by a single space. | |
17 | */ | |
18 | ||
19 | #include <stdio.h> | |
20 | #include <string.h> | |
21 | #include <ctype.h> | |
22 | #include "../ascebc.h" | |
23 | #include "../ebc_disp.h" | |
24 | #include "../kbd3270.h" | |
25 | ||
26 | #include "dohits.h" | |
27 | ||
28 | ||
29 | void | |
30 | main() | |
31 | { | |
32 | int scancode; | |
33 | int empty; | |
34 | int i; | |
35 | struct hits *ph; | |
36 | struct Hits *Ph; | |
37 | ||
38 | dohits(); /* Set up "Hits" */ | |
39 | ||
40 | printf("struct hits hits[] = {\n"); | |
41 | empty = 0; | |
42 | scancode = -1; | |
43 | for (Ph = Hits; Ph < Hits+(sizeof Hits/sizeof Hits[0]); Ph++) { | |
44 | ph = &Ph->hits; | |
45 | scancode++; | |
46 | if ((ph->hit[0].type == undefined) | |
47 | && (ph->hit[1].type == undefined) | |
48 | && (ph->hit[2].type == undefined) | |
49 | && (ph->hit[3].type == undefined)) { | |
50 | empty++; | |
51 | continue; | |
52 | } else { | |
53 | while (empty) { | |
54 | printf("\t{ 0, {\t{ illegal },\t{ illegal }"); | |
55 | printf(",\t{ illegal },\t{ illegal } } },\n"); | |
56 | empty--; | |
57 | } | |
58 | } | |
59 | printf("\t{ %d, {\t/* 0x%02x */\n\t", ph->keynumber, scancode); | |
60 | for (i = 0; i < 4; i++) { | |
61 | printf("\t{ "); | |
62 | switch (ph->hit[i].type) { | |
63 | case undefined: | |
64 | case illegal: | |
65 | printf("illegal"); | |
66 | break; | |
67 | case character: | |
68 | printf("character, 0x%02x", ph->hit[i].code); | |
69 | break; | |
70 | case function: | |
71 | printf("function, %s", Ph->name[i]); | |
72 | break; | |
73 | case aid: | |
74 | printf("aid, %s", Ph->name[i]); | |
75 | break; | |
76 | } | |
77 | printf(" },\n\t"); | |
78 | } | |
79 | printf("} },\n"); | |
80 | } | |
81 | printf("};\n"); | |
82 | } |