remove unused functions

This commit is contained in:
Andras Timar 2011-05-17 18:29:40 +02:00
parent d40a49f73e
commit 45942b26d9

View file

@ -324,18 +324,6 @@ sub merge_gsicheck{
}
$sdffile = $tmpfile;
}
#########################################################
# find search function
sub wanted
{
my $file = $File::Find::name;
if( -f $file && $file =~ /.*localize.sdf$/ && !( $file =~ /.*\.svn.*/ ) ) {
push @sdfparticles , $file;
if( $bVerbose eq "1" ) { print STDOUT "$file\n"; }
else { print "."; }
}
}
sub add_paths
{
my $langhash_ref = shift;
@ -620,146 +608,8 @@ sub collectfiles{
#print STDOUT "DBG: \$localizeSDF $localizeSDF \$particleSDF_merged $particleSDF_merged\n";
unlink $localizeSDF , $particleSDF_merged , $my_localize_log;
#sort_outfile( $outputfile );
#remove_obsolete( $outputfile ) , if $bHasSourceLanguage ne "";
}
#########################################################
sub remove_obsolete{
my $outfile = shift;
my @lines;
my $enusleftpart;
my @good_lines;
print STDOUT "### Removing obsolete strings\n";
# Kick out all strings without en-US reference
if ( open ( SORTEDFILE , "< $outfile" ) ){
while( <SORTEDFILE> ){
if( /$sdf_regex/ ){
my $line = defined $_ ? $_ : '';
my $language = defined $12 ? $12 : '';
my $prj = defined $3 ? $3 : '';
my $file = defined $4 ? $4 : '';
my $type = defined $6 ? $6 : '';
my $gid = defined $7 ? $7 : '';
my $lid = defined $8 ? $8 : '';
my $plattform = defined $10 ? $10 : '';
my $helpid = defined $9 ? $9 : '';
my $leftpart = $prj.$gid.$lid.$file.$type.$plattform.$helpid;
if( $language eq "en-US" ){ # source string found, 1. entry
$enusleftpart = $leftpart;
push @good_lines , $line;
}else{
if( !defined $enusleftpart or !defined $leftpart ){
print STDERR "BADLINE: $line\n";
print STDERR "\$enusleftpart = $enusleftpart\n";
print STDERR "\$leftpart = $leftpart\n";
}
if( $enusleftpart eq $leftpart ){ # matching language
push @good_lines , $line;
}
#else{
# print STDERR "OUT: \$enusleftpart=$enusleftpart \$leftpart=$leftpart \$line=$line\n";
#}
}
}
}
close SORTEDFILE;
} else { print STDERR "ERROR: Can't open file $outfile\n";}
# Write file
if ( open ( SORTEDFILE , "> $outfile" ) ){
foreach my $newline ( @good_lines ) {
print SORTEDFILE $newline;
}
close SORTEDFILE;
} else { print STDERR "ERROR: Can't open file $outfile\n";}
}
#########################################################
sub sort_outfile{
my $outfile = shift;
print STDOUT "### Sorting ... $outfile ...";
my @lines;
my @sorted_lines;
#if ( open ( SORTEDFILE , "< $outputfile" ) ){
if ( open ( SORTEDFILE , "< $outfile" ) ){
my $line;
while ( <SORTEDFILE> ){
$line = $_;
if( $line =~ /^[^\#]/ ){
push @lines , $line;
}
}
close SORTEDFILE;
@sorted_lines = sort {
my $xa_lang = "";
my $xa_left_part = "";
my $xa_right_part = "";
my $xa_timestamp = "";
my $xb_lang = "";
my $xb_left_part = "";
my $xb_right_part = "";
my $xb_timestamp = "";
my $xa = "";
my $xb = "";
my @alist;
my @blist;
if( $a=~ /$sdf_regex/ ){
$xa_left_part = defined $2 ? $2 : '';
$xa_lang = defined $12 ? $12 : '';
$xa_right_part = defined $13 ? $13 : '';
$xa_left_part = remove_last_column( $xa_left_part );
}
if( $b=~ /$sdf_regex/ ){
$xb_left_part = defined $2 ? $2 : '';
$xb_lang = defined $12 ? $12 : '';
$xb_right_part = defined $13 ? $13 : '';
$xb_left_part = remove_last_column( $xb_left_part );
}
if( ( $xa_left_part cmp $xb_left_part ) == 0 ){ # Left part equal
if( ( $xa_lang cmp $xb_lang ) == 0 ){ # Lang equal
return ( $xa_right_part cmp $xb_right_part ); # Right part compare
}
elsif( $xa_lang eq "en-US" ) { return -1; } # en-US wins
elsif( $xb_lang eq "en-US" ) { return 1; } # en-US wins
else { return $xa_lang cmp $xb_lang; } # lang compare
}
else {
return $xa_left_part cmp $xb_left_part; # Left part compare
}
} @lines;
if ( open ( SORTEDFILE , "> $outfile" ) ){
print SORTEDFILE get_license_header();
foreach my $newline ( @sorted_lines ) {
print SORTEDFILE $newline;
#print STDOUT $newline;
}
}
close SORTEDFILE;
} else { print STDERR "WARNING: Can't open file $outfile\n";}
print "done\n";
}
#########################################################
sub remove_last_column{
my $string = shift;
my @alist = split ( "\t" , $string );
pop @alist;
return join( "\t" , @alist );
}
#########################################################
sub rename_language{
my $fallbackhashhash_ref = shift;