#!/usr/bin/perl -s if(!$ARGV[0]) { print <] When running this program. .h and .c will be created in the "current directory". is "lang" by default. MOO ; exit; } my $prefix = $p; if(!$prefix) { $prefix="lang"; } my $input = $ARGV[0]; open(HFILE, ">$prefix.h"); open(CFILE, ">$prefix.c"); print HFILE <) { $line++; if($_ =~ / *\#/) { # comment next; } # get rid of DOS newlines $_ =~ s/\r//g; if($_ =~ / *([a-z]+): *(.*)/) { ($var, $value) = ($1, $2); # print "$var => $value\n"; $set{$var} = $value; if( (($var eq "new") && $value && ($value !~ /^\"(.*)\"\W*$/)) || (($var eq "voice") && $value && ($value !~ /^\"(.*)\"\W*$/)) || (($var eq "eng") && ($value !~ /^\"(.*)\"\W*$/)) ) { print "$input:$line:missing quotes for ".$set{'id'}."\n"; $errors++; next; } if($var eq "new") { # the last one for a single phrase if(!$value || ($value eq "\"\"") ) { # if not set, get the english version $value = $set{'eng'}; } # print "VOICE: ".$set{'voice'}." VALUE: $value\n"; # Note: if both entries are "", the string is deprecated, # but must be included to maintain compatibility if($set{'id'} =~ /^VOICE_/) { # voice-only push @vfile, $set{'id'}; } else { push @hfile, $set{'id'}; $value =~ s/^\"(.*)\"\W*$/\"$1\\0\"/; print CFILE " $value\n"; } undef %set; } } } close(LANG); for(@hfile) { print HFILE " $_,\n"; } print HFILE <