FAMIX Ada language plug-in 2.2

 

Author

Robb Nebbe (nebbe@iam.unibe.ch)

Version

2.2

Last modified

1999-08-17

  1. Abstract
  2. 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.

  3. Notation

The common exchange model is modified in three different ways to handle Ada:

  1. Modified classes
    1. Model (interpreted)

Model

SourceLanguage

SourceDialect

Figure 1: Model

    1. Entity (interpreted and extended)
    2. Entity

      name

      uniqueName

      enclosingEntity (): Name # new

      isPrivate ():Boolean # new

      Figure 2: Entity

      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.

    3. Package (interpreted)

Package

belongsToPackage

Figure 3: Package

    1. Class (interpreted)

Class

isAbstract
belongsToPackage

Figure 2: Class

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.

    1. Method (interpreted)

Method

belongsToClass

isAbstract

signature

declaredReturnClass

Figure 3: Method

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.

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)"

 

    1. Function (interpreted)
    2. Function

      signature

      declaredReturnClass

      Figure 4: Function

      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.

    3. Attribute (extended and interpreted)
    4. Attribute

      belongsToClass

      signature():Qualifier # new

      declaredReturnClass():Name # new

      Figure 5: Attribute

      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.

       

    5. GlobalVariable (interpreted)

GlobalVariable

declaredClass

Figure 6: GlobalVariable

A global variable corresponds to any variable or constant declared in a package thus having a lifetime corresponding to that of the program.

    1. LocalVariable (interpreted)

LocalVariable

declaredClass

Figure 7: LocalVariable

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.

    1. FormalParameter (interpreted)

FormalParameter

declaredClass

position

Figure 8: FormalParameter

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.

    1. InheritanceDefinition (interpreted)

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.

    1. Access (interpreted)

Access

accesses

accessedIn

Figure 10: Access

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.

    1. Invocation (interpreted)

Invocation

invokes

invokedBy

Figure 11: Invocation

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.

  1. Miscellaneous
  2. 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.

  3. References

[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/.

 

Cover Pages

Achievement 2.4.1c

FAMIX Ada language plug-in 2.2

1) Identification

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

2) Abstract

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

3) Keywords

Object-oriented, reengineering, reverse engineering, code repository, round-trip engineering, FAMOOS, FAMIX, Ada.

4) Version History

Ver

Date

Editor(s)

Status & Notes

2.2 alpha

24.08.99

Robb Nebbe

 

2.2

25.08.99

Sander Tichelaar

 

5) Issues for future releases

6) Table of Contents

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 *

 

7) List of Figures

Figure 1: Model *

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 *

 

8) List of Tables