From patchwork Wed Feb 7 17:26:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 127198 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp683871ljc; Wed, 7 Feb 2018 09:28:00 -0800 (PST) X-Google-Smtp-Source: AH8x226d6KoN1/AdlyAvS63RWhunT49Qe4K6yL8Z7Mddgzk5awkazkEzhE3DZh/CTaYVlRe/ohZ0 X-Received: by 10.98.138.70 with SMTP id y67mr4395923pfd.176.1518024480386; Wed, 07 Feb 2018 09:28:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518024480; cv=none; d=google.com; s=arc-20160816; b=PCuEFc9soHNb5Jl5CvAgSZpYVaOxpiFsLm16gygPfG8Nj5YDRBAZkD0rNjW9moYQ/q tqcHSiK4xKkTNoR7My0O7VelPcpYeN1y24wULIVcxRM/SnHvvCccYOgMPrTqLNhSqnxM +RE7k7xbFarnnwPyPpjLWk8ZVrTYZFU40P9f3xV2LpKCcNjRHuazfQHrodTLqBq+cNM4 LoGrTRb5evFy4XaWq3folABd7lWNipZdyPzx48Rq5jy3Vxg5eZs8kC/W8DKDm9pd2MDQ ZgFtMhQEL9ogOLjG1Jb0XFWuNafl/jM8TJviSIeWys/vmM2QT17bmbed1UDE06pD94PH nQkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=gDuOAyOlwUGUfqkVwU8/MPJjf1bRd/vPq+FhlI4/1AA=; b=pLBycjFktYgFToci76SP1SypjCAXEqpVjsEcNw095oKTGPnOVdl/uMx1mpivUSdk9u JhcWx/o54v4Vg+idebouVamqev4fZOd8zCra9vt6T1uGPxCfpfcvXRPubm8lQpDuR6qv fFMKBxevrXV6nDOClTwYHhxWWDyMSLuGT5/CRr0CzptvEbA6l70xQIfmBYkm5EVUaCgA v4rz+QjsBQOf4qDC12j2WaK4Y2RgmtB51I10vyCyCNX2dInUVgDKv504hY7dtd7gX0VS SuybhMEfS7CORLilWCIPV/jFjFZwF2I2X3uYEcQJqLlowbLJzN31LMNbGHcNn0y8VQPA VdPw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f10si1176226pgu.783.2018.02.07.09.28.00; Wed, 07 Feb 2018 09:28:00 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754848AbeBGR1F (ORCPT + 18 others); Wed, 7 Feb 2018 12:27:05 -0500 Received: from ms.lwn.net ([45.79.88.28]:41634 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754831AbeBGR1C (ORCPT ); Wed, 7 Feb 2018 12:27:02 -0500 Received: from tpad.lan (localhost [127.0.0.1]) by ms.lwn.net (Postfix) with ESMTPA id 678751329; Wed, 7 Feb 2018 17:27:01 +0000 (UTC) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mchehab@kernel.org, me@tobin.cc, Jonathan Corbet Subject: [PATCH 3/8] docs: kernel-doc: Move STATE_NORMAL processing into its own function Date: Wed, 7 Feb 2018 10:26:19 -0700 Message-Id: <20180207172624.24555-4-corbet@lwn.net> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180207172624.24555-1-corbet@lwn.net> References: <20180207172624.24555-1-corbet@lwn.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Begin the process of splitting up the nearly 500-line process_file() function by moving STATE_NORMAL processing to a separate function. Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) -- 2.14.3 Reviewed-by: Jani Nikula diff --git a/scripts/kernel-doc b/scripts/kernel-doc index ad30c52f91ef..65150b7c8472 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1780,6 +1780,21 @@ sub process_export_file($) { close(IN); } +# +# Parsers for the various processing states. +# +# STATE_NORMAL: looking for the /** to begin everything. +# +sub process_normal() { + if (/$doc_start/o) { + $state = STATE_NAME; # next line is always the function name + $in_doc_sect = 0; + $declaration_start_line = $. + 1; + } +} + + + sub process_file($) { my $file; my $identifier; @@ -1807,11 +1822,7 @@ sub process_file($) { # Replace tabs by spaces while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; if ($state == STATE_NORMAL) { - if (/$doc_start/o) { - $state = STATE_NAME; # next line is always the function name - $in_doc_sect = 0; - $declaration_start_line = $. + 1; - } + process_normal(); } elsif ($state == STATE_NAME) {# this line is the function name (always) if (/$doc_block/o) { $state = STATE_DOCBLOCK;