changeset 579:fe8c04001929

clean Gears::Util
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Wed, 27 Nov 2019 13:13:15 +0900
parents d6718b5ad312
children 39b5adbcd83f
files src/parallel_execution/lib/Gears/Util.pm src/parallel_execution/plautogen/impl/TaskManagerImpl.h
diffstat 2 files changed, 12 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/lib/Gears/Util.pm	Wed Nov 27 12:30:09 2019 +0900
+++ b/src/parallel_execution/lib/Gears/Util.pm	Wed Nov 27 13:13:15 2019 +0900
@@ -67,17 +67,10 @@
     next if ($line =~ m[^\}\s*$ir->{name};]);
 
     if ($line =~ m|__code (\w+)\(([()\.\*\s\w,_]+)\)|) {
-      unless ($code_verbose) {
-        push(@{$ir->{codes}},$1);
-        next;
-      }
-      push(@{$ir->{codes}}, [$1,$2]);
-      next;
+      $line = "enum Code $1;\n";
     }
 
-    $line =~ s/\s*([\w\s\*]+);\s*/$1/;
-    chomp $line;
-    push(@{$ir->{data}},$line);
+    push(@{$ir->{content}},$line);
   }
 
   return $ir;
@@ -134,23 +127,16 @@
   my $space = '    ';
 
   $context =  "${space}struct $h2context->{name} {\n";
-  if (exists $h2context->{data}) {
-    for my $datum (@{$h2context->{data}}) {
-      my $dd = $datum;
-      unless (($dd =~ /[{,.]$/) || ($dd =~ m{^\s+(//|/*)})) {
-        $dd =~ s{([\w\*\s]+)+((//|/\*)?.*)}{$1;$2};
-      }
-      if ($dd =~ /^\s*\}\s*\w+\s*$/ ) {
-        $dd .= ";";
-      }
-      $context .= "${space}${space}$dd";
-      $context .= "\n";
-    }
+  my $content_space;
+  my @chars = split //, $h2context->{content}->[0];
+  for my $w (@chars) {
+    last if ($w !~ /\s/);
+    $content_space .= $w;
   }
-  if (exists $h2context->{codes}) {
-    for my $code (@{$h2context->{codes}}) {
-      $context .= "${space}${space}enum Code $code;\n";
-    }
+
+  for my $c (@{$h2context->{content}}) {
+    $c =~ s/$content_space//;
+    $context .= "${space}${space}$c";
   }
   $context .= "${space}} $h2context->{name};\n";
   return $context;
--- a/src/parallel_execution/plautogen/impl/TaskManagerImpl.h	Wed Nov 27 12:30:09 2019 +0900
+++ b/src/parallel_execution/plautogen/impl/TaskManagerImpl.h	Wed Nov 27 13:13:15 2019 +0900
@@ -1,5 +1,4 @@
 typedef struct TaskManagerImpl <Type, Isa> impl TaskManager {
-  __code next(...);
   int numWorker;
   int sendCPUWorkerIndex;
   int sendGPUWorkerIndex;
@@ -13,4 +12,5 @@
   int gpu;
   int io;
   int maxCPU;
+  __code next(...);
 } TaskManagerImpl;