Changeset 3422


Ignore:
Timestamp:
2002-09-11T11:35:28+12:00 (22 years ago)
Author:
jrm21
Message:

Added new languages to be checked.

Cleaned up reg exps as some whitespace isn't necessary.

Use package names as well, as some macros are duplicated in different
packages.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/macros/Chktrans.pl

    r1099 r3422  
    33use strict;
    44
    5 my @languages = ("chinese", "french", "german", "maori");
     5my @languages = ("chinese", "french", "german", "maori", "spanish", "turkish");
    66
    77print "
     
    2929my $count = 0;
    3030my %macro;
    31 
     31my $package="";
    3232while (<E>) {
    3333    chomp;
    3434    $line = $_;
    35 
    36     next unless ($line =~ /^_\w+_ +\{/);
    37    
    38     $line =~ s/ +\{.*//;
    39     $macro{$line} = 1;
     35    if ($line =~ /^package\s+(\w+)/) {
     36    $package="$1:";
     37    next;
     38    }
     39    next unless ($line =~ /^_\w+_ *\{/);
     40    # don't necessarily have space between macro and { - eg _macro_{content}
     41    $line =~ s/_\s*\{.*/_/;
     42    $macro{"$package$line"} = 1;
    4043    $count++;
    4144}
     
    6164    my (%lm, %lmnew, %lr, %lrnew);
    6265    my $lc = 0;
     66    $package = "";
    6367    while (<L>) {
    6468    chomp;
    6569    $line = $_;
    6670   
     71    if ($line =~ /^package\s+(\w+)/) {
     72        $package="$1:";
     73        next;
     74    }
    6775    next unless ($line =~ /^_\w+_/);
    6876    next unless ($line =~ /\{/);
    6977   
    70     $line =~ s/ +\{.*//;
     78    $line =~ s/_\s*\{.*/_/;
    7179    # There are four types of macro, the combos of:
    7280    #  With or without macro country code
    7381    #  Present or not present in %macro
    7482    if ($line =~ /\[/) {
    75         $line =~ s/ .*//;
    76         if (defined($macro{$line})) {
    77         $lm{$line} = $line;
     83# don't need a space between macro and arg (_macro_[args])
     84#       $line =~ s/\s.*//;
     85        $line =~ s/\s*\[.*//;
     86        my $thismacro="$package$line";
     87        if (defined($macro{$thismacro})) {
     88        $lm{$thismacro} = $thismacro;
    7889        } else {
    79         $lmnew{$line} = $line;
     90        $lmnew{$thismacro} = $thismacro;
    8091        }
    8192    } else {
    82         if (defined($macro{$line})) {
    83         $lr{$line} = $line;
     93        my $thismacro="$package$line";
     94        if (defined($macro{$thismacro})) {
     95        $lr{$thismacro} = $thismacro;
    8496        } else {
    85         $lrnew{$line} = $line;
     97        $lrnew{$thismacro} = $thismacro;
    8698        }
    8799    }
Note: See TracChangeset for help on using the changeset viewer.