Merge pull request #2240 from DOCGroup/revert-2239-jwi-pi23
[ACE_TAO.git] / ACE / bin / indent_macros.pl
blobed1330d74cc4948233247e0e3ff9c629b5e08e63
1 eval '(exit $?0)' && eval 'exec perl -i -S $0 ${1+"$@"}'
2 & eval 'exec perl -i -S $0 $argv:q'
3 if 0;
6 # This perl script re-arrange the macro indentation so it's easier to
7 # see the layering relationship.
9 $lineno = 0;
10 $indent = 0;
12 sub inc_indent
14 $indent += 2;
17 sub dec_indent
19 $indent -= 2;
22 sub get_indent
24 $retv = 0;
25 print STDERR "$0 (", $lineno, "): Unbalanced macro pairs\n" if ($indent < 0);
26 $retv = $indent - 1 if ($indent > 0);
27 $retv;
30 while (<>) {
31 $lineno++;
32 if (/^[ \t]*\#[ \t]*((if|el|en|).*)/)
34 $cont = $1;
35 $temp = $2;
36 if ($temp =~ /if/) {
37 print "#", " " x &get_indent (), $cont,"\n";
38 inc_indent ();
40 elsif ($temp =~ /el/) {
41 dec_indent ();
42 print "#", " " x &get_indent (), $cont,"\n";
43 inc_indent ();
45 elsif ($temp =~ /en/) {
46 dec_indent ();
47 print "#", " " x &get_indent (), $cont,"\n";
49 else {
50 print "#", " " x &get_indent (), $cont,"\n";
53 else {
54 print $_;
58 die ("$0 (EOF): Unbalanced macro pairs\n") if ($indent != 0);