Integrations (PTC products, 3rd party products and code) > Code integration (Ada, ARINC 653, C, C#, C++, IDL, Java, SQL and VB) > IDL Code > Reverse engineering legacy IDL code > Overview of reverse engineering IDL code (IDL code)
  
Overview of reverse engineering IDL code (IDL code)
IDL Code Reverser (Reverser) is designed to reverse engineer legacy IDL3+ code into a model.
The Reverser allows you to reverse engineer compilable IDL code in IDL3+ files to a model, which you may want to do for the following reasons:
To view the structure of the IDL3+ code in Modeler.
To develop the IDL3+ code further in Modeler before regenerating the code.
To reuse all or part of the IDL3+ code in other models.
Important: The IDL Code Reverser is not designed to round-trip IDL3+ code that is generated through ACS.
To use the IDL Code Reverser, you require an ACS license, a Modeler license and an IDL Profile license.
* 
You can reduce the time taken to reverse engineer code by having write access to the Model and all Packages in that Model.
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.
* 
Do not include any of the source code package structure in the Root Directory. If you do, the Reverser treats the IDL files you select for reverse engineering as unmapped files and does not reverse engineer them.
IDL Profile package
When you reverse engineer IDL code to a model that does not contain the IDL profile, the Reverser creates an IDL Profile in the Model; however, the IDL profile may contain only the Stereotypes and Tag Definitions required for the code you reverse engineered:
If you want to add a complete IDL profile to a Model that does not contain the IDL Profile package, see Adding the IDL profile package to a model.
If the Reverser has created an IDL profile in your Model and you want to update it so that it is complete, see Updating the IDL profile package in a model
Warning If you want to add additional Tag Definitions to items in the Model, do not do so through the supplied IDL Profile package. If you add Tag Definitions to the supplied Stereotypes, they may be unlinked when reverse engineering code. In addition, if you update the IDL Profile package or upgrade the Reverser, the IDL Profile package will be overwritten.
Mapping information
For information about how model items and IDL Profile items map to IDL3+ code, see Summary of Mappings for IDL code.
Parsing Code Files
The Reverser parses the files you select for reverse engineering. You should ensure that your code files compile cleanly. To parse code files correctly, the Reverser requires the following information:
#Defines that are defined in the compiler project configuration.
Compiler search paths to search for #include files.
* 
If you have code that causes parsing errors but is valid for your compiler, you can hide that code from the Reverser parser through the RTS_SYNC_INVOKED #define. RTS_SYNC_INVOKED is automatically defined when the Reverser is running, so you can make the code that causes parsing errors conditional using #ifndef RTS_SYNC_INVOKED so that the Reverser ignores it.
When you specify a search path for a #include file, you can optionally map the folder to a Package in the Model. If a #include file is found in a search path outside of the root folder, the #include file is reverse engineered only if the search path is mapped to a Package in the Model.
When you specify search paths for #include files, by default the parser does not search for files in subfolders of those search paths. If you want the parser to search for #include files in subfolders of the search paths you have specified, select the Recurse #Include Folders check box on the Reverse Options Page 3 page.
Name Clashes
When the Reverser reverse engineers code, the name of each Modeler item is set to that of the reverse engineered element. If you have code elements whose names differ only by the case of the characters, this can result in a name clash in Modeler.
When there is a name clash, the Reverser uses the CODE_GENERATION_NAME property (appears on the Text tab of an item's Property Pages) to record the correct name of the code element. Note that if a Modeler item has a CODE_GENERATION_NAME value set, ACS generates that value as the code element name.
The following example demonstrates how code elements with name clashes are reverse engineered. A class has three attributes named salary, Salary and SALARY:
struct Class1
{
int salary;
int Salary;
SALARY;
}
For salary, the Reverser creates an Attribute named salary - no value is set for the CODE_GENERATION_NAME property.
For Salary, there is a name clash so the Reverser creates an Attribute named Salary;1 - its CODE_GENERATION_NAME property is set to Salary.
For SALARY, there is again a name clash so the Reverser creates an Attribute named SALARY;2 - its CODE_GENERATION_NAME property is set to SALARY.
When ACS generates the Class, the three Attributes are generated with the correct names.
Basic types
The IDL Profile package contains the following Basic Types in the Basic Types package: any, boolean, char, double, fixed, float, long, long double, long long, octet, short, string, unsigned long, unsigned long long, unsigned short, wchar and wstring.
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 IDL Basic Types folder in the IDL Profile package.
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.