Move rename.pl to scripts & add data file

This commit is contained in:
Manuel Pégourié-Gonnard 2015-04-08 14:56:51 +02:00
parent d759d7d720
commit b20a70fcc7
4 changed files with 2206 additions and 15 deletions

View file

@ -48,7 +48,7 @@ if (@ARGV >= 2 && $ARGV[0] eq "-f") {
} else { } else {
if (! -f $config_file) { if (! -f $config_file) {
chdir '..' or die; chdir '..' or die;
-d $config_file -f $config_file
or die "Without -f, must be run from root or scripts\n" or die "Without -f, must be run from root or scripts\n"
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,23 +1,33 @@
#!/usr/bin/perl #!/usr/bin/perl
# rename identifiers (functions, types, enum constant, etc)
# on upgrades of major version according to a list
use warnings; use warnings;
use strict; use strict;
use utf8; use utf8;
use open qw(:std utf8); use open qw(:std utf8);
# apply substitutions from the table in the first arg to files my $usage = "Usage: $0 [-f datafile] [-s] [--] [filenames...]\n";
# expected usage: via invoke-rename.pl
(my $datafile = $0) =~ s/(rename-1\.3-2\.0)\.pl$/data_files\/$1.txt/;
my $do_strings = 0; my $do_strings = 0;
if( $ARGV[0] eq "-s" ) {
shift; while( @ARGV && $ARGV[0] =~ /^-/ ) {
$do_strings = 1; my $opt = shift;
if( $opt eq '--' ) {
last;
} elsif( $opt eq '-f' ) {
$datafile = shift;
} elsif( $opt eq '-s' ) {
$do_strings = 1; shift;
} else {
die $usage;
}
} }
die "Usage: $0 [-s] names-file [filenames...]\n" if( @ARGV < 1 or ! -r $ARGV[0] ); open my $nfh, '<', $datafile or die "Could not read $datafile\n";
open my $nfh, '<', shift or die;
my @names = <$nfh>; my @names = <$nfh>;
close $nfh or die; close $nfh or die;

View file

@ -8,9 +8,10 @@ set -eu
tmp/analyze-names.sh tmp/analyze-names.sh
tmp/makelist.pl public-names extra-names > old2new tmp/makelist.pl public-names extra-names > old2new
tmp/rename.pl old2new library/*.c tests/suites/* \ scripts/rename.pl -f old2new \
configs/* scripts/data_files/*.fmt library/*.c tests/suites/* configs/* scripts/data_files/*.fmt
tmp/rename.pl -s old2new library/error.c library/version_features.c \ scripts/rename.pl -f old2new -s \
library/error.c library/version_features.c \
library/memory_buffer_alloc.c include/mbedtls/*.h \ library/memory_buffer_alloc.c include/mbedtls/*.h \
library/ecp.c library/ssl_???.c tests/ssl-opt.sh \ library/ecp.c library/ssl_???.c tests/ssl-opt.sh \
programs/*.c programs/*/*.c scripts/* tests/scripts/* programs/*.c programs/*/*.c scripts/* tests/scripts/*