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

⟦d309833f2⟧ Ada Source

    Length: 14336 (0x3800)
    Types: Ada Source
    Notes: 03_class, FILE, R1k_Segment, e3_tag, package body View_Support, seg_03bebe

Derivation

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

E3 Source Code



with Directory;
with Extensions_Support;
with Object_Set;
with Log;
with Io;
with Profile;
with Set_Generic;
with String_Utilities;
package body View_Support is

    package Es     renames Extensions_Support;
    package Naming renames Directory.Naming;

    package Set_Op is new Set_Generic (Directory.Object);
    -- Package that supports set operations for a set of
    -- directory objects.

    function Element_Count (S : Set_Op.Set) return Integer is
        -- Returns the cardinality of the set

        Element_Iter : Set_Op.Iterator;
        Count        : Integer := 0;  
    begin  
        Set_Op.Init (Element_Iter, S);
        -- Initialize the set iterator

        while not Set_Op.Done (Element_Iter) loop
            Count := Count + 1;
            Set_Op.Next (Element_Iter);
        end loop;
        -- Count all the elements in the set

        return Count;
    end Element_Count;

    function To_Unit_List
                (S : Set_Op.Set; Element_Count : Integer) return Unit_List is
        -- Convert a set of directory objects into a
        -- unit list of directory objects

        Units        : Unit_List (Element_Count);
        Element_Iter : Set_Op.Iterator;
        Index        : Integer := 1;
    begin
        Set_Op.Init (Element_Iter, S);
        -- Initialize the set iterator

        while not Set_Op.Done (Element_Iter) loop
            Units.Data (Index) := Set_Op.Value (Element_Iter);
            Index              := Index + 1;  
            Set_Op.Next (Element_Iter);
        end loop;
        -- Collect each element in the set into the unit_list
        -- array

        Simple_Status.Create_Condition
           (Units.Condition, "", "", Simple_Status.Normal);  
        return Units;
    exception
        when others =>
            Simple_Status.Create_Condition
               (Units.Condition, "", "", Simple_Status.Problem);
            return Units;
    end To_Unit_List;

    procedure Open_Set (For_View        :        Directory.Object;
                        Set             : in out Object_Set.Set;
                        Object_Set_Name :        String := "referencers";
                        Status          : out    Directory.Error_Status) is
        Set_Id : Directory.Object;
    begin  
        Set_Id := Es.Get_Object (Directory.Naming.Get_Full_Name
                                    (Es.Get_View (For_View)) &
                                 ".state." & Object_Set_Name);
        -- Get the referencer set object that is present in
        -- every view.

        Object_Set.Open (Set_Id => Set_Id, The_Set => Set, Status => Status);
    end Open_Set;

    procedure Close_Set (The_Set : Object_Set.Set) is
        Status : Directory.Error_Status;
    begin
        Object_Set.Close (The_Set => The_Set, Status => Status);
        -- Close the referencer set object
    end Close_Set;

    function Get_Referencers
                (For_View : Directory.Object; Closure : Boolean := False)
                return Unit_List is

        Closure_Set : Set_Op.Set;
        -- Set used to accumalate all units in closure.

        This_View : Directory.Object := Es.Get_View (For_View);
        -- Current view of the unit

        procedure Compute_Reference_Closure (For_View : Directory.Object) is
            -- Given a unit this procedure computes the compilation
            -- closure of these

            Curr_Obj      : Directory.Object;
            Obj_Set_Iter  : Object_Set.Iterator;
            Reference_Set : Object_Set.Set;
            Status        : Directory.Error_Status;
        begin
            Open_Set (For_View        => For_View,  
                      Set             => Reference_Set,
                      Object_Set_Name => "referencers",
                      Status          => Status);

            if Directory."/=" (Status, Directory.Successful) then
                return;
            end if;
            -- If no referencer set exists return

            -- Get the referencer set for this view

            --
            --   FOR each view in the reference set of the current view LOOP
            --     if view not a member of the closure set
            --        Add it to the closure set
            --        compute_closure (view)
            --     end if
            --   end loop
            --

            Object_Set.Init (Iter => Obj_Set_Iter, The_Set => Reference_Set);

            while not Object_Set.Done (Obj_Set_Iter) loop
                Curr_Obj := Object_Set.Value (Obj_Set_Iter);
                if not String_Utilities.Equal (Naming.Get_Full_Name (Curr_Obj),
                                               "[VERSION_ERROR]") then
                    if not Set_Op.Is_Member (Closure_Set, Curr_Obj) then
                        Set_Op.Add (Closure_Set, Curr_Obj);
                        if Closure then
                            Compute_Reference_Closure (Curr_Obj);
                        end if;
                    end if;
                end if;
                Object_Set.Next (Obj_Set_Iter);
            end loop;

            Close_Set (The_Set => Reference_Set);
        end Compute_Reference_Closure;
    begin  
        Set_Op.Initialize (Closure_Set);
        -- Initialize the referencer closure set

        Compute_Reference_Closure (For_View => For_View);
        -- Compute the closure set of the specified unit object

        return To_Unit_List (Closure_Set, Element_Count (Closure_Set));
        -- Convert the closure set to a directory object list and return.

    end Get_Referencers;


    function Get_Imports
                (For_View : Directory.Object; Closure : Boolean := False)
                return Unit_List is
        Closure_Set : Set_Op.Set;
        -- Set used to accumalate all units in closure.

        This_View : Directory.Object := Es.Get_View (For_View);
        -- Current view of the unit

        procedure Compute_Import_Closure (For_View : Directory.Object) is
            -- Given a unit this procedure computes the compilation
            -- closure of these

            Curr_Obj     : Directory.Object;
            Obj_Set_Iter : Object_Set.Iterator;
            Import_Set   : Object_Set.Set;
            Status       : Directory.Error_Status;
        begin

            Open_Set (For_View        => For_View,
                      Set             => Import_Set,
                      Object_Set_Name => "imports",
                      Status          => Status);
            if Directory."/=" (Status, Directory.Successful) then
                return;
            end if;

            --
            --   FOR each view in the import set of the current view LOOP
            --     if view not a member of the import set
            --        Add it to the closure set
            --        compute_closure (view)
            --     end if
            --   end loop
            --

            Object_Set.Init (Iter => Obj_Set_Iter, The_Set => Import_Set);

            while not Object_Set.Done (Obj_Set_Iter) loop
                Curr_Obj := Object_Set.Value (Obj_Set_Iter);
                if not String_Utilities.Equal (Naming.Get_Full_Name (Curr_Obj),
                                               "[VERSION_ERROR]") then
                    if not Set_Op.Is_Member (Closure_Set, Curr_Obj) then
                        Set_Op.Add (Closure_Set, Curr_Obj);
                        if Closure then
                            Compute_Import_Closure (Curr_Obj);
                        end if;
                    end if;
                end if;
                Object_Set.Next (Obj_Set_Iter);
            end loop;

            Close_Set (The_Set => Import_Set);
        end Compute_Import_Closure;
    begin  
        Set_Op.Initialize (Closure_Set);
        -- Initialize the referencer closure set

        Compute_Import_Closure (For_View => For_View);
        -- Compute the closure set of the specified unit object

        return To_Unit_List (Closure_Set, Element_Count (Closure_Set));
        -- Convert the closure set to a directory object list and return.

    end Get_Imports;


    function Is_Member (View_Obj : Directory.Object; View_List : Unit_List)
                       return Boolean is
    begin  
        if not Simple_Status.Error (View_List.Condition) then
            for Index in View_List.Data'First .. View_List.Data'Last loop
                if Directory."=" (View_Obj, View_List.Data (Index)) then
                    return True;
                end if;  
            end loop;  
        end if;
        return False;
    end Is_Member;

end View_Support;

E3 Meta Data

    nblk1=d
    nid=0
    hdr6=1a
        [0x00] rec0=26 rec1=00 rec2=01 rec3=010
        [0x01] rec0=00 rec1=00 rec2=0d rec3=016
        [0x02] rec0=1a rec1=00 rec2=02 rec3=032
        [0x03] rec0=02 rec1=00 rec2=0c rec3=000
        [0x04] rec0=18 rec1=00 rec2=03 rec3=012
        [0x05] rec0=18 rec1=00 rec2=04 rec3=014
        [0x06] rec0=00 rec1=00 rec2=0b rec3=01a
        [0x07] rec0=18 rec1=00 rec2=05 rec3=01a
        [0x08] rec0=1c rec1=00 rec2=06 rec3=04c
        [0x09] rec0=19 rec1=00 rec2=07 rec3=01e
        [0x0a] rec0=00 rec1=00 rec2=0a rec3=018
        [0x0b] rec0=19 rec1=00 rec2=08 rec3=010
        [0x0c] rec0=19 rec1=00 rec2=09 rec3=000
    tail 0x215348418856575c6ff09 0x42a00088462062803