TOC PREV NEXT INDEX DOC LIST MASTER INDEX




Function Context_Clause_Elements

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

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

Specifies whether pragma definitions should be included in the returned 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

Related subprograms:

Related concepts:


Function Corresponding_Library_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:

If the specified compilation unit is a library unit and not a secondary unit, the function:

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

Specifies the secondary unit to query. The Secondary_Unit must be of the following kinds:
Compilation_Unit_Kinds

A_Generic_Declaration

A_Generic_Instantiation

A_Nonexistent_Library_Unit

A_Nonexistent_Secondary_Unit

A_Package_Body

A_Package_Declaration

A_Subprogram_Body

A_Subprogram_Declaration

Unknown

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:

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

Related subprogram:

Related concept:


Function Corresponding_Secondary_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:

If the specified compilation unit is a secondary unit and not a library unit, the function:

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

Specifies the library unit to query. The Library_Unit must be of the following kinds:
Compilation_Unit_Kinds

A_Generic_Declaration

A_Generic_Instantiation

A_Nonexistent_Library_Unit

A_Nonexistent_Secondary_Unit

A_Package_Body

A_Package_Declaration

A_Subprogram_Body

A_Subprogram_Declaration

Unknown

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:

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

Related subprogram:

Related concept:


Function Debug_Image

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:

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

Specifies the compilation unit for which the debug information is desired.

Returns implementation-defined debug information for the specified compilation unit.

Errors

None.

Examples

Cross-References

Related subprograms and types:


Function Dependents

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

Specifies the list of candidate compilation units. All Compilation_Unit_Kinds are appropriate.

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:

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

Related subprograms:

Related concept:


Function Direct_Dependents

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

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

Specifies the list of candidate compilation units. All Compilation_Unit_Kinds are appropriate.

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:

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

Related subprograms:

Related concept:


Function Direct_Supporters

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

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

:

Specifies the list of candidate compilation units. All Compilation_Unit_Kinds are appropriate.

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:

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

Related subprograms:

Related concept:


Rational Software Corporation  http://www.rational.com
support@rational.com
techpubs@rational.com
Copyright © 1993-2001, Rational Software Corporation. All rights reserved.
TOC PREV NEXT INDEX DOC LIST MASTER INDEX TECHNOTES APEX TIPS