TOC PREV NEXT INDEX DOC LIST MASTER INDEX




Function Kind

Expanded Name Asis.Declarations.Kind

Returns the kind of the specified declaration.

Description

Declarations and specifications are defined by the following Ada constructs:

This function returns the kind of declaration associated with the specified declaration.

Parameters

Specifies the declaration for which the kind should be returned. The declaration must be of the following kind:
Element_Kinds

A_Declaration

Returns the kind of the specified declaration. If an unexpected element is specified, Not_A_Declaration is returned.

Errors

None.

Examples

Cross-References

Related subprograms and types:

Related concept:


Function Names

Expanded Name Asis.Declarations.Names

Returns a list of names from the specified declaration.

Description

The following Ada constructs return a name list with a single entry:

The following Ada constructs can return a name list with multiple entries:

The specific declaration kinds associated with the above language components are shown by the following tables:
Declaration_Kinds Returning Multiple-Entry Name Lists
A_Component_Declaration
A_Constant_Declaration
A_Deferred_Constant_Declaration
A_Discriminant_Specification
A_Generic_Formal_Object_Declaration
A_Parameter_Specification
A_Real_Number_Declaration
A_Variable_Declaration
An_Exception_Declaration
An_Integer_Number_Declaration
A_Full_Type_Declaration
A_Function_Body_Declaration
A_Function_Body_Stub
A_Function_Declaration
A_Function_Instantiation

Declaration_Kinds Returning Multiple-Entry Name Lists
A_Function_Rename_Declaration
A_Generic_Formal_Function_Declaration
A_Generic_Formal_Private_Type_Declaration
A_Generic_Formal_Procedure_Declaration
A_Generic_Formal_Type_Declaration
A_Generic_Function_Declaration
A_Generic_Package_Declaration
A_Generic_Procedure_Declaration
A_Loop_Parameter_Specification
A_Package_Body_Declaration
A_Package_Body_Stub
A_Package_Declaration
A_Package_Instantiation
A_Package_Rename_Declaration
A_Private_Type_Declaration
A_Procedure_Body_Declaration
A_Procedure_Body_Stub
A_Procedure_Declaration
A_Procedure_Instantiation
A_Procedure_Rename_Declaration
A_Subtype_Declaration
A_Task_Body_Declaration
A_Task_Body_Stub
A_Task_Declaration
A_Task_Type_Declaration
An_Entry_Declaration
An_Enumeration_Literal_Specification
An_Exception_Rename_Declaration
An_Incomplete_Type_Declaration
An_Object_Rename_Declaration

In addition to the values listed in the tables in this section, the value Not_A_Declaration can be returned when Asis.Nil_Element is passed or the element does not represent a declaration.

If a multiple-entry list is returned, the entries will be in order of their appearance in the source code

A single-entry list is returned for a multiple-entry list declaration kind if:

Functions in package Environment can be used to determine whether parameters lists are normalized.

Function designators are considered to be a particular kind of An_Entity_Name_Definition. The Expressions.Operator_Kind function can be called with function declarations and identifiers to determine whether they declare a normal function or an operator function.

For further analysis:
Information Desired
Calls to Use
String form of a name
Expressions.Name
Whether a function designator represents a simple name or an operator name
Expressions.Operator_Kind

Parameters

Specifies the declaration for which the names should be returned. The declaration must be of the following kind:
Element_Kinds

A_Declaration

The returned list contains elements of the following kinds:
Element_Kinds
Expression_Kinds
An_Entity_Name_Definition
A_Character_Literal
A_Simple_Name
An_Enumeration_Literal
An_Operator_Symbol

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

Consider the declarations:

If the ASIS implementation normalizes multiple-name lists:

If the ASIS implementation does not normalize multiple-name lists:

Cross-References

Related subprograms:

Related concepts:


Function Object_Declaration_Definition

Expanded Name Asis.Declarations.Object_Declaration_Definition

Returns the subtype indication or the constrained-array definition following the colon in the specified object declaration.

Description

Object and number declarations are partially defined by the following syntax:

Ada83 LRM 3.2, Ada95 LRM 3.3

 object_declaration ::=
   identifier_list :
    [constant] subtype_indication
     [:= expression];
  | identifier_list :
    [constant] constrained_array_definition
     [:= expression];

This function returns the subtype indication or constrained-array definition from the specified object declaration.

Parameters

Specifies the declaration for which the object declaration must be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Component_Declaration
A_Constant_Declaration
A_Variable_Declaration

The returned element is of the following kinds:
Element_Kinds
Type_Definition_Kinds
A_Type_Definition
A_Subtype_Definition
An_Array_Type_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.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Origin

Expanded Name Asis.Declarations.Origin

Returns the origin of the specified declaration.

Description

Declaration origins are shown in the table below:
Declaration_Origins
Declaration Source
An_Explicit_Declaration
An explicit declaration appearing in the source code
An_Implicit_Derived_Declaration
An implicit derived declaration created by declaring a derived type (Ada83 LRM 3.4(12), Ada95 LRM 3.4)
An_Implicit_Predefined_Declaration
An implicit declaration created by declaring or deriving a type (Ada83 LRM 4.5(6), Ada95 LRM 4.5)
Not_A_Declaration
The specified element does not represent a declaration

Parameters

Specifies the declaration for which the origin should be returned. The declaration must be of the following kind:
Element_Kinds

