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

⟦66b462651⟧ TextFile

    Length: 20890 (0x519a)
    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 Determine_Metrics;
separate (Compilation_Unit.Produce_Metrics)
procedure Report_Metrics (Program_Unit : in Program_Unit_State_Machine;
                          Halstead : in Halstead_State_Machine;
                          Loc : in Loc_State_Machine;
                          Mccabe : in Mccabe_State_Machine) is
    --=============================================================
    -- This operation reports all the results of the metrics that =
    -- have been calculated based on the Ada source code file.    =
    -- The results will be displayed using the formats found in   =
    -- the user reference manual. All results will be displayed   =
    -- using Text_IO. The objects corresponding to the metrics    =
    -- that are being reported on, all reside inside the body of  =
    -- Produce_Metrics.                                           =
    --                                                            =
    --  written by Gary Russell at EVB Software Engineering       =
    --  Reviewed by Johan Margono and Brad Balford                =
    --  May 1985                                                  =
    --=============================================================

    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    -- Program unit information

    Name_Of_Program_Unit : Program_Unit_Name;
    -- The name of the current program unit

    Kind_Of_Program_Unit : Program_Unit_Kind;
    -- The current type of program unit
    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    -- Lines of Code objects

    Blank_Lines : Loc_Blank_Lines.Count;
    -- The number of blank lines to report on

    Comments : Loc_Comments.Count;
    -- The number of comments to report on

    Data_Declarations : Loc_Data_Declarations.Count;
    -- Reported number of data declarations

    Physical_Lines : Loc_Physical_Lines.Count;
    -- Reported number of physical lines

    Executable_Statements : Loc_Executable_Statements.Count;
    -- Reported number of executable statements
    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    -- McCabe's Metric object

    Vg : Mccabe_Vg.Number;
    -- Reported cyclomatic complexity number
    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    -- Halstead's metric objects

    Lower_Case_N_1 : Natural;
    -- The current total of unique operators

    Lower_Case_N_2 : Natural;
    -- The current total of unique operands

    Upper_Case_N_1 : Natural;
    -- The current total of all operators

    Upper_Case_N_2 : Natural;
    -- The current total of all operands

    Lower_Case_N : Halstead_Lower_Case_N.Result;
    -- The current size of vocabulary for this compilation unit

    Upper_Case_N : Halstead_Upper_Case_N.Result;
    -- The current Program length for this compilation unit

    Final_Program_Volume : Halstead_V.Result;
    -- The current program volume for this compilation unit

    V_Star : Halstead_V_Star.Result;
    -- The current amount of potential program volume

    Program_Level : Halstead_L.Result;
    -- The current program level for this compilation unit

    Difficulty : Halstead_D.Result;
    -- The current difficulty level for this compilation unit

    Effort : Halstead_E.Result;
    -- The current effort for this compilation unit

    B_Hat : Halstead_B_Hat.Result;
    -- The current number of delivered bugs

    D_Hat : Halstead_D_Hat.Result;
    -- The current amount of Halstead's error proneness

    Time : Halstead_T.Result;
    -- The current value of Halstead's time to understand

    B_Over_P : Halstead_B_Over_P.Result;
    -- The current value of Halstead's fault rate

    Operator_List : Halstead_Operator_List.List;
    -- The list of operators stored in the Halstead task

    Operand_List : Halstead_Operand_List.List;
    -- The list of operands stored in the Halstead task
    --<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    -- Instantiate on all the packages to report all the data
    -- with the use of text_IO

    package Program_Unit_Io is new Text_Io.Enumeration_Io
                                      (Enum => Program_Unit_Kind);
    -- Program_Unit will be used to output the type of
    -- program unit

    package Report_Blank_Lines is new Text_Io.Integer_Io
                                         (Num => Loc_Blank_Lines.Count);
    -- This package will be used to output the number of
    -- blank lines

    package Report_Comments is new Text_Io.Integer_Io
                                      (Num => Loc_Comments.Count);
    -- This package will be used to output the number of
    -- comments

    package Report_Data_Declarations is
       new Text_Io.Integer_Io (Num => Loc_Data_Declarations.Count);
    -- This package will be used to output the number of
    -- Data declarations

    package Report_Physical_Lines is new Text_Io.Integer_Io
                                            (Num => Loc_Physical_Lines.Count);
    -- This package will be used to output the number of
    -- Physical lines

    package Report_Executable_Statements is
       new Text_Io.Integer_Io (Num => Loc_Executable_Statements.Count);
    -- This package will be used to output the number of
    -- executable statements

    package Report_Mccabes_Metric is
       new Text_Io.Integer_Io (Num => Mccabe_Vg.Number);
    -- This package will be used to output the McCabe's
    -- Cyclomatic complexity number

    package Number_Of_Unique_Operators is
       new Text_Io.Integer_Io (Num => Natural);
    -- This package will be used to output Halstead's number
    -- of Unique operators

    package Number_Of_Unique_Operands is
       new Text_Io.Integer_Io (Num => Natural);
    -- This package will be used to output Halstead's number
    -- of Unique operands

    package Total_Number_Of_Operators is
       new Text_Io.Integer_Io (Num => Natural);
    -- This package will be used to output Halstead's total
    -- number of operators

    package Total_Number_Of_Operands is new Text_Io.Integer_Io (Num => Natural);
    -- This package will be used to output Halstead's total
    -- number of operators

    package Size_Of_Vocabulary is new Text_Io.Integer_Io
                                         (Num => Halstead_Lower_Case_N.Result);
    -- This package will be used to output Halstead's
    -- vocabulary size

    package Program_Length is new Text_Io.Integer_Io
                                     (Num => Halstead_Upper_Case_N.Result);
    -- This package will be used to output Halstead's
    -- program length

    package Program_Volume is new Text_Io.Float_Io (Num => Halstead_V.Result);
    -- This package will be used to output Halstead's
    -- program volume

    package Potential_Program_Volume is
       new Text_Io.Float_Io (Num => Halstead_V_Star.Result);
    -- This package will be used to output Halstead's
    -- potential program volume

    package Language_Level is new Text_Io.Float_Io (Num => Halstead_L.Result);
    -- This package will be used to output Halstead's
    -- program level

    package Difficulty_Level is new Text_Io.Float_Io (Num => Halstead_D.Result);
    -- This package will be used to output Halstead's
    -- program length

    package Effort_To_Implement is
       new Text_Io.Float_Io (Num => Halstead_E.Result);
    -- This package will be used to output Halstead's
    -- Effort to implement this module

    package Delivered_Bugs is new Text_Io.Float_Io
                                     (Num => Halstead_B_Hat.Result);
    -- This package will be used to output Halstead's
    -- Number of Delivered bugs

    package Error_Proneness is new Text_Io.Float_Io
                                      (Num => Halstead_D_Hat.Result);
    -- This package will be used to output Halstead's
    -- Error Proneness

    package Time_To_Understand is
       new Text_Io.Float_Io (Num => Halstead_T.Result);
    -- This package will be used to output Halstead's
    -- Time to understand

    package Fault_Rate is new Text_Io.Float_Io
                                 (Num => Halstead_B_Over_P.Result);
    -- This package will be used to output Halstead's
    -- Fault rate

    procedure Display_Operands (Operand_List : in
                                   Halstead_Operand_List.List) is separate;
    -- displays Halstead unique operands and their frequencies

    procedure Display_Operators (Operator_List : in
                                    Halstead_Operator_List.List) is separate;
    -- displays Halstead unique operators and their frequencies

