Mercurial > hg > Members > anatofuz > CbC_xv6
comparison src/gearsTools/generate_stub.pl @ 82:d419660ad71d
tweak generate_stub.pl
author | anatofuz |
---|---|
date | Fri, 11 Oct 2019 19:32:16 +0900 |
parents | 214d21c891c7 |
children |
comparison
equal
deleted
inserted
replaced
81:d41e0a5f7e2f | 82:d419660ad71d |
---|---|
246 # input data gear field | 246 # input data gear field |
247 if ($varName eq $ivar) { | 247 if ($varName eq $ivar) { |
248 if ($typeName eq $var{$interface}->{$ivar}) { | 248 if ($typeName eq $var{$interface}->{$ivar}) { |
249 if ($output) { | 249 if ($output) { |
250 $dataGearName{$codeGearName} .= "\t$typeName$ptrType* O_$varName = &Gearef(cbc_context, $interface)->$varName;\n"; | 250 $dataGearName{$codeGearName} .= "\t$typeName$ptrType* O_$varName = &Gearef(cbc_context, $interface)->$varName;\n"; |
251 $outputVar{$codeGearName} .= "\t$typeName$ptrType $varName = *O_$varName;\n"; | 251 $outputVar{$codeGearName} .= "\t$typeName$ptrType $varName __attribute__((unused)) = *O_$varName;\n"; |
252 return 1; | 252 return 1; |
253 } | 253 } |
254 $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(cbc_context, $interface)->$varName;\n"; | 254 $dataGearName{$codeGearName} .= "\t$typeName$ptrType $varName = Gearef(cbc_context, $interface)->$varName;\n"; |
255 return 1; | 255 return 1; |
256 } | 256 } |
447 # it should be initialze by gearef | 447 # it should be initialze by gearef |
448 print $fd $outputVar{$codeGearName}; | 448 print $fd $outputVar{$codeGearName}; |
449 } | 449 } |
450 next; | 450 next; |
451 } elsif (! $inCode) { | 451 } elsif (! $inCode) { |
452 s/new\s+(\w+)\(\)/\&ALLOCATE(cbc_context, \1)->\1/g; # replacing new | |
452 print $fd $_; | 453 print $fd $_; |
453 next; | 454 next; |
454 } elsif (/^(.*)goto (\w+)\-\>(\w+)\((.*)\);/) { | 455 } elsif (/^(.*)goto (\w+)\-\>(\w+)\((.*)\);/) { |
455 # handling goto statement | 456 # handling goto statement |
456 # convert it to the meta call form with two arugments, that is context and enum Code | 457 # convert it to the meta call form with two arugments, that is context and enum Code |
457 my $prev = $1; | 458 my $prev = $1; |
458 my $next = $2; | 459 my $next = $2; |
459 my $method = $3; | 460 my $method = $3; |
460 my $tmpArgs = $4; | 461 my $tmpArgs = $4; |
461 $tmpArgs =~ s/\(.*\)/\(\)/; | 462 #$tmpArgs =~ s/\(.*\)/\(\)/; |
462 my @args = split(/,/,$tmpArgs); | 463 my @args = split(/,/,$tmpArgs); |
463 if (! defined $dataGearVarType{$codeGearName}) { | 464 if (! defined $dataGearVarType{$codeGearName}) { |
464 print $fd $_ ; | 465 print $fd $_ ; |
465 next ; | 466 next ; |
466 } | 467 } |