* This program scans a file which describes a keyboard. The output
* of the program is a series of 'C' declarations which describe a
* mapping between (scancode, shiftstate, altstate) and 3270 functions,
* The format of the input file is as follows:
* keynumber [ scancode [ unshifted [ shifted [ alted [ shiftalted ] ] ] ] ]
* keynumber is in decimal, and starts in column 1.
* scancode is hexadecimal.
* unshifted, etc. - these are either a single ascii character,
* or the name of a function or an AID-generating key.
* all fields are separated by a single space.
dohits(); /* Set up "Hits" */
printf("struct tctokbd {\n\tenum { cantdo, normal, shifted, alted,");
printf(" shiftalted } shift;\n\tunsigned char scancode;");
printf("\n} tctokbd[] = {\n");
for (TC
= &TC_Ascii
[TC_LOWEST_USER
-TC_LOWEST
];
TC
<= &TC_Ascii
[TC_HIGHEST
-TC_LOWEST
]; TC
++) {
/* Hack for "PFK" names (which should be "PF") */
if (memcmp(TC
->tc_name
, "PFK", 3) == 0) {
static char PFonly
[100] = "PF";
strcpy(PFonly
+2, TC
->tc_name
+3);
for (this = firstentry(TC
->tc_name
); (!found
) && this;
if ((this->name
[4] == TC
->tc_name
[0])
&& (strcmp(this->name
+4, TC
->tc_name
) == 0)) {
/* What we have is a TC entry matching a scancode entry */
Ph
= this->hits
; /* now, get hits */
for (i
= 0; i
< 4; i
++) {
if ((Ph
->name
[i
][4] == TC
->tc_name
[0])
&& (strcmp(Ph
->name
[i
]+4, TC
->tc_name
) == 0)) {
printf("0x%x },\n", Ph
-Hits
);
printf("\t{ cantdo, 0 },\n");
fprintf(stderr
, "Unable to produce TC_%s with scan codes!\n",