Skip to content

Commit

Permalink
formating of generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
crop2000 committed Nov 14, 2024
1 parent 8c22b13 commit a31dd25
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions compiler/generator/rust/rust_code_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -649,15 +649,18 @@ void RustCodeContainer::generateComputeFrame(int n)
tab(n, *fOut);
tab(n, *fOut);
*fOut << "pub fn compute_frame(&mut self, inputs: &[&FaustFloat], ";
*fOut << "outputs: &mut [&mut FaustFloat]) {" << endl;
*fOut << "outputs: &mut [&mut FaustFloat]) {";

for(int i = 0; i < fNumInputs; i++){
tab(n+1, *fOut);
*fOut << "let input"<< i <<" = inputs["<< i <<"];";
};

for(int i = 0; i < fNumOutputs; i++){
*fOut << "let (a, outputs): (&mut [&mut f64], &mut [&mut f64]) = outputs.split_at_mut(1);" << endl;
*fOut << "let output"<< i <<": &mut FaustFloat = a[0];" << endl;
tab(n+1, *fOut);
*fOut << "let (nextoutput, outputs): (&mut [&mut f64], &mut [&mut f64]) = outputs.split_at_mut(1);";
tab(n+1, *fOut);
*fOut << "let output"<< i <<": &mut FaustFloat = nextoutput[0];";
};

fCodeProducer.Tab(n + 1);
Expand All @@ -667,7 +670,9 @@ void RustCodeContainer::generateComputeFrame(int n)
} else {
}

*fOut << "//generateOneSample" << endl;
tab(n+1, *fOut);
*fOut << "//generateOneSample";
tab(n+1, *fOut);
// Generates one sample computation
BlockInst* block = fCurLoop->generateOneSample();
block->accept(&fCodeProducer);
Expand Down

0 comments on commit a31dd25

Please sign in to comment.