Mercurial > hg > GearsTemplate
changeset 258:4fe19a06d666
generate next args
author | mir3636 |
---|---|
date | Sat, 28 Jan 2017 12:25:35 +0900 |
parents | cd3486e4ba70 |
children | 0cd43e22aee1 |
files | src/parallel_execution/generate_stub.pl |
diffstat | 1 files changed, 18 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl Fri Jan 27 21:20:07 2017 +0900 +++ b/src/parallel_execution/generate_stub.pl Sat Jan 28 12:25:35 2017 +0900 @@ -96,7 +96,7 @@ my($codeGearName, $varName, $typeName, $typeField, $interface) = @_; push @{$dataGearVar{$codeGearName}},$varName; if ($typeField ne $varName) { - $dataGearName{$codeGearName} .= "\t$typeName* $varName = ($typeName*)GearImpl(context, $typeName, $varName);\n"; + $dataGearName{$codeGearName} .= "\t$typeName* $varName = ($typeName*)GearImpl(context, $interface, $varName);\n"; # print STDOUT "$codeGearName \t$typeName* $varName = ($typeName*)GearImpl(context, $typeName, $varName);\n"; } else { for my $ivar ($var{$interface}) { @@ -106,7 +106,7 @@ return; } } - $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $typeName)->$typeField;\n"; + $dataGearName{$codeGearName} .= "\t$typeName* $varName = Gearef(context, $typeName);\n"; # print STDOUT "$codeGearName \t$typeName* $varName = Gearef(context, $typeName)->$typeField;\n"; } } @@ -139,6 +139,7 @@ if (! $inTypedef) { if (/^typedef struct (\w+) {/) { $inTypedef = 1; + # get __code name } elsif (/^\_\_code (\w+)\((.*)\)(.*)/) { $codeGearName = $1; my $args = $2; @@ -164,9 +165,18 @@ $newArgs .= $1; } # replace __code next - if ($args =~ s/^\_\_code\s(\w+)\([^)]*\)//) { + if ($args =~ s/^\_\_code\s(\w+)\(([^)]*)\)//) { my $next = $1; - my @args = split(/,/,$2); + my @args = split(/,/,$3); + my $nextArg = $2; + # generate stub args of next args + while ($nextArg =~ s/union (\w+)(\*)+\s([^,]*)//) { + my $typeName = $1.$2; + my $varName = $3; + my $typeField = lcfirst($1); + $newArgs .= "union $typeName\* $3, "; + &generateStubArgs($codeGearName, $varName, $1, $typeField, $interface); + } $newArgs .= "enum Code $next"; for my $arg (@args) { $arg =~ s/^\s*//; @@ -198,10 +208,11 @@ $dataGearName{$codeGearName} .= ");"; print $fd "__code $codeGearName($newArgs)$tail\n"; next; - } elsif (/^(.*)goto next\(\.\.\.(.*)\);/) { + } elsif (/^(.*)goto\s(\w+)\((.*)\.\.\.\);/) { + #print STDOUT "$3\n"; my $prev = $1; - my $args = $2; - print $fd "${prev}goto meta(context, next);\n"; + my $args = $3; + print $fd "${prev}goto meta(context, $2);\n"; next; } print $fd $_;