aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmake-arrays-from-input.h.pl34
1 files changed, 29 insertions, 5 deletions
diff --git a/make-arrays-from-input.h.pl b/make-arrays-from-input.h.pl
index a54ffaa..91d1c2d 100755
--- a/make-arrays-from-input.h.pl
+++ b/make-arrays-from-input.h.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/perl -w
use Switch;
@@ -37,7 +37,7 @@ sub getDataFromHeaderLine
if ( m/#define ([A-Z0-9_]*)\s+(0x)?([0-9a-f]+)/)
{
if ($2) { $index = hex($3); } else { $index = $3; }
- if ($index >=0)
+ if ($index >= 0)
{
$returnArray[0] = $index;
$returnArray[1] = lc("$1");
@@ -49,6 +49,26 @@ sub getDataFromHeaderLine
}
#------------------------------------------------------------------------
+#
+# this is under construction to make the MAX switch structure cleaner
+# donno if it works yet.
+sub createNewArray
+{
+ my $myTypeName = shift;
+ my $myTypeMaxName = shift;
+
+ my $myIndex;
+ my $myValue;
+ my @myNewArray;
+
+ ($myIndex, $myValue) = getDataFromHeaderLine($myTypeMaxName);
+ @myNewArray = initArrayWithGenericNames( $myTypeName, $myIndex + 1 );
+
+ return @myNewArray;
+}
+
+
+#------------------------------------------------------------------------
# declare each array in the header
#
sub printCArrayDeclarations
@@ -156,9 +176,9 @@ while (<INPUT_H>)
@SYN = initArrayWithGenericNames( "SYN", $index + 1 ); }
case "KEY" { ($index, $value) = getDataFromHeaderLine($_);
@KEY = initArrayWithGenericNames( "KEY", $index + 1 ); }
- # BTN codes are actually part of the KEY type
- case "BTN" { ($index, $value) = getDataFromHeaderLine($_);
- @BTN = initArrayWithGenericNames( "KEY", $index + 1 ); }
+# BTN codes are actually part of the KEY type, so this array is unused
+# case "BTN" { ($index, $value) = getDataFromHeaderLine($_);
+# @BTN = initArrayWithGenericNames( "KEY", $index + 1 ); }
case "REL" { ($index, $value) = getDataFromHeaderLine($_);
@REL = initArrayWithGenericNames( "REL", $index + 1 ); }
case "ABS" { ($index, $value) = getDataFromHeaderLine($_);
@@ -182,6 +202,10 @@ while (<INPUT_H>)
}
}
+# there is no SYN_MAX defined in input.h, so we set it here:
+@SYN = initArrayWithGenericNames( "SYN", 512 );
+
+
seek( INPUT_H, 0, 0 );
while (<INPUT_H>)
{