[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]
Datei:
Sprache: Unknown
Columbo aufrufen.in zum Wurzelverzeichnis wechselnAda {Ada[94] Abap[331] [0]}Datei anzeigen
#!/usr/bin/env perl
#
# provethem.in
# Release: ProofLite-6.0.9 (3/14/14)
#
# Contact: Cesar Munoz ([email protected])
# NASA Langley Research Center
# http://shemesh.larc.nasa.gov/people/cam/ProofLite
#
# Copyright (c) 2011-2012 United States Government as represented by
# the National Aeronautics and Space Administration. No copyright
# is claimed in the United States under Title 17, U.S.Code. All Other
# Rights Reserved.
#
# Script for batch proving several libraries in PVS
#
use Getopt::Long; use File::Basename; use Term::ANSIColor qw(:constants); use Cwd;
sub usage() {
print <<EOF;
$PROVETHEMVERSION -- runs proveit on several libraries
$usageln
<option> is --addpath consider the current directory as part of
PVS_LIBRARY_PATH --after=<dir> prove all libraries after <dir>, exclusive. --before=<dir> prove all libraries before <dir>, exclusive. --but=<dir1>,..,<dirn> do not process libraries <dir1>,...,<dirn> --color do not use colors --cleanbin clean binary files but do not prove the libraries --clearpath consider an empty PVS_LIBRARY_PATH --dir <dir> use <dir> as default directory of summary files --do=<dir1>,..,<dirn> process libraries <dir1>,...,<dirn> --disable <o1,...on> disable external oracles o1,...,on. --disable-oracles disable any external oracle --enable <o1,..,on> enable external oracles o1,..,on. Overwrite --disable --ext <ext> use <ext> as default extension of summary files --execute <command> execute Unix <command> on all libraries. Command
may refer to \%DIR\% and \%FILE\% --force force provethem to go even if there is a proveit error --from=<dir> prove all libraries from <dir>, inclusive. --lisp <lisp> specify lisp version; <lisp> is one of allegro,cmulisp --log log all information generated by PVS in <file>.log --out <outfile> save output to <outfile> --test process <file> but do not call proveit --to=<dir> prove all libraries to <dir>, inclusive. --top <th> use <th>.pvs instead of top.pvs as top theory --typecheck-only typecheck but do not prove the libraries --verbose print summary information for all theories --version print version information and exit
File <file> is an ordered list of libraries to be processed by proveit. Each
line in <file> has the form <lib> [: <options>], where <lib> is a directory
name and <options> are paramters to proveit. If <lib> is empty, options apply
to all libraries thenceforth. Output is saved in <outfile>, which can be
specified using the option -out. Otherwise, a default name having the
form <file><postfix>.summaries is used.
The <postfix> depends on the options -do,-but,-from,-to,-after,-before
given to the script.
Unless the option -outis explictly use, an output file isnot created when
the options -cleanbin, -execute or -test are given.
EOF exit;
}
if ($addpath) {
$pwd=getcwd;
$pvslibrarypath = $ENV{'PVS_LIBRARY_PATH'}; if ($pvslibrarypath) {
$ENV{'PVS_LIBRARY_PATH'}="$pwd:$pvslibrarypath";
} else {
$ENV{'PVS_LIBRARY_PATH'}=$pwd;
}
}
$act = "Proving"; if ($execute) {
print "Executing shell command \"$execute\" on library\n";
print "The output of the execution is in $out\n"if $out;
} elsif ($cleanbin || $typecheckonly) { if ($cleanbin) {
print "Removing binary files from library\n";
$act = "Cleaning";
} elsif ($typecheckonly) {
print "Typechecking library\n";
$act = "Typechecking";
}
} else {
my $pvslp = "PVS_LIBRARY_PATH=$ENV{PVS_LIBRARY_PATH}";
print "$pvslp\n";
$summary = "$pvslp\n";
}
$go = "ok"if !($from || $after || @do);
my $totalformulas = 0;
my $totalproofs = 0;
my @libraries=();
while (<INFILE>) {
$line = $_;
$line =~ s/\#.*$//;
$line = trim($line); if ($line) {
@list = split /:/,$line;
$lib = trim($list[0]);
$opts = trim($list[1]); if ($lib) {
$go = "ok"if $from eq $lib;
last if $before eq $lib; if (($go || grep { "$_" eq $lib } @dolist) &&
!(grep { "$_" eq $lib } @butlist)) {
$command = ""; if ($execute) { if (-d $lib) {
$pathlib = $lib;
$baselib = "";
} elsif (-f $lib) {
($baselib,$pathlib,$typelib) = fileparse($lib,qr{\..*});
$baselib .= $typelib;
} else {
die "$lib is neither a file nor a directory\n";
}
($exe = $execute) =~ s/\%DIR\%/$pathlib/g;
$exe =~ s/\%FILE\%/$baselib/g;
$command = "cd $pathlib;echo \"*** $lib\";$exe";
} else {
$command = "$PROVEIT $options $overopts $opts $lib";
} if ($command) { if ($test) {
print "$command\n";
} else {
$beginln = sprintf "%-25s",$lib;
$beginln .= "[";
print $beginln if !$execute;
$proveout=`$command`;
$fail = ($? != 0);
print OUTFILE "$proveout\n"if $out; if ($execute) {
print "$proveout"if !$out;
} else { if ($fail) {
$status = "FAIL"; if ($color) {
print DARK RED $status;
} else {
print $status;
}
print ": $act]\n";
$summary .= "$beginln$status: $act]\n";
}
last if !$force && $fail; if (!$fail) { if ($cleanbin || $typecheckonly) {
$status = "OK"; if ($color) {
print DARK GREEN $status;
} else {
print $status;
}
$endln = ": $act]\n";
} elsif ($proveout =~
m/Grand Totals: (\d+) proofs, (\d+) attempted, (\d+) succeeded/) {
$totalformulas += $1; if ($1 eq $2 && $2 eq $3) {
$totalproofs += $1;
$status = "OK"; if ($color) {
print DARK GREEN $status;
} else {
print $status;
}
$endln = ": $1 proofs]\n";
} else {
$status = "MISS"; if ($color) {
print DARK MAGENTA $status;
} else {
print $status;
}
$totalproofs += $3;
my $miss = $1-$2;
my $unsucc = $1-$3;
my $comma = "";
my $msguna = ""; if ($miss) {
$comma = ", ";
$msguna = "$miss unattempted";
}
my $msguns = "$comma$unsucc unsuccessful"if $unsucc;
$endln = ": $msguna$msguns / $1 formulas]\n";
}
} else {
chomp $proveout;
$endln = ": $proveout]\n";
}
print $endln;
$summary .= "$beginln$status$endln"; if (!$cleanbin) {
$depfile = "$lib/pvsbin/$lib.dep"; if (-f $depfile) {
open (DEPFILE,"$depfile"); while (<DEPFILE>) {
$line = $_;
last if $line =~ /:/;
@list = split /\//,$line; if ($list[0] && !(grep {$_ eq $list[0]} @prelude) &&
!grep {$_ eq $list[0]} @libraries) {
print "*** Warning: Library $list[0] is out of order. It should appear before $lib in $file\n";
}
}
close (DEPFILE);
} else {
print "*** Warning: File $depfile not found\n";
}
}
}
}
}
}
}
push(@libraries,$lib) if !$execute && !$cleanbin;
$go = "ok"if $after eq $lib;
last if $to eq $lib;
} else {
$options .= " $opts";
}
}
}
if (!$cleanbin && !$typecheckonly && !$execute) {
my $missed = $totalformulas-$totalproofs;
my $mssg = "\n*** Grand Total: $totalproofs proofs / $totalformulas formulas. Missed: $missed formulas.\n";
print $mssg;
$summary .= $mssg;
}
close(INFILE); if ($out) {
print OUTFILE $summary;
close(OUTFILE);
}
[ Original von:0.130Diese Quellcodebibliothek enthält Beispiele in vielen Programmiersprachen.
Man kann per Verzeichnistruktur darin navigieren.
Der Code wird farblich markiert angezeigt.
]