![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Context_Clause_Elements
function Context_Clause_Elements (Compilation_Unit : in Asis.Compilation_Unit; Include_Pragmas : in Boolean := False) return Asis.Context_Clause_List;Expanded Name Asis.Compilation_Units.Context_Clause_Elements
Returns a list of the with and use clauses and, optionally, pragmas that appear in the context clause of the specified compilation unit.
Description
Context clauses are defined by the following syntax:
Ada83 LRM 10.1.1, Ada95 LRM 10.1.2
context_clause ::= {with_clause {use_clause}}
Pragmas can appear within a context_clause (Ada83 LRM 2.8, Ada95 LRM 2.8).
This function returns a list of the with_clauses, use_clauses, and optionally, pragmas that appear in the specified context_clause.
All elaborate pragmas (Ada83 LRM 10.5, Ada95 LRM 10.2.1) in the specified compilation unit are also returned by this function.
All pragmas in the context clause, except for pragma elaborate, are also returned by the Compilation_Pragmas function.
With and use clauses that implicitly apply to a given secondary unit are not returned in this list (Ada83 LRM 10.1.1, Ada95 LRM 10.1.2). To derive such a list, you can use the functions that return a Relationship by specifying a Relation parameter value of Supporters.
Some ASIS implementations normalize all multiname with or use clauses into an equivalent sequence of single-name clauses. Similarly, the implementation might retain only a single reference to a name that appears more than once in the original context clause (Ada83 LRM 8.4, Ada95 LRM 8.4 and Ada83 LRM 10.1.1, Ada95 LRM 10.1.2).
Rational ASIS does not normalize multiname with or use clauses.
Ada predefined program units, such as package Standard and the Unchecked_Conversion function, might or might not have pragmas available. These units might not have a physical representation. Whether pragmas and a physical representation exist is implementation-defined. You can use the Origin function to determine whether a compilation unit represents A_Predefined_Unit.
Parameters
Compilation_Unit : in Asis.Compilation_Unit;Specifies the compilation unit to query. The Compilation_Unit 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
Include_Pragmas : in Boolean := False;Specifies whether pragma definitions should be included in the returned list.
return Asis.Context_Clause_List;The returned list contains elements of the following kinds
Element_Kinds
A_Pragma
A_Use_Clause
A_With_Clause
:
If the specified compilation unit has a Compilation_Unit_Kinds of Unknown, Asis.Nil_Element_List is returned.
Errors
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
- function Referenced_Units
- function Elements.Argument_Associations
- function Elements.Is_Predefined
- function Elements.Name
- function Elements.Pragma_Kind
- "Element Gateway and Context Clause Decomposition"
- package Elements, "Processing Pragmas"
- Ada83 LRM 8.4, Ada95 LRM 8.4
- Ada83 LRM 10.1.1, Ada95 LRM 10.1.2
- Ada83 LRM 10.5, Ada95 LRM 10.2.1
Function Corresponding_Library_Unit
function Corresponding_Library_Unit (Secondary_Unit : in Asis.Compilation_Unit) return Asis.Compilation_Unit;
function Corresponding_Library_Unit (Secondary_Unit : in Asis.Compilation_Unit; Library : in Asis.Library) return Asis.Compilation_Unit;Expanded Name Asis.Compilation_Units.Corresponding_Library_Unit
Returns the library unit (specification) corresponding to the specified secondary unit (body).
Description
The specified library need not be the Enclosing_Library of the specified secondary unit. By specifying a different library, you can obtain an Is_Equal compilation-unit value from a different library.
If the specified compilation unit is a secondary unit, the function:
- Returns Asis.Nil_Compilation_Unit if the corresponding library unit does not belong to the specified library
- Returns the corresponding library unit if the unit belongs to the specified library
If the specified compilation unit is a library unit and not a secondary unit, the function:
- Returns Asis.Nil_Compilation_Unit if the unit does not belong to the specified library
- Acts as an identify function and returns the library unit if the unit belongs to the specified library
A subprogram body is treated as a secondary unit when a library unit with the same name already exists. If such a library unit does not exist, the subprogram body is treated as a library unit. In either case, the unit has a Compilation_Unit_Kinds of A_Subprogram_Declaration. In the later case, it has a Declarations.Declaration_Kinds of A_Procedure_Body_Declaration or A_Function_Body_Declaration rather than A_Procedure_Declaration or A_Function_Declaration.
This function can return a compilation unit with a Compilation_Unit_Kinds of A_Nonexistent_Library_Unit. This happens when the specified unit has a Compilation_Unit_Kinds of A_Nonexistent_Library_Unit and the unit belongs to the specified library.
The handling of units with a Compilation_Unit_Kinds of Unknown is implementation-defined. The expected use of Unknown units is to hide implementation details, but other uses are possible.
Compilation units with an Unknown kind can be returned under Apex. If a compilation unit with an Unknown kind is specified, the function acts as an identity function and returns the same compilation-unit value. Other information related to the compilation unit might or might not be available. See "Type Compilation_Unit_Kinds" for more information.
Parameters
Secondary_Unit : in Asis.Compilation_Unit;Specifies the secondary unit to query. The Secondary_Unit must be of the following kinds:
Library : in Asis.Library;Specifies the library to which the returned compilation unit must belong.
If a library is not specified, the Enclosing_Library of the secondary unit is assumed. These calls produce identical results:
Library_Unit := Asis. Compilation_Units.Corresponding_Library_Unit (Secondary_Unit);Library_Unit := Asis. Compilation_Units.Corresponding_Library_Unit (Secondary_Unit, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Secondary_Unit));
return Asis.Compilation_Unit;The returned compilation unit is of the following kinds
Compilation_Unit_Kinds
A_Generic_Declaration
A_Generic_Instantiation
A_Nonexistent_Library_Unit
A_Package_Declaration
A_Subprogram_Declaration
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
Function Corresponding_Secondary_Unit
function Corresponding_Secondary_Unit (Library_Unit : in Asis.Compilation_Unit) return Asis.Compilation_Unit;
function Corresponding_Secondary_Unit (Library_Unit : in Asis.Compilation_Unit; Library : in Asis.Library) return Asis.Compilation_Unit;Expanded Name Asis.Compilation_Units.Corresponding_Secondary_Unit
Returns the secondary unit (body) corresponding to the specified library unit (specification).
Description
The specified library need not be the Enclosing_Library of the specified library unit. By specifying a different library, you can obtain an Is_Equal compilation-unit value from a different library.
If the specified compilation unit is a library unit that exists, the function:
- Returns Asis.Nil_Compilation_Unit if the corresponding library unit does not belong to the specified library
- Returns the corresponding library unit if the unit belongs to the specified library
If the specified compilation unit is a secondary unit and not a library unit, the function:
- Returns Asis.Nil_Compilation_Unit if the unit does not belong to the specified library
- Acts as an identify function and returns the secondary unit if the unit belongs to the specified library
If the library unit has a Compilation_Unit_Kinds of A_Nonexistent_LIbrary_Unit, the secondary unit might not exist. In this case, Asis.Nil_Compilation_Unit is returned.
A subprogram body is treated as a secondary unit when a library unit with the same name already exists. If such a library unit does not exist, the subprogram body is treated as a library unit. In either case, the unit has a Compilation_Unit_Kinds of A_Subprogram_Declaration. In the later case, it has a Declarations.Declaration_Kinds of A_Procedure_Body_Declaration or A_Function_Body_Declaration rather than A_Procedure_Declaration or A_Function_Declaration.
This function can return a compilation unit with a Compilation_Unit_Kinds of A_Nonexistent_Secondary_Unit. This happens when the specified unit has a Compilation_Unit_Kinds of A_Nonexistent_Secondary_Unit and the unit belongs to the specified library.
The handling of units with a Compilation_Unit_Kinds of Unknown is implementation-defined. The expected use of Unknown units is to hide implementation details, but other uses are possible.
Compilation units with an Unknown kind can be returned under Apex. If a compilation unit with an Unknown kind is specified, the function acts as an identity function and returns the same compilation-unit value. Other information related to the compilation unit might or might not be available. See "Type Compilation_Unit_Kinds" for more information.
Parameters
Library_Unit : in Asis.Compilation_Unit;Specifies the library unit to query. The Library_Unit must be of the following kinds:
Library : in Asis.Library;Specifies the library to which the returned compilation unit must belong.
If a library is not specified, the Enclosing_Library of the library unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Corresponding_Secondary_Unit (Secondary_Unit);Library_Unit := Asis.Compilation_Units. Corresponding_Secondary_Unit (Secondary_Unit, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Secondary_Unit));
return Asis.Compilation_Unit;The returned compilation unit is of the following kinds
Compilation_Unit_Kinds
A_Nonexistent_Secondary_Unit
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
Function Debug_Image
function Debug_Image (Compilation_Unit : in Asis.Compilation_Unit) return Asis.Asis_String;Expanded Name Asis.Compilation_Units.Debug_Image
Returns an implementation-defined string representing the specified compilation unit.
Description
Rational ASIS returns a single line of text. The content of the line depends on whether the compilation unit is nil, invalid, represents a nonexistent compilation unit, or represents an existing compilation unit:
- A nil compilation unit tests as Is_Nil. A nil compilation unit returns:
<Nil_Compilation_Unit>- An invalid compilation unit is one where the associated library is closed. An invalid compilation unit returns:
<Invalid Compilation_Unit; Library closed>- A nonexistent compilation unit returns:
<Kind => kind, Object => object>
Where kind is either A_Nonexistent_Library_Unit or A_Nonexistent_Secondary_Unit and object is the full pathname of the compilation unit.
- An existing compilation unit returns:
<16#ddd# 16#ddd#, Kind => kind, Library.Name => name, Library.Parameters => parameters, Object => object, Tree => tree, Opened => opened>
Where the syntactic categories are defined as follows:
Syntactic Category Definition
kind The Compilation_Unit_Kinds of the compilation unit.
name The Name string specified in the Libraries.Associate procedure for the library containing the compilation unit.
object The full pathname of the compilation unit.
opened Indicates True or False. If False, the DIANA tree for the compilation unit has not yet been read.
parameters The Parameters string specified in the Libraries.Associate procedure for the library containing the compilation unit.
tree Data useful to maintainers of Rational ASIS. The data might change from release to release.
Parameters
Compilation_Unit : in Asis.Compilation_Unit;Specifies the compilation unit for which the debug information is desired.
return Asis.Asis_String;Returns implementation-defined debug information for the specified compilation unit.
Errors
Examples
Cross-References
Related subprograms and types:
- type Compilation_Unit_Kinds
- procedure Libraries.Associate
- function Libraries.Name
- function Libraries.Parameters
Function Dependents
function Dependents (Compilation_Unit : in Asis.Compilation_Unit; Compilation_Units : in Asis.Compilation_Unit_List) return Asis.Compilation_Unit_List;
function Dependents (Compilation_Unit : in Asis.Compilation_Unit; Compilation_Units : in Asis.Compilation_Unit_List; Library : in Asis.Library) return Asis.Compilation_Unit_List;Expanded Name Asis.Compilation_Units.Dependents
Returns a list containing the dependents of the specified compilation unit that also exist in the specified compilation-unit list.
Description
If the specified compilation unit does not belong to the specified library, all components of the returned Relationship will be Is_Nil.
The returned list of compilation units contains only those units that are dependents of the specified compilation unit, that exist in the candidate compilation-unit list, and that belong to the specified library. A compilation unit is not a dependent of itself and will not exist in the returned list.
See the enumeration value Dependents in the Relation_Kinds type for a description of what units constitute dependent units.
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 compilation-unit list. Because of this conversion, each unit in the returned compilation-unit list can be Is_Equal, rather than Is_Identical, to the specified units.
The method of converting compilation units from one library to another is implementation-defined. A possible method would be to obtain the unit's name and then use the name to obtain the compilation unit in the other library.
The returned list can include Is_Identical compilation-unit values if duplicates appear in the candidate compilation-unit list.
Parameters
Compilation_Unit
: in Asis.Compilation_Unit;Specifies the compilation unit for which the list of dependent units should be returned. The Compilation_Unit 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
Compilation_Units : in Asis.Compilation_Unit_List;Specifies the list of candidate compilation units. 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 compilation unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Dependents (Compilation_Unit, Compilation_Units);Library_Unit := Asis.Compilation_Units. Dependents (Compilation_Unit, Compilation_Units, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Compilation_Unit));
return Asis.Compilation_Unit_List;Returns a list of the units that are dependents of the specified compilation unit and that also appear in the list of candidate compilation units. All kinds of compilation units can appear in the returned list.
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
- function Direct_Dependents
- function Direct_Supporters
- function Supporters
- function Libraries.Is_Equal
- function Libraries.Is_Identical
Function Direct_Dependents
function Direct_Dependents (Compilation_Unit : in Asis.Compilation_Unit; Compilation_Units : in Asis.Compilation_Unit_List) return Asis.Compilation_Unit_List;
function Direct_Dependents (Compilation_Unit : in Asis.Compilation_Unit; Compilation_Units : in Asis.Compilation_Unit_List; Library : in Asis.Library) return Asis.Compilation_Unit_List;Expanded Name Asis.Compilation_Units.Direct_Dependents
Returns a list of the direct dependents of the specified compilation unit that also exist in the specified compilation-unit list.
Description
If the specified compilation unit does not belong to the specified library, all components of the returned Relationship will be Is_Nil.
The returned list of compilation units contains only those units that are direct dependents of the specified compilation unit, that exist in the candidate compilation-unit list, and that belong to the specified library. A compilation unit is not a direct dependent of itself and will not exist in the returned list.
See the enumeration value Direct_Dependents in the Relation_Kinds type for a description of what units constitute directly dependent units.
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 unit in the returned relationship can be Is_Equal, rather than Is_Identical, to the specified units.
The returned list can include Is_Identical compilation-unit values if duplicates appear in the candidate compilation-unit list.
Parameters
Compilation_Unit : in Asis.Compilation_Unit;Specifies the compilation unit for which the list of directly dependent units should be returned. The Compilation_Unit 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
Compilation_Units : in Asis.Compilation_Unit_List;Specifies the list of candidate compilation units. 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 compilation unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Direct_Dependents (Compilation_Unit, Compilation_Units);Library_Unit := Asis.Compilation_Units. Direct_Dependents (Compilation_Unit, Compilation_Units, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Compilation_Unit));
return Asis.Compilation_Unit_List;Returns a list of the units that are direct dependents of the specified compilation unit and that also appear in the list of candidate compilation units. All kinds of compilation units can appear in the returned list.
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
- function Dependents
- function Direct_Supporters
- function Supporters
- function Libraries.Is_Equal
- function Libraries.Is_Identical
Function Direct_Supporters
function Direct_Supporters (Compilation_Unit : in Asis.Compilation_Unit; Compilation_Units : in Asis.Compilation_Unit_List) return Asis.Compilation_Unit_List;
function Direct_Supporters (Compilation_Unit : in Asis.Compilation_Unit; Compilation_Units : in Asis.Compilation_Unit_List; Library : in Asis.Library) return Asis.Compilation_Unit_List;Expanded Name Asis.Compilation_Units.Direct_Supporters
Returns a list of the units directly supporting the specified compilation unit that also exist in the specified compilation-unit list.
Description
If the specified compilation unit does not belong to the specified library, all components of the returned Relationship will be Is_Nil.
The returned list of compilation units contains only those units that are direct supporters of the specified compilation unit, that exist in the candidate compilation-unit list, and that belong to the specified library. A compilation unit is not a direct supporter of itself and will not exist in the returned list.
See the enumeration value Direct_Supporters in the Relation_Kinds type for a description of what units constitute directly supporting units.
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 unit in the returned relationship can be Is_Equal, rather than Is_Identical, to the specified units.
The returned list can include Is_Identical compilation-unit values if duplicates appear in the candidate compilation-unit list.
Parameters
Compilation_Unit : in Asis.Compilation_Unit;Specifies the compilation unit for which the list of directly supporting units should be returned. The Compilation_Unit 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
:
Compilation_Units : in Asis.Compilation_Unit_List;Specifies the list of candidate compilation units. 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 compilation unit is assumed. These calls produce identical results:
Library_Unit := Asis.Compilation_Units. Direct_Supporters (Compilation_Unit, Compilation_Units);Library_Unit := Asis.Compilation_Units. Direct_Supporters (Compilation_Unit, Compilation_Units, Asis.Compilation_Units.Enclosing_Library (Asis.Compilation_Units. Enclosing_Compilation_Unit (Compilation_Unit));
return Asis.Compilation_Unit_List;Returns a list of the units that are direct supporters of the specified compilation unit and that also appear in the list of candidate compilation units. All kinds of compilation units can appear in the returned list.
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
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |