[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
"use strict" in autoscan.
From: |
Pavel Roskin |
Subject: |
"use strict" in autoscan. |
Date: |
Mon, 22 Jan 2001 12:22:00 -0500 (EST) |
ChangeLog:
* autoscan.pl: Use "use strict". Declare all global variables
or make them private. Make all local variables private.
Regards,
Pavel Roskin
_________________________
--- autoscan.pl
+++ autoscan.pl
@@ -21,6 +21,14 @@
require "find.pl";
use Getopt::Long;
+use strict;
+
+use vars qw($datadir $initfile $me $name $verbose
+ @cfiles @makefiles @shfiles
+ %functions_macros %headers_macros %identifiers_macros
+ %programs_macros %makevars_macros %c_keywords %programs
+ %headers %identifiers %makevars %libraries %functions
+ %printed);
$datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
($me = $0) =~ s,.*/,,;
@@ -76,6 +84,7 @@
# Process any command line arguments.
sub parse_args
{
+ my $srcdir;
Getopt::Long::config ("bundling");
Getopt::Long::GetOptions ("A|autoconf-dir|m|macrodir=s" => \$datadir,
"h|help" => \&print_usage,
@@ -100,7 +109,7 @@
# Put values in the tables of what to do with each token.
sub init_tables
{
- local($kind, $word, $macro);
+ my ($kind, $word, $macro);
# Initialize a table of C keywords (to ignore).
# Taken from K&R 1st edition p. 180.
@@ -154,6 +163,7 @@
# that might create nonportabilities.
sub scan_files
{
+ my $file;
if (defined $cfiles[0]) {
$initfile = $cfiles[0]; # Pick one at random.
}
@@ -180,8 +190,8 @@
sub scan_c_file
{
- local($file) = @_;
- local($in_comment) = 0; # Nonzero if in a multiline comment.
+ my ($file) = @_;
+ my ($in_comment) = 0; # Nonzero if in a multiline comment.
open(CFILE, "<$file") || die "$me: cannot open $file: $!\n";
while (<CFILE>) {
@@ -223,7 +233,7 @@
close(CFILE);
if ($verbose) {
- local($word);
+ my $word;
print "\n$file functions:\n";
foreach $word (sort keys %functions) {
@@ -244,7 +254,7 @@
sub scan_makefile
{
- local($file) = @_;
+ my ($file) = @_;
open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
while (<MFILE>) {
@@ -270,7 +280,7 @@
close(MFILE);
if ($verbose) {
- local($word);
+ my ($word);
print "\n$file makevars:\n";
foreach $word (sort keys %makevars) {
@@ -291,7 +301,7 @@
sub scan_sh_file
{
- local($file) = @_;
+ my ($file) = @_;
open(MFILE, "<$file") || die "$me: cannot open $file: $!\n";
while (<MFILE>) {
@@ -308,7 +318,7 @@
close(MFILE);
if ($verbose) {
- local($word);
+ my ($word);
print "\n$file programs:\n";
foreach $word (sort keys %programs) {
@@ -320,7 +330,7 @@
# Print a configure.ac.
sub output
{
- local (%unique_makefiles);
+ my %unique_makefiles;
print CONF "# Process this file with autoconf to produce a configure
script.\n";
print CONF "AC_INIT\n";
@@ -351,7 +361,7 @@
# Print Autoconf macro $1 if it's not undef and hasn't been printed already.
sub print_unique
{
- local($macro) = @_;
+ my ($macro) = @_;
if (defined($macro) && !defined($printed{$macro})) {
print CONF "$macro\n";
@@ -361,7 +371,7 @@
sub output_programs
{
- local ($word);
+ my $word;
print CONF "\n# Checks for programs.\n";
foreach $word (sort keys %programs) {
@@ -379,7 +389,8 @@
sub output_headers
{
- local ($word);
+ my $word;
+ my @have_headers;
print CONF "\n# Checks for header files.\n";
foreach $word (sort keys %headers) {
@@ -396,7 +407,8 @@
sub output_identifiers
{
- local ($word);
+ my $word;
+ my @have_types;
print CONF "\n# Checks for typedefs, structures, and compiler
characteristics.\n";
foreach $word (sort keys %identifiers) {
@@ -413,7 +425,8 @@
sub output_functions
{
- local ($word);
+ my $word;
+ my @have_funcs;
print CONF "\n# Checks for library functions.\n";
foreach $word (sort keys %functions) {
_________________________
- "use strict" in autoscan.,
Pavel Roskin <=