![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Generic_Formal_Parameters
function Generic_Formal_Parameters (Declaration : in Asis.Declaration; Include_Pragmas : in Boolean := False) return Asis.Generic_Formal_Parameter_List;Expanded Name Asis.Declarations.Generic_Formal_Parameters
Returns a list of all generic-formal parameters and, optionally, pragmas that are present in the specified generic function, package, or procedure declaration.
Description
Generic package and subprogram specifications are 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_formal_part ::= generic
{generic_parameter_declaration}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 a list of the generic-parameter declarations for the specified generic specification.
The list of parameters and pragmas is returned in their order of appearance in the source code.
Parameters
Declaration : in Asis.Declaration;Specifies the declaration for which the formal parameters should be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Generic_Function_Declaration
A_Generic_Package_Declaration
A_Generic_Procedure_Declaration
Include_Pragmas : in Boolean := False;Specifies whether pragma definitions should be included in the returned list.
return Asis.Generic_Formal_Parameter_List;The returned list contains elements of the following kinds
:
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 and types:
- function Corresponding_Generic_Element
- function Enclosing_Generic
- function Generic_Formal_Subprogram_Default
- type Generic_Formal_Subprogram_Default_Kind
- function Is_Generic
- function Is_Generic_Formal
- function Is_Part_Of_Instance
Function Generic_Formal_Subprogram_Default
function Generic_Formal_Subprogram_Default (Declaration : in Asis.Generic_Formal_Parameter) return Asis.Expression;Expanded Name Asis.Declarations.Generic_Formal_Subprogram_Default
Returns the name following the reserved word is for the specified generic-formal-subprogram parameter declaration.
Description
Generic package and subprogram 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 name following the reserved word is for the specified generic-parameter declaration.
If the Generic_Formal_Subprogram_Default_Kind for the specified declaration is not A_Name, Asis_Inappropriate_Element is raised and Environment.Status is set to Value_Error. This function never returns Asis.Nil_Element.
Parameters
Declaration : in Asis.Generic_Formal_Parameter;Specifies the declaration for which the name following the reserved word is should be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Generic_Formal_Function_Declaration
A_Generic_Formal_Procedure_Declaration
Additionally, the Generic_Formal_Subprogram_Default_Kinds of the declaration must be A_Name.
return Asis.Expression;The returned element is of the following kinds:
Element_Kinds Expression_Kinds
An_Expression 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 the Generic_Formal_Subprogram-
_Default_Kind for the parameter is not A_Name.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.
Examples
Cross-References
- function Corresponding_Generic_Element
- function Enclosing_Generic
- function Generic_Formal_Parameters
- function Generic_Formal_Subprogram_Default_Kind
- function Is_Generic
- function Is_Generic_Formal
- function Is_Part_Of_Instance
Function Generic_Formal_Subprogram_Default-
_Kind
function Generic_Formal_Subprogram_Default_Kind (Declaration : in Asis.Generic_Formal_Parameter) return Asis_Declarations. Generic_Formal_Subprogram_Default_Kinds;Expanded Name Asis.Declarations.Generic_Formal_Subprogram-
_Default_KindReturns the kind of the default generic-formal subprogram for the specified declaration.
Description
Generic package and subprogram 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 subprogram default kind specified after the reserved word is for the specified generic-parameter
declaration.Parameters
Declaration : in Asis.Generic_Formal_Parameter;Specifies the declaration for which the generic-formal subprogram default kind should be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Generic_Formal_Function_Declaration
A_Generic_Formal_Procedure_Declaration
return Asis_Declarations.Generic_Formal_Subprogram_Default_Kinds;Returns the formal subprogram default kind for all elements in the above table or Not_A_Generic_Formal_Subprogram_Default for all other elements.
Errors
Examples
Cross-References
Related subprograms and types:
- function Corresponding_Generic_Element
- function Enclosing_Generic
- function Generic_Formal_Parameters
- function Generic_Formal_Subprogram_Default
- type Generic_Formal_Subprogram_Default_Kinds
- function Is_Generic
- function Is_Generic_Formal
- function Is_Part_Of_Instance
Type Generic_Formal_Subprogram_Default-
_Kinds
type Generic_Formal_Subprogram_Default_Kinds is (...);Expanded Name Asis.Declarations.Generic_Formal_Subprogram-
_Default_KindsDescribes the kinds of generic-formal subprograms that can appear in a generic specification after the reserved word is.
Description
Generic package and subprogram 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 type describes the kinds of default parameters that can appear after the subprogram specification.
Enumerations
A_BoxIndicates that box notation follows the reserved word is (Ada83 LRM 12.1.3(2), Ada95 LRM 12.1).
A_NameIndicates that a subprogram or entry name follows the reserved word is (Ada83 LRM 12.1.3(2), Ada95 LRM 12.1).
NoneIndicates that neither box notation nor a subprogram or entry name follows the reserved word is.
Not_A_Generic_Formal_Subprogram_DefaultIndicates that the parameter does not represent a generic-formal subprogram default declaration.
Cross-References
Function Generic_Parameters
function Generic_Parameters (Declaration : in Asis.Declaration; Normalized : in Boolean := False) return Asis.Association_List;Expanded Name Asis.Declarations.Generic_Parameters
Returns a list of the parameter associations associated with the specified generic-instantiation declaration.
Description
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[generic_actual_part];
generic_actual_part ::=
(generic_association {, generic_association})This function returns the generic actual part of the specified generic instantiation.
The Statements.Formal_Parameter function can be used with elements of the returned association list to obtain information on the formal parameters. The Statements.Actual_Parameter function can be used to obtain information on the actual
parameters.The generic parameters can be obtained in unnormalized or normalized form:
- An unnormalized list contains only those arguments that appear in the source and returns them in their order of appearance.
- A normalized list also contains defaulted parameters and is ordered according to the declaration of the formal parameters for the generic definition. All normalized list associations are Expressions.Is_Normalized. Normalized default associations are also Is_Part_Of_Implicit.
Because of variations in Ada library content, some ASIS implementations are not able to present an identical view of parameter lists with respect to the use of named associations. An ASIS implementation can choose to always return parameter lists in normalized format. To determine whether the ASIS implementation always normalizes parameter lists, and ignores the value provided by the Normalize argument, use the Environment.Generic_Parameters_Normalized function.
An ASIS implementation may choose to always include defaulted parameters in the parameter list. If the implementation always includes defaulted parameters, the Normalized parameter is always assumed to be True. In this case, the Statements.Actual_Parameter values derived from the normalized and unnormalized lists will be the same, although the order can differ if the instantiation order does not match the declaration order. To determine whether the ASIS implementation always includes defaulted parameters, use the Environment.Generic_Parameters_Include_Defaults function.
For more information on normalization of parameter lists and default processing, see "Normalization of Parameter Lists" and "Default Parameter Processing" in package Environment.
Parameters
Declaration : in Asis.Declaration;Specifies the generic instantiation for which the parameter list should be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Instantiation
A_Package_Instantiation
A_Procedure_Instantiation
Normalized : in Boolean := False;Specifies whether the parameter list should be returned in normalized or unnormalized form.
return Asis.Association_List;The returned list contains elements of the following kind:
Element_Kinds
A_Parameter_Association
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 Generic_Unit_Name
- function Is_Generic_Instantiation
- function Is_Part_Of_Implicit
- function Expressions.Is_Normalized
- function Environment.Generic_Parameters_Include_Defaults
- function Environment.Generic_Parameters_Normalized
- function Statements.Actual_Parameter
- function Statements.Formal_Parameter
- "Processing Generic Instantiations"
- package Environment, "Default Parameter Processing"
- package Environment, "Normalization of Parameter Lists"
- Ada83 LRM 12.3, Ada95 LRM 12.3
Function Generic_Unit_Name
function Generic_Unit_Name (Declaration : in Asis.Declaration) return Asis.Expression;Expanded Name Asis.Declarations.Generic_Unit_Name
Returns the expression representing the name following the reserved word new in the specified generic-instantiation
declaration.Description
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 isThis function returns the generic package name, generic procedure name, or generic function name of the specified generic instantiation.
Parameters
Declaration : in Asis.Declaration;Specifies the generic instantiation for which the name should be returned. The declaration must be of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Function_Instantiation
A_Package_Instantiation
A_Procedure_Instantiation
return Asis.Expression;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.
Examples
Cross-References
- "Processing Generic Instantiations"
- Ada83 LRM 12.3, Ada95 LRM 12.3
Function Implicit_Attribute_Functions
function Implicit_Attribute_Functions (Type_Definition : in Asis.Type_Definition) return Asis.Declaration_List;Expanded Name Asis.Declarations.Implicit_Attribute_Functions
Returns a list of the a predefined attribute functions that have been implicitly declared for the specified type definition.
Description
If no attribute functions are predefined for the specified type (Ada83 LRM 3.5.5, Ada95 LRM 3.5.5), Asis.Nil_Element_List is returned.
Based on the type, a list containing none, some, or all of the following function declarations is returned:
function Image (X : in <type>) return String;function Pos (X : in <type>) return <universal_integer>;function Pred (X : in <type>) return <type>;function Succ (X : in <type>) return <type>;function Val (X : in <universal_integer>) return <type>;function Value (X : in String) return <type>;A vendor can provide implementation-defined attributes. Vendors are encouraged to return declarations for these functions. Rational Apex does not contain any implementation-defined attributes.
Attributes that are not functions are represented by elements having and expression kind of An_Attribute. See package Expressions, "Processing Attributes," for information on processing attributes that appear in expressions.
Any ASIS subprogram that accepts an Element_Kinds of A_Function_Declaration can be used for further analysis.
Each returned function declaration will be Is_Part_Of_Implicit.
The enclosing element for each of the returned function declarations is the specified type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type for which the implicitly specified attribute functions 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
return Asis.Declaration_List;The returned list contains elements of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Declaration A_Function_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_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
- function Corresponding_Equality_Operator
- function Corresponding_Type
- function Implicit_Derived_Subprograms
- function Implicit_Predefined_Operators
- function Is_Part_Of_Derived
- function Is_Part_Of_Implicit
- function Subprogram_Derivation
- function Type_Operators
Function Implicit_Derived_Subprograms
function Implicit_Derived_Subprograms (Type_Definition : in Asis.Type_Definition) return Asis.Declaration_List;Expanded Name Asis.Declarations.Implicit_Derived_Subprograms
Returns a list of the derived subprograms that have been implicitly declared for the specified derived-type definition.
Description
If there are no derived subprograms for the specified derived type, Asis.Nil_Element_List is returned.
The list does not include hidden derived subprograms (Ada83 LRM 8.3(17), Ada95 LRM 8.3). See "Processing Implicit and Derived Operations" for more information on hidden derived subprograms.
Each returned subprogram declaration will be Is_Part_Of-
_Implicit.The name of each returned subprogram declaration can be obtained by calling the Names function. The kind of operator defined by the subprogram can be obtained by calling Expressions.Operator_Kind with the element returned from Names.
The enclosing element for each of the returned subprogram declarations is the specified type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the derived type for which the derived subprograms should be returned. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition
return Asis.Declaration_List;The returned list contains elements of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Declaration A_Function_Declaration
A_Procedure_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_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
- function Corresponding_Equality_Operator
- function Corresponding_Type
- function Implicit_Attribute_Functions
- function Implicit_Predefined_Operators
- function Is_Part_Of_Derived
- function Is_Part_Of_Implicit
- function Subprogram_Derivation
- function Type_Operators
- "Obtaining Derived Subprograms"
- Ada83 LRM 8.3, Ada95 LRM
8.3
Function Implicit_Predefined_Operators
function Implicit_Predefined_Operators (Type_Definition : in Asis.Type_Definition) return Asis.Declaration_List;Expanded Name Asis.Declarations.Implicit_Predefined_Operators
Returns a list of the operators (functions) that have been implicitly defined for the specified type definition.
Description
The returned list includes only those operators appropriate for the type (Ada83 LRM , Ada95 LRM 4.5.1 through Ada83 LRM 4.5.7, Ada95 LRM 4.6). If no operators are defined, a Nil_Element_List is returned.
The list does not include hidden predefined operators or the programmer-defined overloads that cause such hiding (Ada83 LRM 8.3(17), Ada95 LRM 8.3). See "Processing Implicit and Derived Operations" for more information on hidden derived subprograms.
Each returned subprogram declaration will be Is_Part_Of- _Implicit and Is_Operator_Definition.
The name of each returned function declaration can be obtained by calling the Names function. The kind of operator defined by the subprogram can be obtained by calling Expressions.Operator_Kind with the element returned from Names.
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 of the returned subprogram declarations is the specified type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the derived type for which the implicitly declared operators should be returned. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition
return Asis.Declaration_List;The returned list contains elements of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Declaration A_Function_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_Failed is raised and Environment.Status is set to Obsolete_Reference_Error if a parameter is part of an obsolete compilation unit.
Examples
Cross-References
- function Corresponding_Equality_Operator
- function Corresponding_Type
- function Implicit_Attribute_Functions
- function Implicit_Derived_Subprograms
- function Is_Part_Of_Derived
- function Is_Part_Of_Implicit
- function Subprogram_Derivation
- function Type_Operators
- "Obtaining Implicit Operations"
- Ada83 LRM 4.5.1, Ada95 LRM
4.5.1 through Ada83 LRM 4.5.7, Ada95 LRM 4.6- Ada83 LRM 8.3, Ada95 LRM
8.3
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |