From patchwork Wed Feb 14 18:40:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Corbet X-Patchwork-Id: 128383 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp913138ljc; Wed, 14 Feb 2018 10:42:35 -0800 (PST) X-Google-Smtp-Source: AH8x225mjaFgvzOh++ikNeKWDnbunOkR2ypWIFNfNaM2tAaz7p1t+KstSlAbYPxmvrqZ9LHFCsrx X-Received: by 10.99.167.2 with SMTP id d2mr123565pgf.408.1518633755568; Wed, 14 Feb 2018 10:42:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518633755; cv=none; d=google.com; s=arc-20160816; b=YBFD9uVwTU7oy245i1acH6CFqY9W2UMPExf9IbUtGvH6vr1k6KjhskHZJmWVfKWBlK rhvH2+RTBbOy8v3LLGfylkIS/fdNls2ZlsOOv7FLha7reRWDWurX2SEza48Je857g07v Ohe6/l/9UUlvhXcgijIrWbf5CQ9bQimBjn6v+ODU7hWzwxPpzFTzDVEW7B8UppcjoqQ2 OHeXRMKoY7pVLhzLCOOuavXJmdYc6JEcM7g7q2vFA7TpluVbTqnYvKzvQxFzrSEZvHhZ d8NzpgLVnfA48SC8qnZduahd1xRhNTROyXsHXmIKDWV8JXpWjNpeFofY2mC2h2ZTTuBc V8jQ== 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=PfHt6JD/rfcpJdAzhR8MX1RY2UvG02LoW8Brsgd6AQM=; b=aboqoIOtARRUPKf2pWDt87TvECxo0MzY57vPNGwJ3SHlqTdygrhl/Gcgpnl5Xq/NX/ f9qW5/n2MClsiRWUS1wp5jRj1t1zS69nVgW7WVMLO9cOunu86fNjZKsUlQFvnMNcGgvL El10pX3MymKHL6nKEUVe4OgaRcvylVc/OnkWNujS2FLoU8P3z5324fbzUbiAoXYfxzbq r5b97rTnxRAm8DMrQvqkukOoR6AglBB9HCdC4ekqAQnjAB1J5twjjMcMu/ojRUhnbXru TMBkE6nDyaworS5VkYx67FDwoVxRYUJsiSV7W8uvSYMK6boGzgajcJkhVGofsgJQDMCc y7yg== 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 1-v6si3529445plw.164.2018.02.14.10.42.35; Wed, 14 Feb 2018 10:42:35 -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 S1162314AbeBNSm2 (ORCPT + 28 others); Wed, 14 Feb 2018 13:42:28 -0500 Received: from ms.lwn.net ([45.79.88.28]:54666 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162199AbeBNSkb (ORCPT ); Wed, 14 Feb 2018 13:40:31 -0500 Received: from tpad.lan (localhost [127.0.0.1]) by ms.lwn.net (Postfix) with ESMTPA id 7C9C031D; Wed, 14 Feb 2018 18:40:30 +0000 (UTC) From: Jonathan Corbet To: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mchehab@kernel.org, me@tobin.cc, jani.nikula@linux.intel.com, Jonathan Corbet Subject: [PATCH 3/8] docs: kernel-doc: Move STATE_NORMAL processing into its own function Date: Wed, 14 Feb 2018 11:40:04 -0700 Message-Id: <20180214184009.12657-4-corbet@lwn.net> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180214184009.12657-1-corbet@lwn.net> References: <20180214184009.12657-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. Reviewed-by: Jani Nikula Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) -- 2.14.3 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;