I would like a tool to create diagram in a programming language, maybe something like lua.
Is there any tool designed for that?
Yes, you can generate .dot
files for Graphviz. Since these are text files, you can do it from any language. I wrote a post a while ago about auto-generating binary-tree diagrams from C code using Graphviz.
A little retro, perhaps, but there's always Pic. It outputs to .eps which can easily be convert
ed to anything you want.
The input is a little old-school, but since it's all-text, it can be targetted by any language (even Lua) that has text output. Here's an example of a diagram of a data-structure.
.PS
boxwid = .5; boxht = .25
down
Base: box "base"
Used: box "used"
Max: box "max"
move to Base.e
move right
right
Mfile: box dashed wid 3 ht 5
move to Mfile.nw; move down .125
Mtab: right; box "nexttab"; box "nextent"
move to Mtab.sw; move down .25
Tab: right; box "adr0"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr1"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr2"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr3"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr4"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr5"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr6"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr7"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box "adr8"; box "mark"; box "sz"
move to Tab.sw; move down .25
Tab: right; box invis "..."; box invis "..."; box invis "..."
move to Tab.sw; move down .25
Tab: right; box "adrN"; box "mark"; box "sz"
arrow from Base.e to Mfile.nw
arrow from Used.e to Tab.sw down .125
arrow from Max.e to Mfile.sw
.PE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With