Mercurial > hg > CbC > CbC_gcc
annotate libiberty/gather-docs @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
rev | line source |
---|---|
0 | 1 #!/usr/bin/perl |
2 # -*- perl -*- | |
3 | |
145 | 4 # Copyright (C) 2001-2020 Free Software Foundation, Inc. |
0 | 5 # |
6 # This file is part of the libiberty library. | |
7 # Libiberty is free software; you can redistribute it and/or | |
8 # modify it under the terms of the GNU Library General Public | |
9 # License as published by the Free Software Foundation; either | |
10 # version 2 of the License, or (at your option) any later version. | |
11 # | |
12 # Libiberty is distributed in the hope that it will be useful, | |
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 # Library General Public License for more details. | |
16 # | |
17 # You should have received a copy of the GNU Library General Public | |
18 # License along with libiberty; see the file COPYING.LIB. If not, | |
19 # write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, | |
20 # Boston, MA 02110-1301, USA. | |
21 # | |
22 # Originally written by DJ Delorie <dj@redhat.com> | |
23 | |
24 | |
25 | |
26 # This program looks for texinfo snippets in source files and other | |
27 # files, and builds per-category files with entries sorted in | |
28 # alphabetical order. | |
29 | |
30 # The syntax it looks for is lines starting with '@def' in *.c and | |
31 # other files (see TEXIFILES in Makefile.in). Entries are terminated | |
32 # at the next @def* (which begins a new entry) or, for C files, a line | |
33 # that begins with '*/' without leading spaces (this assumes that the | |
34 # texinfo snippet is within a C-style /* */ comment). | |
35 | |
36 # | |
37 | |
38 | |
39 | |
40 if ($ARGV[0] eq "-v") { | |
41 $verbose = 1; | |
42 shift; | |
43 } | |
44 | |
45 $srcdir = shift; | |
46 $outfile = shift; | |
47 | |
48 if ($outfile !~ /\S/ || ! -f "$srcdir/Makefile.in" ) { | |
49 print STDERR "Usage: gather-docs [-v] srcdir outfile.txi [files with snippets in them ...]\n"; | |
50 exit 1; | |
51 } | |
52 | |
53 $errors = 0; | |
54 | |
55 for $in (@ARGV) { | |
56 | |
57 if (!open(IN, "$srcdir/$in")) { | |
58 print STDERR "Cannot open $srcdir/$in for reading: $!\n"; | |
59 $errors ++; | |
60 | |
61 } else { | |
62 $first = 1; | |
63 $pertinent = 0; | |
64 $man_mode = 0; | |
65 $line = 0; | |
66 | |
67 while (<IN>) { | |
68 $line ++; | |
69 $pertinent = 1 if /^\@def[a-z]*[a-wyz] /; | |
70 $pertinent = 0 if /^\*\//; | |
71 next unless $pertinent; | |
72 | |
73 if (/^\@def[a-z]*[a-wyz] /) { | |
74 | |
67
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
75 ($name) = m/[^\(]* ([^\( \t\r\n\@]+) *(\(|\@?$)/; |
f6334be47118
update gcc from gcc-4.6-20100522 to gcc-4.6-20110318
nobuyasu <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
76 $name =~ s/[ ]*\@?$//; |
0 | 77 $key = $name; |
78 $key =~ tr/A-Z/a-z/; | |
79 $key =~ s/[^a-z0-9]+/ /g; | |
80 $name{$key} = $node; | |
81 $lines{$key} = ''; | |
82 $src_file{$key} = $in; | |
83 $src_line{$key} = $line; | |
84 print "\nReading $in :" if $verbose && $first; | |
85 $first = 0; | |
86 print " $name" if $verbose; | |
87 $node_lines{$key} .= $_; | |
88 | |
89 } else { | |
90 $node_lines{$key} .= $_; | |
91 } | |
92 | |
93 $pertinent = 0 if /^\@end def/; | |
94 } | |
95 close (IN); | |
96 } | |
97 } | |
98 | |
99 print "\n" if $verbose; | |
100 exit $errors if $errors; | |
101 | |
102 if (!open (OUT, "> $outfile")) { | |
103 print STDERR "Cannot open $outfile for writing: $!\n"; | |
104 $errors ++; | |
105 next; | |
106 } | |
107 print "Writing $outfile\n" if $verbose; | |
108 | |
109 print OUT "\@c Automatically generated from *.c and others (the comments before\n"; | |
110 print OUT "\@c each entry tell you which file and where in that file). DO NOT EDIT!\n"; | |
111 print OUT "\@c Edit the *.c files, configure with --enable-maintainer-mode,\n"; | |
55
77e2b8dfacca
update it from 4.4.3 to 4.5.0
ryoma <e075725@ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
112 print OUT "\@c run 'make stamp-functions' and gather-docs will build a new copy.\n\n"; |
0 | 113 |
114 for $key (sort keys %name) { | |
115 print OUT "\@c $src_file{$key}:$src_line{$key}\n"; | |
116 print OUT $node_lines{$key}; | |
117 print OUT "\n"; | |
118 } | |
119 | |
120 if (! print OUT "\n") { | |
121 print STDERR "Disk full writing $srcdir/$cat.texi\n"; | |
122 $errors ++; | |
123 } | |
124 | |
125 close (OUT); | |
126 | |
127 exit $errors; |