# HG changeset patch # User anatofuz # Date 1579507858 -32400 # Node ID f431400da994c44e17a627c2dc29733c19007048 # Parent f9df567f7f2d9074addc11b6309893b9be686162 fix_use_data_gears diff -r f9df567f7f2d -r f431400da994 src/gearsTools/lib/Gears/Context.pm --- a/src/gearsTools/lib/Gears/Context.pm Mon Jan 20 16:44:55 2020 +0900 +++ b/src/gearsTools/lib/Gears/Context.pm Mon Jan 20 17:10:58 2020 +0900 @@ -27,6 +27,7 @@ sub extraction_dg_compile_sources { my $self = shift; my %counter; + my %include_pool = (); for my $cbc_file (@{$self->{compile_sources}}) { open my $fh , '<', $cbc_file; while (my $line = <$fh>) { @@ -34,11 +35,16 @@ next; } - if ($line =~ /#interface\s*"(.*)\.h"/ || $line =~ /^\/\/\s*data_gear\s*"(.*)\.(?:h|dg)?"/) { + if ($line =~ /#interface\s*"(.*)\.h"/) { push(@{$counter{interfaces}->{$1}->{$cbc_file}},$.); next; } + if ($line =~ /^\/\/\s*data_gear\s*"(.*)\.(?:h|dg)?"/) { + push(@{$include_pool{$1}->{$cbc_file}},$.); + next; + } + if ($line =~ m|//\s*Skip:\s*generate_context|) { $line = <$fh>; next; @@ -105,12 +111,29 @@ } close $fh; } + + for my $cg_name (keys %include_pool) { + my @tmp_cbc_file_names = keys %{$include_pool{$cg_name}}; + my $tmp_cbc_file_name = shift @tmp_cbc_file_names; + if (exists $counter{interfaces}->{$cg_name}){ + push(@{$counter{interfaces}->{$cg_name}->{$tmp_cbc_file_name}},$include_pool{$cg_name}->{$tmp_cbc_file_name}); + delete $include_pool{$cg_name}; + last; + } + + if (exists $counter{impl}->{$cg_name}){ + push(@{$counter{impl}->{$cg_name}->{$tmp_cbc_file_name}},$include_pool{$cg_name}->{$tmp_cbc_file_name}); + delete $include_pool{$cg_name}; + last; + } + push(@{$counter{interfaces}->{$cg_name}->{$tmp_cbc_file_name}},$include_pool{$cg_name}->{$tmp_cbc_file_name}); + delete $include_pool{$cg_name}; + } + $counter{interfaces}->{Meta}++; $counter{interfaces}->{TaskManager}++; - $self->{data_gears_with_count}->{Meta}++; - $self->{data_gears_with_count}->{TaskManager}++; + print "-----------\n"; use Data::Dumper; - print "-----------\n"; print Dumper \%counter; print "-----------\n"; return \%counter;