From 388d7f33e710e12596423bab99335f88b5480819 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 21 Aug 2009 17:35:19 +0100 Subject: [PATCH] yppedia-chart-parser better debug --- yarrg/yppedia-chart-parser | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/yarrg/yppedia-chart-parser b/yarrg/yppedia-chart-parser index a8b9f2a..b3cb1c2 100755 --- a/yarrg/yppedia-chart-parser +++ b/yarrg/yppedia-chart-parser @@ -61,7 +61,7 @@ sub parse_yppedia_map () { if (($x,$y,$arch) = m/^\{\{ chart\ label \|(\d+)\|(\d+)\| .* \'\[\[ [^][\']* \| (\S+)\ archipelago \]\]\'*\}\}$/xi) { - printf DEBUG "%d,%d arch %s\n", $x,$y,$arch; + printf DEBUG "%2d,%-2d arch %s\n", $x,$y,$arch; push @wiarchlabels, [ $x,$y,$arch ]; } elsif (($x,$y,$island) = m/^\{\{ chart\ island\ icon \|(\d+)\|(\d+)\| @@ -72,7 +72,7 @@ sub parse_yppedia_map () { $widists->add_vertex($n); $wiarchs->add_vertex($n); #print "\$g->add_vertex('$n');\n"; - printf DEBUG "%d,%d island %s\n", $x,$y,$island; + printf DEBUG "%2d,%-2d island %s\n", $x,$y,$island; } elsif (($solid,$x,$y,$dirn) = m/^\{\{ chart\ league((?:\ solid)?) \|(\d+)\|(\d+)\| ([-\/\\o]) \| .*\}\}$/xi) { @@ -89,7 +89,7 @@ sub parse_yppedia_map () { $wiarchs->add_edge($nn->(), nn_xy($bx,$by)) if $solid; #print "\$g->add_edge('".$nn->()."','".nn_xy($bx,$by)."');\n" if $solid; - printf DEBUG "%d,%d league %s %s \n", $x,$y, + printf DEBUG "%2d,%-2d league %-6s %s\n", $x,$y, $solid?'solid':'dotted', $dirn; } elsif ( m/^\{\{ chart\ head \}\}$/xi @@ -133,7 +133,7 @@ sub process_yppedia_graphs () { map { $weight += $widists->get_edge_weight($delete, $_) } @neigh; $widists->add_weighted_edge(@neigh, $weight); $widists->delete_vertex($delete); - print DEBUG "$delete elide $weight\n"; + printf DEBUG "%-5s elide %5s %-5s %2d\n", $delete, @neigh, $weight; } # Check that it's connected. @@ -165,7 +165,7 @@ sub process_yppedia_graphs () { my ($vx,$vy) = split /,/, $vertex; my $d2= ($vx-$ax)*($vx-$ax) + ($vy-$ay)*($vy-$ay); # printf DEBUG -# "%d,%d arch-island-search %s d2=%d ccix=%d cc=%d %s\n", +# "%2d,%-2d arch-island-search %s d2=%d ccix=%d cc=%d %s\n", # $ax,$ay, $vertex, $d2, $ccix, scalar(@cc), # $winode2island{$vertex}; next unless @cc > 1; @@ -174,7 +174,7 @@ sub process_yppedia_graphs () { $d2best= $d2; } die 'no island vertices?!' unless defined $best; - printf DEBUG "%2d,%-2d arch-island-select %5s d2=%-2d %-10s %s\n", + printf DEBUG "%2d,%-2d arch-island-select %-5s d2=%-2d %-10s %s\n", $ax,$ay, $best, $d2best, $arch, $winode2island{$best}; my $ccix= $wiarchs->connected_component_by_vertex($best); my $desc= join "\n", map { @@ -213,14 +213,12 @@ sub compare_island_lists () { error("would delete island: $island"); next; } - my $ccix= $wiarchs->connected_component_by_vertex($node); - my $wiarch= $wiccix2arch{$ccix}; + my $wiarch= winode2arch($node); if (!defined $wiarch) { error("island has no arch: $island"); next; } my $dbarch= $dbisland2arch{$island}; - my $wiarch= winode2arch($node); if ($wiarch ne $dbarch) { change("change archipelago from $dbarch to $wiarch". " for island $island"); -- 2.30.2