Mercurial > hg > Game > Cerium
changeset 332:5950b6ff7fec draft
change bin/cerium
author | aaa |
---|---|
date | Fri, 12 Jun 2009 17:03:18 +0900 |
parents | 4f2423ed1c86 |
children | 82e217ed5af5 |
files | bin/cerium lib/tasks.xml |
diffstat | 2 files changed, 57 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/cerium Fri Jun 12 16:05:03 2009 +0900 +++ b/bin/cerium Fri Jun 12 17:03:18 2009 +0900 @@ -110,12 +110,65 @@ my $parser = XML::LibXML->new(); my $doc = $parser->parse_file("$cerium_path/lib/tasks.xml"); my $root = $doc->documentElement(); + my $ccs = {}; for my $e ($root->childNodes) { - print $e->nodeName, "\n"; + if ( $e->nodeName eq "cc" ) { + my $cc = {}; + my @att = $e->attributes; + print $e->nodeName, "\n"; + + for my $a (@att) { + if ( $a->nodeName eq "name" ) { + print $a->value, "\n"; + $cc->{"name"} = $a->value; + } + } + + for my $child ( $e->childNodes ) { + &compiler($cc, $child); + } + + $ccs->{$cc->{"name"}} = $cc; + } + } + &printcc($ccs); +} + +sub compiler{ + my ($cc, $e) = @_; + + my $type = $e->nodeName; + my $c = {}; + for my $child ( $e->childNodes ) { + my $node = $child->nodeName; + if ( $node eq "command" ) { + $c->{"command"} = $child->textContent; + } elsif ( $node eq "flag" ) { + $c->{"flag"} .= $child->textContent . " "; + } + } + + $cc->{$type} = $c; +} + +sub printcc{ + my ($ccs) = @_; + + for my $cc (keys %$ccs) { + print "$cc", "\n"; + for my $s (keys %{$ccs->{$cc}}) { + #print "$s : $cc->{$s}" , "\n"; + print " $s "; + my %h = %{$ccs->{$cc}->{$s}}; + for my $t (keys %h) { + print " $t : $h{$t}\n"; + } + } } } + __END__ =head1 NAME
--- a/lib/tasks.xml Fri Jun 12 16:05:03 2009 +0900 +++ b/lib/tasks.xml Fri Jun 12 17:03:18 2009 +0900 @@ -9,6 +9,7 @@ SPE_4 = 6, SPE_5 = 7, --> +<task-config> <cc name="spu-g++"> <compiler> @@ -47,3 +48,5 @@ <flag> ${CERIUM}/TaskManager -lFifoManager `sdl-config --libs` </flag> </linker> </cc> + +</task-config>