file dependency generator?
John R. Comeau
comeaujr at sd.conexant.com
Thu Apr 27 19:52:43 CDT 2000
~sdpm~
I have a large C project I work ON. We have around 100 .c files. At
one time I attempted to write a Perl program that would graph the
dependencies between these files. What I mean by a 'dependency' is
that the C functions in one file call the C functions in another. I
was attempting to graph this relationship in pTk using shapes
containing the names of the .c files connected by arrows pointing from
a "calling" file to a "called" file.
The graphing in pTk wasn't much of a problem, but trying to figure out
how to arrange this many files was a problem. These file nodes with
their connecting arrows ended up looking like a horrible mess, and
didn't shed much light on the relationship between the files. I
played around with various algorithms (all invented by myself), but I
couldn't come up with anything to sort them out in a clear fashion.
Perhaps this means that the project is disorganized and poorly
modularized, but I tend to think the problem was more with my
algorithm for arranging them in two dimensions.
I was thinking that it would be a lot simpler to just create a
text-based structure something like this:
file_A
file_B
file_C
file_D
file_E
file_F
file_G
file_B
file_H
file_I
This is sort of like the directory structures you see in file_ browser
GUIs or generated by the Unix 'tree' command. The problem with this
is that, like file_B in the example above, the tree is not a regular
tree. Sometimes the branches rejoin themselves.
A similar is solved by the Data::Dumper by referring back to a data
structure it has already printed without printing it again. I could
just take that approach and not repeat the tree when it's already been
printed. If I took that approach, I could write a program really
quickly with Data::Dumper by just creating a data structure analogous
to the file dependency structure and then Data::Dump'ing it.
But does anyone have any ideas for graphing a full tree that shows all
the reconnected branches? I.e. that would show the structure like it
really is - like a Hillbilly family tree? I'd think that other
programmers have faced this problem before.
-John
~sdpm~
The posting address is: san-diego-pm-list at hfb.pm.org
List requests should be sent to: majordomo at hfb.pm.org
If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at happyfunball.pm.org> with the following
command in the body of your email message:
unsubscribe san-diego-pm-list
If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at happyfunball.pm.org> .
This is the general rule for most mailing lists when you need
to contact a human.
More information about the San-Diego-pm
mailing list