[PATCH 05/11] fcvextract.pl: Support '/* \lnlbl{...} */' style label in C source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From f5a7cdba0ffb249111f4cf0d83896c0ce368e736 Mon Sep 17 00:00:00 2001
From: Akira Yokosawa <akiyks@xxxxxxxxx>
Date: Sun, 23 Dec 2018 15:06:59 +0900
Subject: [PATCH 05/11] fcvextract.pl: Support '/* \lnlbl{...} */' style label in C source

To embed labels on a multi-line macro definition, we need to
support the following way of labeling:

    #define MULTILINE_MACRO ({ FOO /* \lnlbl{foo} */ \
	BAR }) //\lnlbl{bar}

This style of labels work in snippets without the "keepcomment=yes"
option.

Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx>
---
 utilities/fcvextract.pl | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utilities/fcvextract.pl b/utilities/fcvextract.pl
index 71e761d..f8f274b 100755
--- a/utilities/fcvextract.pl
+++ b/utilities/fcvextract.pl
@@ -115,6 +115,7 @@ use warnings;
 my $src_file;
 my $c_src = 0;
 my $lnlbl_re;
+my $lnlbl_re2;
 my $line;
 my $edit_line;
 my $extract_labelbase;
@@ -143,6 +144,7 @@ $end_re = qr/\\end\{snippet\}/;
 
 if ($src_file =~ /.*\.[ch]$/ ) {
     $lnlbl_re = qr!(.*?)(\s*//\s*)\\lnlbl\{(.*)}\s*$!;
+    $lnlbl_re2 = qr!(.*?)(s*/\*\s*)\\lnlbl\{(.*)}\s*\*/(.*)$!;
     $c_src = 1;
 } elsif ($src_file =~ /.*\.c$/ ) {
     $lnlbl_re = qr!(.*?)(\s*//\s*)\\lnlbl\{(.*)}\s*$!;
@@ -170,6 +172,9 @@ while($line = <>) {
 	if ($line =~ /\\fcvexclude/) {
 	    next; # skip this line
 	}
+	if ($c_src && $line =~ m!$lnlbl_re2!) {
+	    $line = $1 . $esc_bsl . "lnlbl" . $esc_open . $3 . $esc_close . $4 . "\n" ;
+	}
 	if ($c_src && !$keepcomment) {
 	    if ($incomment) {
 		if ($line =~ /\*\/(.*$)/) {
-- 
2.7.4





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux