comp.lang.ada
 help / color / mirror / Atom feed
From: "Pat Rogers" <progers@classwide.com>
Subject: Re: Free Ada UML tools Available  (long)
Date: Sat, 01 Jun 2002 17:16:49 GMT
Date: 2002-06-01T17:16:49+00:00	[thread overview]
Message-ID: <5k7K8.1039$LC4.482810033@newssvr11.news.prodigy.com> (raw)
In-Reply-To: 9ff447f2.0205311903.631465e5@posting.google.com

"Adrian Hoe" <byhoe@greenlime.com> wrote in message
news:9ff447f2.0205311903.631465e5@posting.google.com...
>
<snip>
>
> Too bad, I don't have windows at my office and home. :)

Here is the document that will (eventually) go into their help file (in html)
describing the Ada 95 code generation:



Ada 95 Code Generation

For each master, a corresponding Ada package is generated in a separate file.
If the
master has a file name specified in its property sheet, this file name will be
used for the
generated file. Otherwise, the file name is determined as follows.  If the
namespace is
specified in the master's property sheet, that namespace is used.  If no
namespace is
specified, the master name is used.  In any case, the file containing the
package
declaration will have an extension of "ads".  Corresponding package bodies are
generated
in files having an extension of "adb". As each master is generated, its file
names appear
in the log window messages, e.g., "Generating: 'Foo.ads'".

For each master, the file generated for the package declaration will contain the
following:
* For each master inherited/contained by this master, a with-clause is generated
(e.g.:  "with Bar;").  Clauses are also generated for packages referenced by
types
used for attributes and for generic formal object parameters (for template
classes).
* The class comment (if any) appears next.
* The package declaration then appears, as follows:
* A "primary" tagged type is generated within a corresponding package
declaration
to represent any single class in a diagram.  (Other types are also generated as
necessary.)  A naming convention for the Ada package name and type name is
used, based upon the names of the classes and the namespaces in the property
sheets. Specifically, the namespace for the class is used as the package name
and
the class name is used as the primary type name.  If the namespace is not
specified, the class name becomes the package name and "Object" is used as the
primary type name.  This convention is used for all classes for which code is
generated and is also reflected in the names referenced by with-clauses
generated
due to relationships in the diagrams.
* The kind of type generated for the primary type depends upon the access
control specifications for those things that can be components of the type:
the attributes, the containments and the relations. If all (non-static/non-
const) attributes are public, a simple Ada tagged type is generated with the
attributes as visible record components.  If none are public, a private
tagged type is generated.  If some attributes are public and others are not, a
combination of private and non-private tagged types is used.  Note that
private non-const attributes are not truly private in the C++/Java sense --
they get protected/package visibility because they are placed within the
primary type as record components so they can be referenced as part of
individual object instances.   To do otherwise would have the effect of
making them static.
* Containment relations are generated as components of the tagged type,
using the specific type indicated.
* Relationship declarations are generated as components of the tagged type,
but use the access-to-classwide specific type for the relationship specified.
* Derivations based upon inheritance in the diagram are handled in all the
above cases.  Note that, like Java, Ada only directly supports single
inheritance.  Violations are noted in the log.
* An access type designating the primary tagged type is declared if the primary
type
is not abstract.
* An access-to-class-wide type is declared, designating the class and any class
ever
derived from it.
* Any exceptions defined by the master are declared.
* Visible constant/static attributes are declared.
* Visible methods defined by the master are declared.  Methods specified as
having
a return value type are declared as functions; otherwise they are declared as
procedures.  Like some other object-oriented languages -- but unlike C++ and
Java --
Ada doesn't use the "distinguished receiver" syntax of Object.Operation(params).
The object to be referenced (that controls dynamic
dispatch, etc.) is an explicit parameter of the method.  If a method in an Ada
package doesn't mention the primary tagged type (either as the type for a formal
parameter, or, additionally for functions, as the type of the value returned),
that
method is not a "primitive operation" of the type and is not, for example,
inherited
by descendant types.  Hence the script conditionally inserts a formal parameter
named "This" during code generation, of the primary tagged type.  (This
insertion
is controlled by the script's invocation options.)  The parameter mode for This
in
all methods will be determined by the mode specification for the overall method.
Thus, for const methods, parameter This will have mode "in"; for non-const
procedures the mode will be "in out", and non-const functions will an access
parameter.
* Any exceptions propagated by any given visible method are indicated in a
comment immediately following the method declaration.
* All get/set methods requested for individual non-const/non-static attributes
are
declared.  The "get" methods are declared as functions, with names that
incorporate the corresponding attribute name.  Specifically, the function names
will start with the attribute name, followed by "_of".  The formal parameter
This
will be inserted, following the rules described above for explicit methods,
except
that insertion is unconditional.  Thus, an attribute named "Bar", of type
Integer,
for a type named "Foo", would be declared as follows:
function Bar_of( This : Foo ) return Integer;
 The "set" methods are declared as procedures, with the name "Set".
* The private part of the package is declared (if necessary) and the protected
static/const attributes are declared, along with any type completions required
from
the visible part of the package declaration.
For each master, a package body will be generated only if required, depending
upon the
content and access (visibility) specifications associated with the encapsulated
declarations.  For example, non-abstract methods require bodies and these are
required to
be within the corresponding package body.
The file generated for the package body (if any) will contain the following:
* Private static/const attributes are declared. These private attributes are
sufficient
to cause a package body to be generated even if no method bodies are necessary;
pragma Elaborate_Body is generated in the package specification to make such
bodies legal.  Note, however, that a package body containing only attributes
will
have little use unless additional code is added to the body manually.
* Private method bodies are generated, following the rules for the declarations
described above.
* Any subprogram bodies required to complete the method declarations occurring
in the package declaration are generated.
* An executable part, if any, is generated.  This generation is controlled by
the
script invocation options.






  reply	other threads:[~2002-06-01 17:16 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-23 18:42 Free Ada UML tools Available / Joe Simon
2002-05-23 18:54 ` martin.m.dowie
2002-05-23 20:14   ` Pascal Obry
2002-05-24  7:15     ` martin.m.dowie
2002-05-25  5:29   ` Adrian Hoe
2002-05-23 20:16 ` Pascal Obry
2002-05-23 21:57   ` Preben Randhol
2002-05-24 18:54     ` Pascal Obry
2002-05-24 19:11       ` Preben Randhol
2002-05-24 19:43         ` Pat Rogers
2002-05-24 21:41           ` Preben Randhol
2002-05-24 21:45             ` Pat Rogers
2002-05-24 21:46             ` Pat Rogers
2002-05-24 22:03               ` Preben Randhol
2002-05-23 21:56 ` Preben Randhol
2002-05-24  6:02   ` Adrian Hoe
2002-05-24  9:21     ` Preben Randhol
2002-05-24 19:16       ` Simon Wright
2002-05-25  2:31       ` Adrian Hoe
2002-05-25  7:13         ` Pascal Obry
2002-05-25  7:14         ` Pascal Obry
2002-05-25 15:15           ` Adrian Hoe
2002-05-31  4:12             ` Adrian Hoe
2002-05-31 14:07               ` Pat Rogers
2002-05-31 18:49                 ` Pascal Obry
2002-06-01  3:03                   ` Adrian Hoe
2002-06-01 17:16                     ` Pat Rogers [this message]
2002-05-25  8:13         ` Preben Randhol
2002-05-24  5:37 ` Simon Wright
2002-05-24  9:28   ` Preben Randhol
2002-05-24 18:49     ` Simon Wright
2002-05-29 16:34   ` Frode Tenneboe
2002-05-29 19:16     ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox