Commit dbb90902 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

scripts: get_feat.pl: make complete table more coincise

Currently, there are too many white spaces at the tables,
and the information is very sparsed on it.

Make the format a lot more compact.
Suggested-by: default avatarJonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/8165ff379313e63a69898db19d790e4436224ffd.1607095090.git.mchehab+huawei@kernel.orgSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 7d2c6b1e
...@@ -325,10 +325,10 @@ sub output_feature { ...@@ -325,10 +325,10 @@ sub output_feature {
# Output all features for all architectures # Output all features for all architectures
# #
sub matrix_lines($$) { sub matrix_lines($$$) {
my $partial = shift; my $desc_size = shift;
my $status_size = shift;
my $header = shift; my $header = shift;
my $split;
my $fill; my $fill;
my $ln_marker; my $ln_marker;
...@@ -338,24 +338,14 @@ sub matrix_lines($$) { ...@@ -338,24 +338,14 @@ sub matrix_lines($$) {
$ln_marker = "-"; $ln_marker = "-";
} }
if ($partial) { $fill = $ln_marker;
$split = "|";
$fill = " ";
} else {
$split = "+";
$fill = $ln_marker;
}
print $split; print "+";
print $fill x $max_size_name; print $fill x $max_size_name;
print $split;
print $fill x $max_size_kconfig;
print $split;
print $fill x $max_size_description;
print "+"; print "+";
print $ln_marker x $max_size_arch; print $fill x $desc_size;
print "+"; print "+";
print $ln_marker x $max_size_status; print $ln_marker x $status_size;
print "+\n"; print "+\n";
} }
...@@ -366,6 +356,14 @@ sub output_matrix { ...@@ -366,6 +356,14 @@ sub output_matrix {
print "$title\n"; print "$title\n";
print "=" x length($title) . "\n\n"; print "=" x length($title) . "\n\n";
my $desc_title = "$h_kconfig / $h_description";
my $desc_size = $max_size_kconfig + 4;
$desc_size = $max_size_description if ($max_size_description > $desc_size);
$desc_size = length($desc_title) if (length($desc_title) > $desc_size);
my $status_size = 60;
my $cur_subsys = ""; my $cur_subsys = "";
foreach my $name (sort { foreach my $name (sort {
($data{$a}->{subsys} cmp $data{$b}->{subsys}) or ($data{$a}->{subsys} cmp $data{$b}->{subsys}) or
...@@ -383,36 +381,69 @@ sub output_matrix { ...@@ -383,36 +381,69 @@ sub output_matrix {
print "$title\n"; print "$title\n";
print "=" x length($title) . "\n\n"; print "=" x length($title) . "\n\n";
matrix_lines(0, 0);
printf "|%-${max_size_name}s", $h_name;
printf "|%-${max_size_kconfig}s", $h_kconfig;
printf "|%-${max_size_description}s", $h_description;
printf "|%-${max_size_arch}s", $h_arch; matrix_lines($desc_size, $status_size, 0);
printf "|%-${max_size_status}s|\n", $h_status;
printf "|%-${max_size_name}s", $h_name;
printf "|%-${desc_size}s", $desc_title;
matrix_lines(0, 1); printf "|%-${status_size}s|\n", "Status per architecture";
matrix_lines($desc_size, $status_size, 1);
} }
my %arch_table = %{$data{$name}->{table}}; my %arch_table = %{$data{$name}->{table}};
my $first = 1; my $cur_status = "";
foreach my $arch (sort keys %arch_table) {
if ($first) { my @lines;
printf "|%-${max_size_name}s", $name; my $line = "";
printf "|%-${max_size_kconfig}s", $data{$name}->{kconfig}; foreach my $arch (sort {
printf "|%-${max_size_description}s", $data{$name}->{description}; ($arch_table{$a} cmp $arch_table{$b}) or
$first = 0; ("\L$a" cmp "\L$b")
} keys %arch_table) {
my $status = $arch_table{$arch};
if ($status eq "---") {
$status = "Not compatible";
}
if ($status ne $cur_status) {
if ($line ne "") {
push @lines, $line;
$line = "";
}
$line = "- **" . $status . "**: " . $arch;
} elsif (length($line) + length ($arch) + 2 < $status_size) {
$line .= ", " . $arch;
} else { } else {
matrix_lines(1, 0); push @lines, $line;
$line = " " . $arch;
}
$cur_status = $status;
}
push @lines, $line if ($line ne "");
# Ensure that description will be printed
push @lines, "" while (scalar(@lines) < 2);
my $ln = 0;
for my $line(@lines) {
if (!$ln) {
printf "|%-${max_size_name}s", $name;
printf "|%-${desc_size}s", "``" . $data{$name}->{kconfig} . "``";
} elsif ($ln == 2) {
printf "|%-${max_size_name}s", "";
printf "|%-${desc_size}s", $data{$name}->{description};
} else {
printf "|%-${max_size_name}s", ""; printf "|%-${max_size_name}s", "";
printf "|%-${max_size_kconfig}s", ""; printf "|%-${desc_size}s", "";
printf "|%-${max_size_description}s", "";
} }
printf "|%-${max_size_arch}s", $arch;
printf "|%-${max_size_status}s|\n", $arch_table{$arch}; printf "|%-${status_size}s|\n", $line;
$ln++;
} }
matrix_lines(0, 0); matrix_lines($desc_size, $status_size, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment