ada: Fix Ada.Text_IO.Delete with "encoding=8bits" form
[official-gcc.git] / contrib / make-obstacks-texi.pl
blob63a0bac0b7099362186378fec4eb1c23f856e691
1 #!/usr/bin/perl -w
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
10 use strict;
11 use File::Basename;
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";
20 exit 1;
23 open (IN, "<$ARGV[0]") || die "Cannot open '$ARGV[0]': $!";
24 my $data = join ("", <IN>);
25 close (IN);
27 $data =~ s/.*\@node Obstacks\n/\@node Obstacks\n/s;
28 $data =~ s/\n\@node [^\n]+\n\@subsection.*/\n/s;
30 # Add refs to GLIBC
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) {
38 $node =~ s/\@node //;
39 $node =~ s/,.*//;
40 $node =~ s/ / *\n?/g;
41 chomp ($node);
43 $data =~ s/(\@p?xref{$node), , , libc, The GNU C Library Reference Manual}/$1}/gsi;
46 print $data;