X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tools%2Fmap-symbols;h=94d3016dafc309938d3e9111b7beccb9ca813a39;hb=d9c55a4d021b4a317a25f14f89468d62592aae0b;hp=2089736393cbee5ed4f3bd140a012a0b63901411;hpb=c80c183d44ab8df878945183ca9e89739ec6cd5c;p=libucw.git diff --git a/tools/map-symbols b/tools/map-symbols index 20897363..94d3016d 100755 --- a/tools/map-symbols +++ b/tools/map-symbols @@ -1,15 +1,27 @@ #!/usr/bin/perl # Search for symbols which might need renaming -# (c) 2013 Martin Mares +# (c) 2014 Martin Mares use common::sense; +sub symbol { + my ($sym) = @_; + return if $sym =~ m{^(ucw|ucwlib)_}; + print "$sym\n"; +} + sub parse { my ($file) = @_; print "# $file\n"; open my $f, '<', $file or die; while (<$f>) { chomp; + # Interpret special comments + m{// NOAPI} and next; + if (m{// API: (\w+)}) { + print "$1\n"; + next; + } # Find things which look like top-level declarations s{//.*}{}; s{/\*.*}{}; @@ -32,9 +44,9 @@ sub parse { if (m{^extern [^,]*(\s+\**\w+(,\s+\**\w+)*);}) { my $x = $1; $x =~ s{[,*]}{}g; - print join("\n", grep { !/^$/ } split /\s+/, $x), "\n"; + symbol $_ for grep { !/^$/ } split /\s+/, $x; } elsif (m{( |\*)(\w+)\(}) { - print "$2\n"; + symbol($2); } else { print "??? $_\n"; } @@ -63,9 +75,11 @@ my %blacklist = map { $_ => 1 } qw( charset/U-lower.h charset/U-unacc.h charset/U-upper.h + images/image-walk.h + images/scale-gen.h ); -for my $f (, , ) { +for my $f (, , , ) { next if $blacklist{$f}; parse($f); }