1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714
|
-------------------------------------------------------------------------------
-- (C) Altran Praxis Limited
-------------------------------------------------------------------------------
--
-- The SPARK toolset is free software; you can redistribute it and/or modify it
-- under terms of the GNU General Public License as published by the Free
-- Software Foundation; either version 3, or (at your option) any later
-- version. The SPARK toolset is distributed in the hope that it will be
-- useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-- Public License for more details. You should have received a copy of the GNU
-- General Public License distributed with the SPARK toolset; see file
-- COPYING3. If not, go to http://www.gnu.org/licenses for a complete copy of
-- the license.
--
--=============================================================================
--------------------------------------------------------------------------------
--Synopsis: --
-- --
--Package providing data structure to store running totals, and a procedure --
--to print them. --
-- --
--------------------------------------------------------------------------------
with Banner;
with CommandLine;
with E_Strings;
with FatalErrors;
with Heap;
with VCHeap;
with VCDetails;
use type VCDetails.VC_State_T;
use type VCDetails.DPC_State_T;
package body Total
--# own State is The_Totals;
is
type VC_Counter is array (VCDetails.Terminal_Point_Type) of Natural;
type Error_Type_Counter is array (VCDetails.Error_Type) of Natural;
Null_VC_Counter : constant VC_Counter := VC_Counter'(others => 0);
-- if adding more entries to this type, you must alter the procedure
-- Output below to display the results, and add code in the appropriate
-- analysis routines to increment the counter(s). You must also alter
-- the aggregate in Initialize below to initialize the new counter
type Total_Type is record
-- Subprograms without errors (all subprograms have vcs).
Subprograms_With_VCs : Natural;
-- Subprograms with errors.
Subprograms_Where_Error : Error_Type_Counter;
Subprograms_Where_VC_Analysis_Abandoned : Natural;
Subprograms_Where_DPC_Analysis_Abandoned : Natural;
-- A subprogram with At Least One (ALO) Undischarged VC.
Subprograms_With_ALO_Undischarged_VC : Natural;
-- The following fields record the number of subprograms,
-- which are not necessarily fully proved, but have at least
-- one VC proved by each of the following strategies:
-- A subprogram with At Least One (ALO) VC proved by
-- the Examiner.
Subprograms_With_ALO_Examiner_VC : Natural;
-- A subprogram with At Least One (ALO) VC proved by the
-- simplifier without a user defined rule.
Subprograms_With_ALO_Simplifier_VC : Natural;
-- A subprogram with At Least One (ALO) VC proved using
-- a using proof by contradiction.
Subprograms_With_ALO_Contradiction_VC : Natural;
-- A subprogram with At Least One (ALO) VC proved using
-- a user defined rule.
Subprograms_With_ALO_User_Rule_VC : Natural;
-- A subprogram with At Least One (ALO) VC proved by Victor
Subprograms_With_ALO_Victor_VC : Natural;
-- A subprogram with At Least One (ALO) VC proved by Riposte
Subprograms_With_ALO_Riposte_VC : Natural;
-- A subprogram with At Least One (ALO) VC proved using
-- the Checker.
Subprograms_With_ALO_Checker_VC : Natural;
-- A subprogram with At Least One (ALO) VC discharged by review
Subprograms_With_ALO_Review_VC : Natural;
-- A subprogram with At Least One (ALO) false VC.
Subprograms_With_ALO_False_VC : Natural;
-- The following fields represent the use of a hierachy of
-- proof strategies:
-- Examiner -> Simplifier -> User Rules -> ViCToR -> Checker -> Review
-- When a subprogram is proved, the strategy latest in the hierarchy
-- is considered to have been used to complete the proof, even
-- if earlier strategies have also been applied.
-- The hierachy gives a measure of the extent of the strategies
-- required in proving a subprogram.
-- The definitions of the hierarchical strategies is given below:
-- A subprogram proof is completed by the examiner if:
-- o at LEAST one VC was proved by the examiner and
-- o ZERO VCs were proved by the simplifier,
-- Victor, Riposte, the checker, review file or left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_By_Examiner : Natural;
-- A subprogram proof is completed by the simplifier if:
-- o at LEAST one VC was proved by the simplifier and
-- o ZERO VCs were proved by Victor, Riposte,, the checker, review file
-- or left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_By_Simplifier : Natural;
-- A subprogram proof is completed by a user defined proof rule if:
-- o at least one VC was proved by the simplifier and
-- o at least one user defined rule has been used in the proof of a VC and
-- o ZERO VCs were proved by Victor, Riposte, the checker, review file
-- or left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_With_User_Proof_Rule : Natural;
-- A subprogram proof is completed by ViCToR if:
-- o at least one VC was proved by ViCToR and
-- o ZERO VCs were proved by the Riposte, checker, review file,
-- or left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_By_Victor : Natural;
-- A subprogram proof is completed by Riposte if:
-- o at least one VC was proved by Riposte and
-- o ZERO VCs were proved by the checker, review file
-- or left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_By_Riposte : Natural;
-- A subprogram proof is completed by the checker if:
-- o at LEAST one VC was proved by the checker and
-- o ZERO VCs were proved by the review file or
-- left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_By_Checker : Natural;
-- A subprogram proof is completed by review if:
-- o at LEAST one VC was proved in the review file and
-- o ZERO VCs were left Undischarged and
-- o the subprogram has no false VCs.
Subprograms_Proved_By_Review : Natural;
-- The following fields record the number of VCs proved by
-- each strategy grouped by the sort of origin (the terminal point)
-- of the VC.
VCs_Total : VC_Counter;
VCs_Proved_By_Examiner : VC_Counter;
VCs_Proved_By_Simplifier : VC_Counter;
VCs_Proved_With_User_Proof_Rule : VC_Counter;
VCs_Proved_By_Victor : VC_Counter;
VCs_Proved_By_Riposte : VC_Counter;
VCs_Proved_By_Checker : VC_Counter;
VCs_Proved_By_Review : VC_Counter;
VCs_Proved_False : VC_Counter;
VCs_Undischarged : VC_Counter;
-- Record number of subprograms with DPCs
Subprograms_With_DPCs : Natural;
-- The following fields record the number of dead paths ZombieScope
-- has found.
Number_Of_Dead_Paths : Natural;
Subprograms_With_Dead_Paths : Natural;
end record;
The_Totals : Total_Type;
function Sum (T : in VC_Counter) return Natural is
Result : Natural := 0;
begin
for I in VCDetails.Terminal_Point_Type loop
Result := Result + T (I);
end loop;
return Result;
end Sum;
procedure Calculate_Percentages
(The_Totals : in Total_Type;
Percent_Undischarged_Str : out E_Strings.T;
Percent_Proved_By_Examiner_Str : out E_Strings.T;
Percent_Proved_By_Victor_Str : out E_Strings.T;
Percent_Proved_By_Riposte_Str : out E_Strings.T;
Percent_Proved_By_Checker_Str : out E_Strings.T;
Percent_Proved_By_Review_Str : out E_Strings.T;
Percent_Simplified_Str : out E_Strings.T;
Percent_With_User_Rule_Str : out E_Strings.T;
Percent_Proved_False_Str : out E_Strings.T)
--# derives Percent_Proved_By_Checker_Str,
--# Percent_Proved_By_Examiner_Str,
--# Percent_Proved_By_Review_Str,
--# Percent_Proved_By_Riposte_Str,
--# Percent_Proved_By_Victor_Str,
--# Percent_Proved_False_Str,
--# Percent_Simplified_Str,
--# Percent_Undischarged_Str,
--# Percent_With_User_Rule_Str from The_Totals;
--# pre Sum (The_Totals.VCs_Total) /= 0;
is
subtype Percentage is Natural range 0 .. 100;
VCs_Total : Natural;
procedure Total_And_Value_To_Percentage
(Overall_Total : in Natural;
Value : in Natural;
Percent : out Percentage;
Percent_C : out Character)
--# derives Percent,
--# Percent_C from Overall_Total,
--# Value;
--# pre (Overall_Total/=0);
is
Percise_Percent_Value : Float;
Rounded_Percent_Value : Percentage;
begin
Percise_Percent_Value := (Float (Value) * 100.0) / Float (Overall_Total);
Rounded_Percent_Value := Percentage (Percise_Percent_Value);
case Rounded_Percent_Value is
-- If the rounded percentage value is zero, but the actual
-- value is non-zero, then the rounded value is forced to be 1.
-- This behaviour ensures that a zero percentage really means
-- zero.
when 0 =>
if (Value /= 0) then
Percent := 1;
-- If the actual percent is less than 0.5 then this is
-- indicated with an appropriate leading character.
if (Percise_Percent_Value < 0.5) then
Percent_C := '<';
else
Percent_C := ' ';
end if;
else
Percent := 0;
Percent_C := ' ';
end if;
-- If the rounded percentage value is 100, but the actual value
-- is not equal to the total, then the rounded value is forced
-- to be 99. This behaviour ensures that a hundred percent
-- really means all.
when 100 =>
if (Value /= Overall_Total) then
Percent := 99;
-- If the actual percent is greater than 99.5 then this is
-- indicated with an appropriate leading character.
if (Percise_Percent_Value > 99.5) then
Percent_C := '>';
else
Percent_C := ' ';
end if;
else
Percent := 100;
Percent_C := ' ';
end if;
-- In all other cases, accept the rounding approximation.
when 1 .. 99 =>
Percent := Rounded_Percent_Value;
Percent_C := ' ';
end case;
end Total_And_Value_To_Percentage;
procedure Generate_Percent_String (Percent : in Percentage;
Percent_C : in Character;
Percent_Str : out E_Strings.T)
--# derives Percent_Str from Percent,
--# Percent_C;
is
Percent_Part : E_Strings.T;
begin
--Initialise to empty string.
Percent_Str := E_Strings.Empty_String;
--For alingment: if percent is one digit, add two spaces.
-- : if percent is two digits, add one spaces.
case Percent is
when 0 .. 9 =>
E_Strings.Append_String (E_Str => Percent_Str,
Str => " ");
when 10 .. 99 =>
E_Strings.Append_String (E_Str => Percent_Str,
Str => " ");
when 100 =>
null;
end case;
--Append the: '>','<',' ' prefix. (max length "X": 1)
E_Strings.Append_Char (E_Str => Percent_Str,
Ch => Percent_C);
--Append the: percent number. (max length "XYYY": 4)
E_Strings.Put_Int_To_String (Dest => Percent_Part,
Item => Percent,
Start_Pt => 1,
Base => 10);
E_Strings.Append_Examiner_String (E_Str1 => Percent_Str,
E_Str2 => E_Strings.Trim (E_Str => Percent_Part));
--Append the: symbol '%'. (max length "XYYY%": 5)
E_Strings.Append_Char (E_Str => Percent_Str,
Ch => '%');
end Generate_Percent_String;
function Make_Percent_String (N_Actual, N_Total : in Natural) return E_Strings.T
--# pre N_Total /= 0;
is
Percent : Percentage;
Size_Char : Character; -- For the ordering relation character in >99% or <1%
Retval : E_Strings.T;
begin
Total_And_Value_To_Percentage (Overall_Total => N_Total,
Value => N_Actual,
Percent => Percent,
Percent_C => Size_Char);
Generate_Percent_String (Percent => Percent,
Percent_C => Size_Char,
Percent_Str => Retval);
return Retval;
end Make_Percent_String;
begin
VCs_Total := Sum (The_Totals.VCs_Total);
Percent_Undischarged_Str := Make_Percent_String (Sum (The_Totals.VCs_Undischarged), VCs_Total);
Percent_Proved_By_Examiner_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_By_Examiner), VCs_Total);
Percent_Proved_By_Victor_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_By_Victor), VCs_Total);
Percent_Proved_By_Riposte_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_By_Riposte), VCs_Total);
Percent_Proved_By_Checker_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_By_Checker), VCs_Total);
Percent_Proved_By_Review_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_By_Review), VCs_Total);
Percent_Simplified_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_By_Simplifier), VCs_Total);
Percent_With_User_Rule_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_With_User_Proof_Rule), VCs_Total);
Percent_Proved_False_Str := Make_Percent_String (Sum (The_Totals.VCs_Proved_False), VCs_Total);
end Calculate_Percentages;
-- Never returns from this subprogram.
-- Null dependency relation used to avoid propagation
-- of FatalErrors.State impacting existing clients of Total.
-- FatalErrors.State is of little interest in this context.
procedure Fatal_Error (Error : in FatalErrors.Error_Type)
--# derives null from Error;
is
--# hide Fatal_Error;
begin
FatalErrors.Process (Error, E_Strings.Empty_String);
end Fatal_Error;
function Totals_Are_Balanced return Boolean
--# global in The_Totals;
is
Total_Subprograms_Proved : Natural;
Total_Subprograms_At_Least_One_False_VC : Natural;
Total_Subprograms_No_False_At_Least_One_Undischarged : Natural;
Total_Subprograms : Natural;
begin
-- Total all of the subprogram that have been fully proved.
Total_Subprograms_Proved :=
((((((The_Totals.Subprograms_Proved_By_Examiner + The_Totals.Subprograms_Proved_By_Simplifier) +
The_Totals.Subprograms_Proved_With_User_Proof_Rule) +
The_Totals.Subprograms_Proved_By_Checker) +
The_Totals.Subprograms_Proved_By_Review) +
The_Totals.Subprograms_Proved_By_Victor) +
The_Totals.Subprograms_Proved_By_Riposte);
-- Total all of the subprogram that have at least one false vc.
Total_Subprograms_At_Least_One_False_VC := The_Totals.Subprograms_With_ALO_False_VC;
-- Total all of the subprogram that have no false vcs, and at least one
-- undischarged vc.
Total_Subprograms_No_False_At_Least_One_Undischarged := The_Totals.Subprograms_With_ALO_Undischarged_VC;
-- Total all of the subprograms.
Total_Subprograms :=
((Total_Subprograms_Proved + Total_Subprograms_At_Least_One_False_VC) +
Total_Subprograms_No_False_At_Least_One_Undischarged);
-- Return true if the total matches the recorded total number of Subprograms
-- with VCs and false otherwise.
return (Total_Subprograms = The_Totals.Subprograms_With_VCs);
end Totals_Are_Balanced;
procedure Update_Totals (VCG : in Boolean;
DPC : in Boolean)
--# global in VCHeap.State;
--# in out The_Totals;
--# derives The_Totals from *,
--# DPC,
--# VCG,
--# VCHeap.State;
is
Subprogram_Is_Undischarged : Boolean;
Subprogram_Has_VC_Proved_By_Examiner : Boolean;
Subprogram_Has_VC_Proved_By_Simplifier : Boolean;
Subprogram_Has_VC_Proved_By_Contradiction : Boolean;
Subprogram_Has_VC_Proved_With_User_Proof_Rule : Boolean;
Subprogram_Has_VC_Proved_By_Victor : Boolean;
Subprogram_Has_VC_Proved_By_Riposte : Boolean;
Subprogram_Has_VC_Proved_By_Checker : Boolean;
Subprogram_Has_VC_Proved_By_Review : Boolean;
Subprogram_Has_VC_Proved_False : Boolean;
Subprogram_Contains_Dead_Paths : Boolean;
More_VCs : Boolean;
Heap_Index : Heap.Atom;
Next_Index : Heap.Atom;
Unused_VC_Name : E_Strings.T;
Unused_Path_Start : E_Strings.T;
Unused_Path_End : E_Strings.T;
End_Type : VCDetails.Terminal_Point_Type;
VC_State : VCDetails.VC_State_T;
DPC_State : VCDetails.DPC_State_T;
-- Return true if there was an error analysing any of the .vcg
-- derived files (i.e. .siv, .vct, etc.). Note that corrupted
-- files related to ZombieScope are handeled separately.
function Something_Is_Corrupt_In_VC return Boolean
--# global in VCHeap.State;
is
Tmp : Boolean;
begin
for X in VCDetails.Error_Type_Corrupt_VC_Files loop
Tmp := VCHeap.Error_Raised (Error_Kind => X);
exit when Tmp;
end loop;
return Tmp;
end Something_Is_Corrupt_In_VC;
-- Return true if there was an error analysing any of the .dpc
-- derived files (i.e. .sdp, etc.).
function Something_Is_Corrupt_In_DPC return Boolean
--# global in VCHeap.State;
is
Tmp : Boolean;
begin
for X in VCDetails.Error_Type_Corrupt_DPC_Files loop
Tmp := VCHeap.Error_Raised (Error_Kind => X);
exit when Tmp;
end loop;
return Tmp;
end Something_Is_Corrupt_In_DPC;
begin
-- Initialisation.
Subprogram_Is_Undischarged := False;
Subprogram_Has_VC_Proved_By_Examiner := False;
Subprogram_Has_VC_Proved_By_Simplifier := False;
Subprogram_Has_VC_Proved_By_Contradiction := False;
Subprogram_Has_VC_Proved_With_User_Proof_Rule := False;
Subprogram_Has_VC_Proved_By_Victor := False;
Subprogram_Has_VC_Proved_By_Riposte := False;
Subprogram_Has_VC_Proved_By_Checker := False;
Subprogram_Has_VC_Proved_By_Review := False;
Subprogram_Has_VC_Proved_False := False;
Subprogram_Contains_Dead_Paths := False;
-- Keep count of all the errors.
for X in VCDetails.Error_Type loop
if VCHeap.Error_Raised (Error_Kind => X) then
The_Totals.Subprograms_Where_Error (X) := The_Totals.Subprograms_Where_Error (X) + 1;
end if;
end loop;
--# assert True;
-- Only perform detailed analysis of subprogram if it did not
-- have an associated corrupt file.
if Something_Is_Corrupt_In_VC then
The_Totals.Subprograms_Where_VC_Analysis_Abandoned := The_Totals.Subprograms_Where_VC_Analysis_Abandoned + 1;
end if;
if Something_Is_Corrupt_In_DPC then
The_Totals.Subprograms_Where_DPC_Analysis_Abandoned := The_Totals.Subprograms_Where_DPC_Analysis_Abandoned + 1;
end if;
--# assert True;
-- We count VCs only if the .vcg file is not corrupt. If
-- something else is corrupt we don't care here.
if VCG and then not VCHeap.Error_Raised (Error_Kind => VCDetails.Corrupt_VCG_File) then
The_Totals.Subprograms_With_VCs := The_Totals.Subprograms_With_VCs + 1;
end if;
if DPC and then not VCHeap.Error_Raised (Error_Kind => VCDetails.Corrupt_DPC_File) then
The_Totals.Subprograms_With_DPCs := The_Totals.Subprograms_With_DPCs + 1;
end if;
--# assert True;
More_VCs := True;
Heap_Index := VCHeap.First_Entry;
while More_VCs and not Heap.IsNullPointer (Heap_Index) loop
-- Get the details for the next VC.
--# accept F, 10, Unused_Path_End, "Unused_Path_End unused here" &
--# F, 10, Unused_Path_Start, "Unused_Path_Start unused here" &
--# F, 10, Unused_VC_Name, "Unused_VC_Name unused here" ;
VCHeap.Details
(List_Index => Heap_Index,
VC_Name => Unused_VC_Name,
Path_Start => Unused_Path_Start,
Path_End => Unused_Path_End,
End_Type => End_Type,
VC_State => VC_State,
DPC_State => DPC_State);
--# end accept;
--# assert True;
--# accept F, 41, "Expression is stable";
-- If we have a corrupt VCG file we don't do anything.
if VCG and then not VCHeap.Error_Raised (Error_Kind => VCDetails.Corrupt_VCG_File) then
--# end accept;
The_Totals.VCs_Total (End_Type) := The_Totals.VCs_Total (End_Type) + 1;
--# accept F, 41, "Expression is stable";
-- We only sum up totals if we don't have anything corrupted.
if Something_Is_Corrupt_In_VC then
--# end accept;
The_Totals.VCs_Undischarged (End_Type) := The_Totals.VCs_Undischarged (End_Type) + 1;
Subprogram_Is_Undischarged := True;
else
case VC_State is
when VCDetails.VC_False =>
The_Totals.VCs_Proved_False (End_Type) := The_Totals.VCs_Proved_False (End_Type) + 1;
Subprogram_Has_VC_Proved_False := True;
Subprogram_Is_Undischarged := True;
when VCDetails.VC_Proved_By_Examiner =>
Subprogram_Has_VC_Proved_By_Examiner := True;
The_Totals.VCs_Proved_By_Examiner (End_Type) := The_Totals.VCs_Proved_By_Examiner (End_Type) + 1;
when VCDetails.VC_Proved_By_Inference =>
Subprogram_Has_VC_Proved_By_Simplifier := True;
The_Totals.VCs_Proved_By_Simplifier (End_Type) := The_Totals.VCs_Proved_By_Simplifier (End_Type) + 1;
when VCDetails.VC_Proved_By_Contradiction =>
Subprogram_Has_VC_Proved_By_Contradiction := True;
Subprogram_Has_VC_Proved_By_Simplifier := True;
The_Totals.VCs_Proved_By_Simplifier (End_Type) := The_Totals.VCs_Proved_By_Simplifier (End_Type) + 1;
when VCDetails.VC_Proved_By_Checker =>
Subprogram_Has_VC_Proved_By_Checker := True;
The_Totals.VCs_Proved_By_Checker (End_Type) := The_Totals.VCs_Proved_By_Checker (End_Type) + 1;
when VCDetails.VC_Proved_By_Victor =>
Subprogram_Has_VC_Proved_By_Victor := True;
The_Totals.VCs_Proved_By_Victor (End_Type) := The_Totals.VCs_Proved_By_Victor (End_Type) + 1;
when VCDetails.VC_Proved_By_Riposte =>
Subprogram_Has_VC_Proved_By_Riposte := True;
The_Totals.VCs_Proved_By_Riposte (End_Type) := The_Totals.VCs_Proved_By_Riposte (End_Type) + 1;
when VCDetails.VC_Proved_By_Review =>
Subprogram_Has_VC_Proved_By_Review := True;
The_Totals.VCs_Proved_By_Review (End_Type) := The_Totals.VCs_Proved_By_Review (End_Type) + 1;
when VCDetails.VC_Proved_Using_User_Proof_Rules =>
Subprogram_Has_VC_Proved_With_User_Proof_Rule := True;
Subprogram_Has_VC_Proved_By_Simplifier := True;
The_Totals.VCs_Proved_With_User_Proof_Rule (End_Type) :=
The_Totals.VCs_Proved_With_User_Proof_Rule (End_Type) + 1;
The_Totals.VCs_Proved_By_Simplifier (End_Type) := The_Totals.VCs_Proved_By_Simplifier (End_Type) + 1;
when VCDetails.VC_SIV_Not_Present | VCDetails.VC_Undischarged =>
The_Totals.VCs_Undischarged (End_Type) := The_Totals.VCs_Undischarged (End_Type) + 1;
Subprogram_Is_Undischarged := True;
when VCDetails.VC_Not_Present =>
null;
end case;
end if;
end if;
--# assert True;
--# accept F, 41, "Expression is stable";
-- If we have a corrupt DPC file or anything related we don't do anything.
if DPC and then not Something_Is_Corrupt_In_DPC then
--# end accept;
if DPC_State = VCDetails.DPC_Dead then
-- Update the total number of subprograms containing
-- dead paths.
if not Subprogram_Contains_Dead_Paths then
The_Totals.Subprograms_With_Dead_Paths := The_Totals.Subprograms_With_Dead_Paths + 1;
end if;
Subprogram_Contains_Dead_Paths := True;
-- Update the total number of dead paths found.
The_Totals.Number_Of_Dead_Paths := The_Totals.Number_Of_Dead_Paths + 1;
end if;
end if;
--# assert True;
VCHeap.Next (After_This => Heap_Index,
Success => More_VCs,
Next_One => Next_Index);
Heap_Index := Next_Index;
end loop;
--# assert True;
-- Update the 'At Least One' counts.
if Subprogram_Is_Undischarged then
if Subprogram_Has_VC_Proved_False then
The_Totals.Subprograms_With_ALO_False_VC := The_Totals.Subprograms_With_ALO_False_VC + 1;
else
The_Totals.Subprograms_With_ALO_Undischarged_VC := The_Totals.Subprograms_With_ALO_Undischarged_VC + 1;
end if;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Examiner then
The_Totals.Subprograms_With_ALO_Examiner_VC := The_Totals.Subprograms_With_ALO_Examiner_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Simplifier then
The_Totals.Subprograms_With_ALO_Simplifier_VC := The_Totals.Subprograms_With_ALO_Simplifier_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Contradiction then
The_Totals.Subprograms_With_ALO_Contradiction_VC := The_Totals.Subprograms_With_ALO_Contradiction_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_With_User_Proof_Rule then
The_Totals.Subprograms_With_ALO_User_Rule_VC := The_Totals.Subprograms_With_ALO_User_Rule_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Victor then
The_Totals.Subprograms_With_ALO_Victor_VC := The_Totals.Subprograms_With_ALO_Victor_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Riposte then
The_Totals.Subprograms_With_ALO_Riposte_VC := The_Totals.Subprograms_With_ALO_Riposte_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Checker then
The_Totals.Subprograms_With_ALO_Checker_VC := The_Totals.Subprograms_With_ALO_Checker_VC + 1;
end if;
--# assert True;
if Subprogram_Has_VC_Proved_By_Review then
The_Totals.Subprograms_With_ALO_Review_VC := The_Totals.Subprograms_With_ALO_Review_VC + 1;
end if;
--# assert True;
-- Update the proof strategy use hierarchy (See declaration of Total_Type)
-- Examiner -> Simplifier -> User Rules -> ViCToR -> Checker -> Review
if not Subprogram_Is_Undischarged then
if Subprogram_Has_VC_Proved_By_Review then
The_Totals.Subprograms_Proved_By_Review := The_Totals.Subprograms_Proved_By_Review + 1;
elsif Subprogram_Has_VC_Proved_By_Checker then
The_Totals.Subprograms_Proved_By_Checker := The_Totals.Subprograms_Proved_By_Checker + 1;
elsif Subprogram_Has_VC_Proved_By_Victor then
The_Totals.Subprograms_Proved_By_Victor := The_Totals.Subprograms_Proved_By_Victor + 1;
elsif Subprogram_Has_VC_Proved_By_Riposte then
The_Totals.Subprograms_Proved_By_Riposte := The_Totals.Subprograms_Proved_By_Riposte + 1;
elsif Subprogram_Has_VC_Proved_With_User_Proof_Rule then
The_Totals.Subprograms_Proved_With_User_Proof_Rule := The_Totals.Subprograms_Proved_With_User_Proof_Rule + 1;
elsif Subprogram_Has_VC_Proved_By_Simplifier then
The_Totals.Subprograms_Proved_By_Simplifier := The_Totals.Subprograms_Proved_By_Simplifier + 1;
elsif Subprogram_Has_VC_Proved_By_Examiner then
The_Totals.Subprograms_Proved_By_Examiner := The_Totals.Subprograms_Proved_By_Examiner + 1;
end if;
end if;
--# assert True;
--# accept F, 33, Unused_Path_End, "Unused_Path_End unused here" &
--# F, 33, Unused_Path_Start, "Unused_Path_Start unused here" &
--# F, 33, Unused_VC_Name, "Unused_VC_Name unused here";
end Update_Totals;
procedure Output
(Report_File : in SPARK_IO.File_Type;
Temp_File : in out SPARK_IO.File_Type;
Temp_False_File : in out SPARK_IO.File_Type;
Temp_Contra_File : in out SPARK_IO.File_Type;
Temp_Victor_File : in out SPARK_IO.File_Type;
Temp_Riposte_File : in out SPARK_IO.File_Type;
Temp_User_File : in out SPARK_IO.File_Type;
Temp_Rlu_Error_File : in out SPARK_IO.File_Type;
Temp_Rlu_Used_File : in out SPARK_IO.File_Type;
Temp_PR_Verr_File : in out SPARK_IO.File_Type;
Temp_Warn_Error_File : in out SPARK_IO.File_Type;
Temp_SDP_Error_File : in out SPARK_IO.File_Type;
Temp_DPC_Error_File : in out SPARK_IO.File_Type;
Temp_Victor_Error_File : in out SPARK_IO.File_Type;
Temp_Riposte_Error_File : in out SPARK_IO.File_Type)
--# global in CommandLine.Data;
--# in The_Totals;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# CommandLine.Data,
--# Report_File,
--# Temp_Contra_File,
--# Temp_DPC_Error_File,
--# Temp_False_File,
--# Temp_File,
--# Temp_PR_Verr_File,
--# Temp_Riposte_Error_File,
--# Temp_Riposte_File,
--# Temp_Rlu_Error_File,
--# Temp_Rlu_Used_File,
--# Temp_SDP_Error_File,
--# Temp_User_File,
--# Temp_Victor_Error_File,
--# Temp_Victor_File,
--# Temp_Warn_Error_File,
--# The_Totals &
--# Temp_Contra_File,
--# Temp_DPC_Error_File,
--# Temp_False_File,
--# Temp_File,
--# Temp_PR_Verr_File,
--# Temp_Riposte_Error_File,
--# Temp_Riposte_File,
--# Temp_Rlu_Error_File,
--# Temp_Rlu_Used_File,
--# Temp_SDP_Error_File,
--# Temp_User_File,
--# Temp_Victor_Error_File,
--# Temp_Victor_File,
--# Temp_Warn_Error_File from *;
is
Percent_Undischarged_Str : E_Strings.T;
Percent_Proved_By_Examiner_Str : E_Strings.T;
Percent_Proved_By_Victor_Str : E_Strings.T;
Percent_Proved_By_Riposte_Str : E_Strings.T;
Percent_Proved_By_Checker_Str : E_Strings.T;
Percent_Proved_By_Review_Str : E_Strings.T;
Percent_Simplified_Str : E_Strings.T;
Percent_With_User_Rule_Str : E_Strings.T;
Percent_Proved_False_Str : E_Strings.T;
Total_Subprograms_Proved : Natural;
subtype Valid_Column_Size is Integer range 4 .. Integer'Last;
Name_Column_Width : constant Valid_Column_Size := 14;
Column_Width : constant Valid_Column_Size := 11;
subtype Rowname_String_Positions_T is E_Strings.Positions range E_Strings.Positions'First .. Name_Column_Width;
subtype Colname_String_Positions_T is E_Strings.Positions range E_Strings.Positions'First .. Column_Width;
subtype Table_Rowname_String_T is String (Rowname_String_Positions_T);
subtype Table_Colname_String_T is String (Colname_String_Positions_T);
-- Don't count the 0th column, only the data columns
type Table_Column_Index is range 1 .. 10;
type Table_Column_T is record
Name : Table_Colname_String_T;
Width : Valid_Column_Size;
Brackets : Boolean;
end record;
type Table_Row_T is record
Name : Table_Rowname_String_T;
Nonzero_Only : Boolean;
end record;
type Table_Format_T is array (Table_Column_Index) of Table_Column_T;
type Table_Row_Format_T is array (VCDetails.Terminal_Point_Type) of Table_Row_T;
type Table_Column_Enabled_T is array (Table_Column_Index) of Boolean;
-- Rationale for the widths: Total, Examiner and Simplifier
-- will have big numbers (think iFACTS). The other colums
-- should be much smaller; except maybe the Undischarged column
-- as that is what you get from a pogs run on an unsimplified
-- tree.
Table_Format : constant Table_Format_T :=
Table_Format_T'
(1 => Table_Column_T'("Total ", Column_Width, False),
2 => Table_Column_T'("Examiner ", Column_Width, False),
3 => Table_Column_T'("Simplifier ", Column_Width, False),
4 => Table_Column_T'("(User) ", 7, True),
5 => Table_Column_T'("Victor ", 7, False),
6 => Table_Column_T'("Riposte ", 8, False),
7 => Table_Column_T'("Checker ", 8, False),
8 => Table_Column_T'("Review ", 7, False),
9 => Table_Column_T'("False ", 6, False),
10 => Table_Column_T'("Undisc. ", Column_Width, False));
Table_Column_Enabled : Table_Column_Enabled_T;
Table_Row_Format : constant Table_Row_Format_T :=
Table_Row_Format_T'
(VCDetails.Assert_Point => Table_Row_T'("Assert/Post ", False),
VCDetails.Precondition_Check_Point => Table_Row_T'("Precondition ", False),
VCDetails.Check_Statement_Point => Table_Row_T'("Check stmnt. ", False),
VCDetails.Runtime_Check_Point => Table_Row_T'("Runtime check ", False),
VCDetails.Refinement_VC_Point => Table_Row_T'("Refinem. VCs ", False),
VCDetails.Inheritance_VC_Point => Table_Row_T'("Inherit. VCs ", False),
VCDetails.Undetermined_Point => Table_Row_T'("Undetermined ", True));
Overall_Errors : Boolean := False;
Overall_Warnings : Boolean := False;
function Align_Right (E_Str : E_Strings.T;
Width : E_Strings.Lengths) return E_Strings.T is
Retval : E_Strings.T;
begin
Retval := E_Strings.Empty_String;
if E_Strings.Get_Length (E_Str) < Width then
for I in E_Strings.Lengths range E_Strings.Get_Length (E_Str) + 1 .. Width loop
E_Strings.Append_Char (Retval, ' ');
end loop;
end if;
E_Strings.Append_Examiner_String (Retval, E_Str);
return Retval;
end Align_Right;
function Align_Left (E_Str : E_Strings.T;
Width : E_Strings.Lengths) return E_Strings.T is
Retval : E_Strings.T;
begin
Retval := E_Str;
if E_Strings.Get_Length (E_Str) < Width then
for I in E_Strings.Lengths range E_Strings.Get_Length (E_Str) + 1 .. Width loop
E_Strings.Append_Char (Retval, ' ');
end loop;
end if;
return Retval;
end Align_Left;
-- This procedure prints a table row containing integers. If
-- Show_Warn_Tag is specified, it will also print the '<<<'
-- look-out tag at the end of the row if there are any
-- undischarged or false VCs.
procedure Print_Table_Row
(Title : in String;
The_Total, Examiner, Simplifier, User_Rules, Victor, Riposte, Checker, Review, False_VCs, Undischarged : in Integer;
Show_Warn_Tag : in Boolean)
--# global in Report_File;
--# in Table_Column_Enabled;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# Checker,
--# Examiner,
--# False_VCs,
--# Report_File,
--# Review,
--# Riposte,
--# Show_Warn_Tag,
--# Simplifier,
--# Table_Column_Enabled,
--# The_Total,
--# Title,
--# Undischarged,
--# User_Rules,
--# Victor;
is
Value : Integer;
begin
-- Row name.
E_Strings.Put_String (Report_File, Align_Left (E_Strings.Copy_String (Title), Name_Column_Width));
-- Other columns.
for I in Table_Column_Index loop
if Table_Column_Enabled (I) then
case I is
when 1 =>
Value := The_Total;
when 2 =>
Value := Examiner;
when 3 =>
Value := Simplifier;
when 4 =>
Value := User_Rules;
when 5 =>
Value := Victor;
when 6 =>
Value := Riposte;
when 7 =>
Value := Checker;
when 8 =>
Value := Review;
when 9 =>
Value := False_VCs;
when 10 =>
Value := Undischarged;
end case;
if Table_Format (I).Brackets then
if Value > 0 then
SPARK_IO.Put_Char (Report_File, '(');
SPARK_IO.Put_Integer (Report_File, Value, Table_Format (I).Width - 2, 10);
SPARK_IO.Put_Char (Report_File, ')');
else
E_Strings.Put_String (Report_File, Align_Left (E_Strings.Empty_String, Table_Format (I).Width));
end if;
else
SPARK_IO.Put_Integer (Report_File, Value, Table_Format (I).Width, 10);
end if;
end if;
end loop;
-- Print the 'look-out' tag, if necessary.
if Show_Warn_Tag and (Undischarged > 0 or False_VCs > 0) then
SPARK_IO.Put_String (Report_File, " <<<", 0);
end if;
-- Final EOL.
SPARK_IO.New_Line (Report_File, 1);
end Print_Table_Row;
-- This procedure prints a table row containing strings.
procedure Print_Table_String_Row
(Title : in String;
The_Total, Examiner, Simplifier, User_Rules, Victor, Riposte, Checker, Review, False_VCs, Undischarged : in E_Strings.T)
--# global in Report_File;
--# in Table_Column_Enabled;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# Checker,
--# Examiner,
--# False_VCs,
--# Report_File,
--# Review,
--# Riposte,
--# Simplifier,
--# Table_Column_Enabled,
--# The_Total,
--# Title,
--# Undischarged,
--# User_Rules,
--# Victor;
is
Value : E_Strings.T;
begin
-- Row name.
E_Strings.Put_String (Report_File, Align_Left (E_Strings.Copy_String (Title), Name_Column_Width));
-- Other columns.
for I in Table_Column_Index loop
if Table_Column_Enabled (I) then
case I is
when 1 =>
Value := The_Total;
when 2 =>
Value := Examiner;
when 3 =>
Value := Simplifier;
when 4 =>
Value := User_Rules;
when 5 =>
Value := Victor;
when 6 =>
Value := Riposte;
when 7 =>
Value := Checker;
when 8 =>
Value := Review;
when 9 =>
Value := False_VCs;
when 10 =>
Value := Undischarged;
end case;
if Table_Format (I).Brackets then
if not E_Strings.Is_Empty (Value) then
SPARK_IO.Put_Char (Report_File, '(');
E_Strings.Put_String (Report_File, Align_Right (Value, Table_Format (I).Width - 2));
SPARK_IO.Put_Char (Report_File, ')');
else
E_Strings.Put_String (Report_File, Align_Left (E_Strings.Empty_String, Table_Format (I).Width));
end if;
else
E_Strings.Put_String (Report_File, Align_Right (Value, Table_Format (I).Width));
end if;
end if;
end loop;
-- Final EOL.
SPARK_IO.New_Line (Report_File, 1);
end Print_Table_String_Row;
-- This procedure prints the table column names.
procedure Print_Table_Head
--# global in Report_File;
--# in Table_Column_Enabled;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# Report_File,
--# Table_Column_Enabled;
is
Tmp : E_Strings.T;
begin
-- Skip the 'row name' column
for I in Integer range 1 .. Name_Column_Width loop
SPARK_IO.Put_Char (Report_File, ' ');
end loop;
-- Other columns
for I in Table_Column_Index loop
if Table_Column_Enabled (I) then
Tmp :=
E_Strings.Trim
(E_Strings.Section
(E_Str => E_Strings.Copy_String (Table_Format (I).Name),
Start_Pos => E_Strings.Positions'First,
Length => Table_Format (I).Width));
E_Strings.Put_String (Report_File, Align_Right (Tmp, Table_Format (I).Width));
end if;
end loop;
-- Final EOL
SPARK_IO.New_Line (Report_File, 1);
end Print_Table_Head;
procedure Print_Table_Separator
--# global in Report_File;
--# in Table_Column_Enabled;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# Report_File,
--# Table_Column_Enabled;
is
begin
-- Fill the 'name' column
for I in Integer range 1 .. Name_Column_Width loop
SPARK_IO.Put_Char (Report_File, '=');
end loop;
-- Other columns
for I in Table_Column_Index loop
if Table_Column_Enabled (I) then
for J in Integer range 1 .. Table_Format (I).Width loop
SPARK_IO.Put_Char (Report_File, '=');
end loop;
end if;
end loop;
-- Final EOL
SPARK_IO.New_Line (Report_File, 1);
end Print_Table_Separator;
procedure Print_Final_Summary
--# global in Overall_Errors;
--# in Overall_Warnings;
--# in The_Totals;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# Overall_Errors,
--# Overall_Warnings,
--# The_Totals;
is
Total_VCs : Natural;
False_VCs : Natural;
Undisc_VCs : Natural;
begin
Total_VCs := Sum (The_Totals.VCs_Total);
False_VCs := Sum (The_Totals.VCs_Proved_False);
Undisc_VCs := Sum (The_Totals.VCs_Undischarged);
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, "----- BEGIN PROOF SUMMARY -----", 0);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "VCs discharged: ", 0);
SPARK_IO.Put_Integer (SPARK_IO.Standard_Output, Total_VCs - (False_VCs + Undisc_VCs), 8, 10);
SPARK_IO.New_Line (SPARK_IO.Standard_Output, 1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "VCs false: ", 0);
SPARK_IO.Put_Integer (SPARK_IO.Standard_Output, False_VCs, 8, 10);
SPARK_IO.New_Line (SPARK_IO.Standard_Output, 1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "VCs undischarged: ", 0);
SPARK_IO.Put_Integer (SPARK_IO.Standard_Output, Undisc_VCs, 8, 10);
SPARK_IO.New_Line (SPARK_IO.Standard_Output, 1);
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Warnings: ", 0);
if Overall_Warnings then
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, "YES", 0);
else
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, "No", 0);
end if;
SPARK_IO.Put_String (SPARK_IO.Standard_Output, "Errors: ", 0);
if Overall_Errors then
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, "YES", 0);
else
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, "No", 0);
end if;
SPARK_IO.Put_Line (SPARK_IO.Standard_Output, "----- END PROOF SUMMARY -----", 0);
end Print_Final_Summary;
-- The purpose of this procedure is to read back one of the
-- various temporary files created and produce a simple
-- listing.
-- There are two main file formats, one with number of VCs and
-- one without. The Has_Numbers parameter indicates which one
-- to expect.
procedure Regurgitate_Temp_File
(The_Temp_File : in out SPARK_IO.File_Type;
The_String_1 : in String;
The_String_2 : in String;
Has_Numbers : in Boolean)
--# global in Report_File;
--# in out SPARK_IO.File_Sys;
--# derives SPARK_IO.File_Sys from *,
--# Has_Numbers,
--# Report_File,
--# The_String_1,
--# The_String_2,
--# The_Temp_File &
--# The_Temp_File from *;
is
Temp_Store_Int : Integer;
Temp_Store_String : E_Strings.T;
Temp_Store_Bool : Boolean;
Temp_Status : SPARK_IO.File_Status;
begin
--# accept F, 10, Temp_Status, "Temp_Status not used here" &
--# F, 10, Temp_Store_Bool, "Temp_Store_Bool not used here";
SPARK_IO.Reset (The_Temp_File, SPARK_IO.In_File, Temp_Status);
if not SPARK_IO.End_Of_File (The_Temp_File) then
SPARK_IO.Put_Line (Report_File, The_String_1, 0);
if The_String_2 /= "" then
SPARK_IO.Put_Line (Report_File, The_String_2, 0);
end if;
SPARK_IO.New_Line (Report_File, 1);
while not SPARK_IO.End_Of_File (The_Temp_File) loop
--# accept F, 41, "No need to write two loops here.";
if Has_Numbers then
SPARK_IO.Get_Integer (The_Temp_File, Temp_Store_Int, 4, Temp_Store_Bool);
SPARK_IO.Put_Integer (Report_File, Temp_Store_Int, 4, 10);
SPARK_IO.Put_String (Report_File, " ", 0);
end if;
E_Strings.Get_Line (File => The_Temp_File,
E_Str => Temp_Store_String);
if Has_Numbers or E_Strings.Get_Length (Temp_Store_String) > 0 then
if not Has_Numbers then
SPARK_IO.Put_String (Report_File, " ", 0);
end if;
E_Strings.Put_String (File => Report_File,
E_Str => Temp_Store_String);
SPARK_IO.New_Line (Report_File, 1);
end if;
--# end accept;
end loop;
SPARK_IO.New_Line (Report_File, 1);
end if;
--# accept F, 33, Temp_Store_Bool, "Temp_Store_Bool is not needed." &
--# F, 33, Temp_Status, "Temp_Status is not needed.";
end Regurgitate_Temp_File;
begin
SPARK_IO.Put_Line (Report_File, Banner.MajorSeparatorLine, 0);
SPARK_IO.Put_Line (Report_File, "Summary:", 0);
SPARK_IO.New_Line (Report_File, 1);
-- We want to print the file summaries in roughly two blocks:
-- Warnings/Notes and actual errors. First, the warnings and
-- non-critical errors:
-- print out any used user-defined rule files
Regurgitate_Temp_File
(The_Temp_File => Temp_Rlu_Used_File,
The_String_1 => "The following user-defined rule files have been used:",
The_String_2 => "",
Has_Numbers => False);
-- print out the file names and numbers of any VC proved by a user-defined proof rule
Regurgitate_Temp_File
(The_Temp_File => Temp_User_File,
The_String_1 => "The following subprograms have VCs proved using a user-defined proof rule:",
The_String_2 => "",
Has_Numbers => True);
-- print out the file names and numbers of any VC proved by contradiction
Regurgitate_Temp_File
(The_Temp_File => Temp_Contra_File,
The_String_1 => "The following subprograms have VCs proved by contradiction:",
The_String_2 => "",
Has_Numbers => True);
-- print out the file names and numbers of any VC proved by ViCToR
Regurgitate_Temp_File
(The_Temp_File => Temp_Victor_File,
The_String_1 => "The following subprograms have VCs proved by Victor:",
The_String_2 => "",
Has_Numbers => True);
-- print out the file names and numbers of any VC proved by Riposte
Regurgitate_Temp_File
(The_Temp_File => Temp_Riposte_File,
The_String_1 => "The following subprograms have VCs proved by Riposte:",
The_String_2 => "",
Has_Numbers => True);
-- print out the names of any missing SDP files
Regurgitate_Temp_File
(The_Temp_File => Temp_SDP_Error_File,
The_String_1 => "***WARNING: The following DPC files have not been ZombieScoped:",
The_String_2 => "",
Has_Numbers => False);
-- print out the names of any missing DPC files
Regurgitate_Temp_File
(The_Temp_File => Temp_DPC_Error_File,
The_String_1 => "***WARNING: The following DPC files are missing:",
The_String_2 => "",
Has_Numbers => False);
-- Secondly, we print the actual errors (those indicating that
-- your code is definitely wrong):
-- print out the names of files containing warnings or errors
Regurgitate_Temp_File
(The_Temp_File => Temp_Warn_Error_File,
The_String_1 => "***WARNING: The following files, or their absence, raised warnings or errors:",
The_String_2 => "",
Has_Numbers => True);
-- print out the names of any user rule files containing syntax errors
Regurgitate_Temp_File
(The_Temp_File => Temp_Rlu_Error_File,
The_String_1 => "***WARNING: The following user defined rule files contain syntax errors:",
The_String_2 => "",
Has_Numbers => False);
-- print out the file names and numbers of any false VC
Regurgitate_Temp_File
(The_Temp_File => Temp_False_File,
The_String_1 => "The following subprograms have VCs proved false:",
The_String_2 => "",
Has_Numbers => True);
-- print out the file names and numbers of any undischarged VC (excluding those proved false)
Regurgitate_Temp_File
(The_Temp_File => Temp_File,
The_String_1 => "The following subprograms have undischarged VCs (excluding those proved false):",
The_String_2 => "",
Has_Numbers => True);
-- print out the file names and numbers of any files with review errors
Regurgitate_Temp_File
(The_Temp_File => Temp_PR_Verr_File,
The_String_1 => "***WARNING: The PRV file(s) associated with the following subprograms may be out of date",
The_String_2 => "The following subprograms have review files containing VCs already proved elsewhere:",
Has_Numbers => True);
-- print out all victor errors
Regurgitate_Temp_File
(The_Temp_File => Temp_Victor_Error_File,
The_String_1 => "***WARNING: Please note the following warnings and/or errors surrounding victor files:",
The_String_2 => "",
Has_Numbers => False);
-- print out all Riposte errors
Regurgitate_Temp_File
(The_Temp_File => Temp_Riposte_Error_File,
The_String_1 => "***WARNING: Please note the following warnings and/or errors surrounding Riposte files:",
The_String_2 => "",
Has_Numbers => False);
--# assert True;
-- Print a summary of the number of subprograms conatining at
-- least one instance of the following:
SPARK_IO.Put_Line (Report_File, "Proof strategies used by subprograms", 0);
SPARK_IO.Put_Line (Report_File, "-------------------------------------------------------------------------", 0);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved by examiner: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Examiner_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved by simplifier: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Simplifier_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved by contradiction: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Contradiction_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved with user proof rule: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_User_Rule_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved by Victor: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Victor_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved by Riposte: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Riposte_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC proved using checker: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Checker_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one VC discharged by review: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Review_VC, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
--# assert True;
-- Print out hierarchy of proof strategy use (see declaration of Total_Type)
-- Examiner -> Simplifier -> User Rules -> ViCToR -> Checker -> Review
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_Line (Report_File, "Maximum extent of strategies used for fully proved subprograms:", 0);
SPARK_IO.Put_Line (Report_File, "-------------------------------------------------------------------------", 0);
SPARK_IO.Put_String (Report_File, "Total subprograms with proof completed by examiner: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_By_Examiner, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with proof completed by simplifier: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_By_Simplifier, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with proof completed with user defined rules: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_With_User_Proof_Rule, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with proof completed by Victor: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_By_Victor, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with proof completed by Riposte: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_By_Riposte, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with proof completed by checker: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_By_Checker, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with VCs discharged by review: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Proved_By_Review, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
-- BUG: This could, in theory, overflow.
Total_Subprograms_Proved :=
((((((The_Totals.Subprograms_Proved_By_Examiner + The_Totals.Subprograms_Proved_By_Simplifier) +
The_Totals.Subprograms_Proved_With_User_Proof_Rule) +
The_Totals.Subprograms_Proved_By_Checker) +
The_Totals.Subprograms_Proved_By_Review) +
The_Totals.Subprograms_Proved_By_Victor) +
The_Totals.Subprograms_Proved_By_Riposte);
--# assert Total_Subprograms_Proved =
--# The_Totals.Subprograms_Proved_By_Examiner +
--# The_Totals.Subprograms_Proved_By_Simplifier +
--# The_Totals.Subprograms_Proved_With_User_Proof_Rule +
--# The_Totals.Subprograms_Proved_By_Checker +
--# The_Totals.Subprograms_Proved_By_Review +
--# The_Totals.Subprograms_Proved_By_Victor +
--# The_Totals.Subprograms_Proved_By_Riposte;
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_Line (Report_File, "Overall subprogram summary:", 0);
SPARK_IO.Put_Line (Report_File, "-------------------------------------------------------------------------", 0);
SPARK_IO.Put_String (Report_File, "Total subprograms fully proved: ", 0);
SPARK_IO.Put_Integer (Report_File, Total_Subprograms_Proved, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one undischarged VC: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_Undischarged_VC, 4, 10);
if The_Totals.Subprograms_With_ALO_Undischarged_VC > 0 then
SPARK_IO.Put_String (Report_File, " <<<", 0);
end if;
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms with at least one false VC: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_ALO_False_VC, 4, 10);
if The_Totals.Subprograms_With_ALO_False_VC > 0 then
SPARK_IO.Put_String (Report_File, " <<<", 0);
end if;
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, " -----", 0);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms for which VCs have been generated: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_VCs, 4, 10);
SPARK_IO.New_Line (Report_File, 2);
--# assert Total_Subprograms_Proved =
--# The_Totals.Subprograms_Proved_By_Examiner +
--# The_Totals.Subprograms_Proved_By_Simplifier +
--# The_Totals.Subprograms_Proved_With_User_Proof_Rule +
--# The_Totals.Subprograms_Proved_By_Checker +
--# The_Totals.Subprograms_Proved_By_Review +
--# The_Totals.Subprograms_Proved_By_Victor +
--# The_Totals.Subprograms_Proved_By_Riposte;
-- Only report errors if there are some.
if The_Totals.Subprograms_Where_VC_Analysis_Abandoned > 0
or else The_Totals.Subprograms_Where_DPC_Analysis_Abandoned > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Missing_SLG_File) > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Missing_VLG_File) > 0 then
SPARK_IO.Put_Line (Report_File, "WARNING: Overall error summary:", 0);
SPARK_IO.Put_Line (Report_File, "-------------------------------------------------------------------------", 0);
SPARK_IO.Put_String (Report_File, "Total simplified subprograms with missing slg file: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_Error (VCDetails.Missing_SLG_File), 7, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total victored subprograms with missing vlg file: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_Error (VCDetails.Missing_VLG_File), 7, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms where VC analysis was abandoned due to errors: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_VC_Analysis_Abandoned, 4, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total subprograms where DPC analysis was abandoned due to errors: ", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_DPC_Analysis_Abandoned, 3, 10);
SPARK_IO.New_Line (Report_File, 2);
Overall_Errors := True;
else
-- One blank line between each table in this group, but double blank line
-- after the last table.
SPARK_IO.New_Line (Report_File, 1);
end if;
-- The sum of the subprograms fully proved,
-- the subprograms with at least undischarged VC and
-- the subprograms with at least 1 false VC must equal
-- the number of subprograms for which VCs have been generated.
SPARK_IO.New_Line (SPARK_IO.Standard_Output, 1);
--# assert Total_Subprograms_Proved =
--# The_Totals.Subprograms_Proved_By_Examiner +
--# The_Totals.Subprograms_Proved_By_Simplifier +
--# The_Totals.Subprograms_Proved_With_User_Proof_Rule +
--# The_Totals.Subprograms_Proved_By_Checker +
--# The_Totals.Subprograms_Proved_By_Review +
--# The_Totals.Subprograms_Proved_By_Victor +
--# The_Totals.Subprograms_Proved_By_Riposte;
-- Check the totals are balanced.
if not Totals_Are_Balanced then
Fatal_Error (Error => FatalErrors.Subprogram_Totals_Inconsistent);
end if;
--# assert True;
SPARK_IO.Put_Line (Report_File, "ZombieScope Summary:", 0);
SPARK_IO.Put_Line (Report_File, "-------------------------------------------------------------------------", 0);
SPARK_IO.Put_String (Report_File, "Total subprograms for which DPCs have been generated:", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_DPCs, 20, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total number subprograms with dead paths found:", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_With_Dead_Paths, 26, 10);
SPARK_IO.New_Line (Report_File, 1);
SPARK_IO.Put_String (Report_File, "Total number of dead paths found:", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Number_Of_Dead_Paths, 40, 10);
SPARK_IO.New_Line (Report_File, 3);
-- Issue warning message if some DPC files have not been analysed.
--# assert True;
SPARK_IO.Put_Line (Report_File, "VC summary:", 0);
SPARK_IO.Put_Line (Report_File, "-------------------------------------------------------------------------", 0);
SPARK_IO.Put_Line (Report_File, "Note: (User) denotes where the Simplifier has proved VCs using one or", 0);
SPARK_IO.Put_Line (Report_File, " more user-defined proof rules.", 0);
SPARK_IO.New_Line (Report_File, 1);
Table_Column_Enabled :=
Table_Column_Enabled_T'
(1 => True,
2 => Sum (The_Totals.VCs_Proved_By_Examiner) > 0,
3 => Sum (The_Totals.VCs_Proved_By_Simplifier) > 0,
4 => Sum (The_Totals.VCs_Proved_With_User_Proof_Rule) > 0,
5 => Sum (The_Totals.VCs_Proved_By_Victor) > 0,
6 => Sum (The_Totals.VCs_Proved_By_Riposte) > 0,
7 => Sum (The_Totals.VCs_Proved_By_Checker) > 0,
8 => Sum (The_Totals.VCs_Proved_By_Review) > 0,
9 => Sum (The_Totals.VCs_Proved_False) > 0,
10 => Sum (The_Totals.VCs_Undischarged) > 0);
SPARK_IO.Put_Line (Report_File, "Total VCs by type:", 0);
SPARK_IO.Put_Line (Report_File, "------------------", 0);
Print_Table_Head;
for R in VCDetails.Terminal_Point_Type loop
if not Table_Row_Format (R).Nonzero_Only or The_Totals.VCs_Total (R) > 0 then
Print_Table_Row
(Title => Table_Row_Format (R).Name,
The_Total => The_Totals.VCs_Total (R),
Examiner => The_Totals.VCs_Proved_By_Examiner (R),
Simplifier => The_Totals.VCs_Proved_By_Simplifier (R),
User_Rules => The_Totals.VCs_Proved_With_User_Proof_Rule (R),
Victor => The_Totals.VCs_Proved_By_Victor (R),
Riposte => The_Totals.VCs_Proved_By_Riposte (R),
Checker => The_Totals.VCs_Proved_By_Checker (R),
Review => The_Totals.VCs_Proved_By_Review (R),
False_VCs => The_Totals.VCs_Proved_False (R),
Undischarged => The_Totals.VCs_Undischarged (R),
Show_Warn_Tag => False);
end if;
end loop;
Print_Table_Separator;
Print_Table_Row
(Title => "Totals:",
The_Total => Sum (The_Totals.VCs_Total),
Examiner => Sum (The_Totals.VCs_Proved_By_Examiner),
Simplifier => Sum (The_Totals.VCs_Proved_By_Simplifier),
User_Rules => Sum (The_Totals.VCs_Proved_With_User_Proof_Rule),
Victor => Sum (The_Totals.VCs_Proved_By_Victor),
Riposte => Sum (The_Totals.VCs_Proved_By_Riposte),
Checker => Sum (The_Totals.VCs_Proved_By_Checker),
Review => Sum (The_Totals.VCs_Proved_By_Review),
False_VCs => Sum (The_Totals.VCs_Proved_False),
Undischarged => Sum (The_Totals.VCs_Undischarged),
Show_Warn_Tag => True);
--# assert True;
if CommandLine.Data.OutputPercentUndischarged and then Sum (The_Totals.VCs_Total) /= 0 then
Calculate_Percentages
(The_Totals => The_Totals,
Percent_Undischarged_Str => Percent_Undischarged_Str,
Percent_Proved_By_Examiner_Str => Percent_Proved_By_Examiner_Str,
Percent_Proved_By_Victor_Str => Percent_Proved_By_Victor_Str,
Percent_Proved_By_Riposte_Str => Percent_Proved_By_Riposte_Str,
Percent_Proved_By_Checker_Str => Percent_Proved_By_Checker_Str,
Percent_Proved_By_Review_Str => Percent_Proved_By_Review_Str,
Percent_Simplified_Str => Percent_Simplified_Str,
Percent_With_User_Rule_Str => Percent_With_User_Rule_Str,
Percent_Proved_False_Str => Percent_Proved_False_Str);
if Sum (The_Totals.VCs_Proved_With_User_Proof_Rule) = 0 then
Percent_With_User_Rule_Str := E_Strings.Empty_String;
end if;
Print_Table_String_Row
(Title => "%Totals:",
The_Total => E_Strings.Empty_String,
Examiner => Percent_Proved_By_Examiner_Str,
Simplifier => Percent_Simplified_Str,
User_Rules => Percent_With_User_Rule_Str,
Victor => Percent_Proved_By_Victor_Str,
Riposte => Percent_Proved_By_Riposte_Str,
Checker => Percent_Proved_By_Checker_Str,
Review => Percent_Proved_By_Review_Str,
False_VCs => Percent_Proved_False_Str,
Undischarged => Percent_Undischarged_Str);
end if;
--# assert True;
-- If we used or tried to use Victor or Riposte, we print a warning
if The_Totals.Subprograms_With_ALO_Victor_VC > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Missing_VLG_File) > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Corrupt_VCT_File) > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Corrupt_VLG_File) > 0 then
Overall_Warnings := True;
SPARK_IO.Put_Line (Report_File, "!!! WARNING: Experimental feature used: Proof by Victor", 0);
end if;
if The_Totals.Subprograms_Where_Error (VCDetails.Missing_VLG_File) > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Corrupt_VCT_File) > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Corrupt_VLG_File) > 0 then
Overall_Errors := True;
end if;
if The_Totals.Subprograms_With_ALO_Riposte_VC > 0
or else The_Totals.Subprograms_Where_Error (VCDetails.Corrupt_RSM_File) > 0 then
Overall_Warnings := True;
SPARK_IO.Put_Line (Report_File, "!!! WARNING: Experimental feature used: Proof with Riposte", 0);
end if;
if The_Totals.Subprograms_Where_Error (VCDetails.Corrupt_RSM_File) > 0 then
Overall_Errors := True;
end if;
--# assert True;
-- Only report errors if there are some.
if The_Totals.Subprograms_Where_VC_Analysis_Abandoned > 0 then
Overall_Errors := True;
SPARK_IO.Put_Line (Report_File, "!!! ERRORS IN FILES RELATED TO ANALYSIS OF VCs; as below:", 0);
for X in VCDetails.Error_Type_Missing_VC_Files loop
if The_Totals.Subprograms_Where_Error (X) > 0 then
case X is
when VCDetails.Missing_SLG_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of missing SLG (simplifier log) files: ", 0);
when VCDetails.Missing_VLG_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of missing VLG (ViCToR log) files: ", 0);
end case;
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_Error (X), 8, 10);
SPARK_IO.New_Line (Report_File, 1);
end if;
end loop;
for X in VCDetails.Error_Type_Corrupt_VC_Files loop
if The_Totals.Subprograms_Where_Error (X) > 0 then
case X is
when VCDetails.Corrupt_VCG_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous VCG files: ", 0);
when VCDetails.Corrupt_SIV_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous SIV (simplified) files: ", 0);
when VCDetails.Corrupt_SLG_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous SLG (simplifier log) files: ", 0);
when VCDetails.Corrupt_VCT_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous VCT (Victor) files: ", 0);
when VCDetails.Corrupt_VLG_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous VLG (Victor log) files: ", 0);
when VCDetails.Corrupt_RSM_File =>
SPARK_IO.Put_String
(Report_File,
"!!! Number of erroneous RSM (Riposte summary) files: ",
0);
when VCDetails.Corrupt_PLG_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous PLG (checker proof log) files: ", 0);
when VCDetails.Corrupt_PRV_File =>
SPARK_IO.Put_String (Report_File, "!!! Number of erroneous PRV (manual proof review) files: ", 0);
end case;
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_Error (X), 8, 10);
SPARK_IO.New_Line (Report_File, 1);
end if;
end loop;
end if;
--# assert True;
if The_Totals.Subprograms_Where_DPC_Analysis_Abandoned > 0 then
Overall_Errors := True;
SPARK_IO.Put_String (Report_File, "!!! ERRORS IN DPC FILES: !!!", 0);
SPARK_IO.Put_Integer (Report_File, The_Totals.Subprograms_Where_DPC_Analysis_Abandoned, 8, 10);
SPARK_IO.New_Line (Report_File, 1);
end if;
SPARK_IO.New_Line (Report_File, 1);
--# assert True;
Print_Final_Summary;
end Output;
begin
The_Totals :=
Total_Type'
(Subprograms_With_VCs => 0,
Subprograms_Where_Error => Error_Type_Counter'(others => 0),
Subprograms_Where_VC_Analysis_Abandoned => 0,
Subprograms_Where_DPC_Analysis_Abandoned => 0,
Subprograms_With_ALO_Undischarged_VC => 0,
Subprograms_With_ALO_Examiner_VC => 0,
Subprograms_With_ALO_Simplifier_VC => 0,
Subprograms_With_ALO_Contradiction_VC => 0,
Subprograms_With_ALO_User_Rule_VC => 0,
Subprograms_With_ALO_Victor_VC => 0,
Subprograms_With_ALO_Riposte_VC => 0,
Subprograms_With_ALO_Checker_VC => 0,
Subprograms_With_ALO_Review_VC => 0,
Subprograms_With_ALO_False_VC => 0,
Subprograms_Proved_By_Examiner => 0,
Subprograms_Proved_By_Simplifier => 0,
Subprograms_Proved_By_Victor => 0,
Subprograms_Proved_By_Riposte => 0,
Subprograms_Proved_By_Checker => 0,
Subprograms_Proved_With_User_Proof_Rule => 0,
Subprograms_Proved_By_Review => 0,
VCs_Total => Null_VC_Counter,
VCs_Proved_By_Examiner => Null_VC_Counter,
VCs_Proved_By_Simplifier => Null_VC_Counter,
VCs_Proved_By_Victor => Null_VC_Counter,
VCs_Proved_By_Riposte => Null_VC_Counter,
VCs_Proved_By_Checker => Null_VC_Counter,
VCs_Proved_With_User_Proof_Rule => Null_VC_Counter,
VCs_Proved_By_Review => Null_VC_Counter,
VCs_Proved_False => Null_VC_Counter,
VCs_Undischarged => Null_VC_Counter,
Subprograms_With_DPCs => 0,
Subprograms_With_Dead_Paths => 0,
Number_Of_Dead_Paths => 0);
end Total;
|