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
This commit is contained in:
parent
464c757f0d
commit
92cf8ca257
1 changed files with 33 additions and 7 deletions
|
@ -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;
|
||||
|
||||
$id{$idstr} = $idcount;
|
||||
$idnum[$idcount]=$idstr;
|
||||
if($idstr =~ /^VOICE/) {
|
||||
$idnum = $voiceid++;
|
||||
}
|
||||
else {
|
||||
$idnum = $idcount++;
|
||||
}
|
||||
|
||||
$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
|
||||
|
|
Loading…
Reference in a new issue