|
|
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: 18799 (0x496f)
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 Sequential_Io, Terminal_Interface;
package body Get_User_Info is
package Read_Info is new Sequential_Io (User_Info_Type);
--****************************************************************
--****************************************************************
--------------------------------------------------------------------------
-- Abstract : This operation will open the SPELL_DATA.INI file.
-- : If the open fails because the file is not present
-- : then set the SUCCESSFUL flag to false and terminate.
-- : Otherwise read in the user information.
--------------------------------------------------------------------------
-- Parameters : USER_INFO : out USER_INFO_TYPE; this is the record
-- : which will containt the operational values.
-- :
-- : SUCCESSFUL : out BOOLEAN; This will indicate wheather or
-- : not the file was present and the information obtained.
--------------------------------------------------------------------------
-- Algorithm :
--
--------------------------------------------------------------------------
procedure Get_Info (User_Info : out User_Info_Type;
Successful : out Boolean) is
Input : Read_Info.File_Type;
begin
Read_Info.Open (Input, Read_Info.In_File,
Machine_Dependencies.Info_File);
Read_Info.Read (Input, User_Info);
Successful := True;
Read_Info.Close (Input);
exception
when others =>
Successful := False;
end Get_Info;
--****************************************************************
--****************************************************************
--------------------------------------------------------------------------
-- Abstract : This operation will replace USER_INFO into
-- : the SPELLDAT.INI
-- : file.
--------------------------------------------------------------------------
-- Parameters : USER_INFO : out USER_INFO_TYPE; this is the record
-- : which
-- : will containt the operational values.
-- :
--------------------------------------------------------------------------
-- Algorithm :
--
--------------------------------------------------------------------------
procedure Save_Info (User_Info : User_Info_Type) is
Output : Read_Info.File_Type;
begin
-- Read_Info.Create (Output, Read_Info.Out_File,
-- Machine_Dependencies.Info_File);
-- Read_Info.Write (Output, User_Info);
-- Read_Info.Close (Output);
null;
end Save_Info;
--****************************************************************
--****************************************************************
--------------------------------------------------------------------------
-- Abstract : This operation will collect the necessary information
-- : needed to operate this tool. The information will come
-- : from the user, and will be stored in the USER_INFO
-- : record.
--------------------------------------------------------------------------
-- Parameters : USER_INFO : out USER_INFO_TYPE;
-- : This value is a record containing the following fields:
-- : DOCUMENT
-- : CORRECTED_DOC
-- : WORD_LIST
-- : MODE
-- : MASTER
-- : ACRONYM
-- : USER_DICT
--------------------------------------------------------------------------
-- Algorithm :
--
--------------------------------------------------------------------------
procedure Collect_User_Info (User_Info : in out User_Info_Type) is
Upper_Yes : constant Character := 'Y';
Lower_Yes : constant Character := 'y';
Upper_No : constant Character := 'N';
Lower_No : constant Character := 'n';
Found_In_The_List : Boolean;
Characters_Read : Natural;
User_Response : String (Name_Range);
-----------------------------------------------------------------
--
--
-- The following outline the prompts which must be responded
-- to by the user.
--
--
-----------------------------------------------------------------
Mask_Line1 : constant String :=
"Enter text file name of the document to be checked: ";
Mask_Line2 : constant String :=
"Enter text file name of the corrected document";
Mask_Line3 : constant String :=
"Enter text file name which will contain the suspect words";
Mask_Line4 : constant String :=
"Do you wish to enable the CORRECTOR? <Y/N>";
Mask_Line5 : constant String :=
"Do you wish to disable the CORRECTOR? <Y/N>";
Mask_Line6 : constant String :=
"Do you wish to enable the MASTER dictionary ? <Y/N> ";
Mask_Line7 : constant String :=
"Do you wish to disable the MASTER dictionary ? <Y/N> ";
Mask_Line8 : constant String :=
"Do you wish to enable the ACRONYM Dictionary? <Y/N> ";
Mask_Line9 : constant String :=
"Do you wish to disable the ACRONYM Dictionary? <Y/N> ";
Mask_Line10 : constant String :=
"Do you wish to enable a User-defined Dictionary? <Y/N> ";
Mask_Line11 : constant String := "Enter User Dictionary name: ";
Mask_Line12 : constant String :=
"Do you wish to enable another User-defined Dictionary? <Y/N> ";
begin
Terminal_Interface.New_Page;
-------------------------------------------------------
-- Enter text file name of the document to be checked
-------------------------------------------------------
loop
Terminal_Interface.Put_Line (Mask_Line1);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if Characters_Read >= User_Response'First then
User_Info.Document.Name := User_Response;
User_Info.Document.Length := Characters_Read;
exit;
end if;
end loop;
-----------------------------------------------------------------
-- Do you wish to disable the CORRECTOR? <Y/N>
-----------------------------------------------------------------
if User_Info.Mode = Enabled then
Terminal_Interface.Put_Line (Mask_Line5);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if User_Response (User_Response'First) = Upper_Yes or else
User_Response (User_Response'First) = Lower_Yes then
User_Info.Mode := Disabled;
User_Info.Corrected_Doc.Length := 0;
end if;
else
------------------------------------------------------------------
-- Do you wish to enable the CORRECTOR? <Y/N>
------------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line4);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if User_Response (User_Response'First) = Upper_Yes or else
User_Response (User_Response'First) = Lower_Yes then
User_Info.Mode := Enabled;
User_Info.Word_List.Length := 0;
end if;
end if;
if User_Info.Mode = Get_User_Info.Enabled then
-------------------------------------------------------
-- Enter text file name of the corrected document
-------------------------------------------------------
loop
Terminal_Interface.Put_Line (Mask_Line2);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if Characters_Read = User_Info.Document.Length and then
User_Response (User_Response'First .. Characters_Read) =
User_Info.Document.Name
(User_Info.Document.Name'First ..
User_Info.Document.Length) then
Terminal_Interface.Put_Line
("The corrected document name must be unique.");
elsif Characters_Read >= User_Response'First then
User_Info.Corrected_Doc.Name := User_Response;
User_Info.Corrected_Doc.Length := Characters_Read;
exit;
else
null;
end if;
end loop;
end if;
------------------------------------------------------------------
-- Enter text file name which will contain the suspect words
------------------------------------------------------------------
loop
Terminal_Interface.Put_Line (Mask_Line3);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if Characters_Read >= User_Response'First then
User_Info.Word_List.Name := User_Response;
User_Info.Word_List.Length := Characters_Read;
end if;
if User_Info.Word_List.Length = User_Info.Document.Length and then
User_Info.Word_List.Name (User_Info.Word_List.Name'First ..
User_Info.Word_List.Length) =
User_Info.Document.Name (User_Info.Document.Name'First ..
User_Info.Document.Length) then
Terminal_Interface.Put_Line ("This file name must be unique.");
elsif User_Info.Word_List.Length =
User_Info.Corrected_Doc.Length and then
User_Info.Word_List.Name (User_Info.Word_List.Name'First ..
User_Info.Word_List.Length) =
User_Info.Corrected_Doc.Name
(User_Info.Corrected_Doc.Name'First ..
User_Info.Corrected_Doc.Length) then
Terminal_Interface.Put_Line ("This file name must be unique.");
else
exit;
end if;
end loop;
if User_Info.Master then
-------------------------------------------------------------------
-- Do you wish to disable the MASTER dictionary ? <Y/N>
-------------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line7);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if User_Response (User_Response'First) = Upper_Yes or else
User_Response (User_Response'First) = Lower_Yes then
User_Info.Master := False;
end if;
else
-----------------------------------------------------------------
-- Do you wish to enable the MASTER dictionary ? <Y/N>
-----------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line6);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if User_Response (User_Response'First) = Upper_Yes or else
User_Response (User_Response'First) = Lower_Yes then
User_Info.Master := True;
end if;
end if;
if User_Info.Acronym then
-----------------------------------------------------------------
-- Do you wish to disable the ACRONYM Dictionary? <Y/N>
-----------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line9);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if User_Response (User_Response'First) = Upper_Yes or else
User_Response (User_Response'First) = Lower_Yes then
User_Info.Acronym := False;
end if;
else
-----------------------------------------------------------------
-- Do you wish to enable the ACRONYM Dictionary? <Y/N>
-----------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line8);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if User_Response (User_Response'First) = Upper_Yes or else
User_Response (User_Response'First) = Lower_Yes then
User_Info.Acronym := True;
end if;
end if;
------------------------------------------------------------------
-- Do you wish to enable a User-defined Dictionary? <Y/N>
------------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line10);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if Characters_Read >= User_Response'First and
(User_Response (User_Response'First) = Upper_Yes or
User_Response (User_Response'First) = Lower_Yes) then
User_Info.User_Dict.Number_Of_Entries := 1;
User_Info.User_Dict.Mode := Enabled;
----------------------------------------------
-- disable all user dictionaries
----------------------------------------------
for I in 1 .. Number_Of_User_Dictionaries loop
User_Info.User_Dict.Names (I).Mode := Disabled;
end loop;
-------------------------------------------------------------------
-- Enter User Dictionary name:
-------------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line11);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
-----------------------------------------------------
-- Insert the dictionary at the head of the list
-----------------------------------------------------
User_Info.User_Dict.Names (User_Info.User_Dict.Number_Of_Entries).
Name := User_Response;
User_Info.User_Dict.Names (User_Info.User_Dict.Number_Of_Entries).
Length := Characters_Read;
----------------------------------------------------
-- Enable it as well
----------------------------------------------------
User_Info.User_Dict.Names (User_Info.User_Dict.Number_Of_Entries).
Mode := Enabled;
-------------------------------------------------------------
-- Do you wish to enable another User-defined Dictionary?
-------------------------------------------------------------
Terminal_Interface.Put_Line (Mask_Line12);
Terminal_Interface.Get_Line (User_Response, Characters_Read);
if Characters_Read < User_Response'First or
User_Response (User_Response'First) = Upper_No or
User_Response (User_Response'First) = Lower_No then
null;
else
Terminal_Interface.Put_Line ("Enter <cr> to terminate.");
loop
User_Info.User_Dict.Number_Of_Entries :=
User_Info.User_Dict.Number_Of_Entries + 1;
Terminal_Interface.Put_Line (Mask_Line11);
Terminal_Interface.Get_Line
(User_Response, Characters_Read);
exit when Characters_Read = 0;
Found_In_The_List := False;
for I in User_Info.User_Dict.Number_Of_Entries ..
Number_Of_User_Dictionaries loop
if Characters_Read =
User_Info.User_Dict.Names (I).Length
and then
User_Response
(User_Response'First .. Characters_Read) =
User_Info.User_Dict.Names (I).Name
(User_Info.User_Dict.Names (I).Name'First ..
User_Info.User_Dict.Names (I).Length)
-----------------------------------------------------
-- if it is in the list simply enable it
-----------------------------------------------------
then
User_Info.User_Dict.Names (I).Mode := Enabled;
Found_In_The_List := True;
exit;
end if;
end loop;
if not Found_In_The_List then
--------------------------------------------------------------
-- Insert the dictionary at the NEW head of the list
--------------------------------------------------------------
User_Info.User_Dict.Names
(User_Info.User_Dict.Number_Of_Entries).Name :=
User_Response;
User_Info.User_Dict.Names
(User_Info.User_Dict.Number_Of_Entries).Length :=
Characters_Read;
----------------------------------------------------
-- Enable it as well
----------------------------------------------------
User_Info.User_Dict.Names
(User_Info.User_Dict.Number_Of_Entries).Mode :=
Enabled;
end if;
exit when User_Info.User_Dict.Number_Of_Entries =
Number_Of_User_Dictionaries;
end loop;
end if;
else
User_Info.User_Dict.Mode := Disabled;
for I in 1 .. Number_Of_User_Dictionaries loop
User_Info.User_Dict.Names (I).Mode := Disabled;
end loop;
User_Info.User_Dict.Number_Of_Entries := 0;
end if;
end Collect_User_Info;
--***************************************************************
--***************************************************************
end Get_User_Info;