Book a Demo

Author Topic: C++ macro import problem  (Read 4272 times)

Claudio

  • Guest
C++ macro import problem
« on: October 15, 2007, 06:24:32 am »
Hello,

I'm evaluating Enterprise Architect using the version V7.0.817 and I try to import the following C++ code :

CWType : TEMPLATE_ASONODE (CComObjectRootEx<CComSingleThreadModel>, CPType)

and I have the result "unexeptect symbol: (" and the explanation "You may need to define a language macro."

I set the correct include path to find the macro, I also try to define the TEMPLATE_ASONODE using "Settings-Prepocessor Macros..." but it doesn't work.

If I expend manualy the macro, no more problem.

Have you some idea ?

Thank you

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: C++ macro import problem
« Reply #1 on: October 15, 2007, 07:05:24 am »
Hi, AFAIK EA doesn't support macro's :(. You need to identify what keywords are macro's and then the parser will basically ignore them, so the rest of the file can be imported. (section 9.1.3/4 (http://www.sparxsystems.com.au/EAUserGuide/o314.htm) covers import and 9.3.4 (http://www.sparxsystems.com.au/EAUserGuide/languagemacros.htm) covers language macro's).
HTH.



Claudio

  • Guest
Re: C++ macro import problem
« Reply #2 on: October 15, 2007, 10:49:25 pm »
Yes, I know that the parser ignores the macro, but even if I declare it to be ignored in the "Settings | Preprocessor Macros" the parser returns this problem, and I'm not sure that all the rest of the file is imported

Thanks

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: C++ macro import problem
« Reply #3 on: October 15, 2007, 11:52:16 pm »
Hi Claudio,
The macro should be declared as "TEMPLATE_ASONODE()". I believe you'll need the parenthesis as the macro takes parameters. You'll probably get more errors, but it should get you past the "unexpected (".  

Claudio

  • Guest
Re: C++ macro import problem
« Reply #4 on: October 21, 2007, 11:02:29 pm »
Ok thank you very much, that's the good solution  :D
« Last Edit: October 23, 2007, 10:30:26 pm by Claudio »

Claudio

  • Guest
Re: C++ macro import problem
« Reply #5 on: October 23, 2007, 10:37:44 pm »
In fact no :(.

I put the "()" after the macro definition as you suggest to me and I have another problem on the following character ("unexpected symbol"): the "," if it is in a multiple inheritance or the "{" if it is the only inheritance   :-[

Any other idea ??

Thanks

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: C++ macro import problem
« Reply #6 on: October 24, 2007, 01:16:16 am »
Sorry, no.  :'(
The macro can be bypassed, but if it's being used to replace text in a class definition, then EA would need to know about macro's and not just ignore them. This would get even more complicated with #ifdefined's and such.
Maybe you could pre-process the files and use that output to import the code?

Claudio

  • Guest
Re: C++ macro import problem
« Reply #7 on: October 24, 2007, 03:16:42 am »
If I understand correctly, the macro is ignored so the lines
CWType : TEMPLATE_ASONODE (CComObjectRootEx<CComSingleThreadModel>, CPType)
{
}

becomes

CWType :
{
}

which is not correct :(