Mercurial > hg > GearsTemplate
changeset 252:682b1195e604
fix stub
author | mir3636 |
---|---|
date | Thu, 26 Jan 2017 17:38:33 +0900 |
parents | 0ab52d6e2fd9 |
children | ebc13549394c |
files | src/parallel_execution/generate_stub.pl |
diffstat | 1 files changed, 12 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl Thu Jan 26 09:38:09 2017 +0900 +++ b/src/parallel_execution/generate_stub.pl Thu Jan 26 17:38:33 2017 +0900 @@ -13,7 +13,8 @@ # struct Queue* tasks; # } Worker; -while (<*.cbc>) { +#while (<*.cbc>) { +while (<SingleLinkedStack.cbc>) { my $fn = $_; &getDataGear($fn); &generateDataGear($fn); @@ -48,22 +49,25 @@ } elsif (/^\_\_code (\w+)/) { $codeGearName = $1; $dataGearVar{$codeGearName} = []; - args:while (/(struct|union) (\w+)\*\s(\w+)/g) { + args:while (/(struct|union) (\w+)(\*)+\s(\w+)/g) { my $structType = $1; my $typeName = $2; - my $varName = $3; + my $varName = $4; my $typeField = lcfirst($typeName); push @{$dataGearVar{$codeGearName}},$varName; if ($typeField ne $varName) { - $dataGearName{$codeGearName} .= "\t$typeName* $varName = (" . $typeName . "*)GearImpl(context, " . $varName . ", " . $varName . ");\n"; + $dataGearName{$codeGearName} .= "\t$typeName* $varName = ($typeName*)GearImpl(context, $varName, $varName);\n"; + print STDOUT "$codeGearName \t$typeName* $varName = ($typeName*)GearImpl(context, $varName, $varName);\n"; } else { - for my $ivar ( $var{$interface}) { + for my $ivar ($var{$interface}) { if ($varName eq $ivar) { $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $interface)->$varName;\n"; + print STDOUT "$codeGearName \t$typeName* $varName = Gearef(context, $interface)->$varName;\n"; next args; } } - $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, " . $typeName . ")->$typeField;\n"; + $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $typeName)->$typeField;\n"; + print STDOUT "$codeGearName \t$typeName* $varName = Gearef(context, $typeName)->$typeField;\n"; } } $dataGearName{$codeGearName} .= "\tgoto $codeGearName(context"; @@ -130,6 +134,7 @@ print $fd $_; next; } + $prevCodeGearName = $codeGearName; if (defined $prevCodeGearName) { if (defined $stub{$prevCodeGearName."_stub"}) { undef $prevCodeGearName; @@ -138,7 +143,7 @@ } $stub{$prevCodeGearName."_stub"} = &generateStub($fd,$prevCodeGearName,$dataGearName{$codeGearName}); } - $prevCodeGearName = $codeGearName; + #$prevCodeGearName = $codeGearName; } elsif (/^(.*)goto next\(\.\.\.(.*)\);/) { my $prev = $1; my $args = $2;