made wmlxgettext to restore the textdomain on #enddef,

...to match the new preprocessor behaviour
This commit is contained in:
Yann Dirson 2005-05-08 12:30:04 +00:00
parent 876d57c1d6
commit dda5cb55ba

View file

@ -28,10 +28,21 @@ foreach my $file (@ARGV) {
open (FILE, "<$file") or die "cannot read from $file";
my $readingattack = 0;
my @domainstack = ($initialdomain);
my ($is_define, $macro_has_textdomain) = (0, 0);
LINE: while (<FILE>) {
# record a #define scope
if (m/\#define\>/) {
$is_define = 1; $macro_has_textdomain = 0;
next LINE;
} elsif (m/\#enddef\>/) {
$is_define = 0;
if ($macro_has_textdomain) { shift @domainstack; };
}
# change the current textdomain when hitting the directive
if (m/\s*\#textdomain\s+(\S+)/) {
if (m/\#textdomain\s+(\S+)/) {
unshift @domainstack, $1;
if ($is_define) { $macro_has_textdomain = 1; };
next LINE;
}