* Switches for gnat2xml::
* Other Programs::
* Structure of the XML::
+* Generating Representation Clauses::
@end menu
@node Switches for gnat2xml
output.)
-I <include-dir>
- directories to search for dependencies
- You can also set the ADA_INCLUDE_PATH environment variable for this.
+ directories to search for dependencies
+ You can also set the ADA_INCLUDE_PATH environment variable for this.
--compact -- debugging version, with interspersed source, and a more
compact representation of "sloc". This version does not conform
to any schema.
+--rep-clauses -- generate representation clauses (see ``Generating
+ Representation Clauses'' below).
+
-files=filename - the name of a text file containing a list
of Ada source files to process
formal_package
formal_package_declaration_with_box
@end smallexample
+
+@node Generating Representation Clauses
+@section Generating Representation Clauses
+
+@noindent
+If the @option{--rep-clauses} switch is given, @command{gnat2xml} will
+generate representation clauses for certain types showing the
+representation chosen by the compiler. The information is produced by
+the ASIS ``Data Decomposition'' facility --- see the
+@code{Asis.Data_Decomposition} package for details.
+
+Not all types are supported. For example, @code{Type_Model_Kind} must
+be @code{A_Simple_Static_Model}. Types declared within generic units
+have no representation. The clauses that are generated include
+@code{attribute_definition_clauses} for @code{Size} and
+@code{Component_Size}, as well as
+@code{record_representation_clauses}.
+
+There is no guarantee that the generated representation clauses could
+have actually come from legal Ada code; Ada has some restrictions that
+are not necessarily obeyed by the generated clauses.
+
+The representation clauses are surrounded by comment elements to
+indicate that they are automatically generated, something like this:
+
+@smallexample
+<comment text="--gen+">
+...
+<attribute_definition_clause>
+...
+<comment text="--gen-">
+...
+@end smallexample
+
@end ifclear
@end ifclear
-
@ifclear FSFEDITION
@c *********************************
@node The GNAT Metrics Tool gnatmetric
Loc : constant Source_Ptr := Sloc (Lo);
Lov : constant Entity_Id :=
Make_Defining_Identifier (Loc,
- Chars => New_External_Name (Chars (Subtyp), 'L'));
+ Chars =>
+ New_External_Name (Chars (Subtyp), "_FIRST"));
begin
Insert_Action (R,
Make_Object_Declaration (Loc,
Loc : constant Source_Ptr := Sloc (Hi);
Hiv : constant Entity_Id :=
Make_Defining_Identifier (Loc,
- Chars => New_External_Name (Chars (Subtyp), 'H'));
+ Chars =>
+ New_External_Name (Chars (Subtyp), "_LAST"));
begin
Insert_Action (R,
Make_Object_Declaration (Loc,
-- positive, or if Suffix_Index is negative 1, then a unique serialized
-- suffix is added. If Suffix_Index is zero, then no index is appended.
- -- Suffix is also a single upper case letter other than O,Q,U,W,X and is a
- -- required parameter (T is permitted). The constructed name is stored
- -- using Name_Find so that it can be located using a subsequent Name_Find
- -- operation (i.e. it is properly hashed into the names table). The upper
- -- case letter given as the Suffix argument ensures that the name does
- -- not clash with any Ada identifier name. These generated names are
- -- permitted, but not required, to be made public by setting the flag
- -- Is_Public in the associated entity.
+ -- Suffix is also a single upper case letter other than O,Q,U,W,X (T is
+ -- allowed in this context), or a string of such upper case letters. In
+ -- the case of a string, an initial underscore may be given.
+ --
+ -- The constructed name is stored using Name_Find so that it can be located
+ -- using a subsequent Name_Find operation (i.e. it is properly hashed into
+ -- the names table). The upper case letter given as the Suffix argument
+ -- ensures that the name does not clash with any Ada identifier name. These
+ -- generated names are permitted, but not required, to be made public by
+ -- setting the flag Is_Public in the associated entity.
+ --
+ -- Note: it is dubious to make them public if they have serial numbers,
+ -- since we are counting on the serial numbers being the same for the
+ -- clients with'ing a package and the actual compilation of the package
+ -- with full expansion. This is a dubious assumption ???
function New_External_Name
(Suffix : Character;
-- not clash with any Ada identifier name. These generated names are
-- permitted, but not required, to be made public by setting the flag
-- Is_Public in the associated entity.
+ --
+ -- Note: it is dubious to make these public since they have serial numbers,
+ -- which means we are counting on the serial numbers being the same for the
+ -- clients with'ing a package and the actual compilation of the package
+ -- with full expansion. This is a dubious assumption ???
function New_Internal_Name (Id_Char : Character) return Name_Id;
-- Id_Char is an upper case letter other than O,Q,U,W (which are reserved
-- the Name_Find procedure later on. Names created by New_Internal_Name
-- are guaranteed to be consistent from one compilation to another (i.e.
-- if the identical unit is compiled with a semantically consistent set
- -- of sources, the numbers will be consistent. This means that it is fine
+ -- of sources, the numbers will be consistent). This means that it is fine
-- to use these as public symbols.
--
-- Note: Nearly all uses of this function are via calls to Make_Temporary,
-- but there are just a few cases where it is called directly.
+ --
+ -- Note: despite the guarantee of consistency stated above, it is dubious
+ -- to make these public since they have serial numbers, which means we are
+ -- counting on the serial numbers being the same for the clients with'ing
+ -- a package and the actual compilation of the package with full expansion.
+ -- This is a dubious assumption ???
function New_Occurrence_Of
(Def_Id : Entity_Id;