diff options
| author | Daniel Stenberg <daniel@haxx.se> | 2006-03-21 12:56:52 +0000 |
|---|---|---|
| committer | Daniel Stenberg <daniel@haxx.se> | 2006-03-21 12:56:52 +0000 |
| commit | 92cf8ca257a039a730d8c5ed92dbff318d318b40 (patch) | |
| tree | 5a60bee9017a8493f63307534c1172b0062ef984 | |
| parent | 464c757f0da7ccacbb84f63ef92cda4898b6d9c3 (diff) | |
| download | rockbox-92cf8ca257a039a730d8c5ed92dbff318d318b40.zip rockbox-92cf8ca257a039a730d8c5ed92dbff318d318b40.tar.gz rockbox-92cf8ca257a039a730d8c5ed92dbff318d318b40.tar.bz2 rockbox-92cf8ca257a039a730d8c5ed92dbff318d318b40.tar.xz | |
seems to generate correct .c and .h files from v2 files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9163 a1c6a512-1295-4272-9138-f99709370657
| -rwxr-xr-x | tools/genlang2 | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/tools/genlang2 b/tools/genlang2 index 6db7d39..400b915 100755 --- a/tools/genlang2 +++ b/tools/genlang2 @@ -1,4 +1,14 @@ #!/usr/bin/perl -s +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# +# Copyright (C) 2006 by Daniel Stenberg +# if(!$ARGV[0]) { print <<MOO @@ -130,7 +140,8 @@ sub voice { parsetarget("voice", \$voice, @_); } -my $idcount; # counter for ID numbers +my $idcount; # counter for lang ID numbers +my $voiceid=0x8000; # counter for voice-only ID numbers open(LANG, "<$input"); while(<LANG>) { @@ -150,23 +161,29 @@ while(<LANG>) { if($part =~ /^\//) { if($part eq "/phrase") { my $idstr = $phrase{'id'}; + my $idnum; + + if($idstr =~ /^VOICE/) { + $idnum = $voiceid++; + } + else { + $idnum = $idcount++; + } - $id{$idstr} = $idcount; - $idnum[$idcount]=$idstr; + $id{$idstr} = $idnum; + $idnum[$idnum]=$idstr; $source{$idstr}=$src; $dest{$idstr}=$dest; $voice{$idstr}=$voice; if($verbose) { - print "id: $phrase{id}\n"; + print "id: $phrase{id} ($idnum)\n"; print "source: $src\n"; print "dest: $dest\n"; print "voice: $voice\n"; } - $idcount++; - undef $src; undef $dest; undef $voice; @@ -208,7 +225,16 @@ print HFILE <<MOO MOO ; -# TODO: add voice-only phrase IDs here +# Output the ID names for the enum in the header file +my $i; +for $i (0x8000 .. ($voiceid-1)) { + my $name=$idnum[$i]; # get the ID name + + $name =~ s/\"//g; # cut off the quotes + + printf HFILE (" %s,\n", $name); +} + # Output end of enum print HFILE <<MOO |