Mercurial > hg > Gears > GearsAgda
changeset 243:6a80ab36181c
generate impl
author | mir3636 |
---|---|
date | Tue, 24 Jan 2017 19:52:20 +0900 |
parents | 9f3f8ed6ed9f |
children | 308368406fe7 |
files | src/parallel_execution/generate_stub.pl |
diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/generate_stub.pl Tue Jan 24 18:39:42 2017 +0900 +++ b/src/parallel_execution/generate_stub.pl Tue Jan 24 19:52:20 2017 +0900 @@ -32,9 +32,16 @@ } if (/^\_\_code (\w+)/) { $codeGearName = $1; - while (/struct (\w+)/g) { - $dataGearName{$codeGearName} .= "\t\tGearef(context, " . $1 . ")"; - $dataGearName{$codeGearName} .= ",\n"; + while (/struct (\w+)\*\s(\w+)/g) { + $tmp = lcfirst($1); + if ($tmp ne $2) { + $tmp = ucfirst($2); + $dataGearName{$codeGearName} .= "\t\t(" . $1 . "*)GearImpl(context, " . $tmp . ", " . $2 . ")"; + $dataGearName{$codeGearName} .= ",\n"; + } else { + $dataGearName{$codeGearName} .= "\t\tGearef(context, " . $1 . ")"; + $dataGearName{$codeGearName} .= ",\n"; + } } next; } @@ -76,11 +83,10 @@ open my $fd,">","d/stub.h" or die("can't open d/stub.h $!"); for my $codeGearName ( sort keys %dataGearName ) { print $fd "__code ", $codeGearName ,"_stub (struct Context* context) {\n"; - #print $fd "\tgoto meta(context, \n"; - print $fd "\tgoto meta("; - chomp($dataGearName{$codeGearName}); - chop($dataGearName{$codeGearName}); - print $fd $dataGearName{$codeGearName},"); \n} \n\n"; + print $fd "\tgoto " . $codeGearName . "("; + #print $fd "\tgoto " . $codeGearName . "(context,\n"; + print $fd substr($dataGearName{$codeGearName},2,-2); + print $fd "); \n} \n\n"; } print $fd "\n"; }