3 # (C) 2013 Free Software Foundation
4 # Contributed by Tobias Burnus
6 # This script is Free Software, and it can be copied, distributed and
7 # modified as defined in the GNU General Public License. A copy of
8 # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
14 if ($#ARGV != 0 or $ARGV[0] eq "") {
15 my $name = basename
($0);
17 print "\nUSAGE: `$name` memory.texi\n\n";
18 print "Reads GLIBC's manual/memory.texi and extracts the obstacks section\n"
19 ."Redirect the output to update GCC's libiberty/obstacks.texi\n\n";
23 open (IN
, "<$ARGV[0]") || die "Cannot open '$ARGV[0]': $!";
24 my $data = join ("", <IN
>);
27 $data =~ s/.*\@node Obstacks\n/\@node Obstacks\n/s;
28 $data =~ s/\n\@node [^\n]+\n\@subsection.*/\n/s;
31 $data =~ s/(\@p?xref{[^}]*)}/$1, , , libc, The GNU C Library Reference Manual}/gs;
34 # And undo the refs which are in this file
35 my @nodes = grep /^\@node /, (split /\n/, $data);
37 foreach my $node (@nodes) {
43 $data =~ s/(\@p?xref{$node), , , libc, The GNU C Library Reference Manual}/$1}/gsi;