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 - download
Index: ┃ B T

⟦192b1d7eb⟧ TextFile

    Length: 5308 (0x14bc)
    Types: TextFile
    Names: »B«

Derivation

└─⟦a7d1ea751⟧ Bits:30000550 8mm tape, Rational 1000, !users!projects 94_04_11
    └─ ⟦129cab021⟧ »DATA« 
        └─⟦this⟧ 
└─⟦2f6cfab89⟧ Bits:30000547 8mm tape, Rational 1000, !projects 94-01-04
    └─ ⟦d65440be7⟧ »DATA« 
        └─⟦this⟧ 

TextFile

with Text_Io;
with Test;
package body Les_Predicats is

    -- premier type Histogramme
    type Lataille1 is range 1 .. 27;
    package Histo_Lettres is new Test (Taille => Lataille1);
    L_Histogramme1 : Histo_Lettres.Histogramme; -- nombre case dans Histogramme

    -- deuxieme type histogramme
    type Lataille2 is range 1 .. 20;
    package Histo_Long is new Test (Taille => Lataille2);
    L_Histogramme2 : Histo_Long.Histogramme; -- nombre case dans Histogramme

    La_Classe : Text_Io.File_Type;

    function Sont_Egaux_Confondre_Maj_Min
                (X, Y : in Character) return Boolean is
    begin
        if X = Y or Character'Pos (X) - Character'Pos (Y) =
                       Character'Pos ('A') - Character'Pos ('a') or
           Character'Pos (X) - Character'Pos (Y) =
              Character'Pos ('a') - Character'Pos ('A')  
            then
            return True;
        else
            return False;
        end if;
    end Sont_Egaux_Confondre_Maj_Min;

    procedure Receuillir_Lettres_Confondre_Min_Maj (Nom_Fichier : String) is
        type Ptr is access String;
        Occurrence : Integer := 1;
        Y : Character;
        S : Ptr;
        F : Text_Io.File_Type;
        use Text_Io;-- sans le use l'affectation In_File ne marcherait pas
        M : Text_Io.File_Mode := In_File;
        C : Character;
        I : Lataille1;

    begin
        Text_Io.Open (File => F, Mode => M, Name => "Letext", Form => "");

        Text_Io.Reset (File => F, Mode => M);



        S := new String'(1 .. 80 => ' ');

        for J in 'A' .. 'Z' loop
            Text_Io.Reset (File => F, Mode => M);

            Y := J;
            Occurrence := 1;


            -- on parcours le text a la recherche de Y

            while ((Text_Io.End_Of_File (F)) /= True) loop
                Text_Io.Get (F, C);

                if Sont_Egaux_Confondre_Maj_Min (C, Y) then

                    --  Text_Io.Put (C);

                    Occurrence := Occurrence + 1;
                end if;  
            end loop;
            I := Lataille1'Val ((1 + Character'Pos (J)) - Character'Pos ('A'));


            L_Histogramme1.Quantite (I) := Occurrence;

        end loop;
        Text_Io.Close (File => F);  
    end Receuillir_Lettres_Confondre_Min_Maj;


    procedure Receuillir_Mots_Longueur_Inferieure (Nom_Fichier : String) is



        F : Text_Io.File_Type;
        use Text_Io;-- sans le use l'affectation In_File ne marcherait pas
        M : Text_Io.File_Mode := In_File;
        C : Character := ' ';
        Long : Lataille2;
        Trouve : Boolean := False;
    begin
        Text_Io.Open (File => F, Mode => M, Name => "Letext", Form => "");

        Text_Io.Reset (File => F, Mode => M);
        Text_Io.Get (F, C);
        -- while ((Text_Io.End_Of_File (F)) /= True) loop
        while (C /= '$') loop
            --Text_Io.Get (F, C);

            -- on elemine les blancs
            while (C = ' ') loop
                Text_Io.Get (F, C);
            end loop;

            -- on compte longueur mot
            Long := 1;
            while (C /= ' ' and C /= '$') loop
                Text_Io.Get (F, C);
                Long := Long + 1;
                Trouve := True;
            end loop;  
            if Trouve then
                Long := Long - 1;
                L_Histogramme2.Quantite (Long) :=
                   L_Histogramme2.Quantite (Long) + 1;
                Trouve := False;
            end if;

        end loop;

    end Receuillir_Mots_Longueur_Inferieure;




    procedure Put1 (Nom_Fichier : String) is
        type Ptr is access String;
        S : Ptr;

    begin
        Receuillir_Lettres_Confondre_Min_Maj (Nom_Fichier);

        S := new String'(1 .. 27 => ' ');

        Text_Io.Put_Line ("HISTOGRAMME D'UN TEXTE");
        Text_Io.Put_Line ("EN CONFONDANT MAJUSCULE ET MINISCULE");

        Text_Io.Put_Line ("Classe   Quantite  Histogramme");

        for I in Lataille1'First .. Lataille1'Last loop

            S (1 .. Positive'Value (Integer'Image
                                       (L_Histogramme1.Quantite (I)))) :=
               (1 .. Positive'Value (Integer'Image
                                        (L_Histogramme1.Quantite (I))) => '*');
            Text_Io.Put_Line
               (Lataille1'Image (I) & "          " &
                Integer'Image (L_Histogramme1.Quantite (I)) & "   " & S.all);

            S.all := (others => ' ');

        end loop;
    end Put1;

    procedure Put2 (Nom_Fichier : String) is
        type Ptr is access String;
        S : Ptr;

    begin
        Receuillir_Mots_Longueur_Inferieure (Nom_Fichier);
        S := new String'(1 .. 27 => ' ');



        Text_Io.Put_Line ("Classe   Quantite  Histogramme");

        for I in Lataille2'First .. Lataille2'Last loop

            S (1 .. Positive'Value (Integer'Image
                                       (L_Histogramme2.Quantite (I)))) :=
               (1 .. Positive'Value (Integer'Image
                                        (L_Histogramme2.Quantite (I))) => '*');
            Text_Io.Put_Line
               (Lataille2'Image (I) & "          " &
                Integer'Image (L_Histogramme2.Quantite (I)) & "   " & S.all);

            S.all := (others => ' ');

        end loop;
    end Put2;

end Les_Predicats;