make_test_dirs.pl 663 B

123456789101112131415161718192021222324252627
  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. $current_indent_level = -4;
  8. while ($line = <STDIN>) {
  9. $line =~ /^\s*/;
  10. $next_indent_level = length($MATCH);
  11. if ($line =~ /\[([^\]]*)\]/) {
  12. my $section = $1;
  13. while ($next_indent_level < $current_indent_level) {
  14. chdir("..");
  15. $current_indent_level -= 4;
  16. }
  17. if ($next_indent_level == $current_indent_level) {
  18. chdir("..");
  19. } else {
  20. $current_indent_level = $next_indent_level;
  21. }
  22. mkdir($section);
  23. chdir($section);
  24. }
  25. }