summaryrefslogtreecommitdiff
path: root/tools/genlang
diff options
context:
space:
mode:
Diffstat (limited to 'tools/genlang')
-rwxr-xr-xtools/genlang30
1 files changed, 24 insertions, 6 deletions
diff --git a/tools/genlang b/tools/genlang
index 34f0612852..8be9b63d45 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -294,7 +294,7 @@ my $voiceid=0x8000; # counter for voice-only ID numbers
294# Now start the scanning of the selected language string 294# Now start the scanning of the selected language string
295# 295#
296 296
297open(LANG, "<$input"); 297open(LANG, "<$input") || die "couldn't read language file named $input\n";
298my @phrase; 298my @phrase;
299while(<LANG>) { 299while(<LANG>) {
300 300
@@ -329,16 +329,32 @@ while(<LANG>) {
329 my $idnum; 329 my $idnum;
330 330
331 if($dest =~ /^none\z/i) { 331 if($dest =~ /^none\z/i) {
332 # "none" as dest means that this entire phrase is to be 332 # "none" as dest (without quotes) means that this entire
333 # ignored 333 # phrase is to be ignored
334 #print "dest is NONE!\n";
335 } 334 }
336 else { 335 else {
336 # allow the keyword 'deprecated' to be used on dest and
337 # voice strings to mark that as deprecated. It will then
338 # be replaced with "".
339
340 $dest =~ s/^deprecate(|d)\z/\"\"/i;
341 $voice =~ s/^deprecate(|d)\z/\"\"/i;
337 342
338 # Use the ID name to figure out which id number range we 343 # Use the ID name to figure out which id number range we
339 # should use for this phrase. Voice-only strings are 344 # should use for this phrase. Voice-only strings are
340 # separated. 345 # separated.
341 346
347 # basic syntax error alerts
348 if($dest != /^\"/) {
349 print STDERR "dest around line $line lacks quotes!\n";
350 }
351 if($src != /^\"/) {
352 print STDERR "source around line $line lacks quotes!\n";
353 }
354 if($voice != /^\"/) {
355 print STDERR "voice around line $line lacks quotes!\n";
356 }
357
342 if($idstr =~ /^VOICE/) { 358 if($idstr =~ /^VOICE/) {
343 $idnum = $voiceid++; 359 $idnum = $voiceid++;
344 } 360 }
@@ -420,8 +436,10 @@ if($update) {
420if($prefix) { 436if($prefix) {
421 # We create a .c and .h file 437 # We create a .c and .h file
422 438
423 open(HFILE, ">$prefix.h"); 439 open(HFILE, ">$prefix.h") ||
424 open(CFILE, ">$prefix.c"); 440 die "couldn't create file $prefix.h\n";
441 open(CFILE, ">$prefix.c") ||
442 die "couldn't create file $prefix.c\n";
425 443
426 print HFILE <<MOO 444 print HFILE <<MOO
427/* This file was automatically generated using genlang2 */ 445/* This file was automatically generated using genlang2 */