TOC PREV NEXT INDEX DOC LIST MASTER INDEX




Function Renamed_Base_Entity

Expanded Name Asis.Declarations.Renamed_Base_Entity

Returns the base declaration for the specified renamed
declaration.

Description

Renaming clauses are defined by the following syntax:

Ada83 LRM 8.5, Ada95 LRM 8.5

 renaming_declaration ::=
   identifier : type_mark renames
    object_name;
  | identifier : exception renames
    exception_name;
  | package identifier renames package_name;
  | subprogram_specification renames
    subprogram_or_entry_name;

This function returns the base object name, exception name, package name, or subprogram or entry name for the specified renaming declaration.

The function acts recursively and returns the base expression for declarations that reference renamed declarations.

Parameters

Specifies the declaration for which the new name should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Rename_Declaration
A_Package_Rename_Declaration
A_Procedure_Rename_Declaration
An_Exception_Rename_Declaration
An_Object_Rename_Declaration

The returned element is of the following kind:
Element_Kinds

An_Entity_Name_Definition

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Renamed_Entity

Expanded Name Asis.Declarations.Renamed_Entity

Returns the name that follows the reserved word renames in the specified renames declaration.

Description

Renaming clauses are defined by the following syntax:

Ada83 LRM 8.5, Ada95 LRM 8.5

 renaming_declaration ::=
   identifier : type_mark renames
    object_name;
  | identifier : exception renames
    exception_name;
  | package identifier renames package_name;
  | subprogram_specification renames
    subprogram_or_entry_name;

This function returns the object name, exception name, package name, or subprogram or entry name for the specified renaming declaration.

Parameters

Specifies the declaration for which the original name should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Rename_Declaration
A_Package_Rename_Declaration
A_Procedure_Rename_Declaration
An_Exception_Rename_Declaration
An_Object_Rename_Declaration

The returned element is of the following kind:
Element_Kinds

An_Expression

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Return_Type

Expanded Name Asis.Declarations.Return_Type

Returns the type mark for the specified function declaration.

Description

Subprogram specifications are partially defined by the following syntax:

Ada83 LRM 6.1, Ada95 LRM 6.1

 subprogram_specification ::=
   procedure identifier [formal_part]
  | function designator [formal_part]
    return type_mark

Every subprogram specification must have a corresponding subprogram body.

Renaming declarations are defined by the following syntax:

Ada83 LRM 8.5, Ada95 LRM 8.5

 renaming_declaration ::=
   identifier : type_mark renames
    object_name;
  | identifier : exception renames
    exception_name;
  | package identifier renames package_name;
  | subprogram_specification renames
    subprogram_or_entry_name;

Body stubs are partially 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;

Generic specifications are partially defined by the following syntax:

Ada83 LRM 12.1, Ada95 LRM 12.1 

generic_specification ::=
   generic_formal_part
    subprogram_specification
  | generic_formal_part package_specification

Generic-parameter declarations are partially defined by the following syntax:

Ada83 LRM 12.1, Ada95 LRM 12.1 

generic_parameter_declaration ::=
   identifier list : [in [out]] type_mark
    [:= expression]

  | type identifier is     generic_type_definition;
  | private_type_declaration
  | with subprogram_specification [is name];
  | with subprogram_specification [is <>];

Generic instantiations are partially defined by the following syntax:

Ada83 LRM 12.3, Ada95 LRM 12.3

 generic_instantiation ::=
   package identifier is
    new generic_package_name
     [generic_actual_part];
  | procedure identifier is
    new generic_procedure_name
     [generic_actual_part];
  | function designator is
    new generic_function_name
     [generic_actual_part];
  | function designator is
    new generic_function_name

This function returns the type mark of the specified function subprogram specification, function renaming declaration, body-stub function subprogram specification, generic-specification function subprogram specification, generic-parameter declaration of a function subprogram specification, or function generic instantiation.

Parameters

Specifies the declaration for which the type mark should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Body_Declaration
A_Function_Body_Stub
A_Function_Declaration
A_Function_Instantiation
A_Function_Rename_Declaration
A_Generic_Formal_Function_Declaration
A_Generic_Function_Declaration
An_Enumeration_Literal_Specification

The returned element is of the following kinds:
Element_Kinds
Expression_Kinds
An_Expression
A_Selected_Component
A_Simple_Name

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Subprogram_Body_Block

Expanded Name Asis.Declarations.Subprogram_Body_Block

