I have looked at a utility trace2uml which parses the source code and looks for a Trace2UML syntax to describe the sequence diagram and creates the sequence diagram. I am interested to know if it is possible to create the sequence diagram by parsing the C source code alone?
I don't think this is possible at all, by principle. Source code is inherently static. Sequence charts depict dynamical behavior. The dynamic behavior isn't in the source code, so it can't be extracted.
There are tools to make call graphs from C source in both directions, like cflow
. Maybe a call graph can provide some insight into some source code's inner workings.
I am not a big connoisseur of UML diagrams but i know that generating diagrams from the code like: sequential diagram or class diagram are intended for object oriented languages like Java, c++, c# and many others. So if you ask me, it is not possible no generate sequence diagram from the code written in the C.
If you have some code written in the some objected language its possible to generate sequence diagram especially in the visual paradigm (tool for creating UML diagrams).
It does not matter whether it's C (not-/) or C++ (OO). The problem is called Halting problem: see wikipedia. For that simple reason you can not create SDs from pure source. Anyway, a SD is meant to emphasize a certain phase of the executing code, not all paths. Just imagine how ridiculously spider-webby such a SD would look like. It were just useless.
Have you tried with plantuml? It works really well with doxygen, I use it at work with the company template and the syntax it's really easy, you have to write the call sequence yourself though. There are plenty examples in the page, if you are working in Linux you can use your native packaging tool to install it, the same applies to doxygen (e.g. sudo apt-get plantuml). Otherwise if you are using Windows you can use the installers from the official pages too.
You'll have to do some configuration but it's pretty straightforward, I'll leave you the links to each tool.
Download pages:
Plantuml examples: http://plantuml.com/sequence-diagram
You can find the documentation in each page, for plantmul you use java executable (.jar) then you don't have to install nothing, you just need to configure doxygen to find the executable, you can find how in the doxygen documentation page:
http://www.doxygen.nl/manual/index.html
If you want to configure it without reading the documentation you could also watch this video: https://www.youtube.com/watch?v=LZ5E4vEhsKs
I hope this helps, cheers.
© 2022 - 2024 — McMap. All rights reserved.