![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Package Representation_Clauses Package Representation_Clauses provides access to Ada representation clauses. Representation clauses are defined by the following Ada constructs:
- Length Clauses (Ada83 LRM 13.2, Ada95 LRM 13.3)
- Enumeration Representation Clauses (Ada83 LRM 13.3, Ada95 LRM 13.4)
- Record Representation Clauses (Ada83 LRM 13.4, Ada95 LRM 13.5.1)
- Address Clauses (Ada83 LRM 13.5, Ada95 LRM 13.3)
For more information, click on a topic:
The subprograms in package Representation_Clauses fall into several functional groups, as shown below.
To see detailed referenced information, click on the name of a subprogram:
Key Concepts for Package Representation_ClausesPackage Representation_Clauses provides subprograms that return semantic information from representation clauses. Processing is divided into the following categories. To see more information, click on a topic:
- "Determining Representation Kind"
- "Processing Length Clauses"
- "Processing Enumeration Representation Clauses"
- "Processing Record Representation Clauses"
- "Processing Address Clauses"
Determining Representation Kind
Representation clauses are defined by the following syntax:
Ada83 LRM 13.1, Ada95 LRM 13.1
representation_clause ::=
type_representation_clause | address_clausetype_representation_clause ::= length_clause
| enumeration_representation_clause
| record_representation_clauseA representation clause is identified by an Element_Kind of A_Representation_Clause. To determine the kind of representation clause represented by an element, use the Kind function. Once the kind has been determined, appropriate other functions in this package can be called to obtain more detailed semantic information on the clause.
Elements representing representation clauses are returned in a Declarative_Item_List by the following functions:
- Declarations.Private_Part_Declarative_Items
- Declarations.Task_Declaration_Declarative_Items
- Declarations.Visible_Part_Declarative_Items
- Statements.Declarative_Items
- Type_Definitions.Task_Type_Declarative_Items
Processing Length Clauses
Length clauses are defined by the following syntax:
Ada83 LRM 13.2, Ada95 LRM 13.3
length_clause ::=
for attribute use simple_expression;Ada83 LRM 4.1.4, Ada95 LRM 4.1.4
attribute ::= prefix'attribute_designator
The components and related information can be obtained by calling the subprograms in the following table
:
Processing Enumeration Representation Clauses
Enumeration representation clauses are defined by the following syntax:
Ada83 LRM 13.3, Ada95 LRM 13.4
enumeration_representation_clause ::=
for type_simple_name use aggregate;The components and related information can be obtained by calling the subprograms in the following table
:
Processing Record Representation Clauses
Record representation clauses are defined by the following syntax:
Ada83 LRM 13.4, Ada95 LRM 13.5.1
record_representation_clause ::=
for type_simple_name use
record [alignment_clause]
{component_clause}
end record;alignment_clause ::=
at mod static_simple_expression;component_clause ::=
component_name at static_simple_expression
range static_range;In addition to the above syntactic components, the pragma Pack can be applied to a record.
The components and related information can be obtained by calling the subprograms in the following table:
Processing Address Clauses
Address clauses are defined by the following syntax:
Ada83 LRM 13.5, Ada95 LRM 13.3
address_clause ::=
for simple_name use at simple_expression;The components and related information can be obtained by calling the subprograms in the following table:
Function Address_Clause_Associated_Declaration
function Address_Clause_Associated_Declaration (Clause : in Asis.Representation_Clause) return Asis.Declaration;Expanded Name Asis.Representation_Clauses
.Address_Clause_Associated_DeclarationReturns the declaration of the entity associated with the specified clause.
Description
An address clause is defined by the following syntax:
Ada83 LRM 13.5, Ada95 LRM 13.3
address_clause ::=
for simple_name use at simple_expression;This function returns the declaration of the simple name from the specified address clause.
Subprograms in packages Declarations and Type_Definitions can be used with the result of this function to obtain detailed information about the declaration.
Parameters
Clause : in Asis.Representation_Clause;Specifies the address representation clause for which the declaration should be returned. The clause must be of the following kinds:
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause An_Address_Clause
return Asis.Declaration;The returned element is of the following kind:
Element_Kinds
A_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
- function Address_Clause_Simple_Expression
- function Address_Clause_Simple_Name
- function Associated_Address_Representation
- function Kind
- "Processing Address Clauses"
- Ada83 LRM 13.5, Ada95 LRM 13.3
Function Address_Clause_Simple_Expression
function Address_Clause_Simple_Expression (Clause : in Asis.Representation_Clause) return Asis.Expression;Expanded Name Asis.Representation_Clauses-
.Address_Clause_Simple_ExpressionReturns the address expression associated with the specified clause.
Description
An address clause is defined by the following syntax:
Ada83 LRM 13.5, Ada95 LRM 13.3
address_clause ::=
for simple_name use at simple_expression;This function returns the simple expression from the specified address clause.
Parameters
Clause : in Asis.Representation_Clause;Specifies the representation clause for which the address expression should be returned. The clause must be of the following kinds:
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause An_Address_Clause
return Asis.Expression;
Element_Kinds
An_Expression
The returned element is of the following kind:
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 Address_Clause_Associated_Declaration
- function Address_Clause_Simple_Name
- function Associated_Address_Representation
- function Kind
- "Processing Address Clauses"
- Ada83 LRM 13.5, Ada95 LRM 13.3
Function Address_Clause_Simple_Name
function Address_Clause_Simple_Name (Clause : in Asis.Representation_Clause) return Asis.Simple_Name;Expanded Name Asis.Representation_Clauses-
.Address_Clause_Simple_NameReturns the simple name for the entity represented by the specified clause.
Description
An address clause is defined by the following syntax:
Ada83 LRM 13.5, Ada95 LRM 13.3
address_clause ::=
for simple_name use at simple_expression;This function returns the simple name from the specified address clause.
Parameters
Clause : in Asis.Representation_Clause;Specifies the representation clause for which the simple name should be returned. The clause must be of the following kinds:
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause An_Address_Clause
return Asis.Simple_Name;
Element_Kinds Expression_Kinds
An_Expression A_Simple_Name
The returned element is 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
- function Address_Clause_Associated_Declaration
- function Address_Clause_Simple_Expression
- function Address_Clause_Simple_Name
- function Associated_Address_Representation
- function Kind
- "Processing Address Clauses"
- Ada83 LRM 13.5, Ada95 LRM 13.3
Function Associated_Address_Representation
function Associated_Address_Representation (Name : in Asis.Element) return Asis.Representation_Clause;Expanded Name Asis.Representation_Clauses-
.Associated_Address_RepresentationReturns the address representation clause associated with the specified name.
Description
Representation clauses are defined by the following syntax:
Ada83 LRM 13.1, Ada95 LRM 13.1
representation_clause ::=
type_representation_clause | address_clauseThis function returns any address clause associated with the specified name.
If an address clause is not associated with the name, Asis.Nil_Element is returned.
The returned element can be used as a parameter in the other subprograms that provide address-clause information.
Parameters
Name : in Asis.Element;Specifies the element for which an address clause should be returned. The name must be of the following kinds:
Element_Kinds Expression_Kinds
An_Entity_Name_Definition A_Simple_Name
An_Operator_Symbol
If any Expression_Kinds but A_Simple_Name is provided, Asis.Nil_Element is returned.
return Asis.Representation_Clause;Returns the address representation clause associated with the name if one exists or Asis.Nil_Element if one does not exist. The returned element is of the following kinds:
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause An_Address_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.
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 Address_Clause_Associated_Declaration
- function Address_Clause_Simple_Expression
- function Address_Clause_Simple_Name
- function Kind
Function Associated_Enumeration_Type-
_Representation
function Associated_Enumeration_Type_Representation (Type_Definition : in Asis.Type_Definition) return Asis.Representation_Clause;Expanded Name Asis.Representation_Clauses-
.Associated_Enumeration_Type_RepresentationReturns the enumeration representation clause associated with the specified type definition.
Description
Enumeration representation clauses are defined by the following syntax:
Ada83 LRM 13.3, Ada95 LRM 13.4
enumeration_representation_clause ::=
for type_simple_name use aggregate;This function returns any enumeration representation clause for the specified type definition (Ada83 LRM 3.3.1, Ada95 LRM 3.2.1).
If enumeration representation clauses are not associated with the type definition, Asis.Nil_Element is returned.
The representation clause returned may be the clause associated with a parent type if the provided type definition is a derived type with no explicit representation. The clause is not Declarations.Is_Part_Of_Implicit (see package Declarations for a description of elements that are implicit). The returned element references the enumeration representation clause for the parent type.
The returned representation clause can be used as a parameter in the other subprograms that provide information on enumeration representation clauses.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition from which an associated enumeration representation clause should be returned. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition An_Enumeration_Type_Definition
A_Derived_Type_Definition
If a derived type definition is specified, the parent type must be an enumeration.
return Asis.Representation_Clause;
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause An_Enumeration_Representation-
_Specification
The returned element is 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.
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 Associated_Enumeration_Type_Representation
- function Associated_Type
- function Enumeration_Representation_Clause_Aggregate
- function Enumeration_Representation_Clause_Type-
_Simple_Name
- "Processing Enumeration Representation Clauses"
- Ada83 LRM 3.3.1, Ada95 LRM 3.2.1
- Ada83 LRM 13.3, Ada95 LRM 13.4
Function Associated_Length_Clause-
_Representations
function Associated_Length_Clause_Representations (Type_Definition : in Asis.Type_Definition) return Asis.Length_Clause_List;Expanded Name Asis.Representation_Clauses-
.Associated_Length_Clause_RepresentationsReturns a list of the length clauses associated with the specified type definition.
Description
Length clauses are defined by the following syntax:
Ada83 LRM 13.2, Ada95 LRM 13.3
length_clause ::=
for attribute use simple_expression;This function returns a list of length clauses for the specified type definition (Ada83 LRM 3.3.1, Ada95 LRM 3.2.1).
If no length clauses are associated with the type definition, Asis.Nil_Element_List is returned.
Some or all of the clauses returned may be the clauses associated with a parent type if the type definition specified represents a derived type with no explicit representation. The clause is not Declarations.Is_Part_Of_Implicit (see package Declarations for a description of elements that are implicit). The list returned represents that actual length representation clauses specified for the parent type.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition for which all associated length clauses should be returned. The type definition must be of the following kind:
Element_Kinds
A_Type_Definition
return Asis.Length_Clause_List;The returned list contains elements of the following kinds:
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause A_Length_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.
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 Associated_Type
- function Length_Clause_Attribute
- function Length_Clause_Attribute_Kind
- function Length_Clause_Simple_Expression
Function Associated_Record_Type-
_Representation
function Associated_Record_Type_Representation (Type_Definition : in Asis.Type_Definition) return Asis.Representation_Clause;Expanded Name Asis.Representation_Clauses-
.Associated_Record_Type_RepresentationReturns the record representation clause associated with the specified type definition.
Description
Record representation clauses are defined by the following syntax:
Ada83 LRM 13.4, Ada95 LRM 13.5.1
record_representation_clause ::=
for type_simple_name use
record [alignment_clause]
{component_clause}
end record;This function returns any record representation clause for the specified type definition (Ada83 LRM 3.3.1, Ada95 LRM 3.2.1).
If the record type definition has no associated record representation clause, Asis.Nil_Element is returned.
The representation clause returned may be the clause associated with a parent type if the provided type is a derived type with no explicit representation.
Parameters
Type_Definition : in Asis.Type_Definition;Specifies the type definition from which any associated record representation clause should be returned. The type definition must be of the following kinds:
Element_Kinds Type_Definition_Kinds
A_Type_Definition A_Derived_Type_Definition
A_Record_Type_Definition
If a derived type definition is specified, the parent type must be an enumeration.
return Asis.Representation_Clause;
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause A_Record_Representation_Clause
The returned element is 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.
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 Associated_Type
- function Component_Clauses
- function Record_Representation_Clause_Alignment-
_Clause_Expression- function Record_Representation_Clause_Alignment-
_Clause_Pragmas- function Record_Representation_Clause_Type-
_Simple_Name
- "Processing Record Representation Clauses"
- Ada83 LRM 3.3.1, Ada95 LRM 3.2.1
- Ada83 LRM 13.4, Ada95 LRM 13.5.1
Function Associated_Type
function Associated_Type (Clause : in Asis.Representation_Clause) return Asis.Type_Definition;Expanded Name Asis.Representation_Clauses.Associated_Type
Returns the type definition of the specified representation clause.
Description
The subprograms in packages Declaration and Type_Definitions can be used with the result of this function to obtain detailed information about the type.
Parameters
Clause : in Asis.Representation_Clause;Specifies the representation clause for which the associated type definition should be returned. The clause must be of the following kind
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause A_Length_Clause
An_Enumeration_Representation-
_Clause
A_Record_Representation_Clause
s:
return Asis.Type_Definition;
Element_Kinds
A_Declaration
The returned element is of the following kind:
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 Associated_Enumeration_Type_Representation
- function Associated_Length_Clause_Representations
- function Associated_Record_Type_Representation
- "Processing Enumeration Representation Clauses"
- "Processing Length Clauses"
- "Processing Record Representation Clauses"
Function Component_Clause_Name
function Component_Clause_Name (Clause : in Asis.Component_Clause) return Asis.Simple_Name;Expanded Name Asis.Representation_Clauses.Component_Clause_Name
Returns the name associated with the specified record representation component clause.
Description
Record representation clauses are partially defined by the following syntax:
Ada83 LRM 13.4, Ada95 LRM 13.5.1
record_representation_clause ::=
for type_simple_name use
record [alignment_clause]
{component_clause}
end record;component_clause ::=
component_name at static_simple_expression
range static_range;This function returns the component name of the specified component clause.
Parameters
Clause : in Asis.Component_Clause;Specifies the record representation component clause for which the simple name should be returned. The clause must be of the following kind:
Element_Kinds
A_Component_Clause
return Asis.Simple_Name;
Element_Kinds Expression_Kinds
An_Expression A_Simple_Name
An_Attribute
The returned element is 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
- function Component_Clause_Range
- function Component_Clause_Relative_Address
- function Component_Clauses
Function Component_Clause_Range
function Component_Clause_Range (Clause : in Asis.Component_Clause) return Asis.Range_Constraint;Expanded Name Asis.Representation_Clauses.Component_Clause_Range
Returns the range constraint associated with the specified record representation component clause.
Description
Record representation clauses are partially defined by the following syntax:
Ada83 LRM 13.4, Ada95 LRM 13.5.1
record_representation_clause ::=
for type_simple_name use
record [alignment_clause]
{component_clause}
end record;component_clause ::=
component_name at static_simple_expression
range static_range;This function returns the static range of the specified component clause.
Parameters
Clause : in Asis.Component_Clause;Specifies the component clause for which the range constraint should be returned. The clause must be of the following kind:
Element_Kinds
A_Component_Clause
return Asis.Range_Constraint;
Element_Kinds Discrete_Range_Kinds
A_Discrete_Range A_Simple_Range
The returned element is 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
- function Component_Clause_Name
- function Component_Clause_Relative_Address
- function Component_Clauses
- function Type_Definitions.Lower_Bound
- function Type_Definitions.Upper_Bound
- "Processing Record Representation Clauses"
- package Type_Definitions, "Processing Discrete Ranges"
- Ada83 LRM 13.4, Ada95 LRM 13.5.1
Function Component_Clause_Relative_Address
function Component_Clause_Relative_Address (Clause : in Asis.Component_Clause) return Asis.Expression;Expanded Name Asis.Representation_Clauses-
.Component_Clause_Relative_AddressReturns the relative address associated with the specified record representation component clause.
Description
Record representation clauses are partially defined by the following syntax:
Ada83 LRM 13.4, Ada95 LRM 13.5.1
record_representation_clause ::=
for type_simple_name use
record [alignment_clause]
{component_clause}
end record;component_clause ::=
component_name at static_simple_expression
range static_range;This function returns the static simple expression of the specified record representation clause.
Parameters
Clause : in Asis.Component_Clause;Specifies the component clause for which the record representation relative address should be returned. The clause must be of the following kind:
Element_Kinds
A_Component_Clause
return Asis.Expression;
Element_Kinds
An_Expression
The returned element is of the following kind:
Examples
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.
Cross-References
Function Component_Clauses
function Component_Clauses (Clause : in Asis.Representation_Clause; Include_Pragmas : in Boolean := False) return Asis.Component_Clause_List;Expanded Name Asis.Representation_Clauses.Component_Clauses
Returns a list of the all component clauses (primarily record elements) and, optionally, pragmas embedded within the representation clause.
Description
Record representation clauses are partially defined by the following syntax:
Ada83 LRM 13.4, Ada95 LRM 13.5.1
record_representation_clause ::=
for type_simple_name use
record [alignment_clause]
{component_clause}
end record;This function returns the component clauses of the specified record representation clause.
If the representation clause contains no components, Asis.Nil_Element_List is returned.
The component clauses are returned in their order of appearance in the representation clause. The list will not include any embedded pragmas unless Include_Pragmas is True.
The clauses may include implementation-dependent components. The names of these components will have the form of attributes (A'B). These components do not appear in the actual declaration of the record.
Refer to Appendix F of your Ada compiler documentation for a description of any implementation-dependent components.
Parameters
Clause : in Asis.Representation_Clause;Specifies the record representation clause for which the components should be returned. The Clause must be of the following kinds:
Element_Kinds Representation_Clause_Kinds
A_Representation_Clause A_Record_Representation_Clause
Include_Pragmas : in Boolean := False;Specifies whether pragma definitions should be included in the returned list.
return Asis.Component_Clause_List;
Element_Kinds Declaration_Kinds
A_Component_Clause A_Component_Declaration
A_Pragma
The returned list contains elements of the following kinds:
A_Pragma will not be returned in the list unless Include-
_Pragmas has been specified as True.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
Assume the following record representation clause:
for Shoes use record Size at 0 range 0 .. 7;pragma Page; Color at 2 range 0 .. 7;end recordIf Include_Pragmas is not specified or is specified as False, Component_Clauses returns a two-item list:
(A_Component_Clause, A_Component_Clause)
If Include_Pragmas is specified as True, Component_Clauses returns a three-item list:
(A_Component_Clause, A_Pragma, A_Component_Clause)
Cross-References
Rational Software Corporation
http://www.rational.com support@rational.com techpubs@rational.com Copyright © 1993-2001, Rational Software Corporation. All rights reserved. |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |