blob: 3a524d2adb1b52be6f4d2556ee230735e1b420a2 [file] [log] [blame]
Douglas Gregordf8c96b2009-06-13 06:06:53 +00001#!/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.
6use English;
7
8$current_indent_level = -4;
9while ($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}