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

⟦fc02f4d42⟧ TextFile

    Length: 30895 (0x78af)
    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 Object_Info;
package body Object_Sets is
    --
    function "+" (This_Set : in Set; That_Set : in Set) return Set
        renames Union;
    --
    function Empty_Set return Set is
    begin
        return (Directory_Tools.Object.Create);
    end Empty_Set;
    --
    function Is_Empty (This_Set : in Set) return Boolean is
    begin
        return (Object_Info.Any.Is_Empty (This_Set));
    end Is_Empty;
    --
    function Number_In (This_Set : in Set) return Natural is
    begin  
        return (Object_Info.Any.Number_In (This_Set));
    end Number_In;
    --
    function Are_Equal (This_Set : in Set; That_Set : in Set) return Boolean is
        --
        Working_Set : Set := This_Set;
        --
    begin
        Directory_Tools.Object.Reset (Working_Set);
        while (not Directory_Tools.Object.Done (Working_Set)) loop
            if (not Is_Member (That_Set,
                               Directory_Tools.Object.Value (Working_Set))) then
                -- Found element in one set which isn't in other set.
                Directory_Tools.Object.Reset (Working_Set);
                return (True);
            end if;
            Directory_Tools.Object.Next (Working_Set);
        end loop;
        Directory_Tools.Object.Reset (Working_Set);
        return (False);
        --
    exception
        when others =>
            Directory_Tools.Object.Reset (Working_Set);
            return (False);
            --
    end Are_Equal;
    --
    function Copy_Of (This_Set : in Set) return Set is
        --
        Working_Set : Set := This_Set;
        Copy_Set : Set := Empty_Set;
        --
    begin
        Directory_Tools.Object.Reset (Working_Set);  
        while (not Directory_Tools.Object.Done (Working_Set)) loop
            Add (Directory_Tools.Object.Value (Working_Set), Copy_Set);
            Directory_Tools.Object.Next (Working_Set);
        end loop;
        return (Copy_Set);
    end Copy_Of;
    --
    function Is_Member
                (This_Set : in Set; This_Element : in Element) return Boolean is
    begin
        return (Directory_Tools.Object.Has (This_Set, This_Element));
    end Is_Member;
    --
    procedure Add (This_Element : in Element; This_Set : in out Set) is
        --
        Dummy : Boolean;
        --
    begin
        if ((Object_Info.Any.Is_Good (This_Element)) and then
            (not Is_Member (This_Set, This_Element))) then
            Directory_Tools.Object.Add (This_Set, This_Element, Dummy);
        end if;
    end Add;
    --
    procedure Remove (This_Element : in Element; This_Set : in out Set) is
        --
        Dummy : Boolean;
        --
    begin
        Directory_Tools.Object.Remove (This_Set, This_Element, Dummy);
    end Remove;
    --
    procedure Sort (This_Set : in out Set) is
        --
        type Sorted_Array is array (1 .. Number_In (This_Set)) of Boolean;
        --
        Already_Sorted : Sorted_Array := (others => False);
        Remaining : Natural := Number_In (This_Set);
        Sorted_Set : Set := Empty_Set;
        Smallest_This_Pass : Element;  
        Index_Of_Smallest : Natural;
        Current_Index : Natural;
        --
    begin  
        while (Remaining > 0) loop  
            Current_Index := 1;
            Directory_Tools.Object.Reset (This_Set);
            Smallest_This_Pass := Directory_Tools.Object.Value (This_Set);
            while (not Directory_Tools.Object.Done (This_Set)) loop
                if (not Already_Sorted (Current_Index)) then
                    -- Current element hasn't already been put in
                    -- the sorted array, so test it.
                    if (Directory_Tools.Object.Value (This_Set) <
                        Smallest_This_Pass) then
                        -- Current element is smaller than the smallest
                        -- element found so far on this pass, so make
                        -- it the new smallest.
                        Smallest_This_Pass :=
                           Directory_Tools.Object.Value (This_Set);
                        Index_Of_Smallest := Current_Index;
                    end if;
                end if;
                Directory_Tools.Object.Next (This_Set);  
                Current_Index := Current_Index + 1;
            end loop;
            Add (Smallest_This_Pass, Sorted_Set);
            Already_Sorted (Index_Of_Smallest) := True;
            Remaining := Remaining - 1;
        end loop;
        This_Set := Sorted_Set;
    end Sort;
    --
    procedure Filter (This_Set : in out Set) is
        --
        New_Set : Set := Empty_Set;
        --
    begin
        Directory_Tools.Object.Reset (This_Set);
        while (not Directory_Tools.Object.Done (This_Set)) loop
            if (not Dont_Want (Directory_Tools.Object.Value (This_Set))) then
                -- Want current element, so add it.
                Add (Directory_Tools.Object.Value (This_Set), New_Set);
            end if;
            Directory_Tools.Object.Next (This_Set);
        end loop;
        This_Set := New_Set;
    end Filter;
    --
    procedure Process_Elements (This_Set : in out Set) is
    begin
        Directory_Tools.Object.Reset (This_Set);
        while (not Directory_Tools.Object.Done (This_Set)) loop
            declare
                Current_Element : Element :=
                   Directory_Tools.Object.Value (This_Set);
            begin
                Process (Current_Element);
            end;
            Directory_Tools.Object.Next (This_Set);
        end loop;
    end Process_Elements;
    --
    procedure Process_Elements_With_State
                 (This_Set : in out Set; This_State : in out Process_State) is
    begin
        Initialize (This_State);
        Directory_Tools.Object.Reset (This_Set);
        while (not Directory_Tools.Object.Done (This_Set)) loop
            declare
                Current_Element : Element :=
                   Directory_Tools.Object.Value (This_Set);
            begin
                Process (Current_Element, This_State);
            end;
            Directory_Tools.Object.Next (This_Set);
        end loop;
        Finalize (This_State);
    end Process_Elements_With_State;
    --
    function Union (This_Set : in Set; That_Set : in Set) return Set is
        --
        Union_Set : Set := Empty_Set;
        --
        procedure Union_Copy (This_Set : in Set; New_Set : in out Set) is
            --
            Working_Set : Set := This_Set;
            --
        begin
            Directory_Tools.Object.Reset (Working_Set);
            while (not Directory_Tools.Object.Done (Working_Set)) loop
                Add (Directory_Tools.Object.Value (Working_Set), New_Set);
                Directory_Tools.Object.Next (Working_Set);
            end loop;
        end Union_Copy;
        --
    begin  
        Union_Copy (This_Set, Union_Set);
        Union_Copy (That_Set, Union_Set);
        return (Union_Set);
    end Union;
    --
    function Intersection (This_Set : in Set; That_Set : in Set) return Set is
        --
        Working_Set : Set := This_Set;
        Intersection_Set : Set := Empty_Set;
        --
    begin
        Directory_Tools.Object.Reset (Working_Set);
        while (not Directory_Tools.Object.Done (Working_Set)) loop
            if (Is_Member (That_Set,
                           Directory_Tools.Object.Value (Working_Set))) then
                -- Found an element in the one set which is also in the
                -- other set, so add it to the intersection set.
                Add (Directory_Tools.Object.Value (Working_Set),
                     Intersection_Set);
            end if;
            Directory_Tools.Object.Next (Working_Set);
        end loop;
        return (Intersection_Set);
    end Intersection;
    --
    function Exclusive_Or (This_Set : in Set; That_Set : in Set) return Set is
        --
        Xor_Set : Set := Empty_Set;
        --
        procedure Xor_Copy (This_Set : in Set;
                            Except_For : in Set;
                            Into : in out Set) is
            --
            Working_Set : Set := This_Set;
            --
        begin
            Directory_Tools.Object.Reset (Working_Set);
            while (not Directory_Tools.Object.Done (Working_Set)) loop
                if (not Is_Member (Except_For, Directory_Tools.Object.Value
                                                  (Working_Set))) then
                    -- Found an element in the one set which is not also
                    -- in the other set, so add it to the new set.
                    Add (Directory_Tools.Object.Value (Working_Set), Into);
                end if;
                Directory_Tools.Object.Next (Working_Set);
            end loop;
        end Xor_Copy;
        --
    begin
        Xor_Copy (This_Set, That_Set, Xor_Set);
        Xor_Copy (That_Set, This_Set, Xor_Set);
        return (Xor_Set);
    end Exclusive_Or;
    --
    function Subtraction (This_Set : in Set; Except_For : in Set) return Set is
        --
        Working_Set : Set := This_Set;
        Subtraction_Set : Set := Empty_Set;
        --
    begin
        Directory_Tools.Object.Reset (Working_Set);
        while (not Directory_Tools.Object.Done (Working_Set)) loop
            if (not Is_Member (Except_For,
                               Directory_Tools.Object.Value (Working_Set))) then
                -- Found an element in the one set which is not also
                -- in the other set, so add it to the subtraction set.
                Add (Directory_Tools.Object.Value (Working_Set),
                     Subtraction_Set);
            end if;
            Directory_Tools.Object.Next (Working_Set);
        end loop;
        return (Subtraction_Set);
    end Subtraction;
    --
    function Subset (This_Set : in Set; Contains : in Set) return Boolean is
        --
        Working_Set : Set := Contains;
        Result : Boolean := True;
        --
    begin  
        Directory_Tools.Object.Reset (Working_Set);
        while (not Directory_Tools.Object.Done (Working_Set)) loop
            if (not Is_Member (This_Set,
                               Directory_Tools.Object.Value (Working_Set))) then
                -- Found an element in "Contains" which is not in the
                -- other set, so is not a subset of the other set.
                Result := False;
                exit;
            end if;
            Directory_Tools.Object.Next (Working_Set);
        end loop;
        return (Result);
    end Subset;
    --
    function Proper_Subset
                (This_Set : in Set; Contains : in Set) return Boolean is
    begin
        return (Subset (This_Set, Contains) and then
                (Number_In (This_Set) > Number_In (Contains)));
    end Proper_Subset;
    --
    procedure Screen (These_Units : in out Set;
                      Exclude : in Set;
                      Specs_Only : in Boolean;
                      Include_Universe_Mirrors : in Boolean) is
        --
        Screened : Set := Empty_Set;
        --
        Current : Element;
        --
    begin
        Directory_Tools.Object.Reset (These_Units);
        while (not Directory_Tools.Object.Done (These_Units)) loop
            Current := Directory_Tools.Object.Value (These_Units);
            if (Object_Info.Any.Is_Bad (Current)) then
                -- Current unit is bad, so don't add it.
                null;  
            elsif (Is_Member (Exclude, Current)) then
                -- Already have the current unit, so don't add it.
                null;
            elsif ((Specs_Only) and then
                   (not Object_Info.Ada.Is_Spec (Current))) then
                -- Client wants specs only, and current unit is not a spec,
                -- so don't add it.
                null;
            elsif ((not Include_Universe_Mirrors) and then
                   (Object_Info.Ada.Is_Universe_Mirror (Current))) then
                -- Client doesn't want universe mirrors, and current unit is
                -- a universe mirror, so don't add it.
                null;
            else
                -- Current unit met all criteria, so add it.
                Add (Current, Screened);
            end if;
            Directory_Tools.Object.Next (These_Units);
        end loop;  
        These_Units := Screened;
    end Screen;
    --
    generic

        with function Immediate_Dependencies
                         (This_Element : in Element;
                          Code_Share_Generics : in Boolean;
                          This_Activity : in Activity.Activity_Name) return Set;

    function Single_Unit_Dependency_Closure
                (Unit : in Element;
                 Specs_Only : in Boolean := False;
                 Transitive : in Boolean := True;
                 Include_Universe_Mirrors : in Boolean := False;
                 Code_Share_Generics : in Boolean := True;
                 This_Activity : in Activity.Activity_Name :=
                    Activity.The_Current_Activity) return Set;

    function Single_Unit_Dependency_Closure
                (Unit : in Element;
                 Specs_Only : in Boolean := False;
                 Transitive : in Boolean := True;
                 Include_Universe_Mirrors : in Boolean := False;
                 Code_Share_Generics : in Boolean := True;
                 This_Activity : in Activity.Activity_Name :=
                    Activity.The_Current_Activity) return Set is
        --
        Closure : Set := Empty_Set;
        New_Units : Set := Empty_Set;
        --
        procedure Get_Next_Units (These_Units : in out Set) is
            --
            New_Units : Set := Empty_Set;
            --
        begin
            Directory_Tools.Object.Reset (These_Units);
            while (not Directory_Tools.Object.Done (These_Units)) loop
                New_Units := New_Units +
                                Immediate_Dependencies
                                   (Directory_Tools.Object.Value (These_Units),
                                    Code_Share_Generics, This_Activity);  
                Directory_Tools.Object.Next (These_Units);
            end loop;  
            These_Units := New_Units;
        end Get_Next_Units;
        --
    begin  
        New_Units := Immediate_Dependencies
                        (Unit, Code_Share_Generics, This_Activity);
        loop
            Screen (New_Units, Closure, Specs_Only, Include_Universe_Mirrors);
            Closure := Closure + New_Units;
            if (not Transitive) then
                -- Only needed to calculate first level.
                exit;
            elsif (Is_Empty (New_Units)) then
                -- There were no new units, so closure is complete.
                exit;
            else
                -- There are more units requiring processing.
                Get_Next_Units (New_Units);  
            end if;
        end loop;
        return (Closure);
    end Single_Unit_Dependency_Closure;
    --
    generic

        with function Single_Unit_Dependency_Closure_Instantiation
                         (Unit : in Element;
                          Specs_Only : in Boolean := False;
                          Transitive : in Boolean := True;
                          Include_Universe_Mirrors : in Boolean := False;
                          Code_Share_Generics : in Boolean := True;
                          This_Activity : in Activity.Activity_Name :=
                             Activity.The_Current_Activity) return Set;

    function Multiple_Unit_Dependency_Closure
                (Units : in Set;
                 Specs_Only : in Boolean := False;
                 Transitive : in Boolean := True;
                 Include_Universe_Mirrors : in Boolean := False;
                 Code_Share_Generics : in Boolean := True;
                 This_Activity : in Activity.Activity_Name :=
                    Activity.The_Current_Activity) return Set;

    function Multiple_Unit_Dependency_Closure
                (Units : in Set;
                 Specs_Only : in Boolean := False;
                 Transitive : in Boolean := True;
                 Include_Universe_Mirrors : in Boolean := False;
                 Code_Share_Generics : in Boolean := True;
                 This_Activity : in Activity.Activity_Name :=
                    Activity.The_Current_Activity) return Set is
        --
        Working_Set : Set := Units;
        Closure : Set := Empty_Set;
        --
    begin
        Directory_Tools.Object.Reset (Working_Set);
        while (not Directory_Tools.Object.Done (Working_Set)) loop
            Closure := Closure + Single_Unit_Dependency_Closure_Instantiation
                                    (Directory_Tools.Object.Value (Working_Set),
                                     Specs_Only, Transitive,
                                     Include_Universe_Mirrors,
                                     Code_Share_Generics, This_Activity);
            Directory_Tools.Object.Next (Working_Set);
        end loop;  
        return (Closure);
    end Multiple_Unit_Dependency_Closure;
    --
    function Spec_Is_Generic_For (This_Element : in Element) return Boolean is
        --
        -- Returns True if the spec associated with the specified element
        -- is a generic spec.
        --
    begin
        return (Object_Info.Ada.Is_Generic_Spec
                   (Object_Info.Ada.Spec_For (This_Element)));
    end Spec_Is_Generic_For;
    --
    function Immediate_Dependencies_On
                (This_Element : in Element;
                 Code_Share_Generics : in Boolean;
                 This_Activity : in Activity.Activity_Name) return Set is
        --
        Dependencies : Set := Object_Info.Ada.Dependents_Of (This_Element);
        --
    begin
        if (Object_Info.Any.Is_Ada_Unit (This_Element)) then
            -- Deal with question of code sharing.
            if ((not Code_Share_Generics) and then
                (Object_Info.Ada.Is_Body_Or_Subunit (This_Element)) and then
                (Spec_Is_Generic_For (This_Element))) then
                -- Current element is body or subunit associated with
                -- a generic spec, and generic bodies are not code-shared.
                -- Therefore, the current element will be macro-
                -- inline expanded, and dependencies on the current
                -- element include dependencies on its spec.
                Dependencies := Dependencies +
                                   Object_Info.Ada.Dependents_Of
                                      (Object_Info.Ada.Spec_For (This_Element));
            end if;
            -- Perform spec look-through.
            if (Object_Info.Ada.Is_Spec_In_Load_View (This_Element)) then
                -- The element is a spec in a load view, so it has an associated spec
                -- in a spec view. Anything that depends on the spec in the spec view
                -- in actuality depends on the current element, so add the spec view
                -- spec to the dependencies (so that the next pass will get the
                -- dependencies on it).
                Add (Object_Info.Ada.Spec_In_Other_View
                        (This_Element, This_Activity), Dependencies);
            end if;  
        end if;
        return (Dependencies);
    end Immediate_Dependencies_On;
    --
    function Dependencies_On_Single_Unit is
       new Single_Unit_Dependency_Closure (Immediate_Dependencies_On);
    --
    function Dependencies_On (Unit : in Element;
                              Specs_Only : in Boolean := False;
                              Transitive : in Boolean := True;
                              Include_Universe_Mirrors : in Boolean := False;
                              Code_Share_Generics : in Boolean := True;
                              This_Activity : in Activity.Activity_Name :=
                                 Activity.The_Current_Activity) return Set is
    begin
        return (Dependencies_On_Single_Unit
                   (Unit, Specs_Only, Transitive, Include_Universe_Mirrors,
                    Code_Share_Generics, This_Activity));
    end Dependencies_On;
    --
    function Dependencies_On_Multiple_Units is
       new Multiple_Unit_Dependency_Closure (Dependencies_On);
    --
    function Dependencies_On (Units : in Set;
                              Specs_Only : in Boolean := False;
                              Transitive : in Boolean := True;
                              Include_Universe_Mirrors : in Boolean := False;
                              Code_Share_Generics : in Boolean := True;
                              This_Activity : in Activity.Activity_Name :=
                                 Activity.The_Current_Activity) return Set is
    begin
        return (Dependencies_On_Multiple_Units
                   (Units, Specs_Only, Transitive, Include_Universe_Mirrors,
                    Code_Share_Generics, This_Activity));
    end Dependencies_On;
    --
    function Immediate_Dependencies_By
                (This_Element : in Element;
                 Code_Share_Generics : in Boolean;
                 This_Activity : in Activity.Activity_Name) return Set is
        --
        Dependencies : Set := Object_Info.Ada.Specs_Withed_By (This_Element);
        --
        Families_Of_Generic_Specs : Set := Empty_Set;
        --
        Specs_In_Load_Views : Set := Empty_Set;
        --
    begin
        if (Object_Info.Any.Is_Ada_Unit (This_Element)) then
            -- Deal with bodies and subunits.
            if (Object_Info.Ada.Is_Subunit (This_Element)) then
                Add (Object_Info.Ada.Parent_Of (This_Element), Dependencies);
            elsif (Object_Info.Ada.Is_Body (This_Element)) then
                Add (Object_Info.Ada.Spec_For (This_Element), Dependencies);
            end if;
            -- Deal with question of code sharing.
            if (not Code_Share_Generics) then
                Directory_Tools.Object.Reset (Dependencies);
                while (not Directory_Tools.Object.Done (Dependencies)) loop
                    if (Object_Info.Ada.Is_Generic_Spec
                           (Directory_Tools.Object.Value (Dependencies))) then
                        -- The element depends on a generic spec. Since the body and
                        -- subunits of the generic spec are not code-shared, they
                        -- will be macro-inline expanded. Therefore, the element
                        -- depends on the entire family of the generic spec.
                        Families_Of_Generic_Specs :=
                           Families_Of_Generic_Specs +
                              Family (Directory_Tools.Object.Value
                                         (Dependencies));
                    end if;
                    Directory_Tools.Object.Next (Dependencies);
                end loop;
            end if;
            Dependencies := Dependencies + Families_Of_Generic_Specs;
            -- Perform spec look-through.
            Directory_Tools.Object.Reset (Dependencies);
            while (not Directory_Tools.Object.Done (Dependencies)) loop
                if (Object_Info.Ada.Is_Spec_In_Spec_View
                       (Directory_Tools.Object.Value (Dependencies))) then
                    -- The element depends on a spec in a spec view. So add
                    -- the associated spec in the load view to the dependencies.
                    Add (Object_Info.Ada.Spec_In_Other_View
                            (Directory_Tools.Object.Value (Dependencies),
                             This_Activity), Specs_In_Load_Views);
                end if;
                Directory_Tools.Object.Next (Dependencies);
            end loop;  
            Dependencies := Dependencies + Specs_In_Load_Views;
        end if;
        return (Dependencies);
    end Immediate_Dependencies_By;
    --
    function Dependencies_By_Single_Unit is
       new Single_Unit_Dependency_Closure (Immediate_Dependencies_By);
    --
    function Dependencies_By (Unit : in Element;
                              Specs_Only : in Boolean := False;
                              Transitive : in Boolean := True;
                              Include_Universe_Mirrors : in Boolean := False;
                              Code_Share_Generics : in Boolean := True;
                              This_Activity : in Activity.Activity_Name :=
                                 Activity.The_Current_Activity) return Set is
    begin
        return (Dependencies_By_Single_Unit
                   (Unit, Specs_Only, Transitive, Include_Universe_Mirrors,
                    Code_Share_Generics, This_Activity));
    end Dependencies_By;
    --
    function Dependencies_By_Multiple_Units is
       new Multiple_Unit_Dependency_Closure (Dependencies_By);
    --
    function Dependencies_By (Units : in Set;
                              Specs_Only : in Boolean := False;
                              Transitive : in Boolean := True;
                              Include_Universe_Mirrors : in Boolean := False;
                              Code_Share_Generics : in Boolean := True;
                              This_Activity : in Activity.Activity_Name :=
                                 Activity.The_Current_Activity) return Set is
    begin
        return (Dependencies_By_Multiple_Units
                   (Units, Specs_Only, Transitive, Include_Universe_Mirrors,
                    Code_Share_Generics, This_Activity));
    end Dependencies_By;
    --
    function Immediate_Family_Dependencies_On
                (This_Element : in Element;
                 Code_Share_Generics : in Boolean;
                 This_Activity : in Activity.Activity_Name) return Set is
        --
        Dependencies : Set := Object_Info.Ada.Subunits_Of (This_Element);
        --
    begin  
        if (Object_Info.Ada.Is_Spec (This_Element)) then
            -- Add body.
            Add (Object_Info.Ada.Body_For (This_Element), Dependencies);
            -- Add subunits.
            Dependencies := Dependencies +
                               Object_Info.Ada.Subunits_Of
                                  (Object_Info.Ada.Body_For (This_Element));
            -- Perform spec look-through.
            if (Object_Info.Ada.Is_Spec_In_Spec_View (This_Element)) then
                Add (Object_Info.Ada.Spec_In_Other_View
                        (This_Element, This_Activity), Dependencies);
            end if;
        elsif (Object_Info.Ada.Is_Body_Or_Subunit (This_Element)) then
            -- Add subunits.
            Dependencies := Dependencies +
                               Object_Info.Ada.Subunits_Of (This_Element);
        end if;
        return (Dependencies);
    end Immediate_Family_Dependencies_On;
    --
    function Family_Dependencies_On is
       new Single_Unit_Dependency_Closure (Immediate_Family_Dependencies_On);
    --
    function Family (Unit : in Element;
                     This_Activity : in Activity.Activity_Name :=
                        Activity.The_Current_Activity) return Set is
        --
        Family_Dependencies : Set :=
           Family_Dependencies_On (Unit,
                                   Specs_Only => False,
                                   Transitive => True,
                                   Include_Universe_Mirrors => True,
                                   Code_Share_Generics => True,
                                   This_Activity => This_Activity);
        --
    begin
        if (Object_Info.Any.Is_Ada_Unit (Unit)) then
            Add (Unit, Family_Dependencies);
        end if;
        return (Family_Dependencies);
    end Family;
    --
    function Immediate_Execution_Closure_For
                (This_Element : in Element;
                 Code_Share_Generics : in Boolean;
                 This_Activity : in Activity.Activity_Name) return Set is
        --
        Dependencies : Set := Object_Info.Ada.Specs_Withed_By (This_Element);
        --
        Families_Of_Elements : Set := Empty_Set;
        --
        Specs_In_Load_Views : Set := Empty_Set;
        --
    begin
        if (Object_Info.Any.Is_Ada_Unit (This_Element)) then
            -- Add the element itself to the closure.
            Add (This_Element, Dependencies);
            -- Deal with bodies and subunits.
            if (Object_Info.Ada.Is_Subunit (This_Element)) then
                Add (Object_Info.Ada.Parent_Of (This_Element), Dependencies);
            elsif (Object_Info.Ada.Is_Body (This_Element)) then
                Add (Object_Info.Ada.Spec_For (This_Element), Dependencies);
            end if;
            -- Add families of all elements to dependencies.
            Directory_Tools.Object.Reset (Dependencies);
            while (not Directory_Tools.Object.Done (Dependencies)) loop
                Families_Of_Elements :=
                   Families_Of_Elements +
                      Family (Directory_Tools.Object.Value (Dependencies));
                Directory_Tools.Object.Next (Dependencies);
            end loop;
            Dependencies := Dependencies + Families_Of_Elements;
            -- Perform spec look-through.
            Directory_Tools.Object.Reset (Dependencies);
            while (not Directory_Tools.Object.Done (Dependencies)) loop
                if (Object_Info.Ada.Is_Spec_In_Spec_View
                       (Directory_Tools.Object.Value (Dependencies))) then
                    -- The element depends on a spec in a spec view. So add
                    -- the associated spec in the load view to the dependencies.
                    Add (Object_Info.Ada.Spec_In_Other_View
                            (Directory_Tools.Object.Value (Dependencies),
                             This_Activity), Specs_In_Load_Views);
                end if;
                Directory_Tools.Object.Next (Dependencies);
            end loop;  
            Dependencies := Dependencies + Specs_In_Load_Views;
        end if;
        return (Dependencies);
    end Immediate_Execution_Closure_For;
    --
    function Execution_Closure_For_Single_Unit is
       new Single_Unit_Dependency_Closure (Immediate_Execution_Closure_For);
    --
    function Execution_Closure_For
                (Unit : in Element;
                 Include_Universe_Mirrors : in Boolean := False;
                 This_Activity : in Activity.Activity_Name :=
                    Activity.The_Current_Activity) return Set is
    begin
        return (Execution_Closure_For_Single_Unit
                   (Unit,
                    Specs_Only => False,
                    Transitive => True,
                    Include_Universe_Mirrors => Include_Universe_Mirrors,
                    Code_Share_Generics => True,
                    This_Activity => This_Activity));
    end Execution_Closure_For;
    --
end Object_Sets;