Book a Demo

Author Topic: C++ code generation errors  (Read 3699 times)

aram

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
C++ code generation errors
« on: May 30, 2006, 12:50:25 am »
The C++ code generation template introduces simple errors when generating the code. For association classes it generates a pointer variable however in the getters and setters it uses this variable as an value object.

I've tried to modify the template but I got stuck in the following lines:

%if opCode != ""%
%WRAP_LINES(opCode, "-1", "\t", "")%

This opCode produces the getter/setter method implementation. However it is not explained anywhere how is opCode constructed and how could one modify it.

thomaskilian

  • Guest
Re: C++ code generation errors
« Reply #1 on: May 30, 2006, 04:16:46 am »
I'm not very much in C++ but I can't recall any opCode macro. Can you point out in which template you found this. I just browsed through them but could not find it.

aram

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: C++ code generation errors
« Reply #2 on: May 30, 2006, 04:41:12 am »
its in the C++ Language Operation Body template.

I've tried to remove the lines
%if opCode != ""%
%WRAP_LINES(opCode, "-1", "\t", "")%
then i don't get any getter/setter implementation which means that the whole thing is being done exactly in the opCode macro.

thnx.

thomaskilian

  • Guest
Re: C++ code generation errors
« Reply #3 on: May 30, 2006, 06:16:27 am »
Now this is funny. The help file does not explain opCode while (almost?) all other op* macros are explained. Search the help for "opBehaviour" and you will see the list - except opCode. Sparxian, could you pls. fix that...

However, I remember now that this will return the contents of the "Initial Code:" frame which you will find in Properties/Behaviour of an operation.

aram

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: C++ code generation errors
« Reply #4 on: May 30, 2006, 06:23:29 am »
So what should I do to have
*variable = newVal
instead of the currently generated
variable = newVal

thomaskilian

  • Guest
Re: C++ code generation errors
« Reply #5 on: May 30, 2006, 10:09:26 am »
You likely have to look into the Attribute Declaration macro. There's a place where "By Reference" is used. This is just a shot in the dark. Maybe someone else has better advice :-/

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8098
  • Karma: +118/-20
    • View Profile
Re: C++ code generation errors
« Reply #6 on: May 30, 2006, 03:11:56 pm »
Shortly after the code that you've removed there is the following that generates the code you're interested in.

Code: [Select]
%elseIf opStereotype == "property set" and opTag:"attribute_name" != ""%
\t%opTag:"attribute_name"% = newVal;


If you're removing the first clause of the if-else, make sure you change the next elseIf to an if.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8098
  • Karma: +118/-20
    • View Profile
Re: C++ code generation errors
« Reply #7 on: June 01, 2006, 03:30:55 pm »
The opCode macro is documented in the help file for 791.

thomaskilian

  • Guest
Re: C++ code generation errors
« Reply #8 on: June 01, 2006, 11:39:31 pm »
 :)