Subj : Re: Flowchart software that supports top down development? To : comp.programming,microsoft.public.vb.general.discussion,microsoft.public.visio.developer From : Richard Heathfield Date : Wed Jul 27 2005 09:12 am [Followups set to comp.programming] LurfysMa wrote: > Now, do you know of a flowcharting tool that will do most of the > clerical part of keeping track of the links (stubs)? No, but I can think of an easy way to do it yourself. In each function, write a line to a dot file, documenting the function. If it's a stub, make the label stand out (e.g. colour it red). Whenever you call a function, write a line to the dot file, documenting the call. So, for example, you might end up with a dot file like this: digraph "G" { main [label="main" fontcolor="white" color="blue" style="filled"]; main -> foo; main -> bar; foo [label="foo" fontcolor="white" color="red" style="filled"]; bar [label="bar" fontcolor="white" color="blue" style="filled"]; bar -> foo; bar -> baz; baz [label="baz" fontcolor="white" color="red" style="filled"]; }; (I've written this in the same order that I would expect it to be generated.) In this example, I've used red for stubs and blue for non-stubs. The exact details of how you actually write the dot file code does, of course, depend on the language you're using, but the good news is that it should modularise nicely. To generate the dot file itself, of course, you simply run the program. Then you pipe the resulting output through dot: me@here:~/dev/scratch> cat scratch.dot | dot -Tps -o scratch.ps or, if you're using an Imperial system: c:\dev\scratch> type scratch.dot | dot -Tps -o scratch.ps How you view the resulting image depends on which output format you chose. Here, I chose PostScript, so I can just do: me@here:~/dev/scratch> gv scratch.ps & Just one annoyance - if, say, bar calls foo MANY times (i.e. more than once), you'll get many arrows joining them in your diagram. The fix is either to ensure that your call-generating code only gets called once regardless of how often the subsidiary function is called, or to pour the program through a uniqueness filter that preserves line order. Fortunately, it's fairly trivial to write such a filter (or of course you could nose around on the Net for one). Last I checked, you could get dot from: http://www.graphviz.org -- Richard Heathfield "Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk mail: rjh at above domain .