123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
- if 0;
- BEGIN
- {
- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
- unshift @INC, $pkgdatadir;
-
-
-
-
- $ENV{'SHELL'} = '@SHELL@' if ($^O eq 'dos');
- }
- use Autom4te::General;
- use Autom4te::XFile;
- use Autom4te::FileUtils;
- $help = "Usage: $0 [OPTION]... [FILE]...
- Scan all of the C source FILES (or the standard input, if none are
- given) and write to the standard output a sorted list of all the
- identifiers that appear in those files in `#if', `#elif', `#ifdef', or
- `#ifndef' directives. Print each identifier on a line, followed by a
- space-separated list of the files in which that identifier occurs.
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- Report bugs to <bug-autoconf\@gnu.org>.
- GNU Autoconf home page: <http://www.gnu.org/software/autoconf/>.
- General help using GNU software: <http://www.gnu.org/gethelp/>.
- ";
- $version = "ifnames (@PACKAGE_NAME@) @VERSION@
- Copyright (C) @RELEASE_YEAR@ Free Software Foundation, Inc.
- License GPLv3+/Autoconf: GNU GPL version 3 or later
- <http://gnu.org/licenses/gpl.html>, <http://gnu.org/licenses/exceptions.html>
- This is free software: you are free to change and redistribute it.
- There is NO WARRANTY, to the extent permitted by law.
- Written by David J. MacKenzie and Paul Eggert.
- ";
- sub parse_args ()
- {
- getopt ();
- }
- my %occurrence;
- sub scan_file ($)
- {
- my ($file_name) = @_;
- my $file = new Autom4te::XFile ("< " . open_quote ($file_name));
- while ($_ = $file->getline)
- {
-
- $_ .= $file->getline
- while (s/\\$//);
-
- if (s/^\s*\#\s*(if|ifdef|ifndef|elif)\s+//)
- {
-
- s(/\*.*?\*/)();
- s(/\*.*)();
- s(//.*)();
- foreach my $word (split (/\W+/))
- {
- next
- if $word eq 'defined' || $word !~ /^[a-zA-Z_]/;
- $occurrence{$word}{$file_name} = 1;
- }
- }
- }
- }
- parse_args();
- foreach (@ARGV)
- {
- scan_file ($_);
- }
- foreach (sort keys %occurrence)
- {
- print "$_ ", join (' ', sort keys %{$occurrence{$_}}), "\n";
- }
|