![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Kind
function Kind (Declaration : in Asis.Declaration) return Asis_Declarations.Declaration_Kinds;Expanded Name Asis.Declarations.Kind
Returns the kind of the specified declaration.
Description
Declarations and specifications are defined by the following Ada constructs:
- Object and number declarations (Ada83 LRM 3.2, Ada95 LRM 3.3)
- Full-type, subtype, incomplete-type, and private-type declarations (Ada83 LRM 3.3.1, 3.3.2, 3.7.1, 3.8.1, and 7.4, Ada95 LRM 3.2.1, 3.2.2, 3.7, 3.10.1, and 7.3)
- Component declarations (Ada83 LRM 3.7, Ada95 LRM 3.8)
- Enumeration-literal specifications (Ada83 LRM 3.5.1, Ada95 LRM 3.5.1)
- For-loop parameter specifications (Ada83 LRM 5.5, Ada95 LRM 5.5)
- Subprogram declarations, bodies, and parameters (Ada83 LRM 6.1, and 6.3, Ada95 LRM 6.1 and 6.3)
- Package specifications and package bodies (Ada83 LRM 7.1, 7.3, Ada95 LRM 7.1 and 7.2)
- Deferred-constant declarations (Ada83 LRM 7.4, Ada95 LRM 7.4)
- Renaming declarations (Ada83 LRM 8.5, Ada95 LRM 8.5)
- Task and task-type specifications and bodies (Ada83 LRM 9.1, Ada95 LRM 9.1)
- Task-entry declarations (Ada83 LRM 9.5, Ada95 LRM 9.5)
- Subunits of compilation units (Ada83 LRM 10.2, Ada95 LRM 10.1.3)
- Exception declarations (Ada83 LRM 11.1, Ada95 LRM 11.1
- Generic and generic-formal parameter declarations (Ada83 LRM 12.1, Ada95 LRM 12.1)
- Generic instantiations (Ada83 LRM 12.3, Ada95 LRM 12.3)
This function returns the kind of declaration associated with the specified declaration.
Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the kind should be returned. The declaration must be of the following kind:
Element_Kinds
A_Declaration
return Asis_Declarations.Declaration_Kinds;Returns the kind of the specified declaration. If an unexpected element is specified, Not_A_Declaration is returned.
Errors
Examples
Cross-References
Related subprograms and types:
- "Determining Declaration Kinds and Names"
- Ada83 LRM 3.2, Ada95 LRM 3.3
- Ada83 LRM 3.3.1, Ada95 LRM 3.2.1
- Ada83 LRM 3.3.2, Ada95 LRM 3.2.2
- Ada83 LRM 3.4, Ada95 LRM 3.4
- Ada83 LRM 3.7.1, Ada95 LRM 3.7
- Ada83 LRM 3.8.1, Ada95 LRM 3.10.1
- Ada83 LRM 4.5, Ada95 LRM 4.5
- Ada83 LRM 6.1, Ada95 LRM 6.1
- Ada83 LRM 7.1, Ada95 LRM 7.1
- Ada83 LRM 7.4, Ada95 LRM 7.3
- Ada83 LRM 8.5, Ada95 LRM 8.5
- Ada83 LRM 9.5, Ada95 LRM 9.5
- Ada83 LRM 10.2, Ada95 LRM 10.1.3
- Ada83 LRM 112.1, Ada95 LRM 12.1
- Ada83 LRM 12.3, Ada95 LRM 12.3
Function Names
function Names (Declaration : in Asis.Declaration) return Asis.Entity_Name_Definition_List;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:
- Full-type, subtype, incomplete-type, and private-type declarations, (Ada83 LRM 3.3.1, 3.3.2, 3.8.1, and 7.4, Ada95 LRM 3.2.1, 3.2.2, 3.10.1, and 7.3)
- Enumeration-literal specifications (Ada83 LRM 3.5.1, Ada95 LRM 3.5.1)
- For-loop parameter specifications (Ada83 LRM 5.5, Ada95 LRM 5.5)
- Subprogram declarations and bodies (Ada83 LRM 6.1, 6.3, Ada95 LRM 6.1 and 6.3)
- Package specifications and package bodies (Ada83 LRM 7.1, 7.3, Ada95 LRM 7.1 and 7.2)
- Renaming declarations (Ada83 LRM 8.5, Ada95 LRM 8.5)
- Task and task-type specifications and bodies (Ada83 LRM 9.1, Ada95 LRM 9.1)
- Task-entry declarations (Ada83 LRM 9.5, Ada95 LRM 9.5)
- Subunits of compilation units (Ada83 LRM 10.2, Ada95 LRM 10.1.3)
- Generic declarations (Ada83 LRM 12.1, Ada95 LRM 12.1)
- Generic instantiations (Ada83 LRM 12.3, Ada95 LRM 12.3)
The following Ada constructs can return a name list with multiple entries:
- Object and number declarations (Ada83 LRM 3.2, Ada95 LRM 3.3)
- Component declarations (Ada83 LRM 3.7, Ada95 LRM 3.8)
- Discriminant specifications (Ada83 LRM 3.7.1, Ada95 LRM 3.7)
- Subprogram parameter specifications (Ada83 LRM 6.1, Ada95 LRM 6.1)
- Deferred-constant declarations (Ada83 LRM 7.4, Ada95 LRM 7.3)
- Exception declarations (Ada83 LRM 11.1, Ada95 LRM 11.1)
- Generic-formal object declarations (Ada83 LRM 12.1, Ada95 LRM 12.1)
The specific declaration kinds associated with the above language components are shown by the following tables:
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:
- The source code included only a single name
- The ASIS implementation normalizes multiple-object declarations into an equivalent series of corresponding single-object declarations (Ada83 LRM 3.2
(10), Ada95 LRM 3.3). See package Environment, "Normalization of Parameter Lists" for more details.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.
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
Declaration : in Asis.Declaration;Specifies the declaration for which the names should be returned. The declaration must be of the following kind:
Element_Kinds
A_Declaration
return Asis.Entity_Name_Definition_List;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
John, Paul : Person_Name; Frank : Person_Name;If the ASIS implementation normalizes multiple-name lists:
- John, Paul, and Frank are each returned in single-name lists
If the ASIS implementation does not normalize multiple-name lists:
- John and Paul will be returned in a multiple-name list (with two entries)
- Frank will be returned in a single-name list
Cross-References
- function Environment.Call_Parameters_Normalized
- function Expressions.Name
- function Expressions.Operator_Kind
- "Determining Declaration Kinds and Names"
- package Environment, "Normalization of Parameter Lists"
- Ada83 LRM 3.2, Ada95 LRM 3.3
- Ada83 LRM 3.7, Ada95 LRM 3.8
- Ada83 LRM 3.7.1, Ada95 LRM 3.7
- Ada83 LRM 6.1, Ada95 LRM 6.1
- Ada83 LRM 7.4, Ada95 LRM 7.3
Function Object_Declaration_Definition
function Object_Declaration_Definition (Declaration : in Asis.Declaration) return Asis.Type_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:
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
Declaration : in Asis.Declaration;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
return Asis.Type_Definition;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
- function Corresponding_Constant_Declaration
- function Initial_Value
- function Is_Constant
- function Is_Initialized
- function Is_Variable
- function Type_Definitions.Component_Subtype_Indication
Function Origin
function Origin (Declaration : in Asis.Declaration) return Asis_Declarations.Declaration_Origins;Expanded Name Asis.Declarations.Origin
Returns the origin of the specified declaration.
Description
Declaration origins are shown in the table below:
Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the origin should be returned. The declaration must be of the following kind:
Element_Kinds
A_Declaration
return Asis_Declarations.Declaration_Origins;Returns the origin of the specified declaration. If an unexpected element is specified, Not_A_Declaration is returned.
Errors
Examples
Cross-References
Function Package_Body_Block
function Package_Body_Block (Declaration : in Asis.Declaration) return Asis.Statement;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:
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.
Information Desired Calls to Use
declarative_part Statements.Declarative_Items
sequence_of_statements Statements.Block_Body-
_Statements
exception_handler Statements.Block_Exception-
_Handlers
Parameters
Declaration : in Asis.Declaration;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
return Asis.Statement;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
- function Private_Part_Declarative_Items
- function Visible_Part_Declarative_Items
- function Compilation_Units.Unit_Declaration
- function Statements.Block_Body_Statements
- function Statements.Block_Exception_Handlers
- function Statements.Declarative_Items
- "Processing Package Specifications and Body Blocks"
- package Statements, "Determining Statement Kind"
- Ada83 LRM 7.1, Ada95 LRM 7.1
Function Parameter_Mode_Kind
function Parameter_Mode_Kind (Declaration : in Asis.Parameter_Specification) return Asis_Declarations. Parameter_Mode_Kinds;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:
parameter_specification ::=
identifier_list : mode type_mark
[:= expression]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
Declaration : in Asis.Parameter_Specification;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
return Asis_Declarations.Parameter_Mode_Kinds;Returns the parameter-mode kind associated with the specified declaration.
Errors
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:
- function Names
- type Parameter_Mode_Kinds
- function Parameters
- function Environment.Default_In_Mode_Supported
Type Parameter_Mode_Kinds
type Parameter_Mode_Kinds is (...);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
A_Default_In_ModeIndicates 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.
An_In_ModeIndicates that the parameter has a mode of in (Ada83 LRM 6.2(3), Ada95 LRM 6.2).
An_In_Out_ModeIndicates that the parameter has a mode of in out (Ada83 LRM 6.2(4), Ada95 LRM 6.2).
An_Out_ModeIndicates that the parameter has a mode of out (Ada83 LRM 6.2(5), Ada95 LRM 6.2).
Not_A_Parameter_ModeIndicates that in incorrect parameter was provided (which does not have a mode).
Cross-References
Function Parameters
function Parameters (Declaration : in Asis.Declaration) return Asis.Parameter_Specification_List;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:
subprogram_specification ::=
procedure identifier [formal_part]
| function designator [formal_part]
return type_markTask-entry declarations are defined by the following syntax:
entry_declaration ::=
entry identifier [(discrete_range)]
[formal_part];The formal part of the above definitions is defined by the following syntax:
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
Declaration : in Asis.Declaration;Specifies the subprogram or entry for which the parameter list should be returned. The declaration must be of the following kinds:
return Asis.Parameter_Specification_List;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
function "+" (Left, Right : in Declaration_Kinds) return Boolean;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
- function Initial_Value
- function Is_Initialized
- function Names
- function Parameter_Mode_Kind
- function Type_Mark
Function Private_Part_Declarative_Items
function Private_Part_Declarative_Items (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Declarative_Item_List;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:
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.
Parameters
Declaration : in Asis.Declaration;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:
Include_Pragmas : in Boolean := False;Specifies whether pragma definitions should be included in the returned list.
return Asis.Declarative_Item_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
- function Package_Body_Block
- function Visible_Part_Declarative_Items
- function Elements.Argument_Associations
- function Elements.Is_Predefined
- function Elements.Name
- function Elements.Pragma_Kind
- function Elements.Pragmas
- function Expressions.Named_Packages
- function Representation_Clauses.Kind
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |