Device list now showing usage collection string.
2 #Developed by Stéphane Lenclud
3 #Generate C# enumeration from parsing Hid Usage Table
6 #perl -S genUsageTableEnum.pl ../data/gl.h
12 my $inputFile = $ARGV[0];
15 #$dummy=~s/(^\w)/uc($1)/e;
20 open INPUT, "< $inputFile" or die "Can't read $inputFile\n";
28 foreach my $line(@lines)
30 #if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+15\..*$/)
31 if ($line=~ /^([a-fA-FxX\d]+)(.+)\s+\w+\s+\d+\..*$/)
36 my $varName=FormatVarName($string);
39 $hash{$string}=$value;
41 print "$varName = 0x$value,\n";
45 #print "NO MATCH $line\n";
51 #Output in sorted order
52 for my $string ( sort keys %hash )
54 #print "_S8(\"$string\"),$hash{$string}, //$count\n";
55 print "_S8(\"$string\"),$string, //$count\n";
60 print "$count const found.\n";
71 #Make sure AC ends up as AppCtrl
72 $text=~s/(^AC)/App Ctrl/;
73 #Make sure AL ends up as AppLaunch
74 $text=~s/(^AL)/App Launch/;
75 #Replace / by white-space
79 #Replace - with white-space
84 while ($text=~/(\w+)\s+(.+)/)
88 #upper case the first letter
89 $word=~s/(^\w)/uc($1)/e;
93 $text=~s/(^\w)/uc($1)/e;
96 $varName=~s/-(\w)/uc($1)/e;
103 $_[0] =~ s/^\s+//; #Trim leading space and line return char
104 $_[0] =~ s/\s+$//; #Trim trailling space and line return char