Book a Demo

Author Topic: How to import C code?  (Read 3049 times)

rschreiber

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
How to import C code?
« on: December 08, 2010, 07:13:02 am »
I am sort of new to EA, please bear with me if
this is a dumb question...

I have a simple C program (below) in a file named
temp.c and I am trying to import it into EA
(Registered Professional Edition.) What I did was
to create an empty class diagram, right-click on
it, and then did an "Import from source
file(s)..." C and then selected temp.c. So far so
good. I got these messages:

Reverse engineer classes:
--importing C:\Temp\test.c
  Adding: Class - test
Resolve relationships:
--relationships for test
--linking with existing attributes
--resolve generalizations
--resolve realisations
Complete!

I can see that I now have a class named "test"
with two operations:
-main(int,char*):int
-mysum(int,int):int

Question:
Where is the "code?" I expected to see activity
diagram(s) for main() and mysum() that indicate
their internal workings. I don't seem to be able
to find them. Am I missing a step, doing something
wrong, or am I just plain missing the point of EA?
Somehow I get the feeling that I am missing a very
fundamental point here.

I tried to create an Activity diagram but it seems
that you cannot import into it?

How do you "Load" a program in EA, edit it, and
then write it back? I've looked around a lot on
the internet and have not found much help on this.

========

int main (int argc, char * argv[])
{
         int var_1;
         int var_2;
         int var_3;
         real var_4;

         var_1=8;
         var_2=9;
         var3=mysum(var_1,var_2);
}

int mysum(int x, int y)
{
         int result;

         result=x+y;
         return result;
}


Aaron B

  • EA Administrator
  • EA User
  • *****
  • Posts: 941
  • Karma: +18/-0
    • View Profile
Re: How to import C code?
« Reply #1 on: December 08, 2010, 09:15:06 am »
EA cannot reverse engineer behavioral diagram types such as Activity or State at this time.  Sequence diagrams can be recorded by debugging your application in Enterprise Architect.  For an example, see:
http://www.sparxsystems.com/enterprise_architect_user_guide/8.0/software_development/how_it_works.html

rschreiber

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: How to import C code?
« Reply #2 on: December 09, 2010, 02:38:29 am »
Are there plans to provide this functionality? If so, a projected date? It seems to me that would be a big selling point for EA.

Using the execution analyzer is only a partial solution and not a good one at that. It would only cover paths that are actually executed and it assumes that the code is running on Windows.  How about an application running on some other hardware such as an imbedded controller? Also there are many code paths that are rarely executed. This approach is too simplistic.
« Last Edit: December 09, 2010, 02:44:32 am by rschreiber »