IBM Support

How to put the Variable definition before the Type definition when Reverse Engineering code

Question & Answer


Question

How to put the Variable definition before the Type definition when Reverse Engineering code

Answer

The Reverse Engineering in Rhapsody translate struct {}; into typedef struct {} ; The problem is that the file Rhapsody generates
always put type definition before variable definitions. And #define is considered as variable definitions. In the attached file, we
use #define to specify the size of arrays and define arrays in struct. Obviously , #define is written before struct.  However,
Rhapsody changes the sequence of definitions and move struct definition before #define. So the file generated by Rhapsody will
have syntax errors because variables are used before defined. And modifying the code in the generated file does not work. How
can one resolve this?
For example: In the source file #define MAX_FLOOR 128 preceded struct BuildingInfo. But the file generated by Rhapsody put
struct BuildingInfo before #define MAX_FLOOR. So the file generated by Rhapsody cannot be compiled at all.
 
To resolve this y ou must set the C_ReverseEngineering::ImplementationTrait::ImportDefineAsType property to True (or Default)
before Reverse Engineering the files. This will force the #define statements to be treated as "Types" rather than "Variables" and
will cause Rhapsody to generate defines before the structs.
 
You may also then re-arrange the order of the Types as needed.
1556AnswerProduct versionPartner ContentInternal ContentCategoryReference ID

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"Version Independent","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Historical Number

10491

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21323758