comparison src/parallel_execution/generate_stub.pl @ 415:eec6553a2aa6

fix redblacktree
author mir3636
date Thu, 05 Oct 2017 17:00:48 +0900
parents 00d9b0664bdb
children a74bec89c198
comparison
equal deleted inserted replaced
414:49159fbdd1fb 415:eec6553a2aa6
380 my $next = $2; 380 my $next = $2;
381 my $method = $3; 381 my $method = $3;
382 my @args = split(/,/,$4); 382 my @args = split(/,/,$4);
383 my @types = @{$dataGearVarType{$codeGearName}}; 383 my @types = @{$dataGearVarType{$codeGearName}};
384 my $ntype; 384 my $ntype;
385 my $ftype;
385 for my $v (@{$dataGearVar{$codeGearName}}) { 386 for my $v (@{$dataGearVar{$codeGearName}}) {
386 my $t = shift @types; 387 my $t = shift @types;
387 if ($v eq $next) { 388 if ($v eq $next) {
388 $ntype = $t; 389 $ntype = $t;
389 } 390 $ftype = lcfirst($ntype);
390 } 391 }
391 print $fd "\tGearef(context, $ntype)->$next = $next->$next;\n"; 392 }
392 # Put interface argument 393 print $fd "\tGearef(context, $ntype)->$ftype = $next->$ftype;\n";
394 # Put interface argument
393 my $prot = $code{$ntype}->{$method}; 395 my $prot = $code{$ntype}->{$method};
394 my $i = 1; 396 my $i = 1;
395 for my $arg (@args) { 397 for my $arg (@args) {
398 my $pType;
399 my $pName;
396 my $p = @$prot[$i]; 400 my $p = @$prot[$i];
397 next if ( $p eq $arg); 401 next if ( $p eq $arg);
398 $p =~ s/^(.*)\s(\w+)//; 402 $p =~ s/^(.*)\s(\w+)//;
399 my $pType = $1; 403 $pType = $1;
400 my $pName = $2; 404 $pName = $2;
401 $arg =~ s/^(\s)*(\w+)/$2/; 405 $arg =~ s/^(\s)*(\w+)/$2/;
402 if ($pType =~ s/\_\_code$//) { 406 if ($pType =~ s/\_\_code$//) {
403 print $fd "\tGearef(context, $ntype)->$pName = C_$arg;\n"; 407 print $fd "\tGearef(context, $ntype)->$pName = C_$arg;\n";
404 } elsif ($pType =~ s/Data$//){ 408 } elsif ($pType =~ s/Data$//){
405 print $fd "\tGearef(context, $ntype)->$pName = (union Data*) $arg;\n"; 409 print $fd "\tGearef(context, $ntype)->$pName = (union Data*) $arg;\n";
406 } else { 410 } else {
407 print $fd "\tGearef(context, $ntype)->$pName = $arg;\n"; 411 print $fd "\tGearef(context, $ntype)->$pName = $arg;\n";
408 } 412 }
409 $i++; 413 $i++;
410 } 414 }
411 print $fd "${prev}goto meta(context, $next->$next->$ntype.$method);\n"; 415 print $fd "${prev}goto meta(context, $next->$ftype->$ntype.$method);\n";
412 next; 416 next;
413 } elsif(/^(.*)par goto (\w+)\((.*)\);/) { 417 } elsif(/^(.*)par goto (\w+)\((.*)\);/) {
414 # handling par goto statement 418 # handling par goto statement
415 # convert it to the parallel 419 # convert it to the parallel
416 my $prev = $1; 420 my $prev = $1;