#include <sys/fcntl.h>
#include <linux/input.h>
+
+typedef struct InputEventState InputEventState;
#include "input-codes.h" /* not really a header */
typedef struct {
static void pr_hex(unsigned long value) { printf("%#lx",value); }
-#define PR_TABLE_STR(tab, val) (pr_table_str(iesis_##tab, iesin_##tab, (val)))
+#define PR_TABLE_STR(tab, val) (pr_table_str(iesis_##tab, ien_##tab, (val)))
static void pr_table_str(const InputEventStringInfo *strings, int nstrings,
unsigned long value) {
const InputEventStringInfo *string;
}
}
-our ($i,$iesis,$iesin,$n,$si);
+our ($i,$iesis,$ien,$n,$si);
print <<END
typedef struct {
typedef struct {
int nstrings;
const InputEventStringInfo *strings;
+ InputEventState **states;
} InputEventTypeInfo;
END
for $t (sort keys %strs) {
$s= $strs{$t};
$n= @$s;
- $iesin= "IESIN_$t";
+ $ien= "IEN_$t";
$iesis= "iesis_\L$t";
print <<END
-#define $iesin $n
-static const int \L$iesin\E= $n;
-static const InputEventStringInfo ${iesis}[$iesin] = {
+#define $ien $n
+static const int \L$ien\E= $n;
+static const InputEventStringInfo ${iesis}[$ien] = {
END
or die $!;
for ($i=0; $i<@$s; $i++) {
or die $!;
}
}
- printf "};\n"
+ printf <<END
+};
+END
or die $!;
+ printf <<END
+static InputEventState *iess_\L$t\E[$ien];
+END
+ or die $!
+ if exists $evtypes{$t};
}
for $tab (sort keys %tabaliases) {
$t= $tabaliases{$tab};
print <<END
-#define IESIN_${tab} IESIN_${t}
+#define IEN_${tab} IEN_${t}
#define iesis_\L${tab} iesis_${t}
+#define iess_\L${tab} iess_${t}
END
or die $!;
}
$s= $strs{'EV'};
print <<END
-#define IETIN IESIN_EV
+#define IETIN IEN_EV
static const InputEventTypeInfo ietis[IETIN]= {
END
or die $!;
$si= $s->[$i];
$tab= defined $si ? $si->[1] : undef;
$tab= $tab && exists $evtypes{$tab} ? $tab : undef;
- @sip= $tab ? ("IESIN_$tab", "iesis_\L$tab") : ("-1", "0");
+ @sip= $tab ? ("IEN_$tab", "iesis_\L$tab", "iess_\L$tab") : (-1, 0, 0);
print_i();
- printf " { %-21s %-20s },\n", "$sip[0],", $sip[1]
+ printf " { %-16s %-15s %-15s },\n", "$sip[0],", "$sip[1],", $sip[2],
or die $!;
}
print <<END