From c06e7772ff81ed4bbc78377a6e16456456f3e96c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 3 Apr 2006 21:11:11 +0000 Subject: langv2 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9470 a1c6a512-1295-4272-9138-f99709370657 --- tools/binlang | 130 ++-------------------------------------------------------- 1 file changed, 4 insertions(+), 126 deletions(-) (limited to 'tools/binlang') diff --git a/tools/binlang b/tools/binlang index 053180317a..90681348f9 100755 --- a/tools/binlang +++ b/tools/binlang @@ -8,7 +8,7 @@ # \/ \/ \/ \/ \/ # $Id$ # -# Copyright (C) 2002 by Daniel Stenberg +# Copyright (C) 2002, 2006 by Daniel Stenberg # # All files in this archive are subject to the GNU General Public License. # See the file COPYING in the source tree root for full license agreement. @@ -18,130 +18,8 @@ # ############################################################################ -if(!$ARGV[0] || !$ARGV[1] || !$ARGV[2]) { - print < - -Generate a binary language file. +print <$output") or die "Can't open $output"; - -my $langversion = 3; - -binmode OUTF; - -printf OUTF ("\x1a%c", $langversion); # magic lang file header - -# -# We scan the english file to get the correct order of the id numbers -# -my $idnum=0; # start with a true number -while() { - if($_ =~ / *\#/) { - # comment - next; - } - # get rid of DOS newlines - $_ =~ s/\r//g; - if($_ =~ /^ *([a-z]+): *(.*)/) { - ($var, $value) = ($1, $2); - $set{$var} = $value; - - # "new" is always the last one, so now we have them all - if($var eq "new") { - $value = $set{'eng'}; - - if($value =~ s/^\"(.*)\"\s*$/$1/g) { - # Skip voice-only entries - if($set{'id'} =~ /^VOICE_/) { - $idnum{$set{'id'}} = '_done_'; - next; - } - - # Assign an ID number to this entry - $idnum{$set{'id'}}=$idnum; - $idnum++; - } - undef %set; - } - } -} -close(ENG); - -while() { - if($_ =~ /^ *\#/) { - # comment - next; - } - # get rid of DOS newlines - $_ =~ s/\r//g; - if($_ =~ /^ *([a-z]+): *(.*)/) { - ($var, $value) = ($1, $2); - - $set{$var} = $value; - - # "new" is always the last one, so now we have them all - if($var eq "new") { - $idnum = $idnum{$set{'id'}}; - - # Skip already processed entries (like voice-only ones) - next if($idnum eq '_done_'); - - if(!$value) { - # if not set, get the english version - $value = $set{'eng'}; - } - - if($value =~ s/^\"(.*)\"\s*$/$1/g) { - if($idnum eq "") { - warn "Found no ".$set{'id'}." in english file!\n"; - } - else { - $idnum{$set{'id'}} = '_done_'; - - printf OUTF ("%c%c%s\x00", - ($idnum>>8), ($idnum&0xff), - $value); - if($debug) { - printf("%02x => %s\n", $idnum, $value); - } - } - } - else { - warn "String for ".$set{'id'}." misses quotes\n"; - } - - undef %set; - } - - } - -} -close(LANG); - -close(OUTF); - -foreach $k (keys(%idnum)) -{ - if($idnum{$k} ne '_done_') - { - warn "Missing ID in $input: $k\n"; - } -} -- cgit v1.2.3