Home | History | Annotate | Download | only in test
      1 #!/usr/bin/perl -w
      2 #
      3 # Simple little Perl script that takes the cxx-sections.data file as
      4 # input and generates a directory structure that mimics the standard's
      5 # structure.
      6 use English;
      7 
      8 $current_indent_level = -4;
      9 while ($line = <STDIN>) {
     10   $line =~ /^\s*/;
     11   $next_indent_level = length($MATCH);
     12   if ($line =~ /\[([^\]]*)\]/) {
     13     my $section = $1;
     14     while ($next_indent_level < $current_indent_level) {
     15       chdir("..");
     16       $current_indent_level -= 4;
     17     }
     18 
     19     if ($next_indent_level == $current_indent_level) {
     20       chdir("..");
     21     } else {
     22       $current_indent_level = $next_indent_level;
     23     }
     24     mkdir($section);
     25     chdir($section);
     26   }
     27 }
     28