diff options
author | Marcin Bukat <marcin.bukat@gmail.com> | 2011-03-02 09:22:42 +0000 |
---|---|---|
committer | Marcin Bukat <marcin.bukat@gmail.com> | 2011-03-02 09:22:42 +0000 |
commit | c9b0044274bc3871311e84ced66f4aaec6b48355 (patch) | |
tree | d2b8ce8c0ce8d7363d72472e9bf15a8af200c8f2 /tools/genlang | |
parent | 74b7b3f1b07ad8c38c6f58f8a7540a183d4b7473 (diff) | |
download | rockbox-c9b0044274bc3871311e84ced66f4aaec6b48355.tar.gz rockbox-c9b0044274bc3871311e84ced66f4aaec6b48355.zip |
genlang: Remove unused subs. Use precompiled regex in parsetarget(). Minor tweek by substituting s/\r//g with tr/\r//d.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29494 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/genlang')
-rwxr-xr-x | tools/genlang | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/tools/genlang b/tools/genlang index 81d5066453..6a63f8004e 100755 --- a/tools/genlang +++ b/tools/genlang | |||
@@ -148,16 +148,6 @@ sub trim { | |||
148 | return $string; | 148 | return $string; |
149 | } | 149 | } |
150 | 150 | ||
151 | sub match { | ||
152 | my ($string, $pattern)=@_; | ||
153 | |||
154 | return ($string =~ /^$pattern\z/); | ||
155 | } | ||
156 | |||
157 | sub blank { | ||
158 | # nothing to do | ||
159 | } | ||
160 | |||
161 | my %head; | 151 | my %head; |
162 | sub header { | 152 | sub header { |
163 | my ($full, $n, $v)=@_; | 153 | my ($full, $n, $v)=@_; |
@@ -181,13 +171,14 @@ sub parsetarget { | |||
181 | my $string; | 171 | my $string; |
182 | my @all= split(" *, *", $n); | 172 | my @all= split(" *, *", $n); |
183 | my $test; | 173 | my $test; |
174 | my $regexp; | ||
184 | for $test (@all) { | 175 | for $test (@all) { |
185 | $test =~ s/\*/.*/g; | 176 | $test =~ s/\*/.*/g; |
186 | $test =~ s/\?/./g; | 177 | $test =~ s/\?/./g; |
187 | 178 | $regexp = qr/^$test\z/; | |
188 | # print "TEST ($debug) $target for $test\n"; | 179 | # print "TEST ($debug) $target for $test\n"; |
189 | for my $part (@target_parts) { | 180 | for my $part (@target_parts) { |
190 | if($part =~ /^$test\z/) { | 181 | if($part =~ $regexp) { |
191 | $string = $v; | 182 | $string = $v; |
192 | # print "MATCH: $test => $v\n"; | 183 | # print "MATCH: $test => $v\n"; |
193 | $$strref = $string; | 184 | $$strref = $string; |
@@ -233,7 +224,7 @@ if($english) { | |||
233 | while(<ENG>) { | 224 | while(<ENG>) { |
234 | 225 | ||
235 | # get rid of DOS newlines | 226 | # get rid of DOS newlines |
236 | $_ =~ s/\r//g; | 227 | $_ =~ tr/\r//d; |
237 | 228 | ||
238 | if($_ =~ /^ *\<phrase\>/) { | 229 | if($_ =~ /^ *\<phrase\>/) { |
239 | # this is the start of a phrase | 230 | # this is the start of a phrase |
@@ -350,7 +341,7 @@ sub compare { | |||
350 | $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n"; | 341 | $l = "### The 'desc' field differs from the english!\n### the previously used desc is commented below:\n### desc: $ldesc\n desc: $edesc\n"; |
351 | } | 342 | } |
352 | push @show, $l; | 343 | push @show, $l; |
353 | } | 344 | } |
354 | elsif($l =~ / *\<source\>/i) { | 345 | elsif($l =~ / *\<source\>/i) { |
355 | $mode=1; | 346 | $mode=1; |
356 | push @show, $l; | 347 | push @show, $l; |
@@ -409,7 +400,7 @@ while(<LANG>) { | |||
409 | $line++; | 400 | $line++; |
410 | 401 | ||
411 | # get rid of DOS newlines | 402 | # get rid of DOS newlines |
412 | $_ =~ s/\r//g; | 403 | $_ =~ tr/\r//d; |
413 | 404 | ||
414 | if($_ =~ /^( *\#|[ \t\n\r]*\z)/) { | 405 | if($_ =~ /^( *\#|[ \t\n\r]*\z)/) { |
415 | # comment or empty line - output it if it's part of the header | 406 | # comment or empty line - output it if it's part of the header |