On 7/13/23 5:23 PM, via Doxygen-users wrote:
I'm using doxygen to create state machine diagrams from my C code. This works
great, I can create a comment block like this, run doxygen / graphwiz, and get
a html file with the diagram:
/*!
\dot
digraph my_state_machine {
rankdir=LR;
size="8,5"
init -> start [ label = "" ];
start -> continue [ label = "" ];
continue -> stop[ label = "" ];
stop -> start [ label = "" ]; }
\enddot
*/
Now I would like to be able in interleave doxygen comments with my code, so the
documentation and the corresponding code are closer together. I would like to
split the above diagram like this:
/*! \dot digraph my_state_machine { rankdir=LR; size="8,5" } \enddot */
uint8_t mystate = ST_INIT;
while 1
{
switch (myState)
{
case ST_INIT:
{
/*! \dot digraph my_state_machine { init -> start [ label =
"" ]; } \enddot */
myState = ST_START;
break;
}
case ST_START:
{
/*! \dot digraph my_state_machine { start -> continue [ label =
"" ]; } \enddot */
myState = ST_CONTINUE;
break;
}
case ST_CONTINUE:
{
/*! \dot digraph my_state_machine { continue -> stop [ label =
"" ]; } \enddot */
myState = ST_STOP;
break;
}
case ST_STOP:
{
/*! \dot digraph my_state_machine { stop -> start [ label =
"" ]; } \enddot */
myState = ST_START;
break;
}
}
}
Is there any filter that can take fragments of the digraph diagram, assemble
it, and then feed it to doxygen, so doxygen can feed it into graphwiz/dot?
Can doxygen be extended to be able to assemble \dot fragments?
One thought to try,( not at a setup to test this right now), use ///
comments like:
/// \dot digraph my_state_machine { rankdir=LR; size="8,5" } \enddot
uint8_t mystate = ST_INIT; ///
while 1 ///
{ ///
switch (myState) ///
{ ///
case ST_INIT: ///
{ ///
/// \dot digraph my_state_machine { init -> start [ label =
"" ]; } \enddot
myState = ST_START; ///
break; ///
} ///
case ST_START: ///
{ ///
/// \dot digraph my_state_machine { start -> continue [ label =
"" ]; } \enddot
myState = ST_CONTINUE; ///
break; ///
} ///
case ST_CONTINUE: ///
{ ///
/// \dot digraph my_state_machine { continue -> stop [ label =
"" ]; } \enddot
myState = ST_STOP; ///
break; ///
} ///
case ST_STOP: ///
{ ///
/// \dot digraph my_state_machine { stop -> start [ label =
"" ]; } \enddot */
myState = ST_START; ///
break; ///
} ///
} ///
} ///
Since every line has a comment, the documenting comment block should
continue
--
Richard Damon
_______________________________________________
Doxygen-users mailing list
Doxygen-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/doxygen-users