changeset 573:5f4b7ff18a34

set header path each include struct
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 24 Nov 2019 23:50:28 +0900
parents 3c35bcb82f08
children 7d66643d837d
files src/parallel_execution/auto_generate_context.pl src/parallel_execution/lib/Gears/Context.pm src/parallel_execution/lib/Gears/Util.pm
diffstat 3 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/auto_generate_context.pl	Sun Nov 24 22:59:13 2019 +0900
+++ b/src/parallel_execution/auto_generate_context.pl	Sun Nov 24 23:50:28 2019 +0900
@@ -8,7 +8,9 @@
 chomp @cbc_files;
 my $gears = Gears::Context->new(compile_sources => \@cbc_files);
 $gears->extraction_dg_compile_sources();
+#p $gears;
 $gears->search_data_gears();
+#p $gears;
 
 
 __DATA__
--- a/src/parallel_execution/lib/Gears/Context.pm	Sun Nov 24 22:59:13 2019 +0900
+++ b/src/parallel_execution/lib/Gears/Context.pm	Sun Nov 24 23:50:28 2019 +0900
@@ -52,11 +52,25 @@
   if (@_) {
     @data_gears_name = @_;
   } else {
-    @data_gears_name = keys %{$self->{data_gears_with_count}};
+    map { push (@data_gears_name,$_) if $_ ne "Context" } keys %{$self->{data_gears_with_count}};
   }
-  #my @data_gears_name =  keys %{$self->{data_gears_with_count}};
-  p @data_gears_name;
+  $self->find_headers(".",\@data_gears_name);
 }
 
+sub find_headers {
+  my ($self, $search_bash_path, $targets) = @_;
+  my %res;
+  map { $res{$_}++ } @$targets;
+
+  my $header_paths = Gears::Util->find_headers_path($search_bash_path);
+  map {
+    /(\w+)\.h/;
+    my $header_tile = $1;
+    if (exists $res{$header_tile}){
+      $res{$header_tile} = $_;
+    }
+  } @$header_paths;
+  p %res;
+}
 
 1;
--- a/src/parallel_execution/lib/Gears/Util.pm	Sun Nov 24 22:59:13 2019 +0900
+++ b/src/parallel_execution/lib/Gears/Util.pm	Sun Nov 24 23:50:28 2019 +0900
@@ -116,4 +116,14 @@
   return $header_file;
 }
 
+sub find_headers_path {
+  my $class = shift;
+  my $find_path = shift // ".";
+
+  my @files;
+  find( { wanted => sub { push @files, $_ if /\.h/ }, no_chdir => 1 }, $find_path);
+
+  return \@files;
+}
+
 1;