Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14:21

0001 #!/ usr / bin / perl
0002 
0003 #For full function lowercasing
0004 #@headers = grep{chomp; $_ !~m !(attic | Ice | CMS - 2017 | MatriplexCommon | binnor) !; } `find.- name \*.h`;
0005 
0006 #For MkFinder cleanup
0007 @headers = map {
0008   "MkFitCore/src/Mk$_.h";
0009 }
0010 qw{Base Fitter Finder};
0011 
0012 #$TARGET = "functions";
0013 $TARGET = "data-members";
0014 
0015 # 1. Grep for classes, structs - so we don't try to fix ctors and dtors.
0016 
0017 % ClassesStructs = ();
0018 % Funcs = ();
0019 
0020 % HeaderText = ();
0021 
0022 for
0023   my $h(@headers) {
0024 #local $ / = undef;
0025     open F, $h;
0026     my @lines = <F>;
0027     close F;
0028 
0029 #filter out  //-style commented lines
0030     @lines = grep {
0031       $_ !~m !^\s*  //!o; } @lines;
0032 
0033           if ($TARGET eq "data-members") {
0034 #fileter out class / struct declarations(also forward decls)
0035         @lines = grep {
0036           $_ !~m !^\s*(class | struct)\s\w !o;
0037         }
0038         @lines;
0039       }
0040 
0041       my $f = join( '', @lines);
0042 
0043 #filter out /*-style commented code
0044     $f =~ s!/\*.*?\*/ \
0045     !!omsg;
0046 
0047       if ($TARGET eq "data-members") {
0048 #fileter out default value assignments
0049         $f = ~s !\s *=\s *\w +\s*;
0050         !;
0051         !omsg;
0052       }
0053 
0054       my @css = $f = ~m /\s(?: class | struct)\s + (\w +) / omsg;
0055 
0056 #print "In $h: ", join(" ", @css), "\n";
0057 
0058     for
0059       my $cs(@css) { $ClassesStructs{$cs} = 1; }
0060 
0061     $HeaderText{$h} = $f;
0062     }
0063 
0064 # 2. Grep for stuff that looks like fuctions and starts with a capital letter
0065     if ($TARGET eq "functions") {
0066     for
0067       my $h(keys % HeaderText) {
0068         my @foos = $HeaderText{$h} =~ m/\s([A-Z]\w+)\([^)]*\)\s*(?:const)?\s*(?:;|{)/omsg;
0069 
0070 #print "In $h: ", join(" ", @foos), "\n";
0071 
0072             my @ffoos;
0073         for
0074           my $foo(@foos) {
0075             next if exists $ClassesStructs{$foo};
0076             next if exists $Funcs{$foo};
0077             $Funcs{$foo} = 1;
0078 
0079 #Needed just for printout
0080             push @ffoos, $foo;
0081           }
0082 
0083         if (scalar @ffoos) {
0084           print "# In $h:\n  ", join("\n  ", @ffoos), "\n";
0085         }
0086     }
0087       }
0088 
0089 # 3. Grep for stuff that looks like data members
0090     elsif($TARGET eq "data-members") {
0091     for
0092       my $h(keys % HeaderText) {
0093 #my @mmbs = $HeaderText{$h } = ~m / ^\s*(?: [\w <>]\s +) + (\w +)(?:\s *\[[\w +:]\]) *\s*; / omg;
0094         my @mmbs = $HeaderText{$h} = ~m / (?: [\w<>] +)\s[&*] ? (\w +)(?:\s *\[[\w:] +\]) *\s*;
0095         / omg;
0096 
0097         print "In $h: ", join(" ", @mmbs), "\n";
0098       }
0099     }
0100     else {
0101       die "Unsupported TARGET $TARGET";
0102     }