changeset 178:0ef5c1d852fe

mofidy show caller line number at generate_context
author anatofuz
date Fri, 17 Jan 2020 15:25:05 +0900
parents d4e068b15f30
children 2842d9e65751
files src/gearsTools/lib/Gears/Context.pm
diffstat 1 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/gearsTools/lib/Gears/Context.pm	Fri Jan 17 15:09:01 2020 +0900
+++ b/src/gearsTools/lib/Gears/Context.pm	Fri Jan 17 15:25:05 2020 +0900
@@ -31,8 +31,8 @@
     open my $fh , '<', $cbc_file;
     while (my $line = <$fh>) {
        if ($line =~ /#interface\s*"(.*)\.h"/ || $line =~ /^\/\/\s*data_gear\s*"(.*)\.(?:h|dg)?"/) {
-          $self->{data_gears_with_count}->{$1}->{caller}->{$cbc_file}++;
-          $counter{interfaces}->{$1}++;
+          push(@{$counter{interfaces}->{$1}},$.);
+          push(@{$self->{data_gears_with_count}->{$1}->{caller}->{$cbc_file}},$.);
           next;
        }
 
@@ -53,37 +53,37 @@
 
        if ($line =~ /Gearef\(context,\s*(\w+)\)/) {
           my $implementation = $1;
-          $counter{impl}->{$implementation}++;
-          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          push(@{$counter{impl}->{$implementation}},$.);
+          push(@{$self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}},$.);
           next;
        }
 
     #Element* element = &ALLOCATE(cbc_context, Element)->Element;
        if ($line =~ /ALLOCATE\w*\((?:cbc_)?context,\s*(\w+)\)/) {
           my $implementation = $1;
-          $counter{impl}->{$implementation}++;
-          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          push(@{$counter{impl}->{$implementation}},$.);
+          push(@{$self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}},$.);
           next;
        }
 
        if ($line =~ /ALLOCATE_(?:PTR_)?ARRAY\((?:cbc_)?context,\s*(\w+),[\s\w]+\)/) {
           my $implementation = $1;
-          $counter{impl}->{$implementation}++;
-          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          push(@{$counter{impl}->{$implementation}},$.);
+          push(@{$self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}},$.);
           next;
        }
 
        if ($line =~ /new\s+(\w+?)\([\w\s]*\);/) {
           my $implementation = $1;
-          $counter{impl}->{$implementation}++;
-          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          push(@{$counter{impl}->{$implementation}},$.);
+          push(@{$self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}},$.);
           next;
        }
 
        if ($line =~ /ALLOCATE_DATA_GEAR\((\w+),\s*(\w+)\)/) {
           my $implementation = $2;
-          $counter{impl}->{$implementation}++;
-          $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++;
+          push(@{$counter{impl}->{$implementation}},$.);
+          push(@{$self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}},$.);
           next;
        }
 
@@ -91,16 +91,16 @@
        if ($line =~ /\((\w+)\*\)GearImpl\(context,\s*(\w+),\s*(\w+)\)/) {
           my $interface = $2;
           my $implementation = $1;
-          $self->{data_gears_with_count}->{$interface}->{caller}->{$cbc_file}++;
-          $counter{interfaces}->{$interface}++;
-          $counter{impl}->{$implementation}++;
+          push(@{$counter{impl}->{$implementation}},$.);
+          push(@{$counter{interfaces}->{$interface}},$.);
+          push(@{$self->{data_gears_with_count}->{$interface}->{caller}->{$cbc_file}},$.);
           next;
        }
 
        if ($line =~ /^__code/) {
          while ($line =~ /struct (\w+)\s*\*/g) {
            next if $1 eq "Context";
-           $self->{data_gears_with_count}->{$1}->{caller}->{$cbc_file}++;
+           push(@{$self->{data_gears_with_count}->{$1}->{caller}->{$cbc_file}},$.);
            next if (exists $counter{interfaces}->{$1});
            $counter{impl}->{$1}++;
          }