The Compile > Build Rep Clauses command builds confirming representation clauses for types.
A confirming representation clause is a representation clause that specifies the same value that the compiler would have chosen by default. Confirming representation clauses are useful for the following reasons:
Build Rep Clauses is capable of generating six kinds of representation clauses:
for T use
record
C1 at 0 range 0 .. 31;
C2 at 4 range 0 .. 31;
end record;
Such clauses are generated for tagged or untagged record types, including type extensions. Note that no at_clause is ever generated, even in Ada 83. Also note that it is not possible to write component clauses for some components, for instance because they cannot be named (tag of a tagged type) or because their size is dynamic. Build Rep Clauses doesn't generate component clauses in such cases. However this has the consequence that the record clause may not be confirming (since it doesn't specify the layout of all the components).
for T'Alignment use 4;
Such clauses are generated for all types, except generic formal types. They are not generated in Ada 83, where they would be illegal.
for T'Component_Size use 2;
Such clauses are generated for array types (derived or not). They are not generated in Ada 83, where they would be illegal.
for T'Small use 2.0 ** (-6);
Such clauses are generated for ordinary fixed-point types (derived or not).
Only those clauses that are applicable to the type (depending on its class) and have not been explicitly specified are generated. In the case of record clauses, an existing record clause, if any, is completed by inserting new component clauses.
In interactive mode, Build Rep Clauses works as follows:
Build Rep Clauses may also be executed from the command line as follows:
build_rep_clauses [-visit|-no_visit] -ada_name
"foo.bar'spec"
The -visit and –no_visit flags specify whether the modified unit is to be visited in the Ada editor. The default is -visit.
The -ada_name parameter is used to denote the type or package to process. It may contain wildcards; for instance the expression "foo'body.bar@" would process all declarations whose name starts with Bar in the body of unit Foo.
Copyright © 1993-2002, Rational Software Corporation. All rights reserved.