From: Peter O. <obe...@us...> - 2010-08-05 15:12:04
|
Update of /cvsroot/ltp/utils/analysis/lcov/bin In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv5351/bin Modified Files: lcov Log Message: lcov: introduce configuration file parameters for list output Make some aspects of list output customizable via configuration file parameters. Also introduce special handling, if the root directory is chosen as prefix. Index: lcov =================================================================== RCS file: /cvsroot/ltp/utils/analysis/lcov/bin/lcov,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** lcov 5 Aug 2010 14:07:35 -0000 1.70 --- lcov 5 Aug 2010 15:11:56 -0000 1.71 *************** *** 185,188 **** --- 185,190 ---- our $opt_list_full_path; our $opt_no_list_full_path; + our $opt_list_width = 80; + our $opt_list_truncate_max = 20; our $ln_overall_found; our $ln_overall_hit; *************** *** 228,231 **** --- 230,235 ---- "lcov_tmp_dir" => \$tmp_dir, "lcov_list_full_path" => \$opt_list_full_path, + "lcov_list_width" => \$opt_list_width, + "lcov_list_truncate_max"=> \$opt_list_truncate_max, }); } *************** *** 307,310 **** --- 311,320 ---- } + # Check list width option + if ($opt_list_width <= 40) { + die("ERROR: lcov_list_width parameter out of range (needs to be ". + "larger than 40)\n"); + } + # Normalize --path text $diff_path =~ s/\/$//; *************** *** 2880,2887 **** my @fwidth = @fwidth_wide; my $w; ! my $max_width = 80; ! my $max_long = 20; my $fwidth_narrow_length; my $fwidth_wide_length; # Calculate total width of narrow fields --- 2890,2899 ---- my @fwidth = @fwidth_wide; my $w; ! my $max_width = $opt_list_width; ! my $max_long = $opt_list_truncate_max; my $fwidth_narrow_length; my $fwidth_wide_length; + my $got_prefix = 0; + my $root_prefix = 0; # Calculate total width of narrow fields *************** *** 2898,2906 **** $prefix = get_prefix($max_width - $fwidth_narrow_length, $max_long, keys(%{$data})); $prefix =~ s/\/$//; # Get longest filename length foreach $filename (keys(%{$data})) { if (!$opt_list_full_path) { ! if ((length($prefix) == 0) || !($filename =~ s/^\Q$prefix\/\E//)) { my ($v, $d, $f) = splitpath($filename); --- 2910,2920 ---- $prefix = get_prefix($max_width - $fwidth_narrow_length, $max_long, keys(%{$data})); + $root_prefix = 1 if ($prefix eq rootdir()); + $got_prefix = 1 if (length($prefix) > 0); $prefix =~ s/\/$//; # Get longest filename length foreach $filename (keys(%{$data})) { if (!$opt_list_full_path) { ! if (!$got_prefix || !$root_prefix && !($filename =~ s/^\Q$prefix\/\E//)) { my ($v, $d, $f) = splitpath($filename); *************** *** 3001,3005 **** $print_filename = $filename; ! if ((length($prefix) == 0) || !($print_filename =~ s/^\Q$prefix\/\E//)) { my ($v, $d, $f) = splitpath($filename); --- 3015,3019 ---- $print_filename = $filename; ! if (!$got_prefix || !$root_prefix && !($print_filename =~ s/^\Q$prefix\/\E//)) { my ($v, $d, $f) = splitpath($filename); *************** *** 3015,3019 **** print("\n") if (defined($lastpath)); $lastpath = $p; ! print("[$lastpath/]\n"); } $print_filename = shorten_filename($print_filename, --- 3029,3033 ---- print("\n") if (defined($lastpath)); $lastpath = $p; ! print("[$lastpath/]\n") if (!$root_prefix); } $print_filename = shorten_filename($print_filename, |