DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: B T

⟦a49d6aaf8⟧ TextFile

    Length: 34027 (0x84eb)
    Types: TextFile
    Names: »B«

Derivation

└─⟦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⟧ 

TextFile

--------------------------------------------------------------------------
-- Abstract   : This is the main procedure for the SPELLING CORRECTOR.
--            : From here the user can interactively execute this tool,
--            : or execute in batch.
--------------------------------------------------------------------------
-- Parameters :
--
--------------------------------------------------------------------------
-- Algorithm  :
--
--------------------------------------------------------------------------

with Command_Line_Interface, Machine_Dependencies, Terminal_Interface,
     Token_Definition, Process_Package, Get_User_Info, Utilities, Text_Io, Help;

procedure Speller is

    Time_Period : constant Duration := 2.0;

    Level_1 : Help.Level_Type renames Help.Help_Help;

    Processing_Command_Line : Boolean := False;

    Number_Of_Characters : Natural;

    User_Response : String (1 .. Machine_Dependencies.Max_File_Name_Length);

    User_Info : Get_User_Info.User_Info_Type;

    Abandon : exception;

    Invalid_Execution_Attempted : exception;

    function "=" (Left, Right : Get_User_Info.Mode_Type) return Boolean
        renames Get_User_Info."=";

    --***************************************************************
    --***************************************************************


    --------------------------------------------------------------------------
    -- Abstract   : This operation will display the title page to the terminal
    --            : device.
    --------------------------------------------------------------------------
    -- Parameters :
    --
    --------------------------------------------------------------------------
    -- Algorithm  :
    --            :
    --------------------------------------------------------------------------

    procedure Display_Title_Page is

        Title_Page_Line_1 : constant String :=
           ("                    SPELLER - Interactive Spelling Checker ");

        Title_Page_Line_2 : constant String :=
           ("                                Version 0.001");

        To_Screen_Center : constant Terminal_Interface.Count_Type := 11;

    begin
        Terminal_Interface.New_Page;

        Terminal_Interface.Put_Line (Title_Page_Line_1);
        Terminal_Interface.Put_Line (Title_Page_Line_2);

        Terminal_Interface.New_Line (To_Screen_Center);

        delay (Time_Period);

    end Display_Title_Page;

    --****************************************************************
    --****************************************************************

    --------------------------------------------------------------------------
    -- Abstract   : After the title page is displayed, the command choices
    --            : the user may make are displayed.
    --------------------------------------------------------------------------
    -- Parameters :
    --
    --------------------------------------------------------------------------
    -- Algorithm  :
    --
    --------------------------------------------------------------------------

    procedure Display_Command_Choices is

        Speller_Command_Line_1 : constant String :=
           ("  [?] Help                  [L] List dictionary");

        Speller_Command_Line_2 : constant String :=
           ("  [M] Merge dictionaries    [S] Spell check a document");

        Speller_Command_Line_3 : constant String := ("  [Q] Quit  ");

    begin

        -----------------------------------------------------------------
        -- This will require the entire page, therefore it is necessary
        -- to remove the old menu from the screen prior to displaying
        -- the title page.
        -----------------------------------------------------------------
        Terminal_Interface.New_Page;

        -----------------------------------------------------------------
        -- Now that the title page is displayed, begin to display
        -- the command choices.
        -----------------------------------------------------------------

        Terminal_Interface.Put_Line (Speller_Command_Line_1);

        Terminal_Interface.Put_Line (Speller_Command_Line_2);

        Terminal_Interface.Put_Line (Speller_Command_Line_3);

        Terminal_Interface.New_Line;

        -----------------------------------------------------------------
        -- Ouptut the user prompt
        -----------------------------------------------------------------

        Terminal_Interface.Put_Line ("Enter your request <<cr>>");

    end Display_Command_Choices;

    --****************************************************************
    --****************************************************************

    --------------------------------------------------------------------------
    -- Abstract   : This operation will begin the spelling correction
    -- process.
    --            :  The steps taken are;
    --            :      1. Read the default processing options from
    --            :         SPELL_DATA.INI file.
    --            :      2. If the read was successful then print out the
    --            :         the processing options until the user is
    --            :         confirms these options.
    --            :      3. Once confirmed, write out the processing options
    --            :         to the SPELL_DATA.INI file.
    --            :      4. If the user chose the BATCH processing option
    --            :         execute the BATCH_PROCESS operation.
    --            :         Otherwise, execute the INTERACTIVE_PROCESS
    --            :         operation.
    --------------------------------------------------------------------------
    -- Parameters :
    --
    --------------------------------------------------------------------------
    -- Algorithm  :
    --
    --------------------------------------------------------------------------

    procedure Begin_Document_Check is

        User_Response : String (1 .. Machine_Dependencies.File_Line_Length);

        Length : Natural;

        User_Info : Get_User_Info.User_Info_Type;

        Successful : Boolean := False;

        procedure Display (User_Info : Get_User_Info.User_Info_Type) is

        begin
            Terminal_Interface.New_Page;

            Terminal_Interface.Put_Line
               ("The processing options are as follows:");

            if User_Info.Document.Length < User_Info.Document.Name'First then
                Terminal_Interface.Put_Line
                   ("The document being checked is <<>>");
            else
                Terminal_Interface.Put_Line
                   ("The document being checked is <<" &
                    User_Info.Document.Name (User_Info.Document.Name'First ..
                                                User_Info.Document.Length) &
                    ">>");
            end if;

            if User_Info.Corrected_Doc.Length <
               User_Info.Corrected_Doc.Name'First then
                Terminal_Interface.Put_Line
                   ("The corrected document will be <<>>");
            else
                Terminal_Interface.Put_Line
                   ("The corrected document will be <<" &
                    User_Info.Corrected_Doc.Name
                       (User_Info.Corrected_Doc.Name'First ..
                           User_Info.Corrected_Doc.Length) & ">>");

            end if;

            if User_Info.Word_List.Length >= User_Info.Word_List.Name'First then
                Terminal_Interface.Put_Line
                   ("The suspect word list is <<" &
                    User_Info.Word_List.Name (User_Info.Word_List.Name'First ..
                                                 User_Info.Word_List.Length) &
                    ">>");
            else
                Terminal_Interface.Put_Line ("The suspect word list is <<>>");
            end if;

            if User_Info.Mode = Get_User_Info.Disabled then
                Terminal_Interface.Put_Line ("The CORRECTOR is <<Disabled>>");
            else
                Terminal_Interface.Put_Line ("The CORRECTOR is <<Enabled>>");
            end if;

            if User_Info.Master then
                Terminal_Interface.Put_Line ("The MASTER is <<Enabled>>");
            else
                Terminal_Interface.Put_Line ("The MASTER is <<Disabled>>");
            end if;

            if User_Info.Acronym then
                Terminal_Interface.Put_Line ("The ACRONYM is <<Enabled>>");
            else
                Terminal_Interface.Put_Line ("The ACRONYM is <<Disabled>>");
            end if;

            if User_Info.User_Dict.Mode = Get_User_Info.Enabled then
                Terminal_Interface.Put_Line
                   ("The user dictionaries enabled are as follows:");

                for I in 1 .. Get_User_Info.Number_Of_User_Dictionaries loop

                    if User_Info.User_Dict.Names (I).Mode =
                       Get_User_Info.Enabled then

                        Terminal_Interface.Put_Line
                           (User_Info.User_Dict.Names (I).Name
                               (User_Info.User_Dict.Names (I).Name'First ..
                                   User_Info.User_Dict.Names (I).Length));
                    end if;
                end loop;
            else
                Terminal_Interface.Put_Line
                   ("No user dictionaries are enabled");
            end if;
        end Display;

    begin


        Terminal_Interface.New_Page;

        Get_User_Info.Get_Info (User_Info, Successful);

        if Successful then
            null;
        else
            Get_User_Info.Collect_User_Info (User_Info);
        end if;

        loop
            Display (User_Info);
            Terminal_Interface.Put_Line
               ("Type <space> to change options, " &
                "or <cr> to confirm options and continue");
            Terminal_Interface.Get_Line (User_Response, Length);
            exit when Length = 0;
            Get_User_Info.Collect_User_Info (User_Info);
        end loop;

        Get_User_Info.Save_Info (User_Info);

        if User_Info.Mode = Get_User_Info.Disabled then
            Process_Package.Batch_Process (User_Info);

        else
            Process_Package.Interactive_Process (User_Info);
        end if;

    end Begin_Document_Check;

    --****************************************************************
    --****************************************************************

    --------------------------------------------------------------------------
    -- Abstract   : This operation will merge two user dictionaries
    --
    --------------------------------------------------------------------------
    -- Parameters :
    --
    --------------------------------------------------------------------------
    -- Algorithm  :
    --
    --------------------------------------------------------------------------

    procedure Begin_Merge_Operations is

        Help_Level : Help.Level_Type renames Help.Merge_Help;

        Input_File_A : Text_Io.File_Type;

        Input_File_B : Text_Io.File_Type;

        Output_File : Text_Io.File_Type;

        Help_Command : constant String :=
           ("For Help in this operation hit '?' ");

        Dictionary_Prompt_1 : constant String :=
           ("Enter first dictionary name to be merged =>");

        Dictionary_Prompt_2 : constant String :=
           ("Enter second dictionary name to be merged  =>");

        Dictionary_Prompt_3 : constant String :=
           ("Enter output dictionary name =>");

        Dictionary_Name_1 : String
                               (1 .. Machine_Dependencies.Max_File_Name_Length);

        Dictionary_Name_2 : String
                               (1 .. Machine_Dependencies.Max_File_Name_Length);

        Dictionary_Name_3 : String
                               (1 .. Machine_Dependencies.Max_File_Name_Length);

        Name_Length : Natural := 0;

        Error_Occurrence : Natural range 0 .. 2 := 0;

        Needs_Help : exception renames Utilities.Needs_Help;

        Terminate_Error : exception;

        Abandon : exception renames Utilities.Abandon;

        -------------------------------------------------
        -- This local procedure will get a dictionary name
        -- from a user.  If the dictionary name is unique
        -- and if it is a valid dictionary file name, this
        -- procedure will also open the file.  The arguments
        -- pased are the dictionary name which is returned
        -- with a valid name and a file which is returned as
        -- a valid opened file.
        -------------------------------------------------

        procedure Get_And_Open_Dictionary (Dictionary_Name : in out String;
                                           Prompt : String;
                                           File : in out Text_Io.File_Type) is

            Length : Natural;

            Error_State : Natural range 0 .. 2 := 0;

        begin

            loop
                begin

                    Terminal_Interface.Put_Line (Prompt (Prompt'Range));

                    Utilities.Get_Dictionary_Name (Dictionary_Name, Length);

                    if Length = Utilities.Terminal_Device'Length then

                        Error_State := Error_State + 1;

                        Terminal_Interface.Put_Line
                           (" The file name must be specified.");

                        if Error_State > 1 then
                            raise Terminate_Error;
                        end if;

                    else

                        Text_Io.Open (File, Text_Io.In_File,
                                      Dictionary_Name
                                         (Dictionary_Name'First .. Length));

                        exit;
                    end if;

                exception

                    when Text_Io.Status_Error |
                         Constraint_Error | Text_Io.Name_Error =>

                        Error_State := Error_State + 1;

                        Terminal_Interface.Put_Line
                           (" Dictionary name <<" &
                            Dictionary_Name (Dictionary_Name'First .. Length) &
                            ">> is an invalid name");

                        if Error_State > 1 then
                            raise Terminate_Error;
                        end if;
                end;
            end loop;
        end Get_And_Open_Dictionary;

        ------------------------------
        -- end of the local procedure
        ------------------------------



        ------------------------------
        -- start of the main procecure
        ------------------------------


    begin

        Terminal_Interface.New_Page;

        Terminal_Interface.Put_Line (Help_Command);

        Terminal_Interface.New_Line;

        Get_And_Open_Dictionary (Dictionary_Name_1,
                                 Dictionary_Prompt_1, Input_File_A);

        --------------------------------------------
        -- get the second dictionary
        --------------------------------------------

        loop

            Terminal_Interface.New_Line;

            Get_And_Open_Dictionary (Dictionary_Name_2,
                                     Dictionary_Prompt_2, Input_File_B);

            if Text_Io.Name (Input_File_B) = Text_Io.Name (Input_File_A) then

                Error_Occurrence := Error_Occurrence + 1;
                Terminal_Interface.Put_Line
                   ("Dictionary name <<" & Text_Io.Name (Input_File_B) &
                    ">> is currently open.");
                Terminal_Interface.Put_Line
                   (" Cannot merge a dictionary with itself");
                Text_Io.Close (Input_File_B);
                if Error_Occurrence > 1 then
                    raise Terminate_Error;
                end if;
            else
                exit;
            end if;
        end loop;
        --------------------------------------------
        -- work on the third dictionary
        --------------------------------------------
        Error_Occurrence := 0;

        loop

            Terminal_Interface.New_Line;

            Terminal_Interface.Put_Line (Dictionary_Prompt_3);

            Utilities.Get_Dictionary_Name (Dictionary_Name_3, Name_Length);

            if Dictionary_Name_3 = Dictionary_Name_1 then
                Utilities.Merge (Input_File_A, Input_File_B, Input_File_A);

                exit;      -- Merge operation is complete

            elsif Dictionary_Name_3 = Dictionary_Name_2 then
                Utilities.Merge (Input_File_A, Input_File_B, Input_File_B);

                exit;      -- Merge operation is complete

            elsif Name_Length = Utilities.Terminal_Device'Length then

                Error_Occurrence := Error_Occurrence + 1;

                Terminal_Interface.Put_Line ("A file name must be specified.");

                if Error_Occurrence > 1 then
                    raise Terminate_Error;
                end if;

            else
                begin
                    Utilities.Create
                       (Dictionary_Name_3
                           (Dictionary_Name_3'First .. Name_Length),
                        Output_File);

                    Utilities.Merge (Input_File_A, Input_File_B, Output_File);

                    exit;    -- Merge operation is complete

                exception
                    when Text_Io.Name_Error | Constraint_Error =>

                        Error_Occurrence := Error_Occurrence + 1;

                        Terminal_Interface.Put_Line
                           (" Dictionary Name <<" &
                            Dictionary_Name_3
                               (Dictionary_Name_3'First .. Name_Length) &
                            ">> is invalid.");

                        if Error_Occurrence > 1 then
                            raise Terminate_Error;
                        end if;
                end;
            end if;
        end loop;

    exception

        ---------------------------------------------------
        -- the user has requested help. Provide the help
        -- information.
        ---------------------------------------------------

        when Needs_Help =>
            Help.Help_Screen (Help_Level);

            -----------------------------------------------
            -- if the user has suppiled a invalid file name
            -- to many times.  Terminate this operaiton.
            -----------------------------------------------

        when Terminate_Error =>
            Terminal_Interface.Put_Line ("This operation is terminated.");
            delay (Time_Period);

            ------------------------------------------------
            -- The user choose not to execute this operation
            ------------------------------------------------

        when Abandon =>
            null;

    end Begin_Merge_Operations;

    --****************************************************************
    --****************************************************************

    --------------------------------------------------------------------------
    -- Abstract   : This operation will list out a user dictionary either
    --            : to the terminal device or to a file designated by the user.
    --------------------------------------------------------------------------
    -- Parameters :
    --
    --------------------------------------------------------------------------
    -- Algorithm  :
    --
    --------------------------------------------------------------------------

    procedure Begin_Dictionary_List is

        Help_Level : constant Help.Level_Type := Help.List_Help;

        Input_File : Text_Io.File_Type;

        Token : Token_Definition.Token_Type;

        Help_Command : constant String :=
           (" For Help in this operation hit '?'");

        Dictionary_Prompt_1 : constant String :=
           ("Enter dictionary name to be listed.");

        Dictionary_Prompt_2 : constant String :=
           ("Ouptut dictionary name (space = screen).");

        Input_Dictionary_Name :
           String (1 .. Machine_Dependencies.Max_File_Name_Length);

        Output_Dictionary_Name :
           String (1 .. Machine_Dependencies.Max_File_Name_Length);

        Input_Name_Length : Natural;

        Output_Name_Length : Natural;

        Error_Occurrence : Natural range 0 .. 2 := 0;

        Needs_Help : exception renames Utilities.Needs_Help;

        Invalid_Input_File : exception renames Utilities.Invalid_Input_File;

        Invalid_Output_File : exception renames Utilities.Invalid_Output_File;

        Repeat_Get_Input_Dictionary : exception;

        Abandon : exception renames Utilities.Abandon;

        Terminate_Error : exception;




    begin

        Terminal_Interface.New_Page;

        Terminal_Interface.Put_Line (Help_Command);

        loop
            begin
                Terminal_Interface.Put_Line (Dictionary_Prompt_1);

                Utilities.Get_Dictionary_Name
                   (Input_Dictionary_Name, Input_Name_Length);

                if Input_Name_Length = Utilities.Terminal_Device'Length then
                    Terminal_Interface.Put_Line
                       ("A file name must be specified.");

                    Error_Occurrence := Error_Occurrence + 1;

                    if Error_Occurrence > 1 then
                        raise Terminate_Error;
                    end if;
                else
                    Terminal_Interface.New_Line;

                    Terminal_Interface.Put_Line (Dictionary_Prompt_2);

                    Utilities.Get_Dictionary_Name
                       (Output_Dictionary_Name, Output_Name_Length);

                    if Output_Dictionary_Name
                          (Output_Dictionary_Name'First .. Output_Name_Length) =
                       Input_Dictionary_Name (Input_Dictionary_Name'First ..
                                                 Input_Name_Length) then

                        Terminal_Interface.Put_Line
                           ("Dictionary name <<" &

                            Input_Dictionary_Name
                               (Input_Dictionary_Name'First ..
                                   Input_Name_Length) &
                            ">> cannot be used for both input and output.");

                        Error_Occurrence := Error_Occurrence + 1;

                        if Error_Occurrence > 1 then
                            raise Terminate_Error;
                        else
                            raise Repeat_Get_Input_Dictionary;
                        end if;
                    elsif Output_Name_Length =
                          Utilities.Terminal_Device'Length then
                        loop
                            begin
                                Text_Io.Open (Input_File, Text_Io.In_File,
                                              Input_Dictionary_Name
                                                 (Input_Dictionary_Name'First ..
                                                     Input_Name_Length));
                                exit;
                            exception
                                when others =>
                                    Terminal_Interface.Put_Line
                                       ("Dictionary name <<" &
                                        Input_Dictionary_Name
                                           (Input_Dictionary_Name'First ..
                                               Input_Name_Length) &
                                        ">> is invalid");

                                    Error_Occurrence := Error_Occurrence + 1;

                                    if Error_Occurrence > 1 then
                                        raise Terminate_Error;
                                    else
                                        raise Repeat_Get_Input_Dictionary;
                                    end if;
                            end;
                        end loop;

                        Error_Occurrence := 0;

                        Terminal_Interface.New_Line;

                        while not Text_Io.End_Of_File (Input_File) loop
                            Text_Io.Get_Line
                               (Input_File, Token.Word, Token.Length);

                            Terminal_Interface.Put_Line
                               (Token.Word (Token.Word'First .. Token.Length));
                        end loop;
                        Text_Io.Close (Input_File);
                    else
                        Utilities.List (Input_Dictionary_Name
                                           (Input_Dictionary_Name'First ..
                                               Input_Name_Length),
                                        Output_Dictionary_Name
                                           (Output_Dictionary_Name'First ..
                                               Output_Name_Length));


                    end if;
                    exit;
                end if;
            exception

                ---------------------------------------------------
                -- the user has requested help. Provide the help
                -- information.
                ---------------------------------------------------

                when Needs_Help =>
                    Help.Help_Screen (Help_Level);

                when Repeat_Get_Input_Dictionary =>
                    null;

                when Invalid_Input_File | Invalid_Output_File =>
                    Terminal_Interface.Put_Line
                       (" Dictionary name <<" &
                        Input_Dictionary_Name
                           (Input_Dictionary_Name'First .. Input_Name_Length) &
                        ">> or dictionary name <<" &
                        Output_Dictionary_Name (Output_Dictionary_Name'First ..
                                                   Output_Name_Length) &
                        ">> is invalid.");

                    Error_Occurrence := Error_Occurrence + 1;

                    if Error_Occurrence > 1 then
                        raise Terminate_Error;
                    end if;
            end;
        end loop;
    exception
        when Abandon =>
            null;

        when Terminate_Error =>
            Terminal_Interface.Put_Line ("This opeation is terminated");
            delay (Time_Period);

        when others =>
            raise;

    end Begin_Dictionary_List;

    --****************************************************************
    --****************************************************************


begin

    -----------------------------------------------------------
    -- Since the application does not allow for screen adressing
    -- the menus (or pages displayed) must be cleared prior to
    -- displaying the next menu.  To give the user time to read
    -- to read the menue (page) execution will be delayed for
    -- a specified amount of time.
    -----------------------------------------------------------


    begin
        Command_Line_Interface.File_Name
           (User_Info.Document.Name, User_Info.Document.Length);

        if User_Info.Document.Length >= User_Info.Document.Name'First then
            User_Info.Mode := Get_User_Info.Disabled;
            Processing_Command_Line := True;
        end if;

        Command_Line_Interface.Word_List
           (User_Info.Word_List.Name, User_Info.Word_List.Length);

        if User_Info.Word_List.Length < User_Info.Word_List.Name'First and
           Processing_Command_Line then
            raise Invalid_Execution_Attempted;

        elsif User_Info.Word_List.Length >= User_Info.Word_List.Name'First and
              not Processing_Command_Line then
            raise Invalid_Execution_Attempted;
        else
            null;
        end if;

        Command_Line_Interface.Master_Dictionary
           (User_Response, Number_Of_Characters);

        if Number_Of_Characters >= User_Response'First and
           Processing_Command_Line then
            User_Info.Master := True;

        elsif Number_Of_Characters >= User_Response'First and
              not Processing_Command_Line then
            raise Invalid_Execution_Attempted;

        else
            User_Info.Master := False;
        end if;

        Command_Line_Interface.Acronym_Dictionary
           (User_Response, Number_Of_Characters);

        if Number_Of_Characters >= User_Response'First and
           Processing_Command_Line then
            User_Info.Acronym := True;

        elsif Number_Of_Characters >= User_Response'First and
              not Processing_Command_Line then
            raise Invalid_Execution_Attempted;

        else
            User_Info.Acronym := False;
        end if;

        for I in 1 .. Get_User_Info.Number_Of_User_Dictionaries loop

            Command_Line_Interface.User_Dictionary
               (I, User_Response, Number_Of_Characters);

            exit when Number_Of_Characters = 0;

            if Number_Of_Characters >= User_Response'First then

                User_Info.User_Dict.Mode := Get_User_Info.Enabled;
                User_Info.User_Dict.Names (I).Name := User_Response;
                User_Info.User_Dict.Names (I).Length := Number_Of_Characters;
                User_Info.User_Dict.Names (I).Mode := Get_User_Info.Enabled;
            end if;


        end loop;

        if User_Info.User_Dict.Mode = Get_User_Info.Enabled and
           not Processing_Command_Line then
            raise Invalid_Execution_Attempted;
        end if;
    exception
        when Command_Line_Interface.Name_Error =>
            Text_Io.Put_Line (Text_Io.Standard_Output,
                              "Invalid syntax on invocation");
            raise Abandon;

        when Command_Line_Interface.Mix_Error =>
            Text_Io.Put_Line (Text_Io.Standard_Output,
                              "Named association and positional association " &
                                 "improperly mixed on command line.");
            raise Abandon;

        when Command_Line_Interface.User_Dictionary_Number =>
            Text_Io.Put_Line (Text_Io.Standard_Output,
                              "Invalid user dictionary request");
            raise Abandon;

        when Invalid_Execution_Attempted =>
            Text_Io.Put_Line (Text_Io.Standard_Output,
                              "No document or no suspect word list supplied.");
            raise Abandon;
    end;

    if Processing_Command_Line then
        Process_Package.Batch_Process (User_Info);

    else

        Display_Title_Page;
        delay (Time_Period);

        loop
            begin
                -----------------------------------------------------------------
                -- This is the operations menu the user must deal with first.
                -- The operations available include
                --
                --           MERGE
                --           LIST
                --           QUIT
                --           HELP
                --           SPELL
                --
                -- At the conclusion of any of these operations the user will be
                -- prompted for further action.  Eventually the user will choose
                -- quit.  At this time the program terminates.
                -----------------------------------------------------------------

                Display_Command_Choices;

                Terminal_Interface.Get_Line
                   (User_Response, Number_Of_Characters);

                case User_Response (User_Response'First) is

                    when '?' =>
                        Help.Help_Screen (Level_1);

                    when 'S' | 's' =>
                        Begin_Document_Check;

                    when 'Q' | 'q' =>
                        exit;

                    when 'M' | 'm' =>
                        Begin_Merge_Operations;

                    when 'L' | 'l' =>
                        Begin_Dictionary_List;

                    when others =>
                        Terminal_Interface.New_Line;

                        Terminal_Interface.Put_Line
                           ("<<" &
                            User_Response
                               (User_Response'First .. Number_Of_Characters) &
                            ">>");

                        Terminal_Interface.Put_Line
                           (" is not one of your possible choices ");

                        Terminal_Interface.Put_Line (" Reenter your choice ");

                        delay (Time_Period); -- allow the user to see
                        -- the improper response
                end case;

                User_Response := (User_Response'Range => ' ');

            exception
                when Help.Help_File_Error =>
                    Terminal_Interface.Put_Line
                       ("The HELP file does not exist.");
                    Terminal_Interface.Put_Line
                       ("No HELP information is available.");

                when Help.Help_Open_Error =>
                    Terminal_Interface.Put_Line
                       ("The HELP file could not be opened.");
                    Terminal_Interface.Put_Line
                       ("No HELP information is available.");

                when Help.Help_Format_Error =>
                    Terminal_Interface.Put_Line
                       ("The format of the HELP file is not legal.");
                    Terminal_Interface.Put_Line
                       ("No HELP information is available.");
            end;

        end loop;

    end if;

exception
    when Abandon =>
        null;

    when Invalid_Execution_Attempted =>
        Text_Io.Put_Line (Text_Io.Standard_Output,
                          "Invalid execution attempted.");

    when others =>
        null;

end Speller;