diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-12-26 22:29:22 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-12-26 22:29:22 (GMT) |
commit | 42437db418574f2a80d098e568b9498a21343800 (patch) | |
tree | 291c1983d8ad14b97be19fda7f3601b9d83c2031 /contrib | |
parent | 330576fcb4d97504e0d6951067b753499d91b541 (diff) | |
download | uscxml-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-x | contrib/local/prune_promela.pl | 42 |
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 |