comparison src/parallel_execution/generate_stub.pl @ 462:8d7e5d48cad3

Running CPU examples
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Wed, 20 Dec 2017 22:05:08 +0900
parents 6b71cf5b1c22
children 7d67c9cf09ee
comparison
equal deleted inserted replaced
461:6b71cf5b1c22 462:8d7e5d48cad3
160 # continuation case 160 # continuation case
161 if ($args =~ s/^(\s)*\_\_code\s+(\w+)\(([^)]*)\)//) { 161 if ($args =~ s/^(\s)*\_\_code\s+(\w+)\(([^)]*)\)//) {
162 my $next = $2; 162 my $next = $2;
163 my @args = split(/,/,$3); 163 my @args = split(/,/,$3);
164 push(@{$code{$name}->{$method}},"\_\_code $next"); 164 push(@{$code{$name}->{$method}},"\_\_code $next");
165 } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\*)?+\s(\w+)//) { 165 } elsif ($args =~ s/^(struct|union)?\s*(\w+)(\*)*+\s(\w+)//) {
166 my $structType = $1; 166 my $structType = $1;
167 my $typeName = $2; 167 my $typeName = $2;
168 my $varName = $4; 168 my $varName = $4;
169 my $typeField = lcfirst($typeName); 169 my $typeField = lcfirst($typeName);
170 push(@{$code{$name}->{$method}},"$typeName $varName"); 170 push(@{$code{$name}->{$method}},"$typeName $varName");
292 if (! $inTypedef && ! $inStub && ! $inMain) { 292 if (! $inTypedef && ! $inStub && ! $inMain) {
293 if (/^typedef struct (\w+) \{/) { 293 if (/^typedef struct (\w+) \{/) {
294 $inTypedef = 1; 294 $inTypedef = 1;
295 } elsif (/^int main\((.*)\) \{/) { 295 } elsif (/^int main\((.*)\) \{/) {
296 $inMain = 1; 296 $inMain = 1;
297 } elsif(/^#include "(.*)"/) {
298 my $interfaceHeader = $1;
299 # interface include not write
300 next unless ($interfaceHeader =~ /context.h/);
297 } elsif (/^\_\_code (\w+)\((.*)\)(.*)/) { 301 } elsif (/^\_\_code (\w+)\((.*)\)(.*)/) {
298 %localVarType = {}; 302 %localVarType = {};
299 $codeGearName = $1; 303 $codeGearName = $1;
300 my $args = $2; 304 my $args = $2;
301 my $tail = $3; 305 my $tail = $3;
537 } elsif(/^.*(struct|union)?\s(\w+)\*\s(\w+)\s?[=;]/) { 541 } elsif(/^.*(struct|union)?\s(\w+)\*\s(\w+)\s?[=;]/) {
538 my $type = $2; 542 my $type = $2;
539 my $varName = $3; 543 my $varName = $3;
540 $localVarType{$varName} = $type; 544 $localVarType{$varName} = $type;
541 s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new 545 s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new
542 } 546 } elsif(/^}/) {
543 elsif(/^}/) {
544 $inParGoto = 0; 547 $inParGoto = 0;
545 } else { 548 } else {
546 s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new 549 s/new\s+(\w+)\(\)/\&ALLOCATE(context, \1)->\1/g; # replacing new
547 } 550 }
548 # gather type name and type 551 # gather type name and type