Returns a block statement that is the structural equivalent of the function or procedure body or stub declaration.

Description

Subprogram bodies are defined by the following syntax:

Ada83 LRM 6.3, Ada95 LRM 6.3 

subprogram_body ::=
  subprogram_specification is
   [declarative_part]
  begin
   sequence_of_statements
  [exception
   exception_handler
   {exception_handler}]
  end [designator];

This function returns an element that represents the subprogram body for the specified function or procedure body.

The block statement is not part of the code (and is not Is_Part_Of_Implicit); it is an ASIS abstraction that encapsulates the subprogram body. The block includes the declarative part, the sequence of statements, and any exception handlers. It does not have a block simple name.

Asis.Nil_Element is returned if the declaration is a body stub.

Parameters

Specifies the declaration for which the corresponding body block should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Body_Declaration
A_Function_Body_Stub
A_Procedure_Body_Declaration
A_Procedure_Body_Stub

The returned element is of the following kinds:
Element_Kinds
Expression_Kinds
A_Statement
A_Block_Statement

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Subprogram_Derivation

Expanded Name Asis.Declarations.Subprogram_Derivation

Returns the subprogram declaration from which the specified implicit derived subprogram declaration was derived.

Description

The result of this function can be another implicitly derived subprogram (Expressions.Is_Derived returns True). This function can be called iteratively to obtain the base definition of the subprogram.

An implicit derived-operator overload can be generated when:

The operator defined in the second item above is implicitly overloaded for the new type declared in the third item.

This function can return a body declaration when:

Parameters

Specifies the implicit derived-subprogram declaration for which the subprogram declaration must be returned. The type definition must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Declaration
A_Procedure_Declaration

The returned element is of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Body_Declaration
A_Function_Declaration
A_Function_Rename_Declaration
A_Procedure_Body_Declaration
A_Procedure_Declaration
A_Procedure_Rename_Declaration

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Inappropriate_Element is raised and Envronment.Status is set to Value_Error if the declaration does not reference a subprogram that Expressions.Is_Part_Of_Derived.

Examples

Cross-References

Related subprograms:

Related concept:


Function Subunit

Expanded Name Asis.Declarations.Subunit

Returns the unit declaration of the subunit corresponding to the body-stub declaration specified.

Description

Body stubs 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;

Subunits are defined by the following syntax:

 subunit ::=
  separate (parent_unit_name) proper body

This function returns the subunit corresponding to the specified body stub.

If the subunit unit does not exist in the implied or specified library, Asis.Nil_Element is returned. If a non-nil element is returned, the Compilation_Units.Enclosing_Library of the returned element will be the same as the specified library.

The Compilation_Unit_Kinds of a non-nil returned element will be A_Subunit.

Parameters

Specifies the declaration for which the subunit declaration must be returned. The declaration must be of the following kinds
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Body_Stub
A_Package_Body_Stub
A_Procedure_Body_Stub
A_Task_Body_Stub

:

Specifies the library from which to return the declaration. If a library is not specified, the Enclosing_Library of the Declaration parameter is assumed. These calls produce identical results:

The returned element is of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Function_Body_Declaration
A_Package_Body_Declaration
A_Procedure_Body_Declaration
A_Task_Body_Declaration

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

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_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.

Examples

For example:

The element that represents the separate procedure declaration in the body of package Sorting is a Declaration_Kinds of A_Procedure_Body_Stub. When the Subunit function is called with this element, it returns an element with a Declaration_Kinds of A_Procedure_Body_Declaration. This element represents the separate declaration (and implementation) of the procedure.

Cross-References

Related subprograms:

Related concepts:


Function Task_Body_Block

Expanded Name Asis.Declarations.Task_Body_Block

Returns the body block associated with the specified body
declaration.

Description

Task specifications are defined by the following syntax:

Ada83 LRM 9.1, Ada95 LRM 9.1 

task_specification ::=
  task [type] identifier [is
   {entry_declaration}
   {representation_clause}
  end [task_simple_name}]

Each task specification must have a corresponding task body.

This function returns the body-block statement if the specified declaration represents a task body or Asis.Nil_Element if the declaration represents a task-body stub.

To obtain the task body of a task-body stub, call the Subunit function.

The block statement is the structural equivalent of the task body. The block statement is not part of the code (and is not Is_Part_Of_Implicit); it is an ASIS abstraction that encapsulates the task body. The block includes the declarative part, the sequence of statements, and any exception handlers. It does not have a block simple name.

