Convert the gdk keyval-keyname tables to a big string + offsets. (#168901)
2005-03-07 Matthias Clasen <mclasen@redhat.com> Convert the gdk keyval-keyname tables to a big string + offsets. (#168901) * gdk/gen-keyname-table.pl: Perl script inspired by pango/tools/gen-color-table.pl to create the gdk_keys_by_keyval and gdk_keys_by_name tables as lists of offsets pointing into a big const string. * gdk/keynames.txt: List of keyval-keyname pairs. * gdk/keyname-table.h: Generated tables. * gdk/gdkkeynames.c: Include keyname-table.h and don't generate the inverse table at runtime.
This commit is contained in:
parent
f0175e1ff6
commit
3c8b5b490c
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
Convert the gdk keyval-keyname tables to a big string
|
||||||
|
+ offsets. (#168901)
|
||||||
|
|
||||||
|
* gdk/gen-keyname-table.pl: Perl script inspired by
|
||||||
|
pango/tools/gen-color-table.pl to create the
|
||||||
|
gdk_keys_by_keyval and gdk_keys_by_name tables as lists
|
||||||
|
of offsets pointing into a big const string.
|
||||||
|
|
||||||
|
* gdk/keynames.txt: List of keyval-keyname pairs.
|
||||||
|
* gdk/keyname-table.h: Generated tables.
|
||||||
|
|
||||||
|
* gdk/gdkkeynames.c: Include keyname-table.h and don't
|
||||||
|
generate the inverse table at runtime.
|
||||||
|
|
||||||
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkstyle.c: Document which parameters may be NULL.
|
* gtk/gtkstyle.c: Document which parameters may be NULL.
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
Convert the gdk keyval-keyname tables to a big string
|
||||||
|
+ offsets. (#168901)
|
||||||
|
|
||||||
|
* gdk/gen-keyname-table.pl: Perl script inspired by
|
||||||
|
pango/tools/gen-color-table.pl to create the
|
||||||
|
gdk_keys_by_keyval and gdk_keys_by_name tables as lists
|
||||||
|
of offsets pointing into a big const string.
|
||||||
|
|
||||||
|
* gdk/keynames.txt: List of keyval-keyname pairs.
|
||||||
|
* gdk/keyname-table.h: Generated tables.
|
||||||
|
|
||||||
|
* gdk/gdkkeynames.c: Include keyname-table.h and don't
|
||||||
|
generate the inverse table at runtime.
|
||||||
|
|
||||||
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkstyle.c: Document which parameters may be NULL.
|
* gtk/gtkstyle.c: Document which parameters may be NULL.
|
||||||
|
@ -1,3 +1,19 @@
|
|||||||
|
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
|
Convert the gdk keyval-keyname tables to a big string
|
||||||
|
+ offsets. (#168901)
|
||||||
|
|
||||||
|
* gdk/gen-keyname-table.pl: Perl script inspired by
|
||||||
|
pango/tools/gen-color-table.pl to create the
|
||||||
|
gdk_keys_by_keyval and gdk_keys_by_name tables as lists
|
||||||
|
of offsets pointing into a big const string.
|
||||||
|
|
||||||
|
* gdk/keynames.txt: List of keyval-keyname pairs.
|
||||||
|
* gdk/keyname-table.h: Generated tables.
|
||||||
|
|
||||||
|
* gdk/gdkkeynames.c: Include keyname-table.h and don't
|
||||||
|
generate the inverse table at runtime.
|
||||||
|
|
||||||
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
2005-03-07 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* gtk/gtkstyle.c: Document which parameters may be NULL.
|
* gtk/gtkstyle.c: Document which parameters may be NULL.
|
||||||
|
1336
gdk/gdkkeynames.c
1336
gdk/gdkkeynames.c
File diff suppressed because it is too large
Load Diff
92
gdk/gen-keyname-table.pl
Executable file
92
gdk/gen-keyname-table.pl
Executable file
@ -0,0 +1,92 @@
|
|||||||
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
if (@ARGV != 1) {
|
||||||
|
die "Usage: gen-keyname-table.pl keynames.txt > keyname-table.h\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n";
|
||||||
|
|
||||||
|
@keys = ();
|
||||||
|
while (defined($_ = <IN>)) {
|
||||||
|
next if /^!/;
|
||||||
|
if (!/^\s*(0x[0-9a-f]+)\s+(.*\S)\s+$/) {
|
||||||
|
die "Cannot parse line $_";
|
||||||
|
}
|
||||||
|
|
||||||
|
push @keys, [$1, $2];
|
||||||
|
}
|
||||||
|
|
||||||
|
$offset = 0;
|
||||||
|
|
||||||
|
$date = gmtime;
|
||||||
|
|
||||||
|
print <<EOT;
|
||||||
|
/* keyname-table.h: Generated by gen-keyname-table.pl from keynames.txt
|
||||||
|
*
|
||||||
|
* Date: $date
|
||||||
|
*
|
||||||
|
* Do not edit.
|
||||||
|
*/
|
||||||
|
static const char keynames[] =
|
||||||
|
EOT
|
||||||
|
|
||||||
|
for $key (@keys) {
|
||||||
|
$name = $key->[1];
|
||||||
|
|
||||||
|
if ($offset != 0) {
|
||||||
|
print qq(\n);
|
||||||
|
}
|
||||||
|
print qq( "$name\\0");
|
||||||
|
|
||||||
|
$key->[3] = $offset;
|
||||||
|
$offset += length($name) + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
print ";\n\n";
|
||||||
|
|
||||||
|
print <<EOT;
|
||||||
|
typedef struct {
|
||||||
|
guint keyval;
|
||||||
|
guint offset;
|
||||||
|
} gdk_key;
|
||||||
|
|
||||||
|
static const gdk_key gdk_keys_by_keyval[] = {
|
||||||
|
EOT
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
for $key (@keys) {
|
||||||
|
$keyval = $key->[0];
|
||||||
|
$name = $key->[1];
|
||||||
|
$offset = $key->[3];
|
||||||
|
|
||||||
|
if ($i != 0) {
|
||||||
|
print ",\n";
|
||||||
|
}
|
||||||
|
print " { $keyval, $offset }";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n};\n\n";
|
||||||
|
|
||||||
|
@keys = sort { $a->[1] cmp $b->[1] } @keys;
|
||||||
|
|
||||||
|
|
||||||
|
print <<EOT;
|
||||||
|
static const gdk_key gdk_keys_by_name[] = {
|
||||||
|
EOT
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
for $key (@keys) {
|
||||||
|
$keyval = $key->[0];
|
||||||
|
$name = $key->[1];
|
||||||
|
$offset = $key->[3];
|
||||||
|
|
||||||
|
if ($i != 0) {
|
||||||
|
print ",\n";
|
||||||
|
}
|
||||||
|
print " { $keyval, $offset }";
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n};\n";
|
||||||
|
|
3936
gdk/keyname-table.h
Normal file
3936
gdk/keyname-table.h
Normal file
File diff suppressed because it is too large
Load Diff
1306
gdk/keynames.txt
Normal file
1306
gdk/keynames.txt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user