Author |
Robb Nebbe (nebbe@iam.unibe.ch) |
Version |
2.2 |
Last modified |
1999-08-17 |
The common exchange model is modified in three different ways to handle Ada:
Model |
SourceLanguage SourceDialect |
- SourceLanguage
For all Ada models the attribute always contains the string "Ada"- SourceDialect
Entity |
name uniqueName enclosingEntity (): Name # new isPrivate ():Boolean # new |
The name of an entity corresponds to its simple name in Ada. The unique name corresponds to the fully qualified name in Ada but may also require extra information such as the signature in the case of subprograms.
The method enclosingEntity returns the unique name of the entity in which another is declared unless the entity is a library level compilation unit in which case it returns an empty string "". The method isPrivate tells whether the entity in question is made public or private with respect to the enclosing entity.
Package |
belongsToPackage |
- belongsToPackage():Name;
When a package is nested within another package or in the case of a child package this method returns the name of the enclosing package or the parent package. If a package is nested inside another entity such as a subprogram then the method will return the empty string. If both belongsToPackage and enclosingEntity are defined then they will return the same entity.
Class |
isAbstract |
Ada types are all mapped to the class entity in FAMIX with the exception of access types and subtypes. Neither access types or subtypes introduce a new abstraction in the problem domain. Furthermore, pointers are conventionally implicit in traditional object-oriented languages and metrics would be skewed if access types were not eliminated in Ada.
This means that enumeration, signed integer, modular, floating point, fixed point, decimal fixed point, unconstrained and constrained array, record and tagged record types as well as task and protected types are all mapped to the class entity.
- isAbstract():Boolean
- belongsToPackage():Name;
When a class is nested within a package this method returns the name of the enclosing package. If a class is nested inside another entity than a package (such as a subprogram) then the method will return the empty string. If both belongsToPackage and enclosingEntity are defined then they will return the same entity.
Method |
belongsToClass isAbstract signature declaredReturnClass |
Methods correspond to Ada's primitive subprograms and class-wide subprograms. This is because both primitive and class-wide subprograms are already defined for or will be derived for any derived types. Task entries as well as the entries, functions and procedures defined for protected types are also considered as methods.
- belongsToClass():Name
enclosingEntity
is never the same as belongsToClass
.
- isAbstract():Boolean
- signature():Qualifier
The signature consists of the name of the method and the names and types of its parameters. If there, resulttypes are concatenated at the end of the signature as well. Contrary to other object-oriented languagues parameter names and resulttypes are part of the unique identification of a method in Ada package P is
type T is tagged private;
function Method_A( X:Integer; Y:Boolean ) return T;
procedure Method_B( A_T: in out T; Y: in Boolean );
procedure Method_B( A_T: in out T; X: in Integer );
private ...
end P;
for Method_A the signature is: "Method_A(X:Integer,Y:Boolean):T"
for the two methods Method_B the signatures are: "Method_B(A_T:T,Y:Boolean)"
"Method_B(A_T:T,X:Integer)"
- declaredReturnClass():Name
The result of a method corresponding to a function in Ada is obtained through declaredReturnClass, which returns the class corresponding to the Ada type returned by the function
.
Function |
signature declaredReturnClass |
A FAMIX function corresponds to any subprogram that does not qualify as a method. In Ada terminology the choice of function is rather unfortunate but it is kept for compatibility. It is essentially the same as a method except it does not have the method belongsToClass or the method isAbstract.
Attribute |
belongsToClass signature():Qualifier # new declaredReturnClass():Name # new |
A FAMIX attribute corresponds to an Ada record component. It is similar to a method except that an attribute may not be abstract. In Ada a private type declaration leads to a situation where the type is not private but the attributes (record components) are private. An extension is that attributes are considered as having a signature consisting of a single parameter whose class is the class to which the attribute belongs. Since record components are always nested in a type the enclosing entity will always be the same as the result of belongsToClass
.
GlobalVariable |
declaredClass |
A global variable corresponds to any variable or constant declared in a package thus having a lifetime corresponding to that of the program.
- declaredClass():Name
The type of the variable or in the case of an access type the type accessed.
LocalVariable |
declaredClass |
A global variable corresponds to any variable or constant declared local to a subprogram thus having a lifetime corresponding to an invocation of the subprogram.
- declaredClass():Name
The type of the variable or in the case of an access type the type accessed.
FormalParameter |
declaredClass position |
A formal parameter means the same thing in both FAMIX and Ada. The parameter modes as well as access parameters are not carried over into the FAMIX model. A formal parameter is never private as it corresponds to an association formed between a visible entity and those defined by the parameter. If the formal parameter is an access parameter, an access type or a subtype then declaredClass returns the type accessed or the base type of the subtype.
- declaredClass
The type of the formal parameter. Access parameters are contrued as being of the type accessed.
InheritanceDefinition |
subclass superclass |
Figure 9: InheritanceDefinition
An inheritance definition corresponds to a type derivation in Ada. The subclass corresponds to the derived type and the superclass to the base type. All type derivations are considered as an inheritance definition even if the types involved are not tagged types.
- subclass():Name
Returns the uniqueName of the derived type.
- superclass():Name
Returns the uniqueName of the base type.
Access |
accesses accessedIn |
An access corresponds to any time that an attribute (record component) is used in an expression or statement. Accesses is the attribute being accessed and accessedIn is the entity from which the access is made.
- accesses():Name
The uniqueName of the attribute.
- accessedIn():Name
The uniqueName of the behavioural entity from which that attribute is accessed.
Invocation |
invokes invokedBy |
An invocation corresponds to a subprogram call in Ada. The method invokes is the name of the subprogram being called but not the unique name because this may be impossible due to polymorphism. The method invokedBy is the unique name of the behavioural entity from which the subprogram is invoked.
- invokes():Name
The uniqueName of the subprogram that is being called. In the case of polymorphism this subprogram may have been overridden by a derived type so another implementation may actually be executed.
- invokedBy():Name
The uniqueName of the subprogram that calls the other subprogram.
Generic entities are not covered by this plug-in. Their instantiations are however, and they are treated as if they were written from scratch rather than instantiated from a generic. Implicit declarations occurring in the case of type derivation should be handled the same as explicit declarations.
[Deme99] Serge Demeyer, Sander Tichelaar and Patrick Steyaert, FAMIX – The FAMOOS Information Exchange Model, version 2.0 alpha, July 1999. See http://www.iam.unibe.ch/~famoos/FAMIX/.
Achievement 2.4.1c
FAMIX Ada language plug-in 2.2
Project Id: |
Esprit IV #21975 "FAMOOS" |
Deliverable Id: |
D 2.2 – FINALFHB Final FAMOOS Methodology Handbook |
Date for delivery: |
31.08.99 |
Planned date for delivery: |
31.08.99 |
WP(s) contributing to: |
1 |
Author(s): |
Robb Nebbe |
This document defines a language plug-in for FAMIX, the FAMOOS information exchange model [Deme99]. It extends and interprets the FAMIX core model to cover the essential entities from the Ada programming language
Object-oriented, reengineering, reverse engineering, code repository, round-trip engineering, FAMOOS, FAMIX, Ada.
Ver |
Date |
Editor(s) |
Status & Notes |
2.2 alpha |
24.08.99 |
Robb Nebbe |
|
2.2 |
25.08.99 |
Sander Tichelaar |
FAMIX Ada language plug-in 2.2 *
1 Abstract *
2 Notation *
3 Modified classes *
3.1 Model (interpreted)
*3.2 Entity (interpreted and extended)
*3.3 Package (interpreted)
*3.4 Class (interpreted)
*3.5 Method (interpreted)
*3.6 Function (interpreted)
*3.7 Attribute (extended and interpreted)
*3.8 GlobalVariable (interpreted)
*3.9 LocalVariable (interpreted)
*3.10 FormalParameter (interpreted)
*3.11 InheritanceDefinition (interpreted)
*3.12 Access (interpreted)
*3.13 Invocation (interpreted)
*4 Miscellaneous *
5 References *
Cover Pages
*1) Identification
*2) Abstract
*3) Keywords
*4) Version History
*5) Issues for future releases
*6) Table of Contents
*7) List of Figures
*8) List of Tables
*
Figure 2: Entity *
Figure 3: Package *
Figure 2: Class *
Figure 3: Method *
Figure 4: Function *
Figure 5: Attribute *
Figure 6: GlobalVariable *
Figure 7: LocalVariable *
Figure 8: FormalParameter *
Figure 9: InheritanceDefinition *
Figure 10: Access *
Figure 11: Invocation *