Parameters

Specifies the declaration for which the body block should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Task_Body_Declaration
A_Task_Body_Stub

The returned element is of the following kind:
Element_Kinds
Statement_Kinds
A_Statement
A_Block_Statement

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Task_Declaration_Declarative_Items

Expanded Name Asis.Declarations.Task_Declaration_Declarative_Items

Returns a list of all entry declarations, representation specifications, and, optionally, pragmas that are present in the specified task or task-type declaration.

Description

Task specifications are defined by the following syntax:

Ada83 LRM 9.1, Ada95 LRM 9.1 

task_specification ::=
  task [type] identifier [is
   {entry_declaration}
   {representation_clause}
  end [task_simple_name}]

This function returns a list containing the entry declarations, representation clauses, and, optionally, pragmas contained within the task specification or task-type specification. The items are returned in their order of appearance in the source code.

The subprogram Type_Definitions.Task_Type_Declarative_Items returns the same data as this subprogram.

For further analysis:
Element_Kinds
Calls to Use
A_Declaration
Declarations.
(most subprograms)

A_Pragma
Elements.
Argument_Associations
Is_Predefined
Name
Pragma_Kind

A_Representation_Clause
Representation_Clauses.
Associated_Type
Kind
Length_Clause_Attribute
Length_Clause_Attribute_Kind

Parameters

Specifies the declaration for which the declarations, pragmas, and representation clauses should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Task_Declaration
A_Task_Type_Declaration

Specifies whether pragma definitions should be included in the returned list.

The returned list contains elements of the following kinds:
Element_Kinds

A_Declaration
A_Pragma
A_Representation_Clause


If an element in the returned list is A_Declaration, the associated Declaration_Kinds is An_Entry_Declaration.

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Type_Declaration_Definition

Expanded Name Asis.Declarations.Type_Declaration_Definition

Returns the type definition following the reserved word is in the specified type or subtype declaration.

Description

Full-type and subtype declarations are partially defined by the following syntax:

Ada83 LRM 3.3.1, Ada95 LRM 3.2.1  

full_type_declaration ::=
  type identifier [discriminant_part] is
   type_definition;

Ada83 LRM 3.3.2, Ada95 LRM 3.2.2

 subtype_declaration ::=
  subtype identifier is subtype_indication;

If a full-type declaration or subtype declaration is specified, the type definition or subtype indication following the reserved word is is returned.

If an incomplete-type declaration or private-type declaration is specified, the type definition in the corresponding full-type declaration is returned.

To be supplied: Need to verify that the above is really returned and figure out what the return values for the generic formal and task type declarations

Parameters

Specifies the declaration for which the type definition should be returned. The declaration must be of the following kind
Element_Kinds
Declaration_Kinds
A_Declaration
A_Full_Type_Declaration
A_Generic_Formal_Private_Type-
_Declaration
A_Generic_Formal_Type_Declaration
A_Private_Type_Declaration
A_Subtype_Declaration
A_Task_Type_Declaration
An_Incomplete_Type_Declaration

s:

The returned element is of the following kind:
Element_Kinds

A_Type_Definition

If An_Incomplete_Type_Declaration is specified, Asis.Nil_Element is returned.

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Type_Mark

Expanded Name Asis.Declarations.Type_Mark

Returns the type mark of the specified declaration.

Description

Type marks are used in the following Ada constructs:

Ada83 LRM 3.7.1, Ada95 LRM 3.7

 discriminant_specification ::=
  identifier_list : type_mark [:= expression]

Ada83 LRM 6.1, Ada95 LRM 6.1

 parameter_specification ::=
  identifier_list : mode type_mark
   [:= expression]

Ada83 LRM 7.4, Ada95 LRM 7.3

 deferred_constant_declaration ::=
  identifier_list : constant type_mark;

Ada83 LRM 8.5, Ada95 LRM 8.5

 renaming_declaration ::=
   identifier : type_mark renames
    object_name;
  | identifier : exception renames
    exception_name;
  | package identifier renames package_name;
  | subprogram_specification renames
    subprogram_or_entry_name;

Ada83 LRM 12.1, Ada95 LRM 12.1 

generic_parameter_declaration ::=
   identifier list : [in [out]] type_mark
    [:= expression]

  | type identifier is     generic_type_definition;
  | private_type_declaration
  | with subprogram_specification [is name];
  | with subprogram_specification [is <>];

This function returns an expression representing the type mark from each of the above constructs.

Parameters

Specifies the declaration or specification for which the type mark should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Deferred_Constant_Declaration
A_Discriminant_Specification
A_Generic_Formal_Object_Declaration
A_Parameter_Specification
An_Object_Rename_Declaration

The returned element is of the following kinds:
Element_Kinds
Expression_Kinds
An_Expression
A_Selected_Component
A_Simple_Name
An_Attribute

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Type_Operators

Expanded Name Asis.Declarations.Type_Operators

Returns a list of operators defined for the specified type
definition.

Description

The returned list includes all predefined operators (Ada83 LRM 4.5, Ada95 LRM 4.5) and all programmer-defined operator overloads that have been implicitly derived or explicitly declared for the type (Ada83 LRM 7.4.2(5), Ada95 LRM 7.3). The list includes only those operators appropriate for the type.

An implicit derived-operator overload can be generated by:

The operator defined in the second item above is implicitly overloaded for the new type declared in the third item.

The returned list will not include language-defined operators that have been specifically overridden. The operators are not returned if they are totally hidden (Ada83 LRM 7.4.2(16), Ada95 LRM 7.3).

The equality operator can be overloaded for limited private types. Because of variability in underlying Ada implementations, the operation of ASIS varies. See "Processing Implicit and Derived Operations" for how the equality operator is handled.

The enclosing element for each implicit declaration is the declaration, either type or object, that declared the type.

Parameters

Specifies the type for which the predefined operators should be returned. The type definition must be of the following kinds:
Element_Kinds
Type_Definition_Kinds
A_Type_Definition
Any Type_Definition_Kinds except A_Subtype_Declaration

The returned list contains elements of the following kinds:
Element_Kinds
Type_Definition_Kinds
A_Declaration
A_Function_Declaration
A_Function_Body_Declaration
A_Function_Body_Stub
A_Function_Instantiation
A_Function_Rename_Declaration
A_Generic_Formal_Function_Declaration

If there are no predefined or overloaded operators for the specified type, Asis.Nil_Element_List is returned.

Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Asis_Failed is raised and Environment.Status is set to Obso-
lete_Reference_Error if a parameter is part of an obsolete
compilation unit.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Visible_Part_Declarative_Items

Expanded Name Asis.Declarations.Visible_Part_Declarative_Items

Returns a list of all basic declarations, representation specifications, use clauses, and, optionally, pragmas that are present in the visible declarative portion of a package specification.

Description

Package specifications are defined by the following syntax:

Ada83 LRM 7.1, Ada95 LRM 7.1 

package_specification ::=
  package identifier is
   {basic_declarative_item}
  [private
    {basic_declarative_item}]
  end [package_simple_name]

This function returns a list containing the basic declarative items from the visible part of the specification.

The items are returned in their order of appearance in the source code.

The list does not include any pragmas unless Include_Pragmas is specified as True.

Some ASIS implementations may normalize all multiname object definitions into an equivalent sequence of corresponding single-name object definitions (Ada83 LRM 3.2(10), Ada95 LRM 3.3). See the "Determining Declaration Kinds and Names" section for more details.

For further analysis:
Element_Kinds
Calls to Use
A_Declaration
Declarations.
(most subprograms)

A_Pragma
Elements.
Argument_Associations
Is_Predefined
Name
Pragma_Kind

A_Representation_Clause
Representation_Clauses.
Associated_Type
Kind
Length_Clause_Attribute
Length_Clause_Attribute_Kind

A_Use_Clause
Expressions.
Named_Packages

Parameters

Specifies the declaration for which the visible declarative-items list should be returned. The declaration must be of the following kind
Element_Kinds
Declaration_Kinds
A_Declaration
A_Generic_Package_Declaration
A_Package_Declaration

s:

Specifies whether pragma definitions should be included in the returned list.

The returned list contains elements of the following kinds:
Element_Kinds

A_Declaration
A_Pragma
A_Representation_Clause
A_Use_Clause


Errors

Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error if a parameter references a library variable that is no longer open, or a parameter is specified that is not appropriate for the query.

Examples

Cross-References

Related subprograms:

Related concepts:


Package Operations

Expanded Name Asis.Declarations.Operations

Package Operations provides a simple way to obtain visibility to operators for types used in package Declarations. The package typically is referenced in a use clause by an application.

Cross-References

Related subprograms and types:

Related concepts:


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