|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 2018 (0x7e2)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
with Instrument;
use Instrument;
---------------
-- Exhaustive case
---------------
-- This test evaluates the code efficiency of an exhaustive case statement,
-- i.e., one in which all case alternatives are explicitly specified.
-- The purpose of this test is to offer the compiler a case statement
-- that may be implemented by a single jump-table.
-- The variable Local is used in the case expression to select one of
-- five alternatives that are explicitly included in the case statement.
-- In the test version, each alternative comprises a camouflaged assign-
-- ment of the choice value to the global variable. The value of the
-- case expression will always cause execution of the first case
-- alternative; however, this condition is carefully protected from
-- detection by the compiler so that no optimization of the case statement
-- is performed.
-- In the noise version, the case statement is removed to leave an
-- if-then-else construct comprising an equivalent number of assignments
-- so that the code efficiency metrics can be derived.
procedure Cseta1 is
package New_Procs is new Procs (Integer);
use New_Procs;
begin
Start ("CSETA1", "Case Statement Exhaustive Test (control)");
for I in 1 .. 10000 loop
Let (Global, Ident (1));
-- case Global is
-- when 1 =>
if Global = Ident (1) then
-- always true
Let (Global, Ident (1));
else
Let (Global, Ident (0));
-- end if; -- included in test version
-- when 2 =>
Let (Global, Ident (2));
-- when 3 =>
Let (Global, Ident (3));
-- when 4 =>
Let (Global, Ident (4));
-- when 5 =>
Let (Global, Ident (5));
-- when others =>
null;
end if; -- included in control version
-- end case;
end loop;
Stop;
end Cseta1;