Mercurial > hg > Members > menikon > CbC_xv6
changeset 182:f431400da994
fix_use_data_gears
author | anatofuz |
---|---|
date | Mon, 20 Jan 2020 17:10:58 +0900 |
parents | f9df567f7f2d |
children | d00a1d0758cb |
files | src/gearsTools/lib/Gears/Context.pm |
diffstat | 1 files changed, 27 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;