TOC PREV NEXT INDEX DOC LIST MASTER INDEX



Package Representation_Clauses

Package Representation_Clauses provides access to Ada representation clauses. Representation clauses are defined by the following Ada constructs:

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:
Determining representation kind:

Kind

Processing length causes:

Associated_Length_Clause_Representations Associated_Type Length_Clause_Attribute Length_Clause_Attribute_Kind Length_Clause_Simple_Expression
Processing enumeration representation clauses:
Associated_Enumeration_Type_Representation Associated_Type Enumeration_Representation_Clause_Aggregate Enumeration_Representation_Clause_Type_Simple_Name

Processing record representation clauses:
Associated_Record_Type_Representation Associated_Type Component_Clause_Name Component_Clause_Range Component_Clause_Relative_Address Component_Clauses Record_Representation_Clause_Alignment_Clause-
_Expression
Record_Representation_Clause_Alignment_Clause-
_Pragmas
Record_Representation_Clause_Type_Simple_Name
Processing address clauses:
Address_Clause_Associated_Declaration Address_Clause_Simple_Expression Address_Clause_Simple_Name Associated_Address_Representation


Key Concepts for Package Representation_Clauses

Package 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

Representation clauses are defined by the following syntax:

Ada83 LRM 13.1, Ada95 LRM 13.1

representation_clause ::=
  type_representation_clause | address_clause

 type_representation_clause ::= length_clause
  | enumeration_representation_clause
  | record_representation_clause

A 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:

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
Information Desired
Call to Use
attribute
Length_Clause_Attribute
simple_expression
Length_Clause_Simple_Expression
prefix
Expressions.Prefix
attribute_designator kind
Length_Clause_Attribute_Kind
Length clauses associated with a type definition
Associated_Length_Clause_Representations
The type definition associated with a representation clause
Associated_Type
:

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
Information Desired
Call to Use
type_simple_name
Enumeration_Representation_Clause_Type-
_Simple_Name

aggregate
Enumeration_Representation_Clause_Aggregate
enumeration_repre-
sentation_clauses associated with a type definition

Associated_Enumeration_Type_Representation
The type definition associated with a representation clause
Associated_Type
:

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:
Information Desired
Call to Use
type_simple_name
Record_Representation_Clause_Type_Simple-
_Name

alignment_clause
Record_Representation_Clause_Alignment-
_Clause_Expression

component_clause list
Component_Clauses
component_name
Component_Clause_Name
static_simple-
_expression

Component_Clause_Relative_Address
static_range
Component_Clause_Range
record_representation-pt_clauses associated with a type definition
Associated_Record_Type_Representation
The type definition associated with a representation clause
Associated_Type
The alignment pragmas that have been applied to a
representation

Record_Representation_Clause_Alignment-
_Clause_Pragmas

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:
Information Desired
Call to Use
simple_name
Address_Clause_Simple_Name
simple_expression
Address_Clause_Simple_Expression
The address clause that is associated with an element
Associated_Address_Representation
The declaration of the simple_name entity
Address_Clause_Associated_Declaration


Function Address_Clause_Associated_Declaration

Expanded Name Asis.Representation_Clauses
.Address_Clause_Associated_Declaration

Returns 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

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

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

Related subprograms:

Related concepts:


Function Address_Clause_Simple_Expression

Expanded Name Asis.Representation_Clauses-
.Address_Clause_Simple_Expression

Returns 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

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

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

Related subprograms:

Related concepts:


Function Address_Clause_Simple_Name

Expanded Name Asis.Representation_Clauses-
.Address_Clause_Simple_Name

Returns 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

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

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

Related subprograms:

Related concepts:


Function Associated_Address_Representation

Expanded Name Asis.Representation_Clauses-
.Associated_Address_Representation

Returns 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_clause

This 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

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.

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

Related subprograms:

Related concepts:


Function Associated_Enumeration_Type-
_Representation

Expanded Name Asis.Representation_Clauses-
.Associated_Enumeration_Type_Representation

Returns 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

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.

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

Related subprograms:

Related concepts:


Function Associated_Length_Clause-
_Representations

Expanded Name Asis.Representation_Clauses-
.Associated_Length_Clause_Representations

Returns 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

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

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

Related subprograms:

Related concepts:


Function Associated_Record_Type-
_Representation

Expanded Name Asis.Representation_Clauses-
.Associated_Record_Type_Representation

Returns 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

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.

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

Related subprograms:

Related concepts:


Function Associated_Type

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

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:

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

Related subprograms:

Related concepts:


Function Component_Clause_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

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

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

Related subprograms:

Related concepts:


Function Component_Clause_Range

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

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

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

Related subprograms:

Related concepts:


Function Component_Clause_Relative_Address

Expanded Name Asis.Representation_Clauses-
.Component_Clause_Relative_Address

Returns 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

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

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

Related subprograms:

Related concepts:


Function Component_Clauses

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

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

Specifies whether pragma definitions should be included in the returned 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:

If 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

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