forked from 0ad/0ad
Entity XML inheritance graph generator. (Basically just Graphviz.)
This was SVN commit r2091.
This commit is contained in:
parent
bb7a22f32a
commit
31fb8c37c4
BIN
source/tools/entgraph/dot.exe
Normal file
BIN
source/tools/entgraph/dot.exe
Normal file
Binary file not shown.
BIN
source/tools/entgraph/entgraph.exe
Normal file
BIN
source/tools/entgraph/entgraph.exe
Normal file
Binary file not shown.
38
source/tools/entgraph/entgraph.pl
Normal file
38
source/tools/entgraph/entgraph.pl
Normal file
@ -0,0 +1,38 @@
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Find;
|
||||
use Graph;
|
||||
use Graph::Writer::Dot;
|
||||
|
||||
my $dir = '../../../binaries/data/mods/official/entities';
|
||||
my @xml;
|
||||
find({wanted=>sub{
|
||||
push @xml, $_ if /\.xml$/;
|
||||
}, no_chdir=>1}, $dir);
|
||||
s~\Q$dir/~~ for @xml;
|
||||
|
||||
my $graph = new Graph;
|
||||
|
||||
for my $f (@xml) {
|
||||
|
||||
my $parent;
|
||||
open I, "$dir/$f" or die "error opening $dir/$f: $!";
|
||||
while (<I>) {
|
||||
$parent = $1 if /Parent="(.*?)"/;
|
||||
}
|
||||
close I;
|
||||
|
||||
$f =~ m~(?:.*/|^)(.*)\.xml~ or die "invalid filename $f";
|
||||
my $name = $1;
|
||||
|
||||
if (defined $parent) {
|
||||
$graph->add_edge($parent, $name);
|
||||
} else {
|
||||
$graph->add_vertex($name);
|
||||
}
|
||||
}
|
||||
|
||||
Graph::Writer::Dot->new()->write_graph($graph, "entities.dot");
|
||||
|
||||
system("dot.exe", "-Tpng", "entities.dot", "-o", "entities.png");
|
BIN
source/tools/entgraph/jpeg.dll
Normal file
BIN
source/tools/entgraph/jpeg.dll
Normal file
Binary file not shown.
BIN
source/tools/entgraph/libexpat.dll
Normal file
BIN
source/tools/entgraph/libexpat.dll
Normal file
Binary file not shown.
BIN
source/tools/entgraph/png.dll
Normal file
BIN
source/tools/entgraph/png.dll
Normal file
Binary file not shown.
BIN
source/tools/entgraph/z.dll
Normal file
BIN
source/tools/entgraph/z.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user