Overview of reverse engineering legacy Ada code (Ada code)
Ada Code Reverser (Reverser) is designed to reverse engineer legacy Ada code into a model.
The Reverser allows you to reverse engineer compilable Ada code to a model, which you may want to do for the following reasons:
To view the structure of the Ada code in Modeler.
To develop the code further in Modeler before regenerating the code.
To move the Ada code to another platform, such as C++.
To reuse all or part of the Ada code in other models.
* 
Ada Code Reverser is not designed to round-trip code that is generated through ACS.
To use Ada Code Reverser, you require an ACS license, a Modeler license and an ACS Language Pack for Ada license.
If you are reverse engineering Ada code for the first time, we recommend that you reverse engineer the complete Ada project. If you attempt to reverse engineer only part of an Ada code project, you may experience 'undefined type' errors if a withed Package is not included in the code being reverse engineered. After reverse engineering a complete Ada project, you will not experience 'undefined type' errors for withed Packages that are being reverse engineered, or withed Packages that have been previously reverse engineered or generated.
The Reverser can reverse most structural elements of the Ada and SPARK languages; however, SPARK annotations are not reverse engineered.
* 
The time taken to reverse engineer code will be reduced if you have write access to the Model and each Package in that Model, and in each case the Model or Package is not protected.
Parsing Code Files
The Reverser parses the selected code files and reports any parsing errors on the Processing Complete page. If there are parsing errors, you should resolve these errors before reverse engineering any code. Your source code should compile cleanly. You can parse the selected code files again by clicking the Back button, and then the Next button. When resolving errors, resolve #include errors first, by updating the #includes list on the Reverse Engineering Options 3 page.
Root Object and Root Directory
On the Select Model page of the Reverser, you specify a root object (the Model, a Package or a Class) in the Model and a root directory in your file system. The root object and root directory are used as a basis of package construction in the Model.
If you want to reverse engineer a code file that does not reside in the root directory or one of its subfolders, you are prompted to map a parent folder of the code file to a Package in the Model.
Reverse engineering of Ada packages
The Ada Package Mapping options on the Reverse Engineering Options 3 page of the Reverser allow you to specify how you want to reverse engineer Ada packages that do not exist in the Model.
You can reverse Ada packages as either Packages or Classes: If you model Ada Packages through Classes in Modeler, you can make use of Associations and Aggregations.
When reverse engineering, if the Reverser can match an Ada package with a Package or Class in the Model, the Reverser updates that matching Package or Class, irrespective of whether you choose to reverse engineer Ada packages as Packages or Classes.
Ada Profile package
If you reverse engineer Ada code to a Model, the Reverser creates an Ada Profile package in that Model. The Ada Profile package contains Stereotypes and Tag Definitions that are used against model items created by the Reverser.
* 
If the Reverser creates the Ada Profile package in a model, the profile may be incomplete and the Description property of each Stereotype and Tag Definition in the profile is blank. If you want a complete Ada profile and the Description property of each Stereotype and Tag Definition to describe its purpose, you must import the supplied Ada Profile package. If the Reverser creates the Ada Profile in a model, you can add the descriptions by adding the supplied Ada Profile package.
* 
If you want to add additional Tag Definitions to items in the Model, do not do so through the supplied Ada Profile package. If you add Tag Definitions to the supplied Stereotypes, they may be unlinked when reverse engineering code. In addition, if you import the Ada Profile package again or upgrade the Reverser, the Ada Profile package will be overwritten.
Mapping information
For information about how Ada code is mapped to model elements when reverse engineered, see Summary of mappings for reverse engineering Ada code (Ada code).
Command Line Interface
The Reverser has a command line interface that allows you to reverse engineer code through a batch file. This is useful when working with a large model, because you can schedule a batch file to reverse engineer code over night. For more information, see Command line interface (Ada code).
Basic types
The Ada Profile package contains the following Basic Types in the Ada Basic Types package: Boolean, Character, Duration, Float, Integer, Natural, Positive, String, Wide_Character and Wide_String.
When you reverse code that uses a basic type, the Reverser searches the model for a matching Basic Type to use. If the Reverser cannot find a Basic Type to use in the model, it creates a new Basic Type that is scoped directly to the model. You can move any new Basic Types to the Ada Basic Types folder in the Ada Profile package.
Creating class diagrams for reverse engineered packages and classes
After reverse engineering Ada code, you can create Class Diagrams to show views of the items you have created in the Model.
You can create a Class Diagram and add items to that diagram by dragging those items to the diagram. Alternatively, you can add items to the diagram through the populate commands: right-click the diagram background, point to Populate, and then click the command for the item types you want to add.
Was this helpful?