summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-10-18 07:41:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-10-18 07:41:00 +0000
commit537c90b2867993d268e4fb19d55bf923a64de634 (patch)
tree9b42d393fccead68534c1fc501a742f55a969298
parent6fdd4b0837e03f7e10d4b573c4e05c3cb0079b1e (diff)
downloadrockbox-537c90b2867993d268e4fb19d55bf923a64de634.tar.gz
rockbox-537c90b2867993d268e4fb19d55bf923a64de634.zip
Make -t support a range of "targets", which reallly should be one target
and a range of named features. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11254 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-xtools/genlang28
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/genlang b/tools/genlang
index 363ef96cf9..86cb367dd2 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -22,7 +22,7 @@ my $langversion = 3; # 3 was the latest one used in the v1 format
22 22
23if(!$ARGV[0]) { 23if(!$ARGV[0]) {
24 print <<MOO 24 print <<MOO
25Usage: genlang2 [options] <langv2 file> 25Usage: genlang [options] <langv2 file>
26 26
27 -p=<prefix> 27 -p=<prefix>
28 Make the tool create a [prefix].c and [prefix].h file. 28 Make the tool create a [prefix].c and [prefix].h file.
@@ -44,6 +44,10 @@ Usage: genlang2 [options] <langv2 file>
44 Specify which target you want the translations/phrases for. Required when 44 Specify which target you want the translations/phrases for. Required when
45 -b or -p is used. 45 -b or -p is used.
46 46
47 The target can in fact be specified as numerous different strings,
48 separated with colons. This will make genlang to use all the specified
49 strings when searching for a matching phrase.
50
47 -o 51 -o
48 Voice mode output. Outputs all id: and voice: lines for the given target! 52 Voice mode output. Outputs all id: and voice: lines for the given target!
49 53
@@ -140,15 +144,15 @@ sub parsetarget {
140 my $test; 144 my $test;
141 for $test (@all) { 145 for $test (@all) {
142# print "TEST ($debug) $target for $test\n"; 146# print "TEST ($debug) $target for $test\n";
143 if(match($target, $test)) { 147 for my $part (split(":", $target)) {
144 $string = $v; 148 if(match($part, $test)) {
145# print "MATCH: $test => $v\n"; 149 $string = $v;
150# print "MATCH: $test => $v\n";
151 $$strref = $string;
152 return $string;
153 }
146 } 154 }
147 } 155 }
148 if($string) {
149 $$strref = $string;
150 }
151 return $string;
152} 156}
153 157
154my $src; 158my $src;
@@ -446,7 +450,7 @@ if($prefix) {
446 die "couldn't create file $prefix.c\n"; 450 die "couldn't create file $prefix.c\n";
447 451
448 print HFILE <<MOO 452 print HFILE <<MOO
449/* This file was automatically generated using genlang2 */ 453/* This file was automatically generated using genlang */
450/* 454/*
451 * The str() macro/functions is how to access strings that might be 455 * The str() macro/functions is how to access strings that might be
452 * translated. Use it like str(MACRO) and expect a string to be 456 * translated. Use it like str(MACRO) and expect a string to be
@@ -466,7 +470,7 @@ MOO
466 ; 470 ;
467 471
468 print CFILE <<MOO 472 print CFILE <<MOO
469/* This file was automaticly generated using genlang2, the strings come 473/* This file was automaticly generated using genlang, the strings come
470 from "$input" */ 474 from "$input" */
471 475
472#include "$prefix.h" 476#include "$prefix.h"
@@ -496,7 +500,6 @@ MOO
496 ; 500 ;
497 501
498# Output the ID names for the enum in the header file 502# Output the ID names for the enum in the header file
499 my $i;
500 for $i (0x8000 .. ($voiceid-1)) { 503 for $i (0x8000 .. ($voiceid-1)) {
501 my $name=$idnum[$i]; # get the ID name 504 my $name=$idnum[$i]; # get the ID name
502 505
@@ -557,9 +560,6 @@ elsif($binary) {
557 $idnum = $idmap{$name}; 560 $idnum = $idmap{$name};
558 561
559 printf OUTF ("%c%c%s\x00", ($idnum>>8), ($idnum&0xff), $dest); 562 printf OUTF ("%c%c%s\x00", ($idnum>>8), ($idnum&0xff), $dest);
560 if($debug) {
561 printf("%02x => %s\n", $idnum, $value);
562 }
563 } 563 }
564 } 564 }
565} 565}