See at end
On 29-Mar-10 13:32:49, Srdjan Todorovic wrote:
Hi Ted,
On 29/03/2010, Ted Harding Ted.Harding@manchester.ac.uk wrote:
On 29-Mar-10 09:14:43, Srdjan Todorovic wrote:
Lets say I'm documenting a low-level protocol or file format and want to produce a picture such as the TCP header (etc) table (http://izecksohn.com/pedro/pub/tcp_header.jpg), what's the best program to use for that?
Another example: http://www.wtcs.org/snmp4tpc/images/TCP-Header.jpg
The first one is pure "ASCII ART", so you could do it at the keyboard and then take a screenshot of it :)!
I linked that picture to try to show that the byte boundaries need to be shown.
The second one is skewed, as seen on my screen. Is that intentional?
Oh that's just I think scanned from a book. I was more concerned with the representation of the same information from the ASCII picture into this pretty picture.
In either case (being serious for once) the ideal Unix/Linux-based package for this is groff, using the pic preprocessor (which translates a diagram description language into troff input which then draws the diagram). The output is PostScript (PS), which can be coverted (e.g. into JPEG) by the ImageMagick program 'convert'.
Ugh. Sounds like too much work, but thanks for the idea. Does it end up looking horrible just like the ASCII picture?
What would be great is some kind of C/C++ struct to diagram converter program to take care of this for me.
I could prepare examples emulating your two above for study, but don't have time right now (maybe later today, maybe even later).
Thanks for the offer - I'm managing just fine with Inkscape for the moment. One has to be very careful with Inkscape to get the sizes and layouts right. At least it beats Gimp for this kind of work. :)
Srdjan
As illutration, I've done your second one http://www.wtcs.org/snmp4tpc/images/TCP-Header.jpg using pic+groff. I've put the results on
http://www.zen89632.zen.co.uk/Misc
files: tcpheader.tr (text input troff, almost entirely pic language) tcpheader.ps (PostScript output from the first, produced by groff) tcpheader.pdf (PDF converted from PS using pstopdf)
This was not the neatest way to do it. There is a lot of repetition in the ".tr" file (and there's quite a bit in the graphic as well). If I were doing this for a repeated type of job job (or just to make the source look nicer), I'd encapsulate much of it in macros.
As it is, it was just done "on the fly", building it up as I went along. Also, there is a little bit of tweaking which could be done to slightly improve a few bits of it; but I reckon it's not bad as it stands.
For conversion to other formats, the PS file would need to have a BoundingBox line put into it (I haven't done this yet). Then the 'convert' program could convert it into anything else.
Ted. PS: Can one post attachments to the ALUG list?
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 29-Mar-10 Time: 18:52:41 ------------------------------ XFMail ------------------------------