begin
    -- Report_Metrics

    -- Get the program unit name and type from the
    -- program unit task Rendezvous

    Program_Unit.Get_Program_Unit_Name
       (The_Program_Unit_Name => Name_Of_Program_Unit);

    Program_Unit.Get_Kind_Of_Program_Unit
       (The_Kind_Of_Program_Unit => Kind_Of_Program_Unit);

    -- Output the Compilation unit header
    Text_Io.New_Line;
    Text_Io.Put_Line ("****************************************" &
                      "****************************************");
    Text_Io.New_Line;
    Text_Io.Put ("Metrics for : ");
    Text_Io.Put_Line (Name_Of_Program_Unit.Value);
    Text_Io.Put ("Compilation Unit : ");
    Program_Unit_Io.Put (Item => Kind_Of_Program_Unit);
    Text_Io.New_Line (Spacing => 2);

    if Determine_Metrics.Lines_Of_Code_Output_Needed then

        -- Output the Lines of code metric header
        Text_Io.Set_Col (To => 21);
        Text_Io.Put_Line ("Lines of Code");

        -- Get the number of blank lines from the
        -- LOC task Rendezvous
        Loc.Get_Blank_Lines_Count (Blank_Line_Count => Blank_Lines);

        -- Output the number of blank lines
        Text_Io.Put ("Blank Lines");
        Text_Io.Set_Col (To => 25);
        Text_Io.Put ("=> ");
        Report_Blank_Lines.Put (Item => Blank_Lines);
        Text_Io.New_Line (Spacing => 1);

        -- Get the number of comments from the LOC task Rendezvous
        Loc.Get_Comments_Count (Comments => Comments);

        -- Output the number of Comments
        Text_Io.Put ("Comments");
        Text_Io.Set_Col (To => 25);
        Text_Io.Put ("=> ");
        Report_Comments.Put (Item => Comments);
        Text_Io.New_Line (Spacing => 1);

        -- Get the number of physical lines from the
        -- LOC task Rendezvous
        Loc.Get_Physical_Lines_Count (Physical_Lines => Physical_Lines);

        -- Output the number of Physical lines
        Text_Io.Put ("Physical Lines");
        Text_Io.Set_Col (To => 25);
        Text_Io.Put ("=> ");
        Report_Physical_Lines.Put (Item => Physical_Lines);
        Text_Io.New_Line (Spacing => 1);

        -- Get the number of executable statements from the
        -- LOC task rendezvous
        Loc.Get_Executable_Statements_Count
           (Executable_Statements => Executable_Statements);

        -- Output the number of Executable Statements
        Text_Io.Put ("Executable_Statements");
        Text_Io.Set_Col (To => 25);
        Text_Io.Put ("=> ");
        Report_Executable_Statements.Put (Item => Executable_Statements);
        Text_Io.New_Line (Spacing => 1);

        -- Get the number of data declarations from the
        -- LOC task rendezvous
        Loc.Get_Data_Declarations_Count
           (Data_Declarations => Data_Declarations);

        -- Output the number of Data Declarations
        Text_Io.Put ("Data Declarations");
        Text_Io.Set_Col (To => 25);
        Text_Io.Put ("=> ");
        Report_Data_Declarations.Put (Item => Data_Declarations);
        Text_Io.New_Line (Spacing => 2);

    end if;

    if Determine_Metrics.Mccabe_Output_Needed then

        -- Output header for McCabe's metric
        Text_Io.Set_Col (To => 21);
        Text_Io.Put_Line ("McCabe's Metric");

        -- Get the Cyclomatic complexity number from the McCabe
        -- task Rendezvous
        Mccabe.Get_Cyclomatic_Complexity (Cyclomatic_Complexity => Vg);

        -- Output McCabe's metric
        Text_Io.Put ("Cyclomatic Complexity Number - v(G)");
        Text_Io.Set_Col (To => 40);
        Text_Io.Put ("=> ");
        Report_Mccabes_Metric.Put (Item => Vg);
        Text_Io.New_Line (Spacing => 2);

    end if;

    if Determine_Metrics.Halstead_Output_Needed then

        -- Output the header for Halstad's metric
        Text_Io.Set_Col (To => 21);
        Text_Io.Put_Line ("Halstead's Metric");

        -- Get the list of operators from the Halstead
        -- task Rendezvous
        Halstead.Get_The_Operator_List (Operator_List => Operator_List);

        -- Output the header for the operators and their frequency
        Text_Io.Set_Col (To => 5);
        Text_Io.Put ("Operators");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put_Line ("Frequency");
        Display_Operators (Operator_List => Operator_List);
        Text_Io.New_Line (Spacing => 2);

        -- Get the list of operands from the Halstead
        -- task Rendezvous
        Halstead.Get_The_Operand_List (Operand_List => Operand_List);

        -- Output the header for the operands and their frequency
        Text_Io.Set_Col (To => 5);
        Text_Io.Put ("Operands");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put_Line ("Frequency");
        Display_Operands (Operand_List => Operand_List);
        Text_Io.New_Line (Spacing => 2);

        -- Get the number of unique operators from the Halstead
        -- task Rendezvous
        Halstead.Get_Number_Of_Unique_Operators
           (Lower_Case_N_1 => Lower_Case_N_1);

        -- Output the number of Unique Operators - n1
        Text_Io.Put ("Number of Unique Operators");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(n1)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Number_Of_Unique_Operators.Put (Item => Lower_Case_N_1);
        Text_Io.New_Line (Spacing => 1);

        -- Get the number of unique operands from the Halstead
        -- task Rendezvous
        Halstead.Get_Number_Of_Unique_Operands
           (Lower_Case_N_2 => Lower_Case_N_2);

        -- Output the number of Unique Operands - n2
        Text_Io.Put ("Number of Unique Operands");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(n2)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Number_Of_Unique_Operands.Put (Item => Lower_Case_N_2);
        Text_Io.New_Line (Spacing => 1);

        -- Get the total number of operators from the Halstead
        -- task Rendezvous
        Halstead.Get_Total_Number_Of_Operators
           (Upper_Case_N_1 => Upper_Case_N_1);

        -- Output the total number of operators - N1
        Text_Io.Put ("Total Number of operators");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(N1)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Total_Number_Of_Operators.Put (Item => Upper_Case_N_1);
        Text_Io.New_Line (Spacing => 1);

        -- Get the total number of operands from the Halstead
        -- task Rendezvous
        Halstead.Get_Total_Number_Of_Operands
           (Upper_Case_N_2 => Upper_Case_N_2);

        -- Output the total number of operands - N2
        Text_Io.Put ("Total Number of Operands");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(N2)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Total_Number_Of_Operands.Put (Item => Upper_Case_N_2);
        Text_Io.New_Line (Spacing => 1);

        -- Get the size of vocabulary from the Halstead
        -- task Rendezvous
        Halstead.Get_Size_Of_Vocabulary (Lower_Case_N => Lower_Case_N);

        -- Output the Size of Vocabulary - n
        Text_Io.Put ("Size of Vocabulary");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(n)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Size_Of_Vocabulary.Put (Item => Lower_Case_N);
        Text_Io.New_Line (Spacing => 1);

        -- Get the program length from the Halstead
        -- task Rendezvous
        Halstead.Get_Program_Length (Upper_Case_N => Upper_Case_N);

        -- Output the Program Length - N
        Text_Io.Put ("Program Length");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(N)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Program_Length.Put (Item => Upper_Case_N);
        Text_Io.New_Line (Spacing => 1);

        -- Get the program volume from the Halstead
        -- task Rendezvous
        Halstead.Get_Program_Volume
           (The_Program_Volume => Final_Program_Volume);

        -- Output the Program Volume - V
        Text_Io.Put ("Program Volume");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(V)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Program_Volume.Put (Item => Final_Program_Volume, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the potential program volume from the Halstead
        -- task Rendezvous
        Halstead.Get_Potential_Program_Volume (V_Star => V_Star);

        -- Output the Potential Program Volume - V*
        Text_Io.Put ("Potential Program Volume");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(V*)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Potential_Program_Volume.Put (Item => V_Star, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the language level from the Halstead
        -- task Rendezvous
        Halstead.Get_Language_Level (The_Language_Level => Program_Level);

        -- Output the Language Level - L
        Text_Io.Put ("Language Level");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(L)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Language_Level.Put (Item => Program_Level, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the difficulty level from the Halstead
        -- task Rendezvous

        Halstead.Get_Difficulty_Level (The_Difficulty_Level => Difficulty);

        -- Output the Difficult Level - D
        Text_Io.Put ("Difficult Level");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(D)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Difficulty_Level.Put (Item => Difficulty, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the effort to implement from the Halstead
        -- task Rendezvous
        Halstead.Get_Effort_To_Implement (The_Effort => Effort);

        -- Output the Effort to implement this module - E
        Text_Io.Put ("Effort to implement this module");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(E)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Effort_To_Implement.Put (Item => Effort, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the delivered bugs from the Halstead
        -- task Rendezvous
        Halstead.Get_Delivered_Bugs (B_Hat => B_Hat);

        -- Output the Number of Delivered Bugs - B^
        Text_Io.Put ("Number of Delivered Bugs");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(B^)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Delivered_Bugs.Put (Item => B_Hat, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the error proneness from the Halstead
        -- task Rendezvous
        Halstead.Get_Error_Proneness (D_Hat => D_Hat);

        -- Output the Error Proneness
        Text_Io.Put ("Error Proneness");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(D^)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Error_Proneness.Put (Item => D_Hat, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the time to understand from the Halstead
        -- task Rendezvous
        Halstead.Get_Time_To_Understand (The_Time => Time);

        -- Output the Time to Understand
        Text_Io.Put ("Time to Understand");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(T)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Time_To_Understand.Put (Item => Time, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

        -- Get the fault rate from the Halstead
        -- task Rendezvous
        Halstead.Get_Fault_Rate (B_Over_P => B_Over_P);

        -- Output the Fault Rate
        Text_Io.Put ("Fault Rate");
        Text_Io.Set_Col (To => 35);
        Text_Io.Put ("(B/P)");
        Text_Io.Set_Col (To => 42);
        Text_Io.Put ("=>");
        Fault_Rate.Put (Item => B_Over_P, Fore => 6, Aft => 4);
        Text_Io.New_Line (Spacing => 1);

    end if;

end Report_Metrics;