linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/6] scripts: get_feat.pl: improve matrix output
Date: Mon, 30 Nov 2020 16:36:31 +0100	[thread overview]
Message-ID: <9c3e8c813e8146c5c30e10fa75974f8fbfe6016a.1606748711.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1606748711.git.mchehab+huawei@kernel.org>

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: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
 scripts/get_feat.pl | 113 +++++++++++++++++++++++++++-----------------
 1 file changed, 70 insertions(+), 43 deletions(-)

diff --git a/scripts/get_feat.pl b/scripts/get_feat.pl
index 79d83595addd..7b92ebab7ddd 100755
--- a/scripts/get_feat.pl
+++ b/scripts/get_feat.pl
@@ -293,68 +293,95 @@ sub output_feature {
 # Output all features for all architectures
 #
 
-sub matrix_lines {
-	print "=" x $max_size_subsys;
-	print "  ";
-	print "=" x $max_size_name;
-	print "  ";
+sub matrix_lines($$) {
+	my $partial = shift;
+	my $header = shift;
+	my $split;
+	my $fill;
+	my $ln_marker;
 
-	foreach my $arch (sort keys %archs) {
-		my $len = $max_size_status;
-
-		$len = length($arch) if ($len < length($arch));
+	if ($header) {
+		$ln_marker = "=";
+	} else {
+		$ln_marker = "-";
+	}
 
-		print "=" x $len;
-		print "  ";
+	if ($partial) {
+		$split = "|";
+		$fill = " ";
+	} else {
+		$split = "+";
+		$fill = $ln_marker;
 	}
-	print "=" x $max_size_kconfig;
-	print "  ";
-	print "=" x $max_size_description;
-	print "\n";
+
+	print $split;
+	print $fill x $max_size_name;
+	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 {
-
-	my $title = "Feature List (feature x architecture)";
+	my $title = "Feature status on all architectures";
 
 	print "=" x length($title) . "\n";
 	print "$title\n";
 	print "=" x length($title) . "\n\n";
 
-	matrix_lines;
-
-	printf "%-${max_size_subsys}s  ", $h_subsys;
-	printf "%-${max_size_name}s  ", $h_name;
-
-	foreach my $arch (sort keys %archs) {
-		printf "%-${max_size_status}s  ", $arch;
-	}
-	printf "%-${max_size_kconfig}s  ", $h_kconfig;
-	printf "%-${max_size_description}s\n", $h_description;
-
-	matrix_lines;
-
+	my $cur_subsys = "";
 	foreach my $name (sort {
-				($data{$a}->{subsys} cmp $data{$b}->{subsys}) ||
-				($data{$a}->{name} cmp $data{$b}->{name})
+				($data{$a}->{subsys} cmp $data{$b}->{subsys}) or
+				($a cmp $b)
 			       } keys %data) {
-		printf "%-${max_size_subsys}s  ", $data{$name}->{subsys};
-		printf "%-${max_size_name}s  ", $name;
+
+		if ($cur_subsys ne $data{$name}->{subsys}) {
+			if ($cur_subsys ne "") {
+				printf "\n";
+			}
+
+			$cur_subsys = $data{$name}->{subsys};
+
+			my $title = "Subsystem: $cur_subsys";
+			print "$title\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;
+			printf "|%-${max_size_status}s|\n", $h_status;
+
+			matrix_lines(0, 1);
+		}
 
 		my %arch_table = %{$data{$name}->{table}};
-
+		my $first = 1;
 		foreach my $arch (sort keys %arch_table) {
-			my $len = $max_size_status;
+			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);
 
-			$len = length($arch) if ($len < length($arch));
-
-			printf "%-${len}s  ", $arch_table{$arch};
+				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};
-		printf "%-${max_size_description}s\n", $data{$name}->{description};
+		matrix_lines(0, 0);
 	}
-
-	matrix_lines;
 }
 
 
-- 
2.28.0


  parent reply	other threads:[~2020-11-30 15:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 15:36 [PATCH 0/6] Add documentation for Documentation/features at the built docs Mauro Carvalho Chehab
2020-11-30 15:36 ` [PATCH 1/6] scripts: get_feat.pl: add a script to handle Documentation/features Mauro Carvalho Chehab
2020-11-30 15:36 ` Mauro Carvalho Chehab [this message]
2020-11-30 15:36 ` [PATCH 3/6] scripts: get_feat.pl: use its implementation for list-arch.sh Mauro Carvalho Chehab
2020-11-30 15:36 ` [PATCH 4/6] sphinx: kernel_feat.py: add a script to parse feature files Mauro Carvalho Chehab
2020-11-30 15:36 ` [PATCH 5/6] docs: admin-guide: add a features list Mauro Carvalho Chehab
2020-11-30 15:36 ` [PATCH 6/6] docs: archis: add a per-architecture " Mauro Carvalho Chehab
2020-12-03 22:36 ` [PATCH 0/6] Add documentation for Documentation/features at the built docs Jonathan Corbet
2020-12-04  9:17   ` [PATCH] scripts: get_feat.pl: make complete table more coincise Mauro Carvalho Chehab
2020-12-04  9:26     ` [PATCH v2] " Mauro Carvalho Chehab
2020-12-04  9:35       ` [PATCH v3] " Mauro Carvalho Chehab
2020-12-04  9:52         ` Mauro Carvalho Chehab
2020-12-04 15:32   ` [PATCH v4 0/3] improve get_feat.pl output when all features are displayed Mauro Carvalho Chehab
2020-12-04 15:32     ` [PATCH v4 1/3] scripts: get_feat.pl: make complete table more coincise Mauro Carvalho Chehab
2020-12-04 15:32     ` [PATCH v4 2/3] scripts: get_feat.pl: change the group by order Mauro Carvalho Chehab
2020-12-04 15:32     ` [PATCH v4 3/3] scripts: get_feat.pl: reduce table width for all features output Mauro Carvalho Chehab
2020-12-04 21:48     ` [PATCH v4 0/3] improve get_feat.pl output when all features are displayed Jonathan Corbet
2020-12-05 16:03       ` Mauro Carvalho Chehab
2020-12-07  9:33         ` Mauro Carvalho Chehab
2020-12-07 11:34           ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9c3e8c813e8146c5c30e10fa75974f8fbfe6016a.1606748711.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).