Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.0.x
[OpenFOAM-2.0.x.git] / doc / tools / find-retagged
blobbde54a1b9df98e8c30355c7eacb0bcb9044b2da6
1 #!/usr/bin/perl -w
2 use strict;
3 use File::Find ();
5 # -----------------------------------------------------------------------------
7 # Script
8 # find-retagged
10 # Description
11 # Search for *.[H] files with 'InClass', 'InNamespace' or 'Type'
12 # starting in the first column.
13 # In some places these could removed. In other places they should be
14 # replaced with a 'Typedef'
15 # - print filename and the tag (InClass|InNamespace|Type)
17 # -----------------------------------------------------------------------------
19 my $re_filespec = qr{^.+\.[H]$};
21 # for the convenience of &wanted calls, including -eval statements:
22 ## use vars qw( *name *dir *prune );
23 ## *name = *File::Find::name;
24 ## *dir = *File::Find::dir;
25 ## *prune = *File::Find::prune;
27 sub wanted {
28 unless ( lstat($_) and -f _ and -r _ and not -l _ and /$re_filespec/ ) {
29 return;
32 local @ARGV = $_;
33 while (<>) {
34 if (/^(InClass|InNamespace|Type)\s*$/) {
35 print "$File::Find::name $1 line=$.\n";
39 close ARGV;
42 ## Traverse desired filesystems
43 for my $dir (@ARGV) {
44 no warnings 'File::Find';
45 warn "(**) checking '$dir' ...\n";
46 File::Find::find( { wanted => \&wanted }, $dir );