changeset 720:de34a5f91c62

tweak perl scripts
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 06 Nov 2020 16:26:09 +0900
parents 2316193f7999
children 9357393cc9a0
files src/parallel_execution/lib/Gears/Context.pm src/parallel_execution/lib/Gears/Interface.pm
diffstat 2 files changed, 6 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/lib/Gears/Context.pm	Tue Sep 08 18:26:33 2020 +0900
+++ b/src/parallel_execution/lib/Gears/Context.pm	Fri Nov 06 16:26:09 2020 +0900
@@ -124,7 +124,7 @@
   use Data::Dumper;
 
   for my $cg_name (keys %include_pool) {
-    my @tmp_cbc_file_names  = keys %{$include_pool{$cg_name}};
+    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});
@@ -162,15 +162,11 @@
   my $header_paths = Gears::Util->find_headers_from_path($root_path);
 
   for my $headerPATH (sort @$header_paths) {
-    if ($headerPATH !~ /(\w+)\.(?:h|dg)$/) {
-        next;
-    }
+    next if ($headerPATH !~ /(\w+)\.(?:h|dg)$/);
 
     my $header = $1;
 
-    unless (exists $res{$header}) {
-        next;
-    }
+    next unless (exists $res{$header});
 
     if ($res{$header} =~ /^\d+$/) {
       $res{$header} = $headerPATH;
@@ -211,9 +207,7 @@
   my ($self, $dg2path) = @_;
 
 
-  unless ($dg2path) {
-    croak "require ast at tree2create_context_h";
-  }
+  croak "require ast at tree2create_context_h" unless ($dg2path);
 
   my $template = $self->{template};
   load $template;
@@ -298,9 +292,7 @@
 
   for my $impl (keys %$impls) {
     my $ir = Gears::Interface->parse($impls->{$impl});
-    unless ($ir) {
-      next;
-    }
+    next unless ($ir);
 
     if ($ir->{isa}) {
       $dg_str{$ir->{isa}}->{impl}->{$impl} = $ir;
--- a/src/parallel_execution/lib/Gears/Interface.pm	Tue Sep 08 18:26:33 2020 +0900
+++ b/src/parallel_execution/lib/Gears/Interface.pm	Fri Nov 06 16:26:09 2020 +0900
@@ -161,9 +161,7 @@
   my ($class, $filename) = @_;
   open my $fh, '<', $filename;
   my $line = <$fh>;
-  unless ($line =~ /typedef struct \w+\s?<.*>([\s\w{]+)/) {
-    return 0;
-  }
+  return 0 unless ($line =~ /typedef struct \w+\s?<.*>([\s\w{]+)/);
   my $annotation = $1;
   return 0 if ($annotation =~ /impl/);