DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400

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

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download

⟦b99c7566a⟧ Ada Source

    Length: 10240 (0x2800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Package_Static_List_Generic, seg_026cfc

Derivation

└─⟦8527c1e9b⟧ Bits:30000544 8mm tape, Rational 1000, Arrival backup of disks in PAM's R1000
    └─ ⟦cfc2e13cd⟧ »Space Info Vol 2« 
        └─⟦this⟧ 

E3 Source Code



with Static_List_Generic;
with Text_Io;

package body Package_Static_List_Generic is

    package Static_List is new Static_List_Generic (20, Integer);


    procedure Display_Integer (The_Element : Integer; String_Before : String) is
    begin
        Text_Io.Put_Line (String_Before & "The_Integer => " &
                          Integer'Image (The_Element));
    end Display_Integer;

    procedure Display_List is new Static_List.Display (Display_Integer);

    procedure Test_Creation is
        use Text_Io;
        L  : Static_List.Object := Static_List.Null_Object;  
        L2 : Static_List.Object := Static_List.Null_Object;
    begin
        Put_Line ("-- Liste : 23 90 11 23 14 2 6 3 1");
        L := Static_List.Add (1, L);
        L := Static_List.Add (3, L);
        L := Static_List.Add (6, L);
        L := Static_List.Add (2, L);
        L := Static_List.Add (14, L);
        L := Static_List.Add (23, L);
        L := Static_List.Add (11, L);  
        L := Static_List.Add (90, L);
        L := Static_List.Add (23, L);
        Display_List (L);

        Put_Line ("-- Ajout de 11 elements");
        L := Static_List.Add (1, L);
        L := Static_List.Add (2, L);
        L := Static_List.Add (3, L);
        L := Static_List.Add (4, L);
        L := Static_List.Add (5, L);
        L := Static_List.Add (6, L);
        L := Static_List.Add (7, L);
        L := Static_List.Add (8, L);  
        L := Static_List.Add (9, L);
        L := Static_List.Add (10, L);
        L := Static_List.Add (11, L);
        Put_Line ("-- Liste pleine :");
        Put_Line ("Pleine (=TRUE) : " &
                  Boolean'Image (Static_List.Is_Full (L)));

        Put_Line ("-- Reste de la file (19 elements)");
        L2 := Static_List.Rest (L);
        Display_List (L2);

        Static_List.Set_First (L, 4);
        Put_Line ("-- First( Set_First(4)) (=4) : " &
                  Integer'Image (Static_List.First (L)));

        Put_Line ("-- Debordement de la file");
        L := Static_List.Add (10, L);  
        Put_Line ("-- Pas d'exception levee !?!");
    exception
        when Static_List.Full_Error =>
            Put_Line ("-- Exception levee");  
    end Test_Creation;


    procedure Test_Iterateur is  
        L    : Static_List.Object := Static_List.Null_Object;
        Iter : Static_List.Iterator;
        use Text_Io;
    begin  
        New_Line;
        Put_Line ("-- Creation Liste vide :");  
        Put_Line ("-- Vide (TRUE) : " &
                  Boolean'Image (Static_List.Is_Empty (L)));
        Display_List (L);
        New_Line;
        Put_Line ("-- Liste : 23 90 11 23 14 2 6 3 1");
        L := Static_List.Add (1, L);
        L := Static_List.Add (3, L);
        L := Static_List.Add (6, L);
        L := Static_List.Add (2, L);
        L := Static_List.Add (14, L);
        L := Static_List.Add (23, L);
        L := Static_List.Add (11, L);  
        L := Static_List.Add (90, L);
        L := Static_List.Add (23, L);
        New_Line;
        Put_Line ("-- Iterateur");
        Static_List.Init (Iter, L);
        while (not Static_List.Done (Iter, L)) loop
            Display_Integer (Static_List.Value (Iter, L), "--->");
            Static_List.Next (Iter, L);
        end loop;
    end Test_Iterateur;

    function Int_String (I : Integer) return String is
    begin
        return Integer'Image (I);
    end Int_String;


    procedure Test_Trie is
        L : Static_List.Object := Static_List.Null_Object;
        use Text_Io;
    begin
        declare
            procedure Trie       is new Static_List.Sort ("<" => Standard."<");  
            function  List_Image is
               new Static_List.Image (Separator => ",", Image => Int_String);
        begin
            Put_Line ("-- Liste : 23 90 11 23 14 2 6 3 1");
            L := Static_List.Add (1, L);
            L := Static_List.Add (3, L);
            L := Static_List.Add (6, L);
            L := Static_List.Add (2, L);
            L := Static_List.Add (14, L);
            L := Static_List.Add (23, L);
            L := Static_List.Add (11, L);  
            L := Static_List.Add (90, L);
            L := Static_List.Add (23, L);
            Put_Line
               ("-- Resultat attendu apres Trie : 1 2 3 6 11 14 23 23 90");
            New_Line;
            Trie (L);
            Display_List (L);
            Put_Line ("ENTEXTE : " & List_Image (L));  
        end;
    end Test_Trie;

    procedure Test_Compare is
        L1 : Static_List.Object := Static_List.Null_Object;
        L2 : Static_List.Object := Static_List.Null_Object;
        function Egal is new Static_List.Is_Equal (Is_Equal => Standard."=");
        use Text_Io;
    begin
        Put_Line ("-- Liste : 9 8 7 6 5 4 3 2 1");
        L1 := Static_List.Add (1, L1);
        L1 := Static_List.Add (2, L1);
        L1 := Static_List.Add (3, L1);
        L1 := Static_List.Add (4, L1);
        L1 := Static_List.Add (5, L1);
        L1 := Static_List.Add (6, L1);
        L1 := Static_List.Add (7, L1);  
        L1 := Static_List.Add (8, L1);
        L1 := Static_List.Add (9, L1);
        Put_Line ("-- Copie de liste");
        L2 := L1;
        Put_Line ("-- Test (TRUE) : " & Boolean'Image (Egal (L1, L2)));
        Put_Line ("-- Ajout d'un nombre dans une liste");
        L1 := Static_List.Add (10, L1);
        Put_Line ("-- Test (FALSE) : " & Boolean'Image (Egal (L1, L2)));
    end Test_Compare;


    procedure Test_Presence is
        L1 : Static_List.Object := Static_List.Null_Object;
        function Is_Into is new Static_List.Is_Element
                                   (Is_Equal => Standard."=");
        use Text_Io;
    begin
        Put_Line ("-- Liste : 9 8 7 6 5 4 3 2 1");
        L1 := Static_List.Add (1, L1);
        L1 := Static_List.Add (2, L1);
        L1 := Static_List.Add (3, L1);
        L1 := Static_List.Add (4, L1);
        L1 := Static_List.Add (5, L1);
        L1 := Static_List.Add (6, L1);
        L1 := Static_List.Add (7, L1);  
        L1 := Static_List.Add (8, L1);
        L1 := Static_List.Add (9, L1);
        Put_Line ("-- Test presence de 1 (TRUE) : " &
                  Boolean'Image (Is_Into (1, L1)));  
        Put_Line ("-- Test presence de 10 (FALSE) : " &
                  Boolean'Image (Is_Into (10, L1)));  
    end Test_Presence;


    procedure Test is
        use Text_Io;
    begin  
        New_Line;
        Put_Line ("---> Test package Static_List_Generic");
        New_Line;

        Put_Line ("-- Test de creation");
        Test_Creation;
        New_Line;

        Put_Line ("-- Test iterateur");
        Test_Iterateur;  
        New_Line;

        Put_Line ("-- Test trie");
        Test_Trie;
        New_Line;

        Put_Line ("-- Test comparaison");
        Test_Compare;
        New_Line;

        Put_Line ("-- Test presence");
        Test_Presence;
        New_Line;

    end Test;
end Package_Static_List_Generic;

pragma Main;

E3 Meta Data

    nblk1=9
    nid=0
    hdr6=12
        [0x00] rec0=1e rec1=00 rec2=01 rec3=03e
        [0x01] rec0=1b rec1=00 rec2=08 rec3=052
        [0x02] rec0=1d rec1=00 rec2=07 rec3=026
        [0x03] rec0=1d rec1=00 rec2=02 rec3=00c
        [0x04] rec0=19 rec1=00 rec2=06 rec3=03a
        [0x05] rec0=19 rec1=00 rec2=04 rec3=036
        [0x06] rec0=01 rec1=00 rec2=09 rec3=032
        [0x07] rec0=22 rec1=00 rec2=05 rec3=026
        [0x08] rec0=0b rec1=00 rec2=03 rec3=000
    tail 0x21520469883aa76ac5307 0x42a00088462063c03