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

⟦a307b7b8a⟧ Ada Source

    Length: 17408 (0x4400)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body Struct_Component, seg_0466a8

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



package body Struct_Component is

    procedure Set_Iter (In_List : Liste_Structure.List;
                        With_Liste : Liste_Structure.List) is
        Iterstruct, Dest_Iter : Liste_Structure.Listiter;
        Iteratt : Liste_Attribut.Listiter;
        Checked_Struct : Structure;
        Checked_Att : Attribut;
        Found : Boolean;
    begin  
        Checked_Att.Data := new Box;
        Iterstruct := Liste_Structure.Makelistiter (In_List);
        while Liste_Structure.More (Iterstruct) loop
            Liste_Structure.Next (Iterstruct, Checked_Struct);
            Iteratt := Liste_Attribut.Makelistiter (Checked_Struct.Attribut);
            while Liste_Attribut.More (Iteratt) loop
                Liste_Attribut.Next (Iteratt, Checked_Att);
                if Checked_Att.Data.The_Type = Ref2struct then
                    Is_Inside (Bounded_String.Image
                                  (Liste_Attribut.Cellvalue (Iteratt).Data.Id),
                               With_Liste, Dest_Iter, Found);
                    if Found then
                        Set_Val (Liste_Attribut.Cellvalue (Iteratt).Data.all,
                                 Dest_Iter);
                    end if;
                end if;
            end loop;
        end loop;
    end Set_Iter;

    procedure Copy (Pbox : in out Box_Ptr; B : in Box) is
    begin
        Pbox.The_Type := B.The_Type;
        Bounded_String.Copy (Pbox.Id, B.Id);
        Pbox.Val := B.Val;
        Pbox.Acc := B.Acc;
    end Copy;

    procedure Is_Inside (Name : in String;
                         In_The_List : in Liste_Attribut.List;
                         Iterator : in out Liste_Attribut.Listiter;
                         Ok : in out Boolean) is
        Continue : Boolean := True;
        V : Attribut;
    begin
        Iterator := Liste_Attribut.Makelistiter (In_The_List);
        while (Liste_Attribut.More (Iterator) and Continue) loop
            Liste_Attribut.Next (Iterator, V);
            if Bounded_String.Image (V.Name) = Name then
                Continue := False;
            end if;
        end loop;
        Ok := not (Continue);
    end Is_Inside;

    procedure Is_Inside (Name : in String;
                         In_The_List : in Liste_Structure.List;
                         Iterator : in out Liste_Structure.Listiter;
                         Ok : in out Boolean) is  
        Not_Found : Boolean := True;
        Tmp_Iter : Liste_Structure.Listiter;
        V : Structure;
    begin
        Tmp_Iter := Liste_Structure.Makelistiter (In_The_List);
        while (Liste_Structure.More (Tmp_Iter) and Not_Found) loop
            Liste_Structure.Next (Tmp_Iter, V);
            if Bounded_String.Image (V.Name) = Name then
                Not_Found := False;  
                Iterator := Tmp_Iter;
            end if;
        end loop;
        Ok := not (Not_Found);
    end Is_Inside;

    procedure Image (Of_A_Structure_List : in Liste_Structure.List) is  
        Iterator : Liste_Structure.Listiter;  
        Struct : Structure;
    begin  
        Iterator := Liste_Structure.Makelistiter (Of_A_Structure_List);
        while Liste_Structure.More (Iterator) loop
            Liste_Structure.Next (Iterator, Struct);

            Text_Io.Put_Line ("------------------------------------");
            Text_Io.Put (" Nom : ");
            Text_Io.Put_Line (Bounded_String.Image (Struct.Name));  
            Text_Io.Put_Line ("------------------------------------");  
            Image (Struct.Attribut);
        end loop;
    end Image;

    procedure Image (Of_An_Attribut_List : in Liste_Attribut.List) is  
        Iterator : Liste_Attribut.Listiter;  
        Att : Attribut;
    begin  
        Iterator := Liste_Attribut.Makelistiter (Of_An_Attribut_List);
        while Liste_Attribut.More (Iterator) loop
            Liste_Attribut.Next (Iterator, Att);
            Text_Io.Put (" Nom : ");  
            Text_Io.Put_Line (Bounded_String.Image (Att.Name));  
            Text_Io.Put_Line (" Donnee : ");
            Image (Att.Data.all);
            Text_Io.Put_Line ("- - - - - - - - - - - - - - - - - -");
        end loop;
    end Image;

    function Permute (List : in Liste_Structure.List)
                     return Liste_Structure.List is
        Tmp_List : Liste_Structure.List;
        Iterator : Liste_Structure.Listiter;
        Struct : Structure;
    begin
        Iterator := Liste_Structure.Makelistiter (List);
        while (Liste_Structure.More (Iterator)) loop
            Liste_Structure.Next (Iterator, Struct);
            Liste_Structure.Attach (Struct, Tmp_List);
        end loop;
        -- Liste_Structure.Destroy (List);
        return Tmp_List;
    end Permute;

    function Permute (List : in Liste_Attribut.List)
                     return Liste_Attribut.List is
        Tmp_List : Liste_Attribut.List;
        Iterator : Liste_Attribut.Listiter;
        Att : Attribut;
    begin
        Iterator := Liste_Attribut.Makelistiter (List);
        while (Liste_Attribut.More (Iterator)) loop
            Liste_Attribut.Next (Iterator, Att);
            Liste_Attribut.Attach (Att, Tmp_List);
        end loop;
        -- Liste_Attribut.Destroy (List);
        return Tmp_List;
    end Permute;

    procedure New_Value (V : out Value) is
    begin
        V := (Kind => Undef);
    end New_Value;

    function Kind_Of (V : in Value) return Kind_Of_Values is
    begin
        return V.Kind;
    end Kind_Of;

    function Value_As (V : in Value) return Natural is
    begin
        if V.Kind = Int then
            return V.The_Natural;
        else
            raise No_Natural_Value;
        end if;
    end Value_As;

    function Value_As (V : in Value) return Boolean is
    begin
        if V.Kind = Bool then
            return V.The_Boolean;
        else
            raise No_Boolean_Value;
        end if;
    end Value_As;

    function Value_As (V : in Value) return String is
    begin
        if V.Kind = Chaine then
            return Bounded_String.Image (V.The_String);
        else
            if V.Kind = Enum then
                return Bounded_String.Image (V.Enum_String);
            else
                raise No_String_Value;
            end if;
        end if;
    end Value_As;

    function Value_As (V : in Value) return Liste_Structure.Listiter is
    begin
        return V.The_Refs;
    end Value_As;


    function Value_As (V : in Value) return Liste_Attribut.Listiter is
    begin
        return V.The_Refa;  
    end Value_As;

    function Equal (V1 : in Value; V2 : in Value) return Boolean is
    begin
        if V1.Kind = V2.Kind then
            case V1.Kind is
                when Undef =>
                    return True;
                when Int =>
                    return (V1.The_Natural = V2.The_Natural);
                when Bool =>
                    return (V1.The_Boolean = V2.The_Boolean);
                when Chaine =>
                    return Bounded_String.Image (V1.The_String) =
                              Bounded_String.Image (V2.The_String);
                when Enum =>
                    return Bounded_String.Image (V1.Enum_String) =
                              Bounded_String.Image (V2.Enum_String);
                when Ref2struct =>
                    return Bounded_String.Image
                              (Liste_Structure.Cellvalue (V1.The_Refs).Name) =
                           Bounded_String.Image
                              (Liste_Structure.Cellvalue (V2.The_Refs).Name) and
                           (Liste_Attribut.Equal
                               (Liste_Structure.Cellvalue (V1.The_Refs).
                                Attribut,
                                Liste_Structure.Cellvalue (V2.The_Refs).
                                   Attribut));

                when Ref2att =>
                    return Bounded_String.Image
                              (Liste_Attribut.Cellvalue (V1.The_Refa).Name) =
                           Bounded_String.Image
                              (Liste_Attribut.Cellvalue (V2.The_Refa).Name);  
            end case;
        else
            return False;
        end if;
    end Equal;

    function Image (V : in Value) return String is
    begin
        case V.Kind is
            when Undef =>
                return "Undefine value !!";
            when Int =>
                return Integer'Image (V.The_Natural);
            when Bool =>
                return Boolean'Image (V.The_Boolean);
            when Chaine =>
                return Bounded_String.Image (V.The_String);
            when Enum =>
                return Bounded_String.Image (V.Enum_String);
            when Ref2struct =>
                return Bounded_String.Image
                          (Liste_Structure.Cellvalue (V.The_Refs).Name);
            when Ref2att =>
                return Bounded_String.Image
                          (Liste_Attribut.Cellvalue (V.The_Refa).Name);  
        end case;  
    end Image;

    procedure Image (L : in My_List) is
        Tmp_String : My_String;
        Iterator : String_Table.Int_List.Listiter;
    begin
        if not String_Table.Int_List.Isempty (L) then
            Iterator := String_Table.Int_List.Makelistiter (L);
            while String_Table.Int_List.More (Iterator) loop
                String_Table.Int_List.Next (Iterator, Tmp_String);
                Text_Io.Put (Bounded_String.Image (Tmp_String));
                Text_Io.Put (" ");
            end loop;
            Text_Io.New_Line;
        else
            Text_Io.Put_Line ("Liste Vide");
        end if;
    end Image;

    procedure Image (B : in Box) is
    begin
        Text_Io.Put_Line ("------------------------------------");
        Text_Io.Put_Line ("Type :" & Kind_Of_Values'Image (B.The_Type));
        Text_Io.Put_Line ("Id   :" & Bounded_String.Image (B.Id));
        Text_Io.Put ("Val   :");  
        if B.The_Type = Ref2struct then
            Text_Io.Put_Line
               (Bounded_String.Image
                   (Liste_Structure.Cellvalue (B.Val.The_Refs).Name));
        else
            Text_Io.Put_Line (Image (B.Val));
        end if;
        Text_Io.Put ("Acc   :");
        Image (B.Acc);
    end Image;

    procedure Undefine (V : in out Value) is
    begin
        -- Dispose (V);
        New_Value (V);
    end Undefine;

    procedure Set_To (V : in out Value; I : in Natural) is
    begin
        Undefine (V);
        V := (Kind => Int, The_Natural => I);
    end Set_To;

    procedure Set_To (V : in out Value; B : in Boolean) is
    begin
        Undefine (V);
        V := (Kind => Bool, The_Boolean => B);
    end Set_To;

    procedure Set_To (V : in out Value; S : in String) is
        Tmp_String : My_String;
    begin  
        Bounded_String.Copy (Tmp_String, S);
        if V.Kind = Chaine then
            V := (Kind => Chaine, The_String => Tmp_String);
        else
            V := (Kind => Enum, Enum_String => Tmp_String);
        end if;  
    end Set_To;

    procedure Set_To (V : in out Value; I : in Liste_Structure.Listiter) is
    begin
        Undefine (V);
        V := (Kind => Ref2struct, The_Refs => I);
    end Set_To;


    procedure Set_To (V : in out Value; I : in Liste_Attribut.Listiter) is
    begin
        Undefine (V);
        V := (Kind => Ref2att, The_Refa => I);
    end Set_To;

    procedure Set_Id (B : in out Box; S : in String) is
    begin
        Bounded_String.Copy (B.Id, S);
    end Set_Id;

    procedure Set_Type (B : in out Box; E : in Kind_Of_Values) is
    begin
        B.The_Type := E;
    end Set_Type;

    procedure Set_Acc (B : in out Box; L : in My_List) is
    begin
        B.Acc := L;
    end Set_Acc;

    procedure Set_Val (B : in out Box; S : in String) is
    begin
        Set_To (B.Val, S);  
    end Set_Val;

    procedure Set_Val (B : in out Box; Bo : in Boolean) is
    begin
        Set_To (B.Val, Bo);
    end Set_Val;

    procedure Set_Val (B : in out Box; I : in Natural) is
    begin
        Set_To (B.Val, I);
    end Set_Val;

    procedure Set_Val (B : in out Box; Its : in Liste_Structure.Listiter) is
    begin
        Set_To (B.Val, Its);  
    end Set_Val;

    procedure Set_Val (B : in out Box; It : in Liste_Attribut.Listiter) is
    begin
        Set_To (B.Val, It);
    end Set_Val;

    procedure Dispose (V : in out Value) is
    begin
        if V.Kind = Chaine or V.Kind = Enum then
            [statement]
        end if;
        Bounded_String.Free (V.The_String);
        -- V := (Kind => Undef);
    end Dispose;

end Struct_Component;

E3 Meta Data

    nblk1=10
    nid=10
    hdr6=1e
        [0x00] rec0=16 rec1=00 rec2=01 rec3=01e
        [0x01] rec0=1b rec1=00 rec2=04 rec3=014
        [0x02] rec0=1b rec1=00 rec2=0d rec3=006
        [0x03] rec0=04 rec1=00 rec2=02 rec3=002
        [0x04] rec0=16 rec1=00 rec2=03 rec3=004
        [0x05] rec0=1a rec1=00 rec2=0c rec3=06e
        [0x06] rec0=25 rec1=00 rec2=0b rec3=064
        [0x07] rec0=21 rec1=00 rec2=0a rec3=064
        [0x08] rec0=13 rec1=00 rec2=09 rec3=03a
        [0x09] rec0=1a rec1=00 rec2=08 rec3=020
        [0x0a] rec0=1a rec1=00 rec2=0e rec3=082
        [0x0b] rec0=21 rec1=00 rec2=07 rec3=03a
        [0x0c] rec0=21 rec1=00 rec2=06 rec3=020
        [0x0d] rec0=26 rec1=00 rec2=0f rec3=000
        [0x0e] rec0=02 rec1=00 rec2=05 rec3=000
        [0x0f] rec0=02 rec1=00 rec2=05 rec3=000
    tail 0x2174903f0865139e2e2bb 0x42a00088462060003
Free Block Chain:
  0x10: 0000  00 00 00 04 80 01 65 01 00 00 00 00 00 02 1f ff  ┆      e         ┆