#!/usr/bin/perl # # This PERL script builds a Diagram of a C++ Class Hierarchy. # Contributed by: Hans Elbers (elbers@dsv.nl) # # usage: maketree FullDirectoryNameOfFoxIncludes/*.h >tree.html foreach $file (@ARGV) { open (FILE, "<$file"); while () { next unless (/class\s+FXAPI\s+(\w+)\s*:\s*public\s*(\w+).*{/); $parent = $2; $child = $1; $children{$parent} = $children{$parent}.",".$child; $file{$child} = $file; } close FILE; } print < FOX Class Hierarchy

FOX Class Hierarchy

END

showChildren ('FXObject', 0);

print "
\n"; sub showChildren() { my $class=shift; my $indent=shift; my $tab = "| " x $indent; print "$tab$class\n"; my @child = split (/,/, $children{$class}); shift @child; sort @child; for (my $i=0; $i<@child; $i++) { showChildren($child[$i], $indent+1); } }