Merge pull request #2301 from sonndinh/remove-dup-reactor-functions
[ACE_TAO.git] / ACE / bin / clean_dsp.pl
blobb95f41abd0eba7640d7075d98c82e872f90e48ff
1 # DSP cleaner
3 $if_depth = 0;
4 @saved_lines = ();
5 $dirty = 0;
6 $in_dependency = 0;
8 die "Not enough args" if ($#ARGV < 0);
10 open (FILE, "<$ARGV[0]");
12 loop: while (<FILE>)
14 # Check for dependency information
16 if (/^DEP/ || /^NODEP/) {
17 $in_dependency = 1;
20 if ($in_dependency) {
21 $in_dependency = 0 if (!/\\$/);
22 goto loop;
25 # Check for empty !IF blocks
27 if (/^\!IF/) {
28 ++$if_depth;
31 push @saved_lines, $_
32 if ($if_depth > 0);
34 if (/^\!ENDIF/) {
35 --$if_depth;
36 print @saved_lines
37 if ($if_depth == 0 && $dirty == 1);
38 @saved_lines = ();
39 $dirty = 0;
41 elsif ($if_depth == 0) {
42 print;
45 $dirty = 1
46 if ($if_depth > 0 && !/^\!/ && !/^\s+$/);
51 close (FILE);