if ( $opts{h} ) { die "$usage" }
our $rsetup; # the config info
-my $hash='#';
+my $hash = '#';
my $config_file = "config.txt";
if ( !-e $config_file ) {
read_config($config_file);
my $chain_mode = $rsetup->{chain_mode};
+my $append_flags = $rsetup->{append_flags};
my $do_syntax_check = $rsetup->{syntax_check};
my $delete_good_output = $rsetup->{delete_good_output};
my $FILES_file = $rsetup->{files};
my $rsummary = [];
my @problems;
+my $BLINKDIR = "BLINKERS";
+
my $stop_file = 'stop.now';
if ( -e $stop_file ) { unlink $stop_file }
my $efile_count = 0;
my $has_starting_error;
my $starting_syntax_ok = 1;
- my $tmperr = "STDERR.txt";
+ my $tmperr = "STDERR.txt";
# Inner loop over profiles for a given file
for ( my $np = $np_beg ; $np <= $np_end ; $np++ ) {
print STDERR
"$hash>Run '$nf.$np' : profile='$profile', ifile='$ifile'\n";
- if (-e $tmperr) {unlink $tmperr}
- my $cmd = "$binfile <$ifile >$ofile -pro=$profile 2>$tmperr";
- system_echo($cmd,$hash);
+ if ( -e $tmperr ) { unlink $tmperr }
+ #my $cmd = "$binfile <$ifile >$ofile -pro=$profile 2>$tmperr";
+ my $cmd = "$binfile <$ifile >$ofile -pro=$profile $append_flags 2>$tmperr";
+ system_echo( $cmd, $hash );
my $efile = "perltidy.ERR";
my $logfile = "perltidy.LOG";
if ( -e $efile ) { rename $efile, "ERR.$ext" }
if ( -e $logfile ) { rename $logfile, "LOG.$ext" }
if ( -e $tmperr && !-z $tmperr ) {
- open(IN,"<",$tmperr);
- foreach my $line(<IN>) {
- if ($line=~/BLINKER/) {
- $error_count++;
+ open( IN, "<", $tmperr );
+ foreach my $line (<IN>) {
+ if ( $line =~ /BLINKER/ ) {
+ ##$error_count++;
push @blinkers, $ofile;
$error_count_this_file++;
$error_count_this_case++;
+ save_blinker_info( "$np.$nf", $ofile, $profile, $tmperr );
}
- if ($line=~/STRANGE/) {
+ if ( $line =~ /STRANGE/ ) {
$error_count++;
push @strange, $ofile;
$error_count_this_file++;
$error_count_this_case++;
}
- if ($line=~/uninitialized/) {
+ if ( $line =~ /uninitialized/ ) {
$error_count++;
push @uninitialized, $ofile;
$error_count_this_file++;
if ( $do_syntax_check && $starting_syntax_ok ) {
my $synfile = "$ofile.syntax";
my $cmd = "perl -c $ofile 2>$synfile";
- system_echo($cmd,$hash);
+ system_echo( $cmd, $hash );
my $fh;
if ( open( $fh, '<', $synfile ) ) {
my @lines = <$fh>;
if ( $case == 1 ) {
$starting_syntax_ok = $syntax_ok;
unlink $synfile;
- if ($syntax_ok) { print STDERR "$hash syntax OK for $ofile\n"; }
+ if ($syntax_ok) {
+ print STDERR "$hash syntax OK for $ofile\n";
+ }
}
elsif ($syntax_ok) {
unlink $synfile;
# run perltidy on the output to see if it can be reformatted
# without errors
my $cmd2 = "perltidy <$ofile >$chkfile";
- system_echo($cmd2,$hash);
+ system_echo( $cmd2, $hash );
+
#print STDERR "$cmd2\n";
my $err;
if ( -e $efile ) {
}
# Summarize results..
-if (@problems) {
+if (@problems || @blinkers) {
print STDERR <<EOM;
$hash =============================
print STDERR <<EOM;
$hash Some files with blinkers (search above for 'BLINKER'):
$hash (@blinkers[0..$num-1])
+next step...
+cd BLINKERS
+blinker_prep.pl B*
EOM
}
if (@strange) {
$hash Search STDERR for 'uninitialized' and other warnings
EOM
+sub save_blinker_info {
+ my ( $runname, $ofile, $profile, $tmperr ) = @_;
+
+ return unless "$BLINKDIR";
+ if ( !-d $BLINKDIR ) {
+ unless ( mkdir($BLINKDIR) ) {
+ print STDERR "Unable to create $BLINKDIR\n";
+ $BLINKDIR = "";
+ return;
+ }
+ return unless ( -d $BLINKDIR );
+ }
+
+ my $blink_dir = "$BLINKDIR/Blinker-" . "$runname";
+ if ( !-d $blink_dir ) {
+ unless ( mkdir $blink_dir ) {
+ print STDERR "unable to crreate $blink_dir\n";
+ return;
+ }
+ return unless ( -d $blink_dir );
+ }
+
+ system("cp $ofile $blink_dir");
+ system("cp $profile $blink_dir");
+ system("cat $tmperr >$blink_dir/README.txt");
+ return;
+}
+
sub report_results {
my ($rh) = @_;
while (1) {
my $files = $rsetup->{files};
my $chain_mode = $rsetup->{chain_mode};
+ my $append_flags = $rsetup->{append_flags};
my $do_syntax_check = $rsetup->{syntax_check};
my $delete_good_output = $rsetup->{delete_good_output};
my $perltidy_version = $rsetup->{perltidy};
C - Chain mode : $chain_mode
D - Delete good output? : $delete_good_output
S - Syntax check? : $do_syntax_check
+A - Append flags : $append_flags
V - perltidy Version : $perltidy_version
Q - Quit without saving config file
W - Write config, FILES.txt, PROFILES.txt, GO.sh and eXit
$chain_mode = get_num("Chaining: 0=no, 1=always,2=random");
$rsetup->{chain_mode} = $chain_mode;
}
+ elsif ( $ans eq 'A' ) {
+ my $str = query("Enter any flags to append");
+ $rsetup->{append_flags} = $str;
+ }
elsif ( $ans eq 'D' ) {
$delete_good_output =
ifyes( "Delete needless good output files? [Y/N]", "Y" );
profiles => $PROFILES_file,
files => $FILES_file,
perltidy => $perltidy,
+ append_flags => "",
};
return;
}
'default-tabsize' => [ 0, 8 ],
'entab-leading-whitespace' => [ 0, 8 ],
+ # always iterate
+ 'iterations' => [ 6, 10 ],
+
'want-break-after' => \@operators,
'want-break-before' => \@operators,
'want-left-space' => \@operators,
logfile
logfile-gap
look-for-hash-bang
+ maximum-file-size-mb
notidy
outfile
output-file-extension
tee-side-comments
version
delete-pod
+ tabs
+ entab-leading-whitespace
);
my %skip;