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

⟦72b5832aa⟧ TextFile

    Length: 19911 (0x4dc7)
    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 Read_Log;
use Read_Log;
with Simple_Paginated_Output;
use Simple_Paginated_Output;
with Breakpoint;
use Breakpoint;
with String_Pkg;
use String_Pkg;
with Calendar;
with Dynamic_Array_Pkg;
use Dynamic_Array_Pkg;
with Report_Library;
use Report_Library;

package body Adapathr is

    Report_File : Paginated_File_Handle;  --| output report file

    procedure Path_Report_Writer (Logfile_Name : in Filename;
                                  --| name of input log file
                                  Reportfile_Name : in Filename)
                 --| name of ouput report file
                  is
        Program_Name : Ada_Name;  --| name of Ada program being tested
        Test_Id : Test_Identifier;  --| user input
        Test_Date : Calendar.Time;  --| date program was executed
        Tool_Version : constant String := "Path Analyzer 01.00 ";
        Page_Format : Options --| formatting options for reports
            := (80,     --| characters per line
               60,     --| lines per page
               Path_Tool,     --| tool name
               Tool_Version);  --| tool version number



        procedure Execution_Report is

            Blanks : String (1 .. 80) := (others => ' ');  --| blank line
            Buffer_Index : Natural := 1;  --| index for print array
            Compilation_Unit : Ada_Name;  --| current comp unit
            Current_Line : Breakpoint_Number_Range := 1;
            --| current breakpoint number
            Current_Procedure : Ada_Name;  --| name of current unit
            Current_Range : Breakpoint_Number_Range := 1;
            --| starting number of current block
            End_Index : Natural;  --| end of print buffer
            Execution_Counter : Natural := 0;  --| execution number
            Integer_Length : Natural;  --| length of integers
            Integer_String : String (1 ..
                                        6);  --| string representation of number
            Key : Logfile_Keys;  --| type of logfile record
            Num_Of_Breakpoints : Breakpoint_Number_Range := 1;
            --| number of brkpts in procedure
            Parameter_String : Ada_Name;  --| parameters for autopath
            Previous_Key : Logfile_Keys := Unit_Start;
            --|type of previous logfile record
            Previous_Line : Breakpoint_Number_Range := 1;
            --| number of previous line
            Print_String : String (1 .. 80);  --| for printing names
            Procedure_Name : Ada_Name;  --| unit name from logfile
            Unit_Id : Program_Unit_Unique_Identifier;
            --| current breakpoint unit

        begin
            while End_Of_Log = False loop
                Get_Next_Key (Key);
                if Key = Autopath_Call then
                    Skip_Line (Report_File, 2);
                    Execution_Counter := Execution_Counter + 1;
                    Print_String (1 .. 12) := "EXECUTION # ";
                    Integer_Length := Natural'Image (Execution_Counter)'Length;
                    Integer_String := "      ";
                    Integer_String (1 .. Integer_Length) :=
                       Natural'Image (Execution_Counter);
                    End_Index := Integer_Length + 11;
                    Print_String (13 .. End_Index) :=
                       Integer_String (2 .. Integer_Length);
                    Put_Line (Report_File, Print_String);
                    Parameter_String := Call_Parameters;
                    Print_String := Blanks;
                    Print_String (1 .. Length (Parameter_String)) :=
                       Value (Parameter_String);
                    Put_Line (Report_File, Print_String);
                    Buffer_Index := 1;
                elsif Key in Unit_Start .. Unit_Stop then
                    if Previous_Key in Loop_Breakpoint .. Other_Breakpoint then
                        if Previous_Line /= Current_Range then
                            Buffer_Index := Buffer_Index + 1;
                            Print_String (Buffer_Index) := '-';
                            Buffer_Index := Buffer_Index + 1;
                            Integer_String := "      ";
                            Integer_Length :=
                               Natural'Image (Previous_Line)'Length;
                            Integer_String (1 .. Integer_Length) :=
                               Natural'Image (Previous_Line);
                            End_Index := Buffer_Index + Integer_Length - 2;
                            Print_String (Buffer_Index .. End_Index) :=
                               Integer_String (2 .. Integer_Length);
                            Buffer_Index := End_Index;
                        end if;
                        Buffer_Index := Buffer_Index + 1;
                        Print_String (Buffer_Index) := ']';
                        Put_Line (Report_File, Print_String);
                        Buffer_Index := 1;
                    end if;
                    Get_Unit_Id (Unit_Id);
                    Find_Unit_Name (Unit_Id, Procedure_Name);
                    if Key = Unit_Start then
                        Print_String := Blanks;
                        Print_String (1 .. 6) := "Begin ";
                        Print_String (7 .. Length (Procedure_Name) + 6) :=
                           Value (Procedure_Name);
                        Put_Line (Report_File, Print_String);
                        Current_Procedure := Procedure_Name;
                        if Equal (Unit_Id.Enclosing_Unit_Identifier,
                                  Compilation_Unit) = False then
                            Compilation_Unit := Unit_Id.
                                                   Enclosing_Unit_Identifier;
                            Num_Of_Breakpoints :=
                               Number_Of_Breakpoints (Compilation_Unit);
                            Initialize_Breakpoints
                               (Compilation_Unit, Num_Of_Breakpoints);
                        end if;
                    else
                        Print_String := Blanks;
                        Print_String (1 .. 4) := "End ";
                        Print_String (5 .. Length (Procedure_Name) + 4) :=
                           Value (Procedure_Name);
                        Put_Line (Report_File, Print_String);
                    end if;
                    Previous_Key := Key;
                elsif Key in Loop_Breakpoint .. Other_Breakpoint then
                    Get_Breakpoint (Unit_Id, Current_Line);
                    Find_Unit_Name (Unit_Id, Procedure_Name);
                    Break (Unit_Id.Enclosing_Unit_Identifier, Current_Line);
                    if Previous_Key = Unit_Stop then
                        Print_String := Blanks;
                        Print_String (1 .. 7) := "Resume ";
                        Print_String (8 .. Length (Procedure_Name) + 7) :=
                           Value (Procedure_Name);
                        Put_Line (Report_File, Print_String);
                        Current_Procedure := Procedure_Name;
                    end if;
                    if Previous_Key in Unit_Start .. Unit_Stop then
                        if Previous_Key = Unit_Start and
                           Equal (Procedure_Name, Current_Procedure) =
                              False then
                            Print_String := Blanks;
                            Print_String (1 .. 7) := "Resume ";
                            Print_String (8 .. Length (Procedure_Name) + 7) :=
                               Value (Procedure_Name);
                            Put_Line (Report_File, Print_String);
                            Current_Procedure := Procedure_Name;
                        end if;
                        Print_String := Blanks;
                        Print_String (7) := '[';
                        Integer_String := "      ";
                        Integer_Length := Natural'Image (Current_Line)'Length;
                        Integer_String (1 .. Integer_Length) :=
                           Natural'Image (Current_Line);
                        End_Index := Integer_Length + 6;
                        Print_String (8 .. End_Index) :=
                           Integer_String (2 .. Integer_Length);
                        Buffer_Index := End_Index;
                        Current_Range := Current_Line;
                    elsif Previous_Key in
                          Loop_Breakpoint .. Other_Breakpoint then
                        if Equal (Procedure_Name, Current_Procedure) =
                           False then
                            if Previous_Line /= Current_Range then
                                Buffer_Index := Buffer_Index + 1;
                                Print_String (Buffer_Index) := '-';
                                Buffer_Index := Buffer_Index + 1;
                                Integer_Length :=
                                   Natural'Image (Previous_Line)'Length;
                                Integer_String := "      ";
                                Integer_String (1 .. Integer_Length) :=
                                   Natural'Image (Previous_Line);
                                End_Index := Buffer_Index + Integer_Length - 2;
                                Print_String (Buffer_Index .. End_Index) :=
                                   Integer_String (2 .. Integer_Length);
                                Buffer_Index := End_Index;
                            end if;
                            Buffer_Index := Buffer_Index + 1;
                            Print_String (Buffer_Index) := ']';
                            Put_Line (Report_File, Print_String);
                            Current_Procedure := Procedure_Name;
                            Current_Range := Current_Line;
                            Print_String := Blanks;
                            Print_String (1 .. 7) := "Resume ";
                            Print_String (8 .. Length (Procedure_Name) + 7) :=
                               Value (Procedure_Name);
                            Put_Line (Report_File, Print_String);
                            Print_String := Blanks;
                            Print_String (7) := '[';
                            Integer_String := "      ";
                            Integer_Length :=
                               Natural'Image (Current_Line)'Length;
                            Integer_String (1 .. Integer_Length) :=
                               Natural'Image (Current_Line);
                            End_Index := Integer_Length + 6;
                            Print_String (8 .. End_Index) :=
                               Integer_String (2 .. Integer_Length);
                            Buffer_Index := End_Index;
                        elsif Current_Line /= Previous_Line + 1 then
                            if Previous_Line /= Current_Range then
                                Buffer_Index := Buffer_Index + 1;
                                Print_String (Buffer_Index) := '-';
                                Buffer_Index := Buffer_Index + 1;
                                Integer_String := "      ";
                                Integer_Length :=
                                   Natural'Image (Previous_Line)'Length;
                                Integer_String (1 .. Integer_Length) :=
                                   Natural'Image (Previous_Line);
                                End_Index := Buffer_Index + Integer_Length - 2;
                                Print_String (Buffer_Index .. End_Index) :=
                                   Integer_String (2 .. Integer_Length);
                                Buffer_Index := End_Index;
                            end if;
                            Buffer_Index := Buffer_Index + 1;
                            Print_String (Buffer_Index) := ']';
                            if Current_Line < Previous_Line then
                                Buffer_Index := Buffer_Index + 1;
                                Print_String
                                   (Buffer_Index .. Buffer_Index + 1) := " \";
                                Buffer_Index := Buffer_Index + 1;
                            end if;
                            if Buffer_Index > 58 then
                                Put_Line (Report_File, Print_String);
                                Print_String := Blanks;
                                Print_String (7) := '[';
                                Buffer_Index := 7;
                            else
                                Buffer_Index := Buffer_Index + 2;
                                Print_String (Buffer_Index) := '[';
                            end if;
                            Buffer_Index := Buffer_Index + 1;
                            Integer_String := "      ";
                            Integer_Length :=
                               Natural'Image (Current_Line)'Length;
                            Integer_String (1 .. Integer_Length) :=
                               Natural'Image (Current_Line);
                            End_Index := Buffer_Index + Integer_Length - 2;
                            Print_String (Buffer_Index .. End_Index) :=
                               Integer_String (2 .. Integer_Length);
                            Buffer_Index := End_Index;
                            Current_Range := Current_Line;
                        end if;
                    end if;
                    Previous_Line := Current_Line;
                    Previous_Key := Key;
                else
                    Flush_Logfile_Record (Key);
                end if;
            end loop;
        end Execution_Report;

        procedure Summary is


            Blanks : String (1 .. 80) := (others => ' ');  --| blank line
            Buffer_Index : Natural;  --| index for print buffer
            Current_Count : Count_Range;  --| current execution count
            Current_Range : Breakpoint_Number_Range := 1;
            --| start of current statement block
            Dump_Access : Table_Access;  --| pointer to execution count array
            End_Index : Natural;  --| end index for print buffer
            Integer_Length : Natural;  --| length of integer string
            Integer_String : String
                                (1 .. 6);  --| string representation of integer
            More_Units : Boolean := True;  --| additional units to process
            Previous_Count : Count_Range;  --| previous execution count
            Print_String : String (1 .. 80);  --| for printing names

        begin
            while More_Units loop
                Dump (Dump_Access, More_Units);
                Skip_Line (Report_File, 1);
                Print_String := Blanks;
                Print_String (1 .. Length (Dump_Access.Unit_Name)) :=
                   Value (Dump_Access.Unit_Name);
                Put_Line (Report_File, Print_String);
                Print_String := Blanks;
                Print_String (7) := '[';
                Buffer_Index := 8;
                for I in First (Dump_Access.Execution_Count) ..
                            Last (Dump_Access.Execution_Count) loop
                    Current_Count := Fetch (Dump_Access.Execution_Count, I);
                    if I = First (Dump_Access.Execution_Count) then
                        Integer_String := "      ";
                        Integer_Length := Integer'Image (I)'Length;
                        Integer_String (1 .. Integer_Length) :=
                           Integer'Image (I);
                        End_Index := Integer_Length + 6;
                        Print_String (8 .. End_Index) :=
                           Integer_String (2 .. Integer_Length);
                        Buffer_Index := End_Index + 1;
                        Current_Range := I;
                    elsif Current_Count /= Previous_Count then
                        if Current_Range /= I - 1 then
                            Print_String (Buffer_Index) := '-';
                            Buffer_Index := Buffer_Index + 1;
                            Integer_String := "      ";
                            Integer_Length := Natural'Image (I - 1)'Length;
                            Integer_String (1 .. Integer_Length) :=
                               Natural'Image (I - 1);
                            End_Index := Buffer_Index + Integer_Length - 2;
                            Print_String (Buffer_Index .. End_Index) :=
                               Integer_String (2 .. Integer_Length);
                            Buffer_Index := End_Index + 1;
                        end if;
                        Print_String (Buffer_Index) := ']';
                        Integer_String := "      ";
                        Integer_String := String_Of (Previous_Count, 6);
                        Print_String (30 .. 35) := Integer_String;
                        Put_Line (Report_File, Print_String);
                        Print_String := Blanks;
                        Print_String (7) := '[';
                        Integer_String := "      ";
                        Integer_Length := Integer'Image (I)'Length;
                        Integer_String (1 .. Integer_Length) :=
                           Integer'Image (I);
                        End_Index := Integer_Length + 6;
                        Print_String (8 .. End_Index) :=
                           Integer_String (2 .. Integer_Length);
                        Buffer_Index := End_Index + 1;
                        Current_Range := I;
                    end if;
                    Previous_Count := Current_Count;
                end loop;
                if Current_Range /= Last (Dump_Access.Execution_Count) then
                    Print_String (Buffer_Index) := '-';
                    Buffer_Index := Buffer_Index + 1;
                    Integer_String := "      ";
                    Integer_Length :=
                       Natural'Image (Last (Dump_Access.Execution_Count))'
                          Length;
                    Integer_String (1 .. Integer_Length) :=
                       Natural'Image (Last (Dump_Access.Execution_Count));
                    End_Index := Buffer_Index + Integer_Length - 2;
                    Print_String (Buffer_Index .. End_Index) :=
                       Integer_String (2 .. Integer_Length);
                    Buffer_Index := End_Index + 1;
                end if;
                Print_String (Buffer_Index) := ']';
                Integer_String := "      ";
                Integer_String := String_Of (Previous_Count, 6);
                Print_String (30 .. 35) := Integer_String;
                Put_Line (Report_File, Print_String);
            end loop;
        end Summary;

    begin
        Open_Report_File (Report_File, Reportfile_Name, Page_Format);
        Open_Log (Logfile_Name, Program_Name, Test_Id, Test_Date);
        Put_Test_Configuration_Data (Program_Name, Test_Date, Test_Id);
        if Query ("Do you wish to continue (y/n) ? ") then
            Print_Test_Configuration_Report (Report_File, Program_Name,
                                             Logfile_Name, Test_Date, Test_Id);
            Set_Page_Layout (Report_File, 60, 3);
            Set_Header (Report_File, 2, Logfile_Name);
            Set_Header (Report_File, 3, "        ");
            Execution_Report;
            Set_Page_Layout (Report_File, 60, 6);
            Set_Header (Report_File, 4,
                        "      Statement           Execution Count");
            Set_Header (Report_File, 5,
                        "      ---------           ---------------");
            Set_Header (Report_File, 6, "         ");
            Summary;
        end if;
        Close_Log;
        Close_Paginated_File (Report_File);
    end Path_Report_Writer;

end Adapathr;