![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Related_Compilation_Units
function Related_Compilation_Units (Compilation_Units : in Asis.Compilation_Unit_List; Dependent_Units : in Asis.Compilation_Unit_List; Library : in Asis.Library; Relation : in Relation_Kinds) return Asis.Relationship;Expanded Name Asis.Compilation_Units.Related_Compilation_Units
Returns a record containing units with the specified Relation to the specified compilation units.
Description
The list of related compilation units is placed into the Existing component of the returned Relationship. For a description of the other Relationship record components, see "Finding Related Compilation Units."
The Enclosing_Library of all returned compilation units is the specified library.
Parameters
Compilation_Units : in Asis.Compilation_Unit_List;Specifies a list of compilation units. The Compilation_Units must be of the following kinds:
Compilation_Unit_Kinds
A_Generic_Declaration
A_Generic_Instantiation
A_Package_Body
A_Package_Declaration
A_Subprogram_Body
A_Subprogram_Declaration
A_Subunit
Unknown
Dependent_Units : in Asis.Compilation_Unit_List;Specifies dependent compilation units used to limit the query. Dependent_Units are required only when Relation has a value of Direct_Dependents or Dependents; otherwise, the parameter is ignored. If Dependent_Units is required and the:
- Dependent_Units list Is_Nil, the context for the search is the entire library. The returned Relationship includes all direct dependents or dependents of the specified compilation units.
- Dependent_Units list is not Is_Nil, the context for the search is restricted to the extended families of the Dependent_Units. The returned Relationship includes only the direct dependents or dependents of the specified compilation units that also exist in the extended families of the Dependent_Units.
The Dependent_Units must be of the following kinds:
Compilation_Unit_Kinds
A_Generic_Declaration
A_Generic_Instantiation
A_Package_Body
A_Package_Declaration
A_Subprogram_Body
A_Subprogram_Declaration
A_Subunit
Unknown
Library : in Asis.Library;Specifies the library to be searched and to which the returned compilation units must belong.
Relation : in Relation_Kinds;Specifies the required relationship between the specified compilation units and the units returned compilation-unit values.
return Asis.Relationship;Returns a compilation order containing units with the specified Relation to the specified compilation units. The specified compilation units are returned as part of the Relationship.
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Inappropriate_Compilation_Unit is raised and Environment.Status is set to Value_Error if a compilation-unit parameter references a library that is no longer open.
Examples
Cross-References
Type Relation_Kinds
type Relation_Kinds is (...);Expanded Name Asis.Compilation_Units.Relation_Kinds
Defines the kinds of relations between compilation units.
Description
Because of the hierarchical nature of Ada compilation units, they form groups that are related in various ways. For example, the units in a given unit's with clause are dependents of that unit.
ASIS provides a number of functions that return lists of units that are related. This type defines the kinds of relationships possible.
Enumerations
DependentsIndicates all compilation units that must be recompiled if the compilation unit is recompiled; that is, all units made obsolete by the unit's recompilation. A compilation unit's dependents include:
- All units that include it in a with clause and, recursively, all units that include those compilation units in a with clause
- The secondary unit (body) of a library unit (specification)
- The subunits of a secondary unit and, recursively, all subunits of those units
Dependencies can also be introduced by:
- Inlining (Ada83 LRM 10.3, Ada95 LRM 10.1.4)
- Certain implementations of generic units (Ada83 LRM 10.3, Ada95 LRM 10.1.4)
- Certain kinds of compiler optimizations (Ada83 LRM 10.3, Ada95 LRM 10.1.4)
A unit that depends on a given unit is also dependent on the supporters of that unit. See the Direct_Dependents and Supporters enumeration values for more information.
Direct_DependentsIndicates those units that are directly related to a compilation unit. Dependents of a compilation unit are all those compilation units that must be recompiled if the compilation unit is recompiled; that is, all those units made obsolete by the unit's recompilation.
Direct dependents of a compilation unit include:
- All units that include the compilation unit in a with clause
- The secondary unit (body) of a library unit (specification)
- The subunits of a secondary unit
A unit that depends on a given unit is also dependent on the supporters of that unit.
See the Dependents and Supporters enumeration values for more information.
Direct_SupportersIndicates those units that are directly related to a compilation unit. Supporters of a compilation unit are all those compilation units that must be successfully compiled before the compilation unit itself can be successfully compiled.
Direct supporters of a compilation unit include:
- All library units mentioned in a with clause
- The parent unit of a subunit
- The library unit (specification) of a secondary unit (body)
Package Standard is a supporter of every unit, but it is not considered to be a direct supporter unless it is mentioned in a with clause.
See the Supporters enumeration value for more information.
Extended_FamilyIndicates the specification, body, subunits, supporters, and recursively, the extended family of each supporting unit. The extended family consists of all units required to create an executable.
The extended family of a unit is also commonly referred to as the program closure of a unit.
See the Family enumeration value for more information.
FamilyIndicates the specification, body, subunits, and recursively, all subunits of subunits.
See the Extended_Family enumeration value for more information.
SupportersIndicates all those compilation units that must be successfully compiled before the compilation unit itself can be successfully compiled.
Supporters of a compilation unit include:
- All library units mentioned in a with clause and, recursively, all library units mentioned in with clauses in those library units
- All parent units of a subunit
- The library unit (specification) of a secondary unit (body)
See the Direct_Supporters enumeration value for more information.
Cross-References
- function Compilation_Order
- function Dependents
- function Direct_Dependents
- function Direct_Supporters
- function Supporters
- function Recompilation_Order
- function Related_Compilation_Units
- "Finding Related Compilation Units"
- "Consistent and Obsolete Compilation Units"
- Ada83 LRM 10.3, Ada95 LRM 10.1.4
Function Secondary_Unit
function Secondary_Unit (Name : in String; Library : in Asis.Library) return Asis.Compilation_Unit;Expanded Name Asis.Compilation_Units.Secondary_Unit
Returns the secondary unit with the specified simple name or expanded name, belonging to the specified library.
Description
Secondary units are defined by the following syntax:
Ada83 LRM 10.1, Ada95 LRM 10.1.1
secondary_unit ::= library_unit_body | subunit
This function returns the compilation unit of the library_unit_body with the specified simple name ("A") or the subunit with the specified expanded name ("A.B"), belonging to the specified library.
If a secondary unit with the specified name does not belong to the specified library, Asis.Nil_Compilation_Unit is returned.
This function never returns a compilation unit with a Compilation_Unit_Kinds of A_Nonexistent_Secondary_Unit.
If a non-nil compilation unit is returned, the Enclosing_Library is Libraries.Is_Identical to the specified library.
Parameters
Name : in String;Specifies the simple or expanded name of the compilation unit desired.
Library : in Asis.Library;Specifies the library to which the unit must belong.
return Asis.Compilation_Unit;The returned compilation unit is of the following kinds:
Compilation_Unit_Kinds
A_Package_Body
A_Subprogram_Body
A_Subunit
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Examples
Cross-References
- function Corresponding_Library_Unit
- function Library_Unit
- function Library_Units
- function Secondary_Units
- "Library Content"
- Ada83 LRM 10.1, Ada95 LRM 10.1.1
Function Secondary_Units
function Secondary_Units (Library : in Asis.Library) return Asis.Compilation_Unit_List;Expanded Name Asis.Compilation_Units.Secondary_Units
Returns a list containing the secondary units belonging to the specified library.
Description
Secondary units are defined by the following syntax:
Ada83 LRM 10.1, Ada95 LRM 10.1.1
secondary_unit ::= library_unit_body | subunit
This function returns a list containing the secondary_units belonging to the specified library.
The order of appearance of units in the list is not defined. Individual units will only appear once.
If the specified library does not contain any secondary units Asis.Nil_Compilation_Unit_List is returned. Note that an Ada implementation might place units into a newly created library; Asis.Nil_Compilation_Unit_List might never be returned under such an implementation.
This function never returns a compilation unit with a Compilation_Unit_Kinds of A_Nonexistent_Secondary_Unit.
The Enclosing_Library for each unit in the returned list is Libraries.Is_Identical to the specified library.
Parameters
Library : in Asis.Library;Specifies the library to which the units must belong.
return Asis.Compilation_Unit_List;The returned list contains compilation units of the following kinds:
Compilation_Unit_Kinds
A_Package_Body
A_Subprogram_Body
A_Subunit
Unknown
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Examples
Cross-References
- "Library Content"
- Ada83 LRM 10.1, Ada95 LRM 10.1.1
Function Subunit_Ancestor
function Subunit_Ancestor (Subunit : in Asis.Compilation_Unit) return Asis.Compilation_Unit;
function Subunit_Ancestor (Subunit : in Asis.Compilation_Unit; Library : in Asis.Library) return Asis.Compilation_Unit;Expanded Name Asis.Compilation_Units.Subunit_Ancestor
Returns the first parent compilation unit of the specified subunit that is not itself a subunit.
Description
Body stubs and subunits are defined by the following syntax:
Ada83 LRM 10.2, Ada95 LRM 10.1.3
body_stub ::=
subprogram_specification is separate;
| package body package_simple_name
is separate;
| task body task_simple_name is separate;subunit ::=
separate (parent_unit_name) proper_bodyThis function returns the first parent compilation unit containing the body_stub ancestor, of the specified subunit, that is not itself a subunit.
If the ancestor parent unit does not belong to the specified library, Asis.Nil_Compilation_Unit is returned.
If a non-nil compilation unit is returned, the Enclosing_Library is Libraries.Is_Identical to the specified library.
Parameters
Subunit : in Asis.Compilation_Unit;Specifies the subunit for which the parent unit is desired. The Subunit must be of the following kind
Compilation_Unit_Kinds
A_Subunit
:
Library : in Asis.Library;
Specifies the library to which the parent unit must belong.
If a library is not specified, the Enclosing_Library of the parent unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Subunit_Ancestor (Subunit);Library_Unit := Asis.Compilation_Units. Subunit_Ancestor (Subunit, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Subunit));
return Asis.Compilation_Unit;The returned compilation unit is of the following kinds:
Compilation_Unit_Kinds
A_Package_Body
A_Subprogram_Body
Unknown
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Inappropriate_Compilation_Unit is raised and Environment.Status is set to Value_Error if a compilation-unit parameter references a library that is no longer open.
Examples
Cross-References
- "Analyzing Subunits"
- Ada83 LRM 10.2, Ada95 LRM 10.1.3
Function Subunit_Parent
function Subunit_Parent (Subunit : in Asis.Compilation_Unit) return Asis.Compilation_Unit;
function Subunit_Parent (Subunit : in Asis.Compilation_Unit; Library : in Asis.Library) return Asis.Compilation_Unit;Expanded Name Asis.Compilation_Units.Subunit_Parent
Returns the compilation unit containing the body stub of the specified subunit.
Description
Body stubs and subunits are defined by the following syntax:
Ada83 LRM 10.2, Ada95 LRM 10.1.3
body_stub ::=
subprogram_specification is separate;
| package body package_simple_name
is separate;
| task body task_simple_name is separate;subunit ::=
separate (parent_unit_name) proper_bodyThis function returns the compilation unit containing the body_stub for the specified subunit.
If the parent unit does not belong to the specified library, Asis.Nil_Compilation_Unit is returned.
If a non-nil compilation unit is returned, the Enclosing_Library is Libraries.Is_Identical to the specified library.
Parameters
Subunit : in Asis.Compilation_Unit;
Specifies the subunit for which the parent unit is desired. The Subunit must be of the following kind
Compilation_Unit_Kinds
A_Subunit
:
Library : in Asis.Library;
Specifies the library to which the parent unit must belong.If a library is not specified, the Enclosing_Library of the parent unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Subunit_Parent (Subunit);Library_Unit := Asis.Compilation_Units. Subunit_Parent (Subunit, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Subunit));
return Asis.Compilation_Unit;The returned compilation unit is of the following kinds:
Compilation_Unit_Kinds
A_Package_Body
A_Subprogram_Body
A_Subunit
Unknown
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Inappropriate_Compilation_Unit is raised and Environment.Status is set to Value_Error if a compilation-unit parameter references a library that is no longer open.
Examples
Cross-References
- "Analyzing Subunits"
- Ada83 LRM 10.2, Ada95 LRM 10.1.3
Function Subunits
function Subunits (Parent_Unit : in Asis.Compilation_Unit) return Asis.Compilation_Unit_List;
function Subunits (Parent_Unit : in Asis.Compilation_Unit; Library : in Asis.Library) return Asis.Compilation_Unit_List;Expanded Name Asis.Compilation_Units.Subunits
Returns a list of the subunits of the specified parent unit.
Description
Body stubs and subunits are defined by the following syntax:
Ada83 LRM 10.2, Ada95 LRM 10.1.3
body_stub ::=
subprogram_specification is separate;
| package body package_simple_name
is separate;
| task body task_simple_name is separate;subunit ::=
separate (parent_unit_name) proper_bodyThis function returns a list of the compilation units that correspond to the body_stubs in the specified parent unit. One subunit is returned for each body_stub declaration.
If the specified compilation unit does not contain any body_stubs, Asis.Nil_Compilation_Unit_List is returned.
Units in the returned list can have a Compilation_Unit_Kinds of A_Nonexistent_Secondary_Unit if the unit is not compiled.
You can determine whether the subunit is a subprogram, package, or task by analysis of the body_stub declaration. See package Declarations, "Processing Body Stubs and Subunits."
If a candidate compilation unit does not have the specified library as its enclosing library, it is first converted into an Is_Equal unit in the specified library. If a candidate compilation unit does not belong to the specified library, it is ignored and the unit does not appear in the returned relationship. Because of this conversion, each units in the returned relationship can be Is_Equal, rather than Is_Identical, to the specified units.
Compilation subunits can also be obtained with the Related_Compilation_Units function by specifying a Relation_Kinds of Family.
Parameters
Parent_Unit : in Asis.Compilation_Unit;Specifies the compilation unit for which the subunit list is to be returned. All Compilation_Unit_Kinds are appropriate.
Library : in Asis.Library;
Specifies the library to which the returned units must belong.
If a library is not specified, the Enclosing_Library of the parent unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Subunits (Parent_Unit);Library_Unit := Asis.Compilation_Units. Subunits (Parent_Unit, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Parent_Unit));
return Asis.Compilation_Unit_List;The returned list contains compilation units of the following kind:
Compilation_Unit_Kinds
A_Nonexistent_Secondary_Unit
A_Subunit
Errors
Asis_Inappropriate_Library is raised and Environment.Status is set to Value_Error if a library variable is specified that is no longer open.
Asis_Inappropriate_Compilation_Unit is raised and Environment.Status is set to Value_Error if a compilation-unit parameter references a library that is no longer open or if Asis.Nil_Compilation_Unit is specified.
Examples
Cross-References
- "Analyzing Subunits"
- Ada83 LRM 10.2, Ada95 LRM 10.1.3
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |