Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (46 sloc) 1.646 kb
586d47d @jtappin New USE generation tools.
jtappin authored
1 #!/usr/bin/env perl
2
3 # Copyright (C) 2012
4 # Free Software Foundation, Inc.
5 #
6 # This file is part of the gtk-fortran gtk+ Fortran Interface library.
7 #
8 # This is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3, or (at your option)
11 # any later version.
12 #
13 # This software 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
16 # GNU General Public License for more details.
17 #
18 # Under Section 7 of GPL version 3, you are granted additional
19 # permissions described in the GCC Runtime Library Exception, version
20 # 3.1, as published by the Free Software Foundation.
21 #
22 # You should have received a copy of the GNU General Public License along with
23 # this program; see the files COPYING3 and COPYING.RUNTIME respectively.
24 # If not, see <http://www.gnu.org/licenses/>.
25 #
26 # Contributed by James Tappin 8/14/2012.
27
28
29 # Find the enumerator constants in a fortran source file and write
30 # them out to a simple list.
31
32 use Getopt::Long;
33
34 my $infile="gtkenums-auto.f90";
35 my $outfile="gtk-enumerators.lis";
36
37 my $str;
38 my $count = 0;
39
40 GetOptions('in=s' => \$infile,
41 'out=s' => \$outfile);
42
43 open(IN, $infile) || die "Failed to open input $infile: $!\n";
44 open(OUT, ">$outfile") || die "Failed to open output $outfile: $!\n";
45
46 while (<IN>) {
47 chomp;
48 $_ = lc;
49 /\s*enumerator\s*::\s*(\w+).*/ || next;
50 $count++;
51 print OUT "$1\n";
52 }
53
54 print "Found $count enumerator constants\n";
55
56 close(OUT);
57 close(IN);
Something went wrong with that request. Please try again.