Return-Path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Z+fNYJpiVfjQmPmoAxCfilOD/ZJEmWQDmgC/uwig++k=; b=LsOTg6sf08HRv3Ug5inZ26lR7c+p62+1Yo9GuqVmntEAzILZHA2IF4iBRHBTFzw+1/ MHKEHn8YHlbGX//jpDWv7Qv6YFK5oQK9Z4K9yuohJzeavF6o3eOkF1qr84r8PzGaX5Jn 4xTkj7gBoHJZO1Hy38p39P1Jqj89a+5eZc+EjXIcWCwJg7P2xgEratxnq6QCses/IDxL JHpMa74gYTOR3tpwm5f8rujzqsfmphoO0SrkPTlKbQmQZPPOZQIqZx7heJtXzJUhyQ+/ pWcKYKr+bl1b2ACB2EiMkpfySuwMVyGAFwMN+sxXBoTe8vvF2vtM1GKMwOJ5egyV8Mv2 ElKA== Subject: [PATCH 6/9] fcvextract.pl: Support 'style=' option and pass through other options References: From: Akira Yokosawa Message-ID: <7063e860-5d53-0751-fe1f-8dbdb1a97b2e@gmail.com> Date: Sun, 23 Sep 2018 16:30:31 +0900 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: "Paul E. McKenney" Cc: perfbook@vger.kernel.org, Akira Yokosawa List-ID: From 4c276d2dc2b2d056354c3d21d6b9a0f857c36631 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa Date: Wed, 29 Aug 2018 21:16:42 +0900 Subject: [PATCH 6/9] fcvextract.pl: Support 'style=' option and pass through other options "style=N" option will generate a "VerbatimN" environment. "style=U" option will generate a "VerbatimU" environment. Default is the "VerbatimL" environment. Other options to a \begin{snippet} meta command are passed through as options to "VerbatimL/N/U" environment. Signed-off-by: Akira Yokosawa --- utilities/fcvextract.pl | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/utilities/fcvextract.pl b/utilities/fcvextract.pl index cb6869b..ce549d3 100755 --- a/utilities/fcvextract.pl +++ b/utilities/fcvextract.pl @@ -112,6 +112,8 @@ my $dir_name; my $file_name; my $func_name; my $label; +my $env_name = "VerbatimL" ; +my $other_opts; $src_file = $ARGV[0]; $extract_labelbase = $ARGV[1]; @@ -158,25 +160,52 @@ while($line = <>) { print "% Generated by utilities/fcvextract.pl.\n" ; if ($line =~ /labelbase=([^,]+)/) { print "\\begin\{linelabel}\[$1\]\n" ; + $_ = $line ; + s/labelbase=[^,\]]+,?// ; + $line = $_ ; } - print "\\begin\{VerbatimL\}" ; + if ($line =~ /style=N[,\]]/) { + $env_name = "VerbatimN" ; + $_ = $line ; + s/style=N,?// ; + $line = $_ ; + } elsif ($line =~ /style=U[,\]]/) { + $env_name = "VerbatimU" ; + $_ = $line ; + s/style=U,?// ; + $line = $_ ; + } + print "\\begin\{$env_name\}" ; + if ($line =~ /commandchars=([^,]+).*\]/) { $esc_char = $1 ; - print "\[commandchars=" . $esc_char . "\]\n" ; + print "\[commandchars=" . $esc_char ; $esc_bsl = substr $esc_char, 1, 1; $esc_open = substr $esc_char, 3, 1; $esc_close = substr $esc_char, 5, 1; + $_ = $line ; + s/commandchars=.{6},?// ; + $line = $_ ; } else { $esc_bsl = "\\" ; $esc_open = "\{" ; $esc_close = "\}" ; - print "\n" ; + } + if ($line =~ /\[(.*)\]$/) { + $_ = $1 ; + s/,$// ; + $other_opts = $_ ; + } + if ($other_opts ne '') { + print ",$other_opts\]\n"; + } else { + print "\]\n"; } $extracting = 2; } } if ($extracting == 2) { - print "\\end\{VerbatimL\}\n\\end\{linelabel\}\n" ; + print "\\end\{$env_name\}\n\\end\{linelabel\}\n" ; exit 0; } else { exit 1; -- 2.7.4