chiark / gitweb /
InputEventState, preparatory to deletion etc.
authorian <ian>
Sun, 8 Jun 2008 12:48:48 +0000 (12:48 +0000)
committerian <ian>
Sun, 8 Jun 2008 12:48:48 +0000 (12:48 +0000)
hostside/evdev-manip.c
hostside/extract-input-codes

index 34ec916509bb7a3831e9fe42d1dfe1499d214114..5c9fbea002bc7bd45516957d329ec78b13a8d409 100644 (file)
@@ -17,6 +17,8 @@
 #include <sys/fcntl.h>
 
 #include <linux/input.h>
+
+typedef struct InputEventState InputEventState;
 #include "input-codes.h" /* not really a header */
 
 typedef struct {
@@ -42,7 +44,7 @@ static const char *expect_sysfs;
 
 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;
index f95b222a96a7942778969f72da0e5dd3e392b76b..07d988e9c69cce8c7bc7c85d24bbb6065c005aaf 100755 (executable)
@@ -43,7 +43,7 @@ while (<>) {
     }
 }
 
-our ($i,$iesis,$iesin,$n,$si);
+our ($i,$iesis,$ien,$n,$si);
 
 print <<END
 typedef struct {
@@ -53,6 +53,7 @@ typedef struct {
 typedef struct {
   int nstrings;
   const InputEventStringInfo *strings;
+  InputEventState **states;
 } InputEventTypeInfo;
 
 END
@@ -65,12 +66,12 @@ sub print_i () {
 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++) {
@@ -84,22 +85,30 @@ END
                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 $!;
@@ -110,9 +119,9 @@ for ($i=0; $i<@$s; $i++) {
     $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