diff options
Diffstat (limited to 'tools/genlang2')
-rwxr-xr-x | tools/genlang2 | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/tools/genlang2 b/tools/genlang2 index 6db7d39a45..400b915482 100755 --- a/tools/genlang2 +++ b/tools/genlang2 | |||
@@ -1,4 +1,14 @@ | |||
1 | #!/usr/bin/perl -s | 1 | #!/usr/bin/perl -s |
2 | # __________ __ ___. | ||
3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | # \/ \/ \/ \/ \/ | ||
8 | # $Id$ | ||
9 | # | ||
10 | # Copyright (C) 2006 by Daniel Stenberg | ||
11 | # | ||
2 | 12 | ||
3 | if(!$ARGV[0]) { | 13 | if(!$ARGV[0]) { |
4 | print <<MOO | 14 | print <<MOO |
@@ -130,7 +140,8 @@ sub voice { | |||
130 | parsetarget("voice", \$voice, @_); | 140 | parsetarget("voice", \$voice, @_); |
131 | } | 141 | } |
132 | 142 | ||
133 | my $idcount; # counter for ID numbers | 143 | my $idcount; # counter for lang ID numbers |
144 | my $voiceid=0x8000; # counter for voice-only ID numbers | ||
134 | 145 | ||
135 | open(LANG, "<$input"); | 146 | open(LANG, "<$input"); |
136 | while(<LANG>) { | 147 | while(<LANG>) { |
@@ -150,23 +161,29 @@ while(<LANG>) { | |||
150 | if($part =~ /^\//) { | 161 | if($part =~ /^\//) { |
151 | if($part eq "/phrase") { | 162 | if($part eq "/phrase") { |
152 | my $idstr = $phrase{'id'}; | 163 | my $idstr = $phrase{'id'}; |
164 | my $idnum; | ||
165 | |||
166 | if($idstr =~ /^VOICE/) { | ||
167 | $idnum = $voiceid++; | ||
168 | } | ||
169 | else { | ||
170 | $idnum = $idcount++; | ||
171 | } | ||
153 | 172 | ||
154 | $id{$idstr} = $idcount; | 173 | $id{$idstr} = $idnum; |
155 | $idnum[$idcount]=$idstr; | 174 | $idnum[$idnum]=$idstr; |
156 | 175 | ||
157 | $source{$idstr}=$src; | 176 | $source{$idstr}=$src; |
158 | $dest{$idstr}=$dest; | 177 | $dest{$idstr}=$dest; |
159 | $voice{$idstr}=$voice; | 178 | $voice{$idstr}=$voice; |
160 | 179 | ||
161 | if($verbose) { | 180 | if($verbose) { |
162 | print "id: $phrase{id}\n"; | 181 | print "id: $phrase{id} ($idnum)\n"; |
163 | print "source: $src\n"; | 182 | print "source: $src\n"; |
164 | print "dest: $dest\n"; | 183 | print "dest: $dest\n"; |
165 | print "voice: $voice\n"; | 184 | print "voice: $voice\n"; |
166 | } | 185 | } |
167 | 186 | ||
168 | $idcount++; | ||
169 | |||
170 | undef $src; | 187 | undef $src; |
171 | undef $dest; | 188 | undef $dest; |
172 | undef $voice; | 189 | undef $voice; |
@@ -208,7 +225,16 @@ print HFILE <<MOO | |||
208 | MOO | 225 | MOO |
209 | ; | 226 | ; |
210 | 227 | ||
211 | # TODO: add voice-only phrase IDs here | 228 | # Output the ID names for the enum in the header file |
229 | my $i; | ||
230 | for $i (0x8000 .. ($voiceid-1)) { | ||
231 | my $name=$idnum[$i]; # get the ID name | ||
232 | |||
233 | $name =~ s/\"//g; # cut off the quotes | ||
234 | |||
235 | printf HFILE (" %s,\n", $name); | ||
236 | } | ||
237 | |||
212 | 238 | ||
213 | # Output end of enum | 239 | # Output end of enum |
214 | print HFILE <<MOO | 240 | print HFILE <<MOO |