From bc27fea198b8339419471788dcc2d40d1bcde8ef Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 3 Mar 2023 09:32:20 -0800 Subject: [PATCH] Copy file-level preamble to reactor-specific files See https://github.com/lf-lang/lingua-franca/pull/1599#issuecomment-1445004112 for discussion --- org.lflang/src/org/lflang/generator/c/CGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.lflang/src/org/lflang/generator/c/CGenerator.java b/org.lflang/src/org/lflang/generator/c/CGenerator.java index 8861181b36..cee892365c 100644 --- a/org.lflang/src/org/lflang/generator/c/CGenerator.java +++ b/org.lflang/src/org/lflang/generator/c/CGenerator.java @@ -657,7 +657,6 @@ private void generateCodeFor( ) throws IOException { startTimeStepIsPresentCount = 0; code.pr(generateDirectives()); - code.pr(generateTopLevelPreambles()); code.pr(new CMainFunctionGenerator(targetConfig).generateCode()); // Generate code for each reactor. generateReactorDefinitions(); @@ -1043,6 +1042,7 @@ private void generateReactorClass(Reactor reactor) throws IOException { header.pr("#ifndef " + guardMacro); header.pr("#define " + guardMacro); generateReactorClassHeaders(reactor, headerName, header, src); + src.pr(generateTopLevelPreambles()); generateUserPreamblesForReactor(reactor, src); generateReactorClassBody(reactor, header, src); header.pr("#endif // " + guardMacro);