This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/v4l-utils.git tree:
Subject: gen_keytables.pl: use a function to create files Author: Mauro Carvalho Chehab <[email protected]> Date: Mon Nov 8 15:47:35 2010 -0200 We want to move part of the logic from Makefile into gen_keytables.pl, in order to make it process a group of files. So, convert the main logic into a function. Signed-off-by: Mauro Carvalho Chehab <[email protected]> utils/keytable/gen_keytables.pl | 75 +++++++++++++++++++++----------------- 1 files changed, 41 insertions(+), 34 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=d3d94b467eeb5fac10f38041ad44fd843ffca6bf diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl index d8cc664..06400bb 100755 --- a/utils/keytable/gen_keytables.pl +++ b/utils/keytable/gen_keytables.pl @@ -13,7 +13,7 @@ my $check_type = 0; my $name; my $warn; -my $filename = shift or die "Need a file name to proceed."; +my $file = shift or die "Need a file name to proceed."; sub flush() { return if (!$keyname || !$out); @@ -33,48 +33,55 @@ sub flush() $name = ""; } -open IN, "<$filename"; -while (<IN>) { - if (m/struct\s+ir_scancode\s+(\w[\w\d_]+)/) { - flush(); +sub parse_file($) +{ + my $filename = shift; - $keyname = $1; - $keyname =~ s/^ir_codes_//; - $keyname =~ s/_table$//; - $read = 1; - next; - } - if (m/struct\s+rc_keymap.*=\s+{/) { - $check_type = 1; - next; - } - if (m/\.name\s*=\s*(RC_MAP_[^\s\,]+)/) { - $name = $1; - } + open IN, "<$filename"; + while (<IN>) { + if (m/struct\s+ir_scancode\s+(\w[\w\d_]+)/) { + flush(); - if ($check_type) { - if (m/^\s*}/) { - $check_type = 0; + $keyname = $1; + $keyname =~ s/^ir_codes_//; + $keyname =~ s/_table$//; + $read = 1; next; } - if (m/IR_TYPE_([\w\d_]+)/) { - $type = $1; + if (m/struct\s+rc_keymap.*=\s+{/) { + $check_type = 1; + next; + } + if (m/\.name\s*=\s*(RC_MAP_[^\s\,]+)/) { + $name = $1; } - next; - } - if ($read) { - if (m/(0x[\dA-Fa-f]+).*(KEY_[^\s\,\}]+)/) { - $out .= "$1 $2\n"; + if ($check_type) { + if (m/^\s*}/) { + $check_type = 0; + next; + } + if (m/IR_TYPE_([\w\d_]+)/) { + $type = $1; + } next; } - if (m/\}/) { - $read = 0; + + if ($read) { + if (m/(0x[\dA-Fa-f]+).*(KEY_[^\s\,\}]+)/) { + $out .= "$1 $2\n"; + next; + } + if (m/\}/) { + $read = 0; + } } } -} -close IN; + close IN; -flush(); + flush(); + + printf STDERR "WARNING: keyboard name not found on %d tables at file $filename\n", $warn if ($warn); +} -printf STDERR "WARNING: keyboard name not found on %d tables at file $filename\n", $warn if ($warn); +parse_file $file; _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
