GtkSharp/parser/gen_keysyms
Alp Toker 403ed1ac68 2003-04-12 Alp Toker <alp@atoker.com>
* parser/gen_keysyms: Generates a C# Keys enum from the Gdk headers
        (gdkkeysyms.h)
        * gdk/Keys.cs: The generated Keys

svn path=/trunk/gtk-sharp/; revision=13542
2003-04-12 05:05:00 +00:00

29 lines
532 B
Perl
Executable file

#!/usr/bin/perl -w
# Generates a C# Keys enum from the Gdk headers (gdkkeysyms.h)
# Usage: ./gen_keysyms < gdkkeysyms.h > Keys.cs
# Alp Toker <alp@atoker.com>
print "// Generated File. Do not modify.\n\n";
print "namespace Gdk\n";
print "{\n";
print "\tpublic enum Keys {\n";
while(<>) {
chomp;
if (m/^\W*#define\W+GDK_(\w+)\W+(\w+)\W*$/) {
$key = $1;
$value = $2;
# keys can't start with a digit
if ($key =~ m/^\d.*$/) {
$key = "Key_$key";
}
print "\t\t$key = $value,\n";
}
}
print "\t}\n";
print "}\n";