]> granicus.if.org Git - graphviz/commitdiff
fixes from Max, and me, now works
authorellson <devnull@localhost>
Sat, 12 Jan 2008 02:54:02 +0000 (02:54 +0000)
committerellson <devnull@localhost>
Sat, 12 Jan 2008 02:54:02 +0000 (02:54 +0000)
tclpkg/gv/demo/modgraph.pl

index 5fd5f7eb76534de2971c94264876b1704fd625a9..394066dec8e492c9a04038353177e6c350fc0af3 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/perl -w
-# #!/usr/local/bin/perl -w
 # Change ^^ to the version of Perl you installed the SWIG modules / Graphviz with
 #
 # Change this to point to your installed graphviz lib dir
@@ -30,27 +29,31 @@ gv::setv($N, "fontname", "helvetica");
 gv::setv($E, "arrowsize", ".4");
 
 open (M,"<$Modules") or die "Can't open $Modules. $!\n";
+
 while (<M>) {
     chomp;
-    # parport                36832   1 (autoclean) [parport_pc lp]
     my @f = split(/\s+/);
     # Should be at least three columns
     next unless scalar @f >= 3;
 
+    # Linux 2.4 : parport 36832 1 (autoclean) [parport_pc lp]
+    # Linux 2.6 : eeprom 14929 0 - Live 0xffffffff88cc5000
     my $module  = shift @f;
     my $size    = shift @f;
     my $used_by = shift @f;
+    # this is ugly, needed to clean up the list of deps from 2.4 or 2.6
     my $deps    = join (' ',@f);
+    $deps =~ s/ Live.*//;
+    $deps =~ s/[\[\]\-(),]/ /g;
 
     Debug("$module");
     my $n = gv::node($G,$module);
 
-    # look for and get rid of brackets.  ignore parens, etc.
-    if ($deps =~ s/\[(.*)\]/$1/) {
-        foreach my $dep (split(/\s+/,$deps)) {
-            Debug(" $dep -> $module");
-            gv::edge($n, gv::node($G, $dep) );
-        }
+    foreach my $d ( split(/\s+/,$deps) ){
+        # gv::node($G, $d)  creates the node, if needed,
+       #      but doesn't complain if it already exists
+        Debug(" $d -> $module");
+        gv::edge($n, gv::node($G, $d) );
     }
 }