view paper/src/generateOtherStub.pl @ 102:9f5c21b218af

update
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sat, 06 Feb 2021 10:34:02 +0900
parents
children
line wrap: on
line source

#Create a stub when the output is a different interface
for my $modifyEnumCodeCodeGear (keys %{$generateHaveOutputStub->{list}})  {
  my $outputStubElem      = $generateHaveOutputStub->{list}->{$modifyEnumCodeCodeGear};
  my $targetStubName      = $outputStubElem->{createStubName};
  my $createStubName      = "$outputStubElem->{createStubName}_$outputStubElem->{counter}";
  my $replaceArgs         = $outputStubElem->{args};
  my $replaceStubContents = $dataGearName{$targetStubName};

  #If the stub was handwritten, skip
  if ($stub{"${targetStubName}_stub"}->{static}) {
    next;
  }

  for my $arg (keys %$replaceArgs) {
    my $interface = $replaceArgs->{$arg};
    $replaceStubContents =~ s/,(.*)\)->$arg/, $interface)->$arg/;
  }

  generateStub($fd,$createStubName,$replaceStubContents);
}