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

⟦7b9213c61⟧ TextFile

    Length: 6333 (0x18bd)
    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

with File_Name_Package;
with List_Package;
with Text_Io;
with Compilation_Unit;
with Find_Unit;
with Determine_Metrics;

procedure Complexity_Measures_Tool is

    --==============================================================
    -- This is the main program for the complexity measures tool.  =
    -- It gets a list of Ada source code files, an output          =
    -- filename(either the terminal screen or a disk filename),    =
    -- and coordinates various efforts with the Ada source code.   =
    -- These coordination efforts include the reading of files,    =
    -- the forming of metrics, and the reporting of metrics.       =
    --                                                             =
    -- written  by  Gary Russell at EVB Software Engineering Inc.  =
    -- Reviewed by Brad Balfour and Johan Margono                  =
    -- May 1985                                                    =
    --==============================================================

    Output_File_Name : File_Name_Package.File_Name;
    -- The Output file name supplied by the user

    Source_File_Name : File_Name_Package.File_Name;
    -- A file name of a Ada source code file to compute metrics on

    The_Logical_Input_File : Text_Io.File_Type;
    -- The logical file to the output file

    The_Logical_Output_File : Text_Io.File_Type;
    -- The logical file to the output file

    The_Next_Compilation_Unit : Compilation_Unit.Ada_Compilation_Unit;
    -- The next Ada compilation unit in a file that contains
    -- a series of Ada compilation units

    The_Users_List : List_Package.List_Of_File_Names;
    -- This is the list of user-supplied Ada source code file


    function More_To_Read return Boolean is separate;
    -- Returns true if there is more information to read in the
    -- input file and false otherwise


begin
    -- Complexity_Measures_Tool

    -- Get a list of file names
    List_Package.Get_List_Of_Files (This_List => The_Users_List);

    --  get the output file name
    File_Name_Package.Get_Output_File_Name (For_This_File => Output_File_Name);


    -- Determine which of the possible metrics need to be produced
    Determine_Metrics.Prompt_For_Which_Metrics;

    --  Set terminal or given output file name to correct Text_IO file
    if File_Name_Package.File_Name_Is_Given
          (For_This_File => Output_File_Name) then

        Text_Io.Create (File => The_Logical_Output_File,
                        Mode => Text_Io.Out_File,
                        Name => File_Name_Package.A_String_Output_File
                                   (This_File => Output_File_Name));

        Text_Io.Set_Output (File => The_Logical_Output_File);

    end if;

    --  Produce the metrics for a list of Ada source files
    Process_File_Names:
        while List_Package.More_File_Names (In_List => The_Users_List) loop

            -- Get the next file name
            List_Package.Get_File_Name_From_List
               (From_List => The_Users_List,
                Into_File_Name => Source_File_Name);

            Producing_The_Metrics:
                begin

                    -- associate the input file
                    File_Name_Package.Associate_Input_File_Names
                       (This_File => Source_File_Name,
                        With_Input_File => The_Logical_Input_File);

                    -- Produce the metrics for a compilation unit

                    Reading_Compilation_Units:
                        while More_To_Read loop

                            Find_Unit.Build_Ada_Compilation_Unit
                               (Next_Unit => The_Next_Compilation_Unit);

                            Compilation_Unit.Produce_Metrics
                               (This_Compilation_Unit =>
                                   The_Next_Compilation_Unit);

                        end loop Reading_Compilation_Units;

                    Text_Io.Close (File => The_Logical_Input_File);

                exception
                    when Text_Io.Name_Error =>
                        Text_Io.Set_Output (Text_Io.Standard_Output);
                        Text_Io.Put_Line ("***** Error opening input file");
                        Text_Io.Put_Line ("***** Did you type in the correct " &
                                          "input file name?");
                        Text_Io.Set_Output (File => The_Logical_Output_File);

                    when Find_Unit.No_More_Compilation_Units =>
                        Text_Io.Close (File => The_Logical_Input_File);
                        -- There were blanks or comments at the end of the
                        -- file. Get the next file.

                    when Find_Unit.Build_Syntax_Error =>
                        Text_Io.Close (File => The_Logical_Input_File);
                        -- There was something wrong with the syntax. A
                        -- legal compilation unit could not be found.

                    when Compilation_Unit.Syntax_Error =>
                        Text_Io.Close (File => The_Logical_Input_File);
                        -- There was something wrong with the syntax in
                        -- Produce_Metrics. The error message was printed
                        -- out in Produce_Metrics

                    when others =>
                        Text_Io.Close (File => The_Logical_Input_File);
                        -- Something was wrong with last file, try the
                        -- next file

                end Producing_The_Metrics;

        end loop Process_File_Names;

    if File_Name_Package.File_Name_Is_Given
          (For_This_File => Output_File_Name) then

        -- Set the output back to standard output and print
        -- a message

        Text_Io.Set_Output (Text_Io.Standard_Output);

        Text_Io.Put (File_Name_Package.A_String_Output_File
                        (This_File => Output_File_Name));

        Text_Io.Put_Line (" created.");

        Text_Io.Close (File => The_Logical_Output_File);

    end if;

    --** changed 11/13/85 by J. Margono
    --** reason: tried to close the output file TWICE

exception
    when Text_Io.Name_Error =>
        Text_Io.Put_Line ("***** Error opening Output file.");
        Text_Io.Put_Line ("***** Did you type in the correct file name?");

end Complexity_Measures_Tool;