Archived
1
0
Fork 0

Add features to debug notation process

This commit is contained in:
Mercier Pierre-Olivier 2013-09-12 12:00:18 +02:00
commit d3e723f65a
3 changed files with 66 additions and 13 deletions

View file

@ -46,7 +46,7 @@ sub create_from_trace ($$)
for my $id (sort( keys %{ $trace->{ids} } ))
{
my $p = Point->new(0, $id, 0, 0);
my $p = Point->new($trace->{ids}{$id}, $id, 0, 0);
push @{ $g->{tree} }, $p;
}
@ -264,7 +264,7 @@ sub compute ($$$;$$)
@current;
}
else {
$res = $current[0];
$res = $current[0] // 0;
}
$res = $res * $self->{factor};
@ -287,6 +287,7 @@ package Point;
use v5.10.1;
use strict;
use warnings;
use Term::ANSIColor qw(:constants);
sub new ($$$$$)
{
@ -315,12 +316,16 @@ sub to_string ($$$)
$parent->appendChild($point);
}
sub getValue ($$)
sub getValue ($$;$)
{
my $self = shift;
my $ids = shift;
my $justMatch = shift;
if ($self->{value} eq "") {
if (!$justMatch && !$ids->{ $self->{ref} } // 0) {
return 0;
}
elsif ($self->{value} eq "") {
return $ids->{ $self->{ref} } // 0;
}
else {
@ -347,6 +352,16 @@ sub compute ($$$;$$)
}
}
if ($main::debug)
{
my $str = "not=".($self->{not}//0).", qversion".($self->{qversion}//"*").", ref=".($self->{ref}//"").",\tvalue=".$self->getValue( $ids, 1 ).", got=".($ret // 0);
if ($ret) {
say GREEN, ">>>", RESET, " Matching point: ", $str;
} else {
say RED, " * ", RESET, " Skipped point: ", $str;
}
}
return $ret;
}