![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Function Is_Discriminated
function Is_Discriminated (Type_Definition : in Asis.Type_Definition) return Boolean;Expanded Name Asis.Type_Definitions.Is_Discriminated
Returns a Boolean value indicating whether the specified type definition is a record-type definition with discriminants.
Description
Full-type definitions 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;To declare a record, the type definition must be a record-type definition.
Record-type definitions are partially defined by the following syntax:
Ada83 LRM 3.7, Ada95 LRM 3.8
record_type_definition ::=
record
component_list
end recordThis function returns True if the specified full-type declaration is a record-type definition with a discriminant part.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the record-type definition that should be queried. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Record_Type_Definition
return Boolean;Returns True for all elements in the above table that also contain discriminants and False for all other elements.
Errors
Examples
Cross-References
Function Is_Predefined
function Is_Predefined (Type_Definition : in Asis.Type_Definition) return Boolean;Expanded Name Asis.Type_Definitions.Is_Predefined
Returns a Boolean value indicating whether the specified type definition is the definition of a type in package Standard.
Description
Predefined types are those types declared in package Standard (Ada83 LRM 8.6, Ada95 LRM A.1and Annex C). Package Standard must include Ada predefined types, but it can also include other types defined by the compiler vendor. The Ada predefined types are:
- Boolean
- Integer
- Float
- Character
- Natural
- Positive
- String
- Duration
Additionally, when package Standard is examined by an ASIS application, it will always include three explicit type definitions not available to Ada programs:
- Universal_Fixed (Ada83 LRM 3.5.9, Ada95 LRM 3.5.9)
- Universal_Integer (Ada83 LRM 3.5.4, Ada95 LRM 3.5.4)
- Universal_Real (Ada83 LRM 3.5.6, Ada95 LRM 3.5.6)
These universal declarations are not Declarations.Is_Part_Of-_Implicit.
This function returns True for all type definitions from package Standard and False for all other type definitions.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition that should be queried. The type definition must be of the following kind:
Element_Kinds
A_Type_Definition
return Boolean;Returns True for all elements in the above table that are also declarations in package Standard and False for all other elements.
Errors
Examples
Cross-References
Function Kind
function Kind (Type_Definition : in Asis.Type_Definition) return Type_Definition_Kinds;Expanded Name Asis.Type_Definitions.Kind
Returns the kinds of the specified type definition.
Description
This function returns the kind of the specified type definition.
Elements of the kind A_Type_Definition are returned from the following functions:
- Ground_Type
- Last_Constraint
- Last_Subtype
- Parent_Type
- Type_Structure
- Declarations.Corresponding_Type
- Declarations.Object_Declaration_Definition
- Declarations.Type_Declaration_Definition
- Expressions.Expression_Associated_Type
- Expressions.Expression_Type
The functions in this package are used primarily for traversing the type hierarchy. The functions in package Declarations are used to analyze anonymous array declarations as well as type and subtype declarations; they are also used for traversal between private-type declarations and their associated full-type declarations. The functions in package Expressions are used for obtaining the type of an expression.
Description (continued)
Elements of the kind A_Type_Definition are also returned in Declarative_Item_List. These lists are returned from the following functions:
- Task_Type_Declarative_Items
- Declarations.Private_Part_Declarative_Items
- Declarations.Task_Declaration_Declarative_Items
- Declarations.Visible_Part_Declarative_Items
- Statements.Declarative_Items
You can use the Declarations.Is_Type_Declaration function to determine whether a particular element of a Declarative_Item-_List represents a type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition that should be queried. The type definition must be of the following kind:
Element_Kinds
A_Type_Definition
return Type_Definition_Kinds;Returns the kind of the specified type definition. If an unexpected element is specified, Not_A_Type_Definition is returned.
Errors
Examples
Cross-References
Related subprograms and types:
- function Base_Type
- function Ground_Type
- function Last_Constraint
- function Last_Subtype
- function Parent_Type
- type Type_Definition_Kinds
Function Last_Constraint
function Last_Constraint (Type_Definition : in Asis.Type_Definition) return Asis.Type_Definition;Expanded Name Asis.Type_Definitions.Last_Constraint
Returns the type definition of the last type mark that includes a constraint for the specified subtype definition.
Description
Subtype declarations are partially defined by the following syntax:
Ada83 LRM 3.3.2, Ada95 LRM 3.2.2
subtype_declaration ::=
subtype identifier is subtype_indication;
subtype_indication ::= type_mark [constraint]This function recursively unwinds subtyping to arrive at a type definition that is either the base type or a subtype that imposes an explicit constraint.
If the specified type definition is not a subtype declaration, the function acts as an identity function and returns the argument.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition that should be queried. The type definition must be of the following kind:
Element_Kinds
A_Type_Definition
return Asis.Type_Definition;The returned element is of the following kind:
Element_Kinds
A_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.
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 Base_Type
- function Ground_Type
- function Last_Subtype
- function Parent_Subtype
- function Parent_Type
Function Last_Subtype
function Last_Subtype (Type_Definition : in Asis.Type_Definition) return Asis.Type_Definition;Expanded Name Asis.Type_Definitions.Last_Subtype
Returns the type definition of the type mark for the specified subtype definition.
Description
Subtype declarations are partially defined by the following syntax:
Ada83 LRM 3.3.2, Ada95 LRM 3.2.2
subtype_declaration ::=
subtype identifier is subtype_indication;
subtype_indication ::= type_mark [constraint]The function unwinds subtyping one step at a time to return a type definition that is either the base type or a subtype that imposes a constraint.
If the specified type definition is not a subtype declaration, the function acts as an identity function and returns the specified type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition that should be queried. The type definition must be of the following kind:
Element_Kinds
A_Type_Definition
return Asis.Type_Definition;The returned element is of the following kind:
Element_Kinds
A_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.
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 Base_Type
- function Ground_Type
- function Last_Constraint
- function Parent_Subtype
- function Parent_Type
Function Lower_Bound
function Lower_Bound (Constraint : in Asis.Range_Constraint) return Asis.Expression;Expanded Name Asis.Type_Definitions.Lower_Bound
Returns the simple expression that represents the lower bound of the specified range constraint or discrete range constraint.
Description
Range constraints are partially defined by the following syntax:
Ada83 LRM 3.5, Ada95 LRM 3.5
range_constraint ::= range range
range ::= range_attribute
| simple_expressions .. simple_expressionDiscrete ranges are defined by the following syntax:
Ada83 LRM 3.6, Ada95 LRM 3.6
discrete_range ::=
discrete_subtype_indication | rangeThis function returns the lower-bound simple expression of the specified range constraint or discrete range.
Parameters
Constraint : in Asis.Range_Constraint;Specifies the range constraint or discrete range that should be queried. The constraint must be of the following kinds:
Element_Kinds Constraint_Kinds Discrete_Range-_Kind
A_Constraint A_Simple_Range ——
A_Discrete_Range A_Simple_Range A_Simple_Range
return Asis.Expression;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.
Examples
Cross-References
- function Choice_Discrete_Range
- function Discrete_Range_Kind
- function Discrete_Ranges
- function Fixed_Point_Range_Constraint
- function Floating_Point_Range_Constraint
- function Integer_Constraint
- function Upper_Bound
- "Processing Discrete Ranges"
- package Expressions, "Processing Expressions"
- Ada83 LRM 3.5, Ada95 LRM 3.5
- Ada83 LRM 3.6, Ada95 LRM 3.6
Function Parent_Subtype
function Parent_Subtype (Type_Definition : in Asis.Type_Definition) return Asis.Subtype_Indication;Expanded Name Asis.Type_Definitions.Parent_Subtype
Returns the subtype indication associated with the specified derived-type definition.
Description
Derived-type definitions are defined by the following syntax:
Ada83 LRM 3.4, Ada95 LRM 3.4
derived_type_definition ::=
new subtype_indicationThis function returns the subtype indication for the specified derived-type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the derived-type definition that should be queried. The type definitions must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition
return Asis.Subtype_Indication;The returned element is of the following kind:
Element_Kinds
A_Subtype_Indication
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 the Type, Subtype, and Derived-Type Hierarchy"
- Ada83 LRM
3.3.2, Ada95 LRM 3.2.2- Ada83 LRM 3.4, Ada95 LRM 3.4
Function Parent_Type
function Parent_Type (Type_Definition : in Asis.Type_Definition) return Asis.Type_Definition;Expanded Name Asis.Type_Definitions.Parent_Type
Returns the parent-type definition of the specified derived-type definition.
Description
Derived-type definitions are defined by the following syntax:
Ada83 LRM 3.4, Ada95 LRM 3.4
derived_type_definition ::=
new subtype_indicationA derived-type definition defines a new (base) type whose characteristics are derived from those of a parent type (Ada83 LRM 3.4, Ada95 LRM 3.4).
This function returns the parent-type definition for a derived-type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the derived-type definition that should be queried. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition
return Asis.Type_Definition;The returned element is of the following kind:
Element_Kinds
A_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.
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 Base_Type
- function Ground_Type
- function Is_Predefined
- function Last_Constraint
- function Last_Subtype
- function Parent_Subtype
- function Type_Definition_Declaration
- function Type_Structure
Function Range_Attribute
function Range_Attribute (Constraint : in Asis.Range_Constraint) return Asis.Expression;Expanded Name Asis.Type_Definitions.Range_Attribute
Returns the range attribute from the specified range constraint or discrete range.
Description
Range constraints are partially defined by the following syntax:
Ada83 LRM 3.5, Ada95 LRM 3.5
range_constraint ::= range range
range ::= range_attribute
| simple_expressions .. simple_expressionDiscrete ranges are defined by the following syntax:
Ada83 LRM 3.6, Ada95 LRM 3.6
discrete_range ::=
discrete_subtype_indication | rangeThis function returns the range attribute from the specified range constraint or discrete range.
Parameters
Constraint : in Asis.Range_Constraint;Specifies the range constraint or discrete range that should be queried. The constraint must be of the following kinds:
Element_Kinds Constraint_Kinds
A_Constraint A_Range_Attribute
A_Discrete_Range A_Range_Attribute
return Asis.Expression;The returned element is of the following kinds:
Element_Kinds Expression_Kinds
An_Expression An_Attribute
The An_Attribute referenced by the returned element is always 'Range.
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 Choice_Discrete_Range
- function Discrete_Ranges
- function Integer_Constraint
- function Subtype_Constraint
- function Expressions.Attribute_Designator_Argument
- function Expressions.Attribute_Designator_Kind
- function Expressions.Attribute_Designator_Name
- function Expressions.In_Range_Operation-
_Right_Hand_Side- function Expressions.Prefix
- "Processing Index and Range Constraints"
- "Processing Discrete Ranges"
- Ada83 LRM 3.5, Ada95 LRM 3.5
- Ada83 LRM 3.6, Ada95 LRM 3.6
Function Real_Type_Constraint
function Real_Type_Constraint (Type_Definition : in Asis.Type_Definition) return Asis.Constraint;Expanded Name Asis.Type_Definitions.Real_Type_Constraint
Returns the constraint from the specified fixed-point or floating-point type definition.
Description
Real-type definitions are defined by the following syntax:
Ada83 LRM 3.5.6, Ada95 LRM 3.5.6
real_type_definition ::=
floating_point_constraint
| fixed_point_constraintFloating-point constraints are partially defined by the following syntax:
Ada83 LRM 3.5.7, Ada95 LRM 3.5.7
floating_point_constraint ::=
floating_accuracy_definition
[range_constraint]Fixed-point constraints are defined by the following syntax:
Ada83 LRM 3.5.9, Ada95 LRM 3.5.9
fixed_point_constraint ::=
fixed_accuracy_definition
[range_constraint]This function returns the floating-point constraint from the specified floating-point real-type definition or the fixed-point constraint from the specified fixed-point real-type definition.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the fixed-point or floating-point type definition that should be queried. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Fixed_Type_Definition
A_Float_Type_Definition
return Asis.Constraint;The returned element is of the following kinds:
Element_Kinds Constraint_Kinds
A_Constraint A_Fixed_Point_Constraint
A_Floating_Point_Constraint
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 Constraint_Kind
- function Fixed_Accuracy_Definition
- function Fixed_Point_Range_Constraint
- function Floating_Accuracy_Definition
- function Floating_Point_Range_Constraint
- "Processing Index and Range Constraints"
- Ada83 LRM 3.5.6, Ada95 LRM 3.5.6
- Ada83 LRM 3.5.7, Ada95 LRM 3.5.7
- Ada83 LRM 3.5.9, Ada95 LRM 3.5.9
Function Record_Components
function Record_Components (Type_Definition : in Asis.Type_Definition; Include_Pragmas : in Boolean := False) return Asis.Record_Component_List;Expanded Name Asis.Type_Definitions.Record_Components
Returns a list of the all components and, optionally, pragmas that are present in the specified record-type definition.
Description
Record-type definitions are defined by the following syntax:
Ada83 LRM 3.7, Ada95 LRM 3.8
record_type_definition ::=
record
component_list
end record
component_list ::=
component_declaration
{component_declaration}
| {component_declaration} variant_part
| null;This function returns the component-list for the specified record-type definition.
The components and pragmas are returned in their order of appearance in the source code. A_Pragma elements do not appear in the list unless Include_Pragmas has been specified as True.
The list does not include any implementation-defined components (Ada83 LRM 13.4(8), Ada95 LRM 13.5.1). You can obtain these components with the Implicit_Components function.
Description (continued)
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the record-type definition that should be queried. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition1 A_Record_Type_Definition
1 Whose parent type is a record type.
Include_Pragmas : in Boolean := False;Specifies whether pragma definitions should be included in the returned list.
return Asis.Record_Component_List;The returned list contains elements of the following kinds:
Element_Kinds Declaration_Kinds
A_Declaration A_Component_Declaration
A_Null_Component ——
A_Pragma ——
A_Variant_Part ——
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 Component_Kind
- function Corresponding_Discriminant_Simple_Name
- function Implicit_Components
- function Variant_Components
- function Variants
- function Declarations.Initial_Value
- function Declarations.Is_Initialized
- function Elements.Argument_Associations
- function Elements.Is_Predefined
- function Elements.Name
- function Elements.Pragma_Kind
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |