changeset 698:73ebf05f48ee

fix Gearef indent
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 21 Aug 2020 19:00:53 +0900
parents 469aff29c27c
children 4d99aad53969
files src/parallel_execution/generate_stub.pl
diffstat 1 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl	Fri Aug 21 18:58:47 2020 +0900
+++ b/src/parallel_execution/generate_stub.pl	Fri Aug 21 19:00:53 2020 +0900
@@ -634,6 +634,7 @@
                 my $next = $2;
                 my $method = $3;
                 my $tmpArgs = $4;
+                my $indent = get_indent_len($prev);
                 #$tmpArgs =~ s/\(.*\)/\(\)/;
                 my @args = split(/,/,$tmpArgs);
                 if (! defined $dataGearVarType{$codeGearName}) {
@@ -654,7 +655,7 @@
                     $ntype = $localVarType{$next};
                     $ftype = lcfirst($ntype);
                 }
-                print $fd "\tGearef(${context_name}, $ntype)->$ftype = (union Data*) $next;\n";
+                print $fd "${indent}Gearef(${context_name}, $ntype)->$ftype = (union Data*) $next;\n";
                 # Put interface argument
                 my $prot = $code{$ntype}->{$method};
                 my $i = 1;
@@ -669,14 +670,14 @@
                     $arg =~ s/^(\s)*(\w+)/$2/;
                     if ($pType =~ s/\_\_code$//) {
                         if ($arg =~ /(\w+)\(.*\)/) {
-                            print $fd "\tGearef(${context_name}, $ntype)->$pName = $1;\n";
+                            print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = $1;\n";
                         } else {
-                            print $fd "\tGearef(${context_name}, $ntype)->$pName = C_$arg;\n";
+                            print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = C_$arg;\n";
                         }
                     } elsif ($pType =~ /Data\**$/){
-                        print $fd "\tGearef(${context_name}, $ntype)->$pName = (union $pType) $arg;\n";
+                        print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = (union $pType) $arg;\n";
                     } else {
-                        print $fd "\tGearef(${context_name}, $ntype)->$pName = $arg;\n";
+                        print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n";
                     }
                     $i++;
                 }
@@ -900,3 +901,15 @@
     return 0; # Not found
   }
 }
+
+sub get_indent_len {
+  my $prev = shift;
+  my $indent = '';
+  my @chars = split //, $prev;
+  for my $w (@chars) {
+    last if ($w !~ /\s/);
+    $indent .= $w;
+  }
+  return $indent;
+}
+