From 3e0ee4bb017223c9b7ac4cbe6eca3c5540d6af56 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 4 Apr 2013 10:25:30 -0400 Subject: Requirements: Add Frank's html generator script --- Carpet/Requirements/src/util/loc_html.pl | 119 +++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100755 Carpet/Requirements/src/util/loc_html.pl (limited to 'Carpet/Requirements') diff --git a/Carpet/Requirements/src/util/loc_html.pl b/Carpet/Requirements/src/util/loc_html.pl new file mode 100755 index 000000000..06ccacdd4 --- /dev/null +++ b/Carpet/Requirements/src/util/loc_html.pl @@ -0,0 +1,119 @@ +#!/usr/bin/perl -w +use strict; + +# Thorn Requirements can produce debug output describing which regions +# of which variables are valid and which are not at what time may be +# confusing. This is enabled via setting the parameter +# Requirements::output_changes = yes. +# +# This generates lines, prefixed with "LOC: " that contain information +# what is changed when and why. While this is sort of human-readable +# it's not ideal either. Because of that I created a script which +# takes that (just pipe the Cactus stdout into it) and spits out an +# html web page which displays the same information a bit nicer. An +# example can be seen here: +# +# https://www.cct.lsu.edu/~knarf/Requirements_example.html +# +# (green is for a changed setting, bright color is for undefined, dark +# for defined) +# +# Obviously this can be improved upon. Adding the name of the variable +# (instead of only the index (vi) would be an example. Thinking of +# something for the case of a gazillion GFs would also be needed. + + + +sub col +{ + my ($changed, $to) = @_; + if ($changed =~ /[a-z]/) { + if ($to eq "0") { + return "#CCCCCC"; + } else { + return "#777777"; + } + } else { + if ($to eq "0") { + return "#00CC00"; + } else { + return "#007700"; + } + } +} + +my @lines = <>; + +my $max_reflevel = 0; +foreach (@lines) { + if ($_ =~ /LOC: vi:(-?\d+),it:(-?\d+), \[rl:(-?\d+),tl:(-?\d+),m:(-?\d+)\] \((in|IN):([01]),(bo|BO):([01]),(gh|GH):([01]),(bg|BG):([01])\)(.*)/) { + if ($3 > $max_reflevel) { $max_reflevel = $3; }; + } +} + +print "\n"; +print "\n"; +foreach (@lines) { + if ($_ =~ /LOC: vi:(-?\d+),it:(-?\d+), \[rl:(-?\d+),tl:(-?\d+),m:(-?\d+)\] \((in|IN):([01]),(bo|BO):([01]),(gh|GH):([01]),(bg|BG):([01])\)(.*)/) { + my $vi = $1; + my $it = $2; + my $rl = $3; + my $tl = $4; + my $m = $5; + my $IN = $6; + my $in = $7; + my $BO = $8; + my $bo = $9; + my $GH = $10; + my $gh = $11; + my $BG = $12; + my $bg = $13; + my $info = $14; + print "\n"; + print " \n"; + print ""; + my $empty_l = ""; + my $prefix_s = $empty_s x ($rl); + my $prefix_l = $empty_l x ($rl); + print "
itvirltlm  
$it$vi$rl$tl$m\n"; + my $empty_s = "  
"; + print $prefix_s; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print $prefix_l; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print $prefix_s; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print $prefix_l; + print ""; + print ""; + print ""; + print ""; + print ""; + print ""; + print $prefix_s; + print ""; + print ""; + print ""; + print ""; + print ""; + print "
     
     
     
     
     
\n"; + print "$info\n"; + print "\n"; + } +} +print "\n"; -- cgit v1.2.3