# HG changeset patch # User anatofuz # Date 1580197807 -32400 # Node ID 4d76280758dbecf34cb23cdcc0f26647acf89227 # Parent 21a5761e3e7a87df88d068cc292b1f817bd8aedd move context.pm to util.pm ... diff -r 21a5761e3e7a -r 4d76280758db src/gearsTools/gen_Stub.pl --- a/src/gearsTools/gen_Stub.pl Tue Jan 28 15:20:34 2020 +0900 +++ b/src/gearsTools/gen_Stub.pl Tue Jan 28 16:50:07 2020 +0900 @@ -15,4 +15,5 @@ my $target_cbc_file = shift; my $stubManager = Gears::Stub->new(file_name => File::Spec->rel2abs($target_cbc_file)); -$stubManager->findInterfacewImpl(File::Spec->rel2abs($target_cbc_file)); +my $interface_w_impl = $stubManager->findInterfacewImpl(File::Spec->rel2abs($target_cbc_file)); + diff -r 21a5761e3e7a -r 4d76280758db src/gearsTools/lib/Gears/Context.pm --- a/src/gearsTools/lib/Gears/Context.pm Tue Jan 28 15:20:34 2020 +0900 +++ b/src/gearsTools/lib/Gears/Context.pm Tue Jan 28 16:50:07 2020 +0900 @@ -33,7 +33,7 @@ my $self = shift; my @data_gears_name; map { push (@data_gears_name,$_) if $_ ne "Context" } @_; - return _find_headers($self->{find_root},\@data_gears_name); + return Gears::Util->docking_header_name_to_path($self->{find_root},\@data_gears_name); } sub update_dg_each_header_path { @@ -110,26 +110,4 @@ return \%dg_str; } -sub _find_headers { - my ($search_bash_path, $targets) = @_; - my %res; - map { $res{$_}++ } @$targets; - - my $header_paths = Gears::Util->find_headers_path($search_bash_path); - map { - if (/(\w+)\.(?:h|dg)$/) { - my $header_file = $1; - if (exists $res{$header_file}) { - if ($res{$header_file} =~ /^\d+$/){ - $res{$header_file} = $_; - } elsif (($_ =~ /\.dg$/) && ($res{$header_file} =~ /\.h$/)) { - $res{$header_file} = $_; - } - } - } - } sort @$header_paths; - return \%res; -} - - 1; diff -r 21a5761e3e7a -r 4d76280758db src/gearsTools/lib/Gears/Stub.pm --- a/src/gearsTools/lib/Gears/Stub.pm Tue Jan 28 15:20:34 2020 +0900 +++ b/src/gearsTools/lib/Gears/Stub.pm Tue Jan 28 16:50:07 2020 +0900 @@ -22,7 +22,18 @@ my $self = shift; my $cbc_file = shift // $self->{file_name}; my $findInterfaces = Gears::Util->extraction_dg_compile_sources([$cbc_file]); - p $findInterfaces; + my $edgcs = Gears::Util->extraction_dg_compile_sources([$cbc_file]); + my $findInterfaces = {}; + + my %ifs = (); + map { $ifs{$_}++ } keys %{$edgcs->{interfaces}}; + delete $ifs{Meta}; + delete $ifs{TaskManager}; + + push(@{$findInterfaces->{interfaces}}, keys %ifs); + push(@{$findInterfaces->{impls}}, keys %{$edgcs->{impl}}); + + return $findInterfaces; } 1; diff -r 21a5761e3e7a -r 4d76280758db src/gearsTools/lib/Gears/Util.pm --- a/src/gearsTools/lib/Gears/Util.pm Tue Jan 28 15:20:34 2020 +0900 +++ b/src/gearsTools/lib/Gears/Util.pm Tue Jan 28 16:50:07 2020 +0900 @@ -191,15 +191,13 @@ } - #if ($line =~ /^(\w+)(\*)+ *create(\w+)\(([^]]*)\)/) { - # my $interface = $1; - # my $implementation = $3; - # $self->{data_gears_with_count}->{$interface}->{caller}->{$cbc_file}++; - # $self->{data_gears_with_count}->{$implementation}->{caller}->{$cbc_file}++; - # $counter{interfaces}->{$interface}++; - # $counter{impl}->{$implementation}++; - # next; - #} + if ($line =~ /^(\w+)\*\s*create(\w+)\(/) { + my $interface = $1; + my $implementation = $2; + push(@{$counter{interfaces}->{$interface}->{$cbc_file}},$.); + push(@{$counter{impl}->{$implementation}->{$cbc_file}},$.); + next; + } if ($line =~ /Gearef\(context,\s*(\w+)\)/) { my $implementation = $1; @@ -279,6 +277,26 @@ return \%counter; } +sub docking_header_name_to_path { + my ($class, $search_bash_path, $targets) = @_; + my %res; + map { $res{$_}++ } @$targets; + + my $header_paths = Gears::Util->find_headers_path($search_bash_path); + map { + if (/(\w+)\.(?:h|dg)$/) { + my $header_file = $1; + if (exists $res{$header_file}) { + if ($res{$header_file} =~ /^\d+$/){ + $res{$header_file} = $_; + } elsif (($_ =~ /\.dg$/) && ($res{$header_file} =~ /\.h$/)) { + $res{$header_file} = $_; + } + } + } + } sort @$header_paths; + return \%res; +} 1; diff -r 21a5761e3e7a -r 4d76280758db src/impl/vm_impl_private.cbc --- a/src/impl/vm_impl_private.cbc Tue Jan 28 15:20:34 2020 +0900 +++ b/src/impl/vm_impl_private.cbc Tue Jan 28 16:50:07 2020 +0900 @@ -6,7 +6,7 @@ #interface "vm_impl.h" /* -vm_impl* createvm_impl2(); +vm_impl* createvm_impl2(); //:skip */ __code loaduvm_ptesize_checkvm_impl(struct vm_impl* vm_impl, __code next(int ret, ...)) {