OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [libiberty/] [gather-docs] - Blame information for rev 828

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.