A_Declaration

Returns the origin of the specified declaration. If an unexpected element is specified, Not_A_Declaration is returned.

Errors

None.

Examples

Cross-References

Related subprograms:

Related concepts:


Function Package_Body_Block

Expanded Name Asis.Declarations.Package_Body_Block

Returns a block statement that is the structural equivalent of the package body.

Description

Package bodies 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 an element that represents the package 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 package 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.

For further analysis:
Information Desired
Calls to Use
declarative_part
Statements.Declarative_Items
sequence_of_statements
Statements.Block_Body-
_Statements

exception_handler
Statements.Block_Exception-
_Handlers

Parameters

Specifies the declaration for which the body-block definition should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Package_Body_Declaration
A_Package_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 Parameter_Mode_Kind

Expanded Name Asis.Declarations.Parameter_Mode_Kind

Returns the parameter mode associated with the specified parameter or generic-formal object declaration.

Description

Subprogram parameter specifications are defined by the following syntax:

Ada83 LRM 6.1, Ada95 LRM 6.1 

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

 mode ::= [in] | in out | out

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 <>];

This function returns the mode from the specified parameter specification or formal-object generic-parameter declaration.

If the specified declaration does not represent a parameter specification or formal-object generic-parameter declaration, Not_A-
_Parameter_Mode is returned.

Not all ASIS implementations can distinguish between implied in parameters and explicitly specified in parameters. An ASIS implementation that cannot identify implicit in modes will never return this value; it will return An_In_Mode instead.

The Environment.Default_In_Mode_Supported function can be used to determine the capabilities of the ASIS implementation.

Parameters

Specifies the declaration for which the mode should be returned. The declaration must be of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Generic_Formal_Object_Declaration
A_Parameter_Specification

Returns the parameter-mode kind associated with the specified declaration.

Errors

None.

Examples
Declaration
Parameter Mode

A_Default_In_Mode1

An_In_Mode

An_Out_Mode

An_In_Out_Mode
1 Or An_In_Mode if the ASIS implementation cannot identify use of implied in parameters.

Cross-References

Related subprograms and types:

Related concepts:


Type Parameter_Mode_Kinds

Expanded Name Asis.Declarations.Parameter_Mode_Kinds

Describes the kinds of parameter modes that are available.

Description

Parameter modes appear in subprogram and generic
declarations.

Not all ASIS implementations can distinguish between implied in parameters and explicitly specified in parameters. The function Environment.Default_In_Mode_Supported can be used to determine the capabilities of the ASIS implementation being used.

Enumerations

Indicates that a mode for the parameter has not been explicitly specified (Ada83 LRM 6.1(4), Ada95 LRM 6.1). An ASIS implementation that cannot identify implicit in modes will never return this value; it will return An_In_Mode instead.

Indicates that the parameter has a mode of in (Ada83 LRM 6.2(3), Ada95 LRM 6.2).

Indicates that the parameter has a mode of in out (Ada83 LRM 6.2(4), Ada95 LRM 6.2).

Indicates that the parameter has a mode of out (Ada83 LRM 6.2(5), Ada95 LRM 6.2).

Indicates that in incorrect parameter was provided (which does not have a mode).

Cross-References

Related subprograms:

Related concepts:


Function Parameters

Expanded Name Asis.Declarations.Parameters

Returns a list of parameter specifications from the formal part of the specified subprogram or entry 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

Task-entry declarations are defined by the following syntax:

Ada83 LRM 9.5, Ada95 LRM 9.5 

entry_declaration ::=
  entry identifier [(discrete_range)]
   [formal_part];

The formal part of the above definitions is defined by the following syntax:

Ada83 LRM 6.1, Ada95 LRM 6.1

 formal_part ::=
  (parameter_specification
   {; parameter_specification])

This function returns a list of the parameter specifications that make up the formal part of the specified subprogram specification or entry declaration.

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

If the subprogram or entry has no parameters, Asis.Nil_Element-
_List
is returned.

Results of this subprogram can vary between ASIS implementation. An implementation can choose to normalize all multiple- name parameter specifications into an equivalent series of individual specifications (Ada83 LRM 6.1(4), Ada95 LRM 6.1).

Rational ASIS does not normalize parameter lists.

Parameters

Specifies the subprogram or entry for which the parameter list 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_Formal_Procedure_Declaration
A_Generic_Function_Declaration
A_Generic_Procedure_Declaration
A_Procedure_Body_Declaration
A_Procedure_Body_Stub
A_Procedure_Declaration
A_Procedure_Instantiation
A_Procedure_Rename_Declaration

The returned list contains elements of the following kinds:
Element_Kinds
Declaration_Kinds
A_Declaration
A_Parameter_Specification

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

For example:

An ASIS implementation that normalizes parameter lists returns two elements of kind A_Parameter_Specification.

An ASIS implementation that does not normalize parameter lists returns a single element of kind A_Parameter_Specification. When the Names function is called with this element, it returns a two-element list.

Cross-References

Related subprograms:

Related concepts:


Function Private_Part_Declarative_Items

Expanded Name Asis.Declarations.Private_Part_Declarative_Items

Returns a list of all basic declarations, representation specifications, use clauses, and, optionally, pragmas that are present in the private declarative portion of the specified 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 private 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 private 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:


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