blob: c2af9c485f93a92db6ad93562413ce2a40d7e502 [file] [log] [blame]
Harmen Stoppelsa54f1602021-02-25 11:31:42 +01001#!/usr/bin/env perl
Douglas Gregor7a1095f2009-06-13 06:06:53 +00002#
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;
Harmen Stoppelsa54f1602021-02-25 11:31:42 +01007use warnings;
Douglas Gregor7a1095f2009-06-13 06:06:53 +00008
9$current_indent_level = -4;
10while ($line = <STDIN>) {
11 $line =~ /^\s*/;
12 $next_indent_level = length($MATCH);
13 if ($line =~ /\[([^\]]*)\]/) {
14 my $section = $1;
15 while ($next_indent_level < $current_indent_level) {
16 chdir("..");
17 $current_indent_level -= 4;
18 }
19
20 if ($next_indent_level == $current_indent_level) {
21 chdir("..");
22 } else {
23 $current_indent_level = $next_indent_level;
24 }
25 mkdir($section);
26 chdir($section);
27 }
28}