/[autoconf]/autoconf/bin/autoscan.in
ViewVC logotype

Diff of /autoconf/bin/autoscan.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.82 by akim, Fri Sep 27 07:35:39 2002 UTC revision 1.83 by akim, Sat Sep 28 13:59:59 2002 UTC
# Line 37  use strict; Line 37  use strict;
37    
38  use vars qw(@cfiles @makefiles @shfiles %printed);  use vars qw(@cfiles @makefiles @shfiles %printed);
39    
40  # The list of C keywords.  # The kind of the words we are looking for.
 my %c_keywords = map { $_ => 1}  
   qw (int char float double struct union long short unsigned  
       auto extern register typedef static goto return sizeof break  
       continue if else for do while switch case default);  
   
41  my @kinds = qw (functions headers identifiers programs  my @kinds = qw (functions headers identifiers programs
42                  makevars libraries);                  makevars libraries);
43    
# Line 202  sub init_tables () Line 197  sub init_tables ()
197  }  }
198    
199    
200  # used($KIND, $WORD, [$WHERE])  # used ($KIND, $WORD, [$WHERE])
201  # ----------------------------  # -----------------------------
202  # $WORD is used as a $KIND.  # $WORD is used as a $KIND.
203  sub used ($$;$)  sub used ($$;$)
204  {  {
205    my ($kind, $word, $where) = @_;    my ($kind, $word, $where) = @_;
206    $where ||= "$File::Find::name:$.";    $where ||= "$File::Find::name:$.";
207    push (@{$used{$kind}{$word}}, $where);    if (
208          # Check for all the libraries.  But `-links' is certainly a
209          # `find' argument, and `-le', a `test' argument.
210          ($kind eq 'libraries' && $word !~ /^e|inks$/)
211          # Other than libraries are to be checked only if listed in
212          # the Autoscan library files.
213          || defined $macro{$kind}{$word}
214         )
215        {
216          push (@{$used{$kind}{$word}}, $where);
217        }
218  }  }
219    
220    
221    
222  ## ----------------------- ##  ## ----------------------- ##
223  ## Scanning source files.  ##  ## Scanning source files.  ##
224  ## ----------------------- ##  ## ----------------------- ##
225    
226    
227  # scan_c_file($FILENAME)  # scan_c_file ($FILENAME)
228  # ----------------------  # -----------------------
229  sub scan_c_file ($)  sub scan_c_file ($)
230  {  {
231    my ($filename) = @_;    my ($filename) = @_;
# Line 275  sub scan_c_file ($) Line 281  sub scan_c_file ($)
281        # Maybe we should ignore function definitions (in column 0)?        # Maybe we should ignore function definitions (in column 0)?
282        while (s/\b([a-zA-Z_]\w*)\s*\(/ /)        while (s/\b([a-zA-Z_]\w*)\s*\(/ /)
283          {          {
284            used ('functions', $1)            used ('functions', $1);
             if !$c_keywords{$1};  
285          }          }
286        while (s/\b([a-zA-Z_]\w*)\b/ /)        while (s/\b([a-zA-Z_]\w*)\b/ /)
287          {          {
288            used ('identifiers', $1)            used ('identifiers', $1);
             if !$c_keywords{$1};  
289          }          }
290      }      }
291    
# Line 440  sub output_kind ($$) Line 444  sub output_kind ($$)
444      if exists $kind_comment{$kind};      if exists $kind_comment{$kind};
445    foreach my $word (sort keys %{$used{$kind}})    foreach my $word (sort keys %{$used{$kind}})
446      {      {
       # Words that were caught, but not to be checked according to the  
       # autoscan library files.  
       next  
         if ! exists $macro{$kind}{$word};  
   
447        # Output the needed macro invocations in $configure_scan if not        # Output the needed macro invocations in $configure_scan if not
448        # already printed, and remember these macros are needed.        # already printed, and remember these macros are needed.
449        foreach my $macro (@{$macro{$kind}{$word}})        foreach my $macro (@{$macro{$kind}{$word}})
# Line 626  if ($configure_ac) Line 625  if ($configure_ac)
625  # at END.  It results in a truncated file.  # at END.  It results in a truncated file.
626  $log->close;  $log->close;
627  exit 0;  exit 0;
628    
629    ### Setup "GNU" style for perl-mode and cperl-mode.
630    ## Local Variables:
631    ## perl-indent-level: 2
632    ## perl-continued-statement-offset: 2
633    ## perl-continued-brace-offset: 0
634    ## perl-brace-offset: 0
635    ## perl-brace-imaginary-offset: 0
636    ## perl-label-offset: -2
637    ## cperl-indent-level: 2
638    ## cperl-brace-offset: 0
639    ## cperl-continued-brace-offset: 0
640    ## cperl-label-offset: -2
641    ## cperl-extra-newline-before-brace: t
642    ## cperl-merge-trailing-else: nil
643    ## cperl-continued-statement-offset: 2
644    ## End:

Legend:
Removed from v.1.82  
changed lines
  Added in v.1.83

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26