>From 92a662ee9c74b45f3495784dc46587cd633603e3 Mon Sep 17 00:00:00 2001 From: Akira Yokosawa <akiyks@xxxxxxxxx> Date: Wed, 29 Aug 2018 21:05:39 +0900 Subject: [PATCH 4/9] reorder_ltms.pl: Enable further labeling in litmus test snippet In .litmus files, lines of "filter" and "exists" clauses can't have their own comments to put labels. To overcome this restriction, we add options "existslabel=foo" and "filterlabel=bar" to the \end[snippet] meta command. To put a label to an exists clause, you can put the label in the form: ... \end[snippet][existslabel=foo] exists (1:r2=0 /\ 0:r2=0) [EOF] This will be converted to: ... exists (1:r2=0 /\ 0:r2=0)\lnlbl{foo} \end{snippet} [EOF] in .ltms file. Signed-off-by: Akira Yokosawa <akiyks@xxxxxxxxx> --- utilities/reorder_ltms.pl | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/utilities/reorder_ltms.pl b/utilities/reorder_ltms.pl index 72d061b..d4770d0 100755 --- a/utilities/reorder_ltms.pl +++ b/utilities/reorder_ltms.pl @@ -45,11 +45,22 @@ my $edit_line; my $first_line; my $end_command; my $lnlbl_command; +my $lnlbl_on_exists = ""; +my $lnlbl_on_filter = ""; my $status = 0; # 0: just started, 1: first_line read; 2: begin line output, # 3: end line read while($line = <>) { if (eof) { + if ($line =~ /exists/) { + chomp $line; + print $line . $lnlbl_on_exists . "\n"; + } elsif ($line =~ /filter/) { + chomp $line; + print $line . $lnlbl_on_filter . "\n"; + } else { + print $line; + } last; } if ($status == 0) { @@ -70,6 +81,12 @@ while($line = <>) { $_ = $line ; s/\\end\[snippet\]/\\end\{snippet\}/ ; $end_command = $_ ; + if ($line =~ /existslabel=([^\],]+)/) { + $lnlbl_on_exists = "//\\lnlbl\{$1\}"; + } + if ($line =~ /filterlabel=([^\],]+)/) { + $lnlbl_on_filter = "//\\lnlbl\{$1\}"; + } $status = 3; next; } else { @@ -81,7 +98,15 @@ while($line = <>) { print $line ; } } elsif ($status == 3) { - print $line ; + if ($line =~ /exists/) { + chomp $line; + print $line . $lnlbl_on_exists . "\n"; + } elsif ($line =~ /filter/) { + chomp $line; + print $line . $lnlbl_on_filter . "\n"; + } else { + print $line ; + } } } -- 2.7.4