From 51e2959d56a2a753d46dae95e19c293142d72b34 Mon Sep 17 00:00:00 2001 From: jquelin Date: Tue, 6 Nov 2007 23:22:02 +0000 Subject: [PATCH] [project @ 141] r7599@merlin: jquelin | 2007-11-06 23:32:02 +0100 using one label for the ip details --- lib/Language/Befunge/Debugger.pm | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/Language/Befunge/Debugger.pm b/lib/Language/Befunge/Debugger.pm index 6a6e406..56c64ca 100644 --- a/lib/Language/Befunge/Debugger.pm +++ b/lib/Language/Befunge/Debugger.pm @@ -104,13 +104,6 @@ sub _on_start { -anchor => 'w' )->pack(-fill=>'x', -expand=>1); - # stack - my $l_stack = $h->{w}{l_stack} = $poe_main_window->Label( - -text => 'Stack = []', - -justify => 'left', - -anchor => 'w' - )->pack(-fill=>'x', -expand=>1); - #FIXME: lists of ips #-- various initializations @@ -163,13 +156,11 @@ sub _on_b_next { my $vec = $ip->get_position; my $val = $bef->get_torus->get_value($vec); my $chr = chr $val; - my ($curx, $cury) = $vec->get_all_components; - $tm->see("$cury,$curx"); - $tm->tagCell( 'current', "$cury,$curx" ); + my $tmindex = _vec_to_tablematrix_index($vec); + $tm->see($tmindex); + $tm->tagCell( 'current', $tmindex ); # FIXME: more than 1 ip = different colors - my $stack = $ip->get_toss; - $h->{w}{l_stack} ->configure( -text => "Stack = [@$stack]" ); - $h->{w}{l_curpos}->configure( -text => "Position: ($curx,$cury) $chr (ord=$val)" ); + $h->{w}{l_curpos}->configure( -text => _ip_to_label($ip,$bef) ); # end of tick: no more ips to process @@ -206,6 +197,16 @@ sub _get_cell_value { return chr( $torus->get_value($v) ); } +sub _ip_to_label { + my ($ip,$bef) = @_; + my $id = $ip->get_id; + my $vec = $ip->get_position; + my ($x,$y) = $vec->get_all_components; + my $stack = $ip->get_toss; + my $val = $bef->get_torus->get_value($vec); + my $chr = chr $val; + return "IP#$id \@$x,$y $chr (ord=$val) [@$stack]"; +} sub _vec_to_tablematrix_index { my ($vec) = @_; my ($x, $y) = $vec->get_all_components; -- 2.11.4.GIT