|
|
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: 1989 (0x7c5)
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 Text_Io;
procedure Get_The_Answer (Out_Item : out Item) is
--==============================================================
-- The algorithm for this generic comes from Grady Booch's =
-- book Software Engineering with Ada chapter 17. This generic =
-- just prompts the user for an answer of the type given as a =
-- generic enumeration parameter. If the answer is not correct,=
-- then the user gets another chance (up to 6 chances). =
-- =
-- written by Gary Russell at EVB Software Engineering =
-- with help from Brad Balford and Johan Margono =
-- May 1985 =
--==============================================================
Max_Attempts : constant := 6;
subtype Users_Range is Positive range 1 .. Max_Attempts;
package Answer_Io is new Text_Io.Enumeration_Io (Enum => Item);
begin
-- Get_The_Answer
Find_The_Answer:
for Answer_Number in Users_Range loop
Try_To_Get_Answer:
begin
Answer_Io.Get (Out_Item);
exit Find_The_Answer;
exception
when Text_Io.Data_Error =>
if Answer_Number < Max_Attempts then
Text_Io.Skip_Line;
Text_Io.Put_Line ("**** Invalid response, try " &
"the response again");
else
-- Too many tries at y or n
Text_Io.Skip_Line;
Text_Io.Put_Line
("**** You tried too many times, " &
"a default value is used.");
end if;
end Try_To_Get_Answer;
end loop Find_The_Answer;
end Get_The_Answer;