2
votes

I want to reverse engineer models from source code with Enterprise Architect 11. The class definitions look like:

class MYCUSTOMMACRO(className) : public baseClass
{
    ...
}

Unfortunately, EA skips these classes, as the macro was not recognized. If I define a language macro in EA, MYCUSTOMMACRO(className) is skipped as a whole. This, again, produces a parsing error, as the class name is missing.

So, is there a way to extract the class name out of the macro and import the classes?

Thanks, Oliver

1
You might experiment with preprocessing your code (e.g. g++ -E, cl /E) - which will expand the macros - then letting this "EA" thing chew on that.... - Tony Delroy
why don't you just run the files through the preprocessor? - The Paramagnetic Croissant

1 Answers

2
votes

You can get this to work by creating your own MDG technology file based off the following:

<MDG.Technology version="1.0"><Documentation id="0" name="Customer Code Module" version="1" notes="Allows using a Customer Macro as an identifier"/>
<CodeModules><CodeModule language="C++" notes=""><CodeOptions><CodeOption name="PrependGrammarDefinitions">
                    <![CDATA[
<identifier>            ::= "MYCUSTOMMACRO" "(" <> ")"      

]]>
</CodeOption>
</CodeOptions></CodeModule></CodeModules>
</MDG.Technology>

Save the code as an XML file i.e. prependgrammer.xml.

Once created you can activate it by the Extensions | MDG Technologies... dialog then hit the "Advanced..." button, then Add.

Now you can just import the C++ as per normal and it should pick up your "MYCUSTOMMACRO" defined class.

Hope this helps!