Friday, November 24, 2006

 

Generating drawing for documentation.

There are various ways to generate drawing for documentation. For me things are easier if I do not use GUI and Mouse unnecessarily.Graphviz is open source graphic visualization software developed by AT&T. It runs on multiple platforms, I have used it in Windows and Mac OS X.

It accepts scripts written in dot language and produces a graph/picture. Here is one such drawing for documentation.





The dot file (script) which generates the above drawing.
file: commandstructure.dot


digraph structs
{
node [shape=record];
struct1 [shape=record,
label=" COMMAND| \
COMMAND_TYPE| \
COMMAND_SUB_TYPE|\
PARAMETER"
];
struct2 [shape=record,
label=" {\
{0x1|STRT}| \
{0x2|MONI}| \
{0x3|RPLY}| \
{0x4|PLYD}\
}"
];
struct3 [shape=record,
label=" {\
{0x0|NONE}| \
{0xX|CHNL}| \
{0xX|BUTN} \
}"
];
struct4 [shape=record,
label=" {\
{0x0|OFF}| \
{0x1|ON }| \
{0x2|STP} \
}"
];
struct1:f1 -> struct2;
struct1:f2 -> struct3;
struct1:f3 -> struct4;
}


The command to generate the diagram.
c:\usr\shankar\develop\graphviz>dot -Tpng commandstructure.dot -o command.png
Note the diagram is generated in png format. It can also render it in many other formats like: canon, cmap, cmapx, dia, dot, fig, gd ,gd2, gif, hpgl, imap ,ismap, jpeg, jpg, mif, mp, pcl, pi,ps, ps2, svg, svgz, vrm, vtx, wbmp, xdot. So generate in the format your documentation tool can import.

Graphviz is used by Doxygen to draw C++ class diagrams, dependency graphs etc. of a project. I will cover it some other time.

Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?