diff src/parallel_execution/generate_stub.pl @ 280:2c2e4e597eb0

generate no compile errors
author mir3636
date Fri, 03 Feb 2017 17:47:27 +0900
parents 23767f714f4a
children ec0a5b4fba05
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl	Fri Feb 03 03:25:57 2017 +0900
+++ b/src/parallel_execution/generate_stub.pl	Fri Feb 03 17:47:27 2017 +0900
@@ -68,7 +68,12 @@
         # gather type name and type
         $dataGear{$name} .= $_;
 	if (/^\s*(.*)\s+(\w+);$/ ) {
-            $var{$name}->{$2} = $1;
+            my $ttype = $1;
+            my $tname = $2;
+            if ($ttype =~ /^(union|struct) (\w+)/) {
+                $ttype = $2;
+            }
+            $var{$name}->{$tname} = $ttype;
 	} elsif (/\_\_code (\w+)\(/) {
             $code{$name}->{$1} = 1;
         }
@@ -101,13 +106,16 @@
         for my $ivar (keys %{$var{$interface}}) {
             #  input data gear field 
             if ($varName eq $ivar) {
-                if ($output) {
-                    $dataGearName{$codeGearName} .= "\t$typeName** O_$varName = &Gearef(context, $interface)->$varName;\n";
-                    $outputVar{$codeGearName} .= "\t$typeName* $varName;\n";
+                if ($typeName eq $var{$interface}->{$ivar}) {
+                    if ($output) {
+                        $dataGearName{$codeGearName} .= "\t$typeName** O_$varName = &Gearef(context, $interface)->$varName;\n";
+                        $outputVar{$codeGearName} .= "\t$typeName* $varName;\n";
+                        return 1;
+                    }
+                
+                    $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $interface)->$varName;\n";
                     return 1;
                 }
-                $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $interface)->$varName;\n";
-                return 1;
             }
         }
         for my $cName (keys %{$code{$interface}}) {
@@ -192,9 +200,9 @@
                         $newArgs .= $1;
                     }
                     # continuation case
-                    if ($args =~ s/^\_\_code\s+(\w+)\(([^)]*)\)//) {
-                        my $next = $1;
-                        my @args = split(/,/,$2);
+                    if ($args =~ s/^(\s)*\_\_code\s+(\w+)\(([^)]*)\)//) {
+                        my $next = $2;
+                        my @args = split(/,/,$3);
                         if ( &generateStubArgs($codeGearName, $next, "Code", $next, $interface,0) ) {
                             $newArgs .= "enum Code $next";
                         }