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

scripts: get_feat.pl: improve matrix output

Instead of producing a too wide table, let's split it per
subsystem, and use a better notation in order to make easier
for the reader to identify how a feature is supported on
multiple architectures.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/9c3e8c813e8146c5c30e10fa75974f8fbfe6016a.1606748711.git.mchehab+huawei@kernel.orgSigned-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 52a4be3f
...@@ -293,68 +293,95 @@ sub output_feature { ...@@ -293,68 +293,95 @@ sub output_feature {
# Output all features for all architectures # Output all features for all architectures
# #
sub matrix_lines { sub matrix_lines($$) {
print "=" x $max_size_subsys; my $partial = shift;
print " "; my $header = shift;
print "=" x $max_size_name; my $split;
print " "; my $fill;
my $ln_marker;
foreach my $arch (sort keys %archs) {
my $len = $max_size_status; if ($header) {
$ln_marker = "=";
$len = length($arch) if ($len < length($arch)); } else {
$ln_marker = "-";
}
print "=" x $len; if ($partial) {
print " "; $split = "|";
$fill = " ";
} else {
$split = "+";
$fill = $ln_marker;
} }
print "=" x $max_size_kconfig;
print " "; print $split;
print "=" x $max_size_description; print $fill x $max_size_name;
print "\n"; print $split;
print $fill x $max_size_kconfig;
print $split;
print $fill x $max_size_description;
print "+";
print $ln_marker x $max_size_arch;
print "+";
print $ln_marker x $max_size_status;
print "+\n";
} }
sub output_matrix { sub output_matrix {
my $title = "Feature status on all architectures";
my $title = "Feature List (feature x architecture)";
print "=" x length($title) . "\n"; print "=" x length($title) . "\n";
print "$title\n"; print "$title\n";
print "=" x length($title) . "\n\n"; print "=" x length($title) . "\n\n";
matrix_lines; my $cur_subsys = "";
foreach my $name (sort {
printf "%-${max_size_subsys}s ", $h_subsys; ($data{$a}->{subsys} cmp $data{$b}->{subsys}) or
printf "%-${max_size_name}s ", $h_name; ($a cmp $b)
} keys %data) {
foreach my $arch (sort keys %archs) { if ($cur_subsys ne $data{$name}->{subsys}) {
printf "%-${max_size_status}s ", $arch; if ($cur_subsys ne "") {
} printf "\n";
printf "%-${max_size_kconfig}s ", $h_kconfig; }
printf "%-${max_size_description}s\n", $h_description;
matrix_lines; $cur_subsys = $data{$name}->{subsys};
foreach my $name (sort { my $title = "Subsystem: $cur_subsys";
($data{$a}->{subsys} cmp $data{$b}->{subsys}) || print "$title\n";
($data{$a}->{name} cmp $data{$b}->{name}) print "=" x length($title) . "\n\n";
} keys %data) {
printf "%-${max_size_subsys}s ", $data{$name}->{subsys};
printf "%-${max_size_name}s ", $name;
my %arch_table = %{$data{$name}->{table}}; 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;
foreach my $arch (sort keys %arch_table) { printf "|%-${max_size_arch}s", $h_arch;
my $len = $max_size_status; printf "|%-${max_size_status}s|\n", $h_status;
$len = length($arch) if ($len < length($arch)); matrix_lines(0, 1);
}
printf "%-${len}s ", $arch_table{$arch}; my %arch_table = %{$data{$name}->{table}};
my $first = 1;
foreach my $arch (sort keys %arch_table) {
if ($first) {
printf "|%-${max_size_name}s", $name;
printf "|%-${max_size_kconfig}s", $data{$name}->{kconfig};
printf "|%-${max_size_description}s", $data{$name}->{description};
$first = 0;
} else {
matrix_lines(1, 0);
printf "|%-${max_size_name}s", "";
printf "|%-${max_size_kconfig}s", "";
printf "|%-${max_size_description}s", "";
}
printf "|%-${max_size_arch}s", $arch;
printf "|%-${max_size_status}s|\n", $arch_table{$arch};
} }
printf "%-${max_size_kconfig}s ", $data{$name}->{kconfig}; matrix_lines(0, 0);
printf "%-${max_size_description}s\n", $data{$name}->{description};
} }
matrix_lines;
} }
......
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