Mercurial > hg > Gears > Gears
changeset 870:40437e1bd11b
return string
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 Jan 2021 15:34:47 +0900 |
parents | 0f58ffcf8ec3 |
children | 152b952da3e3 |
files | src/parallel_execution/generate_stub.pl |
diffstat | 1 files changed, 20 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl Sat Jan 23 15:27:14 2021 +0900 +++ b/src/parallel_execution/generate_stub.pl Sat Jan 23 15:34:47 2021 +0900 @@ -806,11 +806,12 @@ my $instance = $2; my $method = $3; my $args = $4; + my $currentCodeGearInfo = $filename2EachCodeGearArgs{$filename}->{$codeGearName}; - my $instanceType = $currentCodeGearInfo->{localVar}->{$instance}; - my $currentInfo = $headerNameToInfo->{$instanceType}; - my $parsedInstanceType = Gears::Interface->detailed_parse($currentInfo->{path}); - my $inputCount = $parsedInstanceType->{codeName}->{$method}->{argc}; + my $instanceType = $currentCodeGearInfo->{localVar}->{$instance}; + my $currentInfo = $headerNameToInfo->{$instanceType}; + my $parsedInstanceType = Gears::Interface->detailed_parse($currentInfo->{path}); + my $inputCount = $parsedInstanceType->{codeName}->{$method}->{argc}; $inputCount--; # $inputCount == 1 means self my $outputCount = 0; @@ -890,7 +891,7 @@ tmpArgs => $4, }; #my ($line, $currentCodeGearName, $filename, $fd, $localVarType, $parsed, $filename2args) = @_; - generateInterfaceMeta($_, $codeGearName, $filename, $fd, $parsed, \%filename2EachCodeGearArgs, \%localVarType); + print $fd generateInterfaceMeta($_, $codeGearName, $filename, $parsed, \%filename2EachCodeGearArgs, \%localVarType); next; } elsif(/^(.*)par goto (\w+)\((.*)\);/) { debug_print("generateDataGear",__LINE__, $_) if $opt_debug; @@ -1197,7 +1198,9 @@ } sub generateInterfaceMeta { - my ($line, $currentCodeGearName, $filename, $fd, $parsed, $filename2args, $localVarType) = @_; + my ($line, $currentCodeGearName, $filename, $parsed, $filename2args, $localVarType) = @_; + + my $return_line; my $prev = $parsed->{prev}; my $next = $parsed->{next}; @@ -1209,8 +1212,7 @@ #$tmpArgs =~ s/\(.*\)/\(\)/; my @args = split(/,/,$tmpArgs); if (! defined $dataGearVarType{$currentCodeGearName}) { - print $fd $_ ; - return; + return $line ; } my @types = @{$dataGearVarType{$currentCodeGearName}}; my $ntype; @@ -1226,7 +1228,7 @@ $ntype = $localVarType->{$next}; $ftype = lcfirst($ntype); } - print $fd "${indent}Gearef(${context_name}, $ntype)->$ftype = (union Data*) $next;\n"; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$ftype = (union Data*) $next;\n"; # Put interface argument my $prot = $code{$ntype}->{$method}; my $i = 1; @@ -1260,7 +1262,7 @@ $arg =~ s/^(\s)*(\w+)/$2/; if ($pType =~ s/\_\_code$//) { if ($arg =~ /(\w+)\(.*\)/) { - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = $1;\n"; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = $1;\n"; } else { my $hasGotoArgOrLocalVar = undef; my $outputStubElem = $generateHaveOutputStub->{list}->{$currentCodeGearName}; @@ -1274,7 +1276,7 @@ if ($outputStubElem && !$stub{$outputStubElem->{createStubName}."_stub"}->{static}) { my $pick_next = "$outputStubElem->{createStubName}_$outputStubElem->{counter}"; - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = C_$pick_next;\n"; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = C_$pick_next;\n"; $i++; next; } @@ -1290,28 +1292,28 @@ # inteface case if ($arg =~ /->/) { - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n"; #Gearef->()->next = bar->baz; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n"; #Gearef->()->next = bar->baz; $i++; next; } if ($hasGotoArgOrLocalVar) { - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n"; #Gearef->()->next = next; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n"; #Gearef->()->next = next; $i++; next; } - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = C_$arg;\n"; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = C_$arg;\n"; $i++; next; } } elsif ($pType =~ /Data\**$/){ - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = (union $pType) $arg;\n"; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = (union $pType) $arg;\n"; } else { - print $fd "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n"; + $return_line .= "${indent}Gearef(${context_name}, $ntype)->$pName = $arg;\n"; } $i++; } - print $fd "${prev}goto meta(${context_name}, $next->$method);\n"; - return; + $return_line .= "${prev}goto meta(${context_name}, $next->$method);\n"; + return $return_line; }