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

⟦2e9134cf8⟧ TextFile

    Length: 1420 (0x58c)
    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 Io;
with String_Utilities;
package body Unit_Stats is

    package Sio renames Io;

    function Evaluate (File : String) return Statistics is

        St : Statistics := (0, (others => 0));

        This_File : Sio.File_Type;
        Line_Charac : Line_Utilities.Line_Type;
    begin

        Sio.Open (This_File, Sio.In_File, File);

        loop
            Line_Charac := Line_Utilities.Characterize
                              (Sio.Get_Line (This_File));
            St.Total_Lines := St.Total_Lines + 1;
            St.Counts (Line_Charac) := St.Counts (Line_Charac) + 1;
        end loop;
    exception
        when Sio.End_Error =>
            Sio.Close (This_File);
            return St;
    end Evaluate;

    function Total_Lines (Within : Statistics) return Integer is
    begin
        return Within.Total_Lines;
    end Total_Lines;

    function Count (Of_Kind : Line_Utilities.Line_Type; Within : Statistics)
                   return Integer is
    begin
        return Within.Counts (Of_Kind);
    end Count;

    function Percentage_Whitespace (S : Statistics) return Integer is
    begin
        if S.Total_Lines = 0 then
            return 100;
        else
            return (100 * (S.Counts (Line_Utilities.Blank_Line) +
                           S.Counts (Line_Utilities.Comment_Line)) /
                    S.Total_Lines);
        end if;
    end Percentage_Whitespace;
end Unit_Stats;