summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-12-26 22:29:22 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-12-26 22:29:22 (GMT)
commit42437db418574f2a80d098e568b9498a21343800 (patch)
tree291c1983d8ad14b97be19fda7f3601b9d83c2031 /contrib
parent330576fcb4d97504e0d6951067b753499d91b541 (diff)
downloaduscxml-42437db418574f2a80d098e568b9498a21343800.zip
uscxml-42437db418574f2a80d098e568b9498a21343800.tar.gz
uscxml-42437db418574f2a80d098e568b9498a21343800.tar.bz2
Plenty of smaller bug-fixes for uscxml-transform and PROMELA datamodel
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/local/prune_promela.pl42
1 files changed, 42 insertions, 0 deletions
diff --git a/contrib/local/prune_promela.pl b/contrib/local/prune_promela.pl
new file mode 100755
index 0000000..684afaa
--- /dev/null
+++ b/contrib/local/prune_promela.pl
@@ -0,0 +1,42 @@
+#!/usr/bin/perl -w
+
+die("Not practical as spin reports superfluous line numbers after preprocessing - minimize SCXML instead");
+
+use strict;
+use File::Spec;
+use File::Basename;
+
+my $pmlIn = shift or die("Expected *.pml file as input");
+
+# absolutize and split into components
+$pmlIn = File::Spec->rel2abs($pmlIn) or die($!);
+my($filename, $dirs, $suffix) = fileparse($pmlIn) or die($!);
+
+my $spinOut = `spin -a $pmlIn`;
+my $gccOut = `gcc -DMEMLIM=1024 -O2 -DVECTORSZ=2048 -DXUSAFE -w -o pan pan.c`;
+my $panOut = `./pan -m10000 -a`;
+
+my %unvisited;
+
+for (split /^/, $panOut) {
+ # /Users/sradomski/Desktop/foo.pml:128, state 12, "foreachIndex1 = 0"
+ if (/$pmlIn:(\d+), state (\d+), "(.*)"/) {
+ $unvisited{$1} = $3;
+ }
+}
+
+open(my $fh, "<", $pmlIn) or die($!);
+my $line = 0;
+while(<$fh>) {
+ if (exists($unvisited{$line}) && m/$unvisited{$line}/ ) {
+ print "/* removed as unvisited */\n";
+ } elsif (exists($unvisited{$line})) {
+ chomp($_);
+ chomp($unvisited{$line});
+ print STDERR "$_ vs $unvisited{$line} \n";
+ } else {
+ print;
+ }
+ $line++;
+}
+close($fh); \ No newline at end of file