Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp412329ybi; Thu, 13 Jun 2019 19:06:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6I9AG+RHjVeT5x8hBT84s1W83Vo09kyYzHEsbBM6ml2iaHiImNDEYwNtv0jX3917nLrhR X-Received: by 2002:a63:234c:: with SMTP id u12mr33782970pgm.264.1560477985862; Thu, 13 Jun 2019 19:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560477985; cv=none; d=google.com; s=arc-20160816; b=FB9ZkzfEJyaAIhNATv+PLVKnhjA5IvylLK+igBEYHPE6dCy8Drph7Y1YurL07GpmgM NFwYc+bBuzDubGoHcgbaQmQIWR8cZZOBQn091rc3ndHDLDioXjaOwI+u/j4T/r7Av6Aa WNrD2TAdNPUo+/2+EUbWWClW++eTfpS72wI+BRIQgMtpXYcfjtP0AFQU8W6l0ZHxBos2 zcni6vTfDyxlftVYVAudfgMJYGxvB/nWRCZojV+KzhsTrlJdTSM0YTkQqYAdpYygLQ9f 3uhEEXBhDqKC/PHD1yX3Hhse7RZSOYAZsf2EZ3HELBIQHF6bXJjTOzixL5ocezLTBQDr aeTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5IX0zYlL8/oA+sc7E+MTsWO5O1lu6ceK5gRHr9c7H2s=; b=Hnan8AQKzUqUHYf+C/qGqbAYapcplvTXItyBhFAQEKZYALlSa8YINR7Q6QkgAbXcNf FaQo1itcMxZxNnAyxbPWXJrmLqQh/TqNmBogiT8CJbRV+m/MK1A7qhLuI2yg0cxGGzPi 2I/qs/oZuEfWMHwnjWlPaWWm6jb2BMeT40JoIHw/vrvwoPAIgB78aH9W2HEdxxOxs4Tn HzQGeD1sX1EaIjfv+SpJ+MYjcZ6Fp/j73q0dIN2b2lB+AMLYonoF+zlHRdCVtoZH0pE/ Inovdk/wNkSQVHIfWdVWqgOHzkY6Prxeo8aZAITR5+htjAVCjscW4KwJ6BjD/Px3DEDn TJ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Qy9zUAbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v65si1021632pfb.77.2019.06.13.19.06.10; Thu, 13 Jun 2019 19:06:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Qy9zUAbL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727518AbfFNCF2 (ORCPT + 99 others); Thu, 13 Jun 2019 22:05:28 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52860 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726187AbfFNCE2 (ORCPT ); Thu, 13 Jun 2019 22:04:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5IX0zYlL8/oA+sc7E+MTsWO5O1lu6ceK5gRHr9c7H2s=; b=Qy9zUAbLE/fNWlgA7b71QVmnh4 YOlaJ45E4wIMaCbCCrTaznV7sCaoOVUGs5Wm3ppnniVFK6vg8v/gobT3l7zp6pMRuSBFDfDUMy6Sy LcCl5edAAgIgdW4fvsV22O/1xbm3rc6t+J0uJZj+pa3Uez+eFOYlCLWwzvl84zQzQJC3NMhZqsQ6W 35XaepdSuNFjBQLnjeUvyelyoeN52p4lUdUDeOUumsAbUeUZzgBvXM+Qd6nxBE0V8O8mCgR4K06Ku M6+IZCwspH7oZ3vUcLVqriwAIm+VUmOdOGNykYoLctPBDqagdLYgsvmY79OCBC5BBhSEoAK2nyVJP xrC9ulug==; Received: from 201.86.169.251.dynamic.adsl.gvt.net.br ([201.86.169.251] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hbbZr-0000EA-E1; Fri, 14 Jun 2019 02:04:27 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hbbZn-0002o8-Ui; Thu, 13 Jun 2019 23:04:23 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , Greg Kroah-Hartman Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet , Mauro Carvalho Chehab Subject: [PATCH 10/14] scripts/get_abi.pl: represent what in tables Date: Thu, 13 Jun 2019 23:04:16 -0300 Message-Id: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mauro Carvalho Chehab Several entries at the ABI have multiple What: with the same description. Instead of showing those symbols as sections, let's show them as tables. That makes easier to read on the final output, and avoid too much recursion at Sphinx parsing. We need to put file references at the end, as we don't want non-file tables to be mangled with other entries. Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- scripts/get_abi.pl | 41 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/scripts/get_abi.pl b/scripts/get_abi.pl index c202292af1a2..a2861fcec745 100755 --- a/scripts/get_abi.pl +++ b/scripts/get_abi.pl @@ -193,16 +193,19 @@ sub parse_abi { # # Outputs the book on ReST format # + sub output_rest { - foreach my $what (sort keys %data) { + foreach my $what (sort { + ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") || + $a cmp $b + } keys %data) { my $type = $data{$what}->{type}; my $file = $data{$what}->{file}; + my $filepath = $data{$what}->{filepath}; my $w = $what; $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g; - my $bar = $w; - $bar =~ s/./-/g; foreach my $p (@{$data{$what}->{label}}) { my ($content, $label) = @{$p}; @@ -222,9 +225,37 @@ sub output_rest { last; } - print "$w\n$bar\n\n"; - print "- defined on file $file (type: $type)\n\n" if ($type ne "File"); + $filepath =~ s,.*/(.*/.*),\1,;; + $filepath =~ s,[/\-],_,g;; + my $fileref = "abi_file_".$filepath; + + if ($type eq "File") { + my $bar = $w; + $bar =~ s/./-/g; + + print ".. _$fileref:\n\n"; + print "$w\n$bar\n\n"; + } else { + my @names = split /\s*,\s*/,$w; + + my $len = 0; + + foreach my $name (@names) { + $len = length($name) if (length($name) > $len); + } + + print "What:\n\n"; + + print "+-" . "-" x $len . "-+\n"; + foreach my $name (@names) { + printf "| %s", $name . " " x ($len - length($name)) . " |\n"; + print "+-" . "-" x $len . "-+\n"; + } + print "\n"; + } + + print "Defined on file :ref:`$file <$fileref>`\n\n" if ($type ne "File"); my $desc = $data{$what}->{description}; $desc =~ s/^\s+//; -- 2.21.0