2 # Search for symbols which might need renaming
3 # (c) 2014 Martin Mares <mj@ucw.cz>
9 return if $sym =~ m{^(ucw|ucwlib)_};
16 open my $f, '<', $file or die;
19 # Interpret special comments
21 if (m{// API: (\w+)}) {
25 # Find things which look like top-level declarations
34 /^-/ and next; # Magic for ucw/getopt.h
35 /^\w+:/ and next; # Labels in inline functions
36 /^typedef\s/ and next;
38 /^(struct|union|enum)(\s+\w+)?(;|\s*{)/ and next;
42 # Try to parse the declaration
43 s{\[[^\]]*\]}{}g; # Delete array sizes
44 if (m{^extern [^,]*(\s+\**\w+(,\s+\**\w+)*);}) {
47 symbol $_ for grep { !/^$/ } split /\s+/, $x;
48 } elsif (m{( |\*)(\w+)\(}) {
58 my %blacklist = map { $_ => 1 } qw(
71 charset/charconv-gen.h
82 for my $f (<ucw/*.h>, <ucw/sorter/common.h>, <charset/*.h>, <images/*.h>) {
83 next if $blacklist{$f};