From 42c1f53c5f6c3fbfd1df5b84497fb0a1b38c893b Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Fri, 28 Jul 2023 13:27:01 +0900 Subject: [PATCH 001/141] Update package.json --- core/src/main/resources/lib/ts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/ts/package.json b/core/src/main/resources/lib/ts/package.json index 4a28012180..4797fd56ed 100644 --- a/core/src/main/resources/lib/ts/package.json +++ b/core/src/main/resources/lib/ts/package.json @@ -2,7 +2,7 @@ "name": "LinguaFrancaDefault", "type": "commonjs", "dependencies": { - "@lf-lang/reactor-ts": "git://github.com/lf-lang/reactor-ts.git#ts-level-assignment", + "@lf-lang/reactor-ts": "git://github.com/lf-lang/reactor-ts.git#ts-cyclic-dependencies", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.3" }, From 050729ab02bd63ba7ebd57857a19d172e58b8a63 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Sat, 29 Jul 2023 16:49:14 +0900 Subject: [PATCH 002/141] Pass the TPO level info to network reactors --- .../federated/generator/FedASTUtils.java | 13 +++++++------ .../org/lflang/validation/AttributeSpec.java | 2 +- .../generator/ts/TSConstructorGenerator.kt | 19 ++++++++++++++----- .../generator/ts/TSInstanceGenerator.kt | 15 ++++++++------- .../lflang/generator/ts/TSReactorGenerator.kt | 13 +++++-------- 5 files changed, 35 insertions(+), 27 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java b/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java index d38237c71b..5b4492942d 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java +++ b/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java @@ -43,6 +43,7 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.xtext.xbase.lib.IteratorExtensions; +import org.lflang.AttributeUtils; import org.lflang.InferredType; import org.lflang.MessageReporter; import org.lflang.TargetProperty.CoordinationType; @@ -240,11 +241,11 @@ private static void addNetworkReceiverReactor( .getParent() .reactorDefinition; // Top-level reactor. - // Add the attribute "_NetworkReactor" for the network receiver. + // Add the attribute "_networkReactor" for the network receiver. var a = factory.createAttribute(); - a.setAttrName("_NetworkReactor"); + a.setAttrName("_networkReactor"); var e = factory.createAttrParm(); - e.setValue("Receiver"); + e.setValue("\"receiver\""); a.getAttrParms().add(e); receiver.getAttributes().add(a); @@ -646,11 +647,11 @@ private static Reactor getNetworkSenderReactor( // Initialize Reactor and Reaction AST Nodes Reactor sender = factory.createReactor(); - // Add the attribute "_NetworkReactor" for the network sender. + // Add the attribute "_networkReactor" for the network sender. var a = factory.createAttribute(); - a.setAttrName("_NetworkReactor"); + a.setAttrName("_networkReactor"); var e = factory.createAttrParm(); - e.setValue("Sender"); + e.setValue("\"sender\""); a.getAttrParms().add(e); sender.getAttributes().add(a); diff --git a/core/src/main/java/org/lflang/validation/AttributeSpec.java b/core/src/main/java/org/lflang/validation/AttributeSpec.java index 9e69a28f1f..57405d2983 100644 --- a/core/src/main/java/org/lflang/validation/AttributeSpec.java +++ b/core/src/main/java/org/lflang/validation/AttributeSpec.java @@ -233,7 +233,7 @@ enum AttrParamType { "_tpoLevel", new AttributeSpec(List.of(new AttrParamSpec(VALUE_ATTR, AttrParamType.INT, false)))); ATTRIBUTE_SPECS_BY_NAME.put( - "_NetworkReactor", + "_networkReactor", new AttributeSpec(List.of(new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); } } diff --git a/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt b/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt index b8c01a0ee7..0644319f4d 100644 --- a/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt @@ -25,7 +25,7 @@ class TSConstructorGenerator( private fun initializeParameter(p: Parameter): String = "${p.name}: ${TSTypes.getInstance().getTargetType(p)} = ${TSTypes.getInstance().getTargetInitializer(p)}" - private fun generateConstructorArguments(reactor: Reactor): String { + private fun generateConstructorArguments(reactor: Reactor, isNetworkReactor: Boolean): String { val arguments = StringJoiner(", \n") if (reactor.isMain || reactor.isFederated) { arguments.add("timeout: TimeValue | undefined = undefined") @@ -46,10 +46,14 @@ class TSConstructorGenerator( arguments.add("fail?: () => void") } + if (isNetworkReactor) { + arguments.add("tpoLevel: number") + } + return arguments.toString() } - private fun generateSuperConstructorCall(reactor: Reactor, isFederate: Boolean): String = + private fun generateSuperConstructorCall(reactor: Reactor, isFederate: Boolean, isNetworkReactor: Boolean): String = if (reactor.isMain) { if (isFederate) { """ @@ -65,7 +69,11 @@ class TSConstructorGenerator( "super(timeout, keepAlive, fast, success, fail);" } } else { - "super(parent);" + if (isNetworkReactor) { + "super(parent, tpoLevel)" + } else { + "super(parent);" + } } // Generate code for setting target configurations. @@ -85,6 +93,7 @@ class TSConstructorGenerator( actions: TSActionGenerator, ports: TSPortGenerator, isFederate: Boolean, + isNetworkReactor: Boolean, isNetworkReceiver: Boolean ): String { val connections = TSConnectionGenerator(reactor.connections, messageReporter) @@ -93,9 +102,9 @@ class TSConstructorGenerator( return with(PrependOperator) { """ |constructor ( - ${" | "..generateConstructorArguments(reactor)} + ${" | "..generateConstructorArguments(reactor, isNetworkReactor)} |) { - ${" | "..generateSuperConstructorCall(reactor, isFederate)} + ${" | "..generateSuperConstructorCall(reactor, isFederate, isNetworkReactor)} ${" | "..generateTargetConfigurations(targetConfig)} ${" | "..instances.generateInstantiations()} ${" | "..timers.generateInstantiations()} diff --git a/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt b/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt index 6cb6aea34f..2911503159 100644 --- a/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt @@ -48,19 +48,20 @@ class TSInstanceGenerator( val childReactorInstantiations = LinkedList() var portID = 0 for (childReactor in childReactors) { - var isNetworkSender = false - var isNetworkReceiver = false - val networkReactorAttribute = AttributeUtils.findAttributeByName(childReactor.reactorClass, "_NetworkReactor") - if (networkReactorAttribute != null) { - isNetworkSender = networkReactorAttribute.getAttrParms().get(0).getName() == "Sender" - isNetworkReceiver = networkReactorAttribute.getAttrParms().get(0).getName() == "Receiver" - } + var tpoLevel = AttributeUtils.getFirstArgumentValue(AttributeUtils.findAttributeByName(childReactor, "_tpoLevel")); + val networkReactorAttributeValue = AttributeUtils.getFirstArgumentValue(AttributeUtils.findAttributeByName(childReactor.reactorClass, "_networkReactor")) + var isNetworkReceiver = networkReactorAttributeValue == "receiver" + var isNetworkSender = networkReactorAttributeValue == "sender" + val childReactorArguments = StringJoiner(", ") childReactorArguments.add("this") for (parameter in childReactor.reactorClass.toDefinition().parameters) { childReactorArguments.add(TSTypes.getInstance().getTargetInitializer(parameter, childReactor)) } + if (tpoLevel != null) { + childReactorArguments.add(tpoLevel.toString()); + } if (childReactor.isBank) { childReactorInstantiations.add( "this.${childReactor.name} = " + diff --git a/core/src/main/kotlin/org/lflang/generator/ts/TSReactorGenerator.kt b/core/src/main/kotlin/org/lflang/generator/ts/TSReactorGenerator.kt index e84f012480..73da56bf4c 100644 --- a/core/src/main/kotlin/org/lflang/generator/ts/TSReactorGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/ts/TSReactorGenerator.kt @@ -97,13 +97,10 @@ ${" |"..preamble.code.toText()} } val isFederate = AttributeUtils.isFederate(reactor) - val networkReactorAttribute = AttributeUtils.findAttributeByName(reactor, "_NetworkReactor") - var isNetworkSender = false - var isNetworkReceiver = false - if (networkReactorAttribute != null) { - isNetworkSender = networkReactorAttribute.getAttrParms().get(0).getName() == "Sender" - isNetworkReceiver = networkReactorAttribute.getAttrParms().get(0).getName() == "Receiver" - } + val networkReactorAttributeValue = AttributeUtils.getFirstArgumentValue(AttributeUtils.findAttributeByName(reactor, "_networkReactor")) + var isNetworkReactor = networkReactorAttributeValue != null + var isNetworkReceiver = networkReactorAttributeValue == "receiver" + var isNetworkSender = networkReactorAttributeValue == "sender" // NOTE: type parameters that are referenced in ports or actions must extend // Present in order for the program to type check. @@ -144,7 +141,7 @@ ${" |"..preamble.code.toText()} ${" | "..actionGenerator.generateClassProperties()} ${" | "..portGenerator.generateClassProperties()} ${" | "..constructorGenerator.generateConstructor(targetConfig, instanceGenerator, timerGenerator, parameterGenerator, - stateGenerator, actionGenerator, portGenerator, isFederate, isNetworkReceiver)} + stateGenerator, actionGenerator, portGenerator, isFederate, isNetworkReactor, isNetworkReceiver)} |} |// =============== END reactor class ${reactor.name} | From 3b6a39f72ac9d360133ae20e991bb48d2426d3be Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun <78055940+byeong-gil@users.noreply.github.com> Date: Sat, 29 Jul 2023 16:50:34 +0900 Subject: [PATCH 003/141] Update FedASTUtils.java --- .../main/java/org/lflang/federated/generator/FedASTUtils.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java b/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java index 5b4492942d..dda752ff93 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java +++ b/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java @@ -43,7 +43,6 @@ import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.xtext.xbase.lib.IteratorExtensions; -import org.lflang.AttributeUtils; import org.lflang.InferredType; import org.lflang.MessageReporter; import org.lflang.TargetProperty.CoordinationType; From 6ded11576c52cc62eecedba059d9cb9d77eb44b5 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Mon, 31 Jul 2023 14:27:03 +0900 Subject: [PATCH 004/141] Handle network reactions without a TPO level --- .../kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt b/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt index 0644319f4d..fc8b942a2f 100644 --- a/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/ts/TSConstructorGenerator.kt @@ -47,7 +47,7 @@ class TSConstructorGenerator( } if (isNetworkReactor) { - arguments.add("tpoLevel: number") + arguments.add("tpoLevel?: number") } return arguments.toString() From 6c3916d6aa79fe56b0a40c7a70b2f8df22a29f1f Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Wed, 2 Aug 2023 09:58:53 +0900 Subject: [PATCH 005/141] Restore failing TS tests for testing --- .../src/federated/{failing => }/LoopDistributedCentralized.lf | 0 .../src/federated/{failing => }/LoopDistributedDouble.lf | 0 .../TypeScript/src/federated/{failing => }/PingPongDistributed.lf | 0 .../src/federated/{failing => }/PingPongDistributedPhysical.lf | 0 test/TypeScript/src/federated/{failing => }/SimpleFederated.lf | 0 test/TypeScript/src/federated/{failing => }/SpuriousDependency.lf | 0 6 files changed, 0 insertions(+), 0 deletions(-) rename test/TypeScript/src/federated/{failing => }/LoopDistributedCentralized.lf (100%) rename test/TypeScript/src/federated/{failing => }/LoopDistributedDouble.lf (100%) rename test/TypeScript/src/federated/{failing => }/PingPongDistributed.lf (100%) rename test/TypeScript/src/federated/{failing => }/PingPongDistributedPhysical.lf (100%) rename test/TypeScript/src/federated/{failing => }/SimpleFederated.lf (100%) rename test/TypeScript/src/federated/{failing => }/SpuriousDependency.lf (100%) diff --git a/test/TypeScript/src/federated/failing/LoopDistributedCentralized.lf b/test/TypeScript/src/federated/LoopDistributedCentralized.lf similarity index 100% rename from test/TypeScript/src/federated/failing/LoopDistributedCentralized.lf rename to test/TypeScript/src/federated/LoopDistributedCentralized.lf diff --git a/test/TypeScript/src/federated/failing/LoopDistributedDouble.lf b/test/TypeScript/src/federated/LoopDistributedDouble.lf similarity index 100% rename from test/TypeScript/src/federated/failing/LoopDistributedDouble.lf rename to test/TypeScript/src/federated/LoopDistributedDouble.lf diff --git a/test/TypeScript/src/federated/failing/PingPongDistributed.lf b/test/TypeScript/src/federated/PingPongDistributed.lf similarity index 100% rename from test/TypeScript/src/federated/failing/PingPongDistributed.lf rename to test/TypeScript/src/federated/PingPongDistributed.lf diff --git a/test/TypeScript/src/federated/failing/PingPongDistributedPhysical.lf b/test/TypeScript/src/federated/PingPongDistributedPhysical.lf similarity index 100% rename from test/TypeScript/src/federated/failing/PingPongDistributedPhysical.lf rename to test/TypeScript/src/federated/PingPongDistributedPhysical.lf diff --git a/test/TypeScript/src/federated/failing/SimpleFederated.lf b/test/TypeScript/src/federated/SimpleFederated.lf similarity index 100% rename from test/TypeScript/src/federated/failing/SimpleFederated.lf rename to test/TypeScript/src/federated/SimpleFederated.lf diff --git a/test/TypeScript/src/federated/failing/SpuriousDependency.lf b/test/TypeScript/src/federated/SpuriousDependency.lf similarity index 100% rename from test/TypeScript/src/federated/failing/SpuriousDependency.lf rename to test/TypeScript/src/federated/SpuriousDependency.lf From 71c4fe2a802b9d90f1933908cd70fd54635c8c22 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Fri, 4 Aug 2023 10:56:39 +0900 Subject: [PATCH 006/141] Apply spotless --- .../DistributedCountPhysicalAfterDelay.lf | 34 +++++------ .../federated/LoopDistributedCentralized.lf | 48 ++++++++-------- .../src/federated/LoopDistributedDouble.lf | 56 +++++++++---------- .../src/federated/PingPongDistributed.lf | 42 +++++++------- .../federated/PingPongDistributedPhysical.lf | 38 ++++++------- .../src/federated/SpuriousDependency.lf | 9 +-- 6 files changed, 110 insertions(+), 117 deletions(-) rename test/TypeScript/src/federated/{failing => }/DistributedCountPhysicalAfterDelay.lf (50%) diff --git a/test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf b/test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf similarity index 50% rename from test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf rename to test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf index 0ea0befda7..c6ab1190de 100644 --- a/test/TypeScript/src/federated/failing/DistributedCountPhysicalAfterDelay.lf +++ b/test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -19,30 +19,30 @@ reactor Print { state c: number = 1 reaction(inp) {= - const elapsedTime = util.getElapsedLogicalTime(); - console.log(`At time ${elapsedTime}, received ${inp}`); - if (inp !== c) { - util.requestErrorStop(`ERROR: Expected to receive ${c}.`); - } - if (!elapsedTime.isLaterThan(TimeValue.msec(600))) { - util.requestErrorStop(`ERROR: Expected received time to be strictly greater than ${TimeValue.msec(600)}`); - } - c++; - console.log(`c = ${c}`); - util.requestStop(); + const elapsedTime = util.getElapsedLogicalTime(); + console.log(`At time ${elapsedTime}, received ${inp}`); + if (inp !== c) { + util.requestErrorStop(`ERROR: Expected to receive ${c}.`); + } + if (!elapsedTime.isLaterThan(TimeValue.msec(600))) { + util.requestErrorStop(`ERROR: Expected received time to be strictly greater than ${TimeValue.msec(600)}`); + } + c++; + console.log(`c = ${c}`); + util.requestStop(); =} reaction(shutdown) {= - if (c !== 2) { - util.requestErrorStop(`ERROR: Expected to receive 1 item. Received ${c - 1}.`); - } else { - console.log("SUCCESS: Successfully received 1 item."); - } + if (c !== 2) { + util.requestErrorStop(`ERROR: Expected to receive 1 item. Received ${c - 1}.`); + } else { + console.log("SUCCESS: Successfully received 1 item."); + } =} } federated reactor at localhost { - c = new Count(offset = 200 msec, period = 0) + c = new Count(offset = 200 msec, period=0) p = new Print() c.out ~> p.inp after 400 msec // Indicating a 'physical' connection with a 400 msec after delay. } diff --git a/test/TypeScript/src/federated/LoopDistributedCentralized.lf b/test/TypeScript/src/federated/LoopDistributedCentralized.lf index aebc87d619..15dafae904 100644 --- a/test/TypeScript/src/federated/LoopDistributedCentralized.lf +++ b/test/TypeScript/src/federated/LoopDistributedCentralized.lf @@ -15,50 +15,50 @@ reactor Looper(incr: number = 1, delay: time = 0 msec) { state count: number = 0 preamble {= - let stop = false; - // Function to trigger an action once every second. - function ping(act: any) { - if (!stop) { - console.log("Scheduling action."); - act.schedule(0, null); - setTimeout(ping, 1000, act); + let stop = false; + // Function to trigger an action once every second. + function ping(act: any) { + if (!stop) { + console.log("Scheduling action."); + act.schedule(0, null); + setTimeout(ping, 1000, act); + } } - } =} reaction(startup) -> a {= - // Start the ping function for triggering an action every second. - console.log("Starting ping function."); - ping(actions.a); + // Start the ping function for triggering an action every second. + console.log("Starting ping function."); + ping(actions.a); =} reaction(a) -> out {= - out = count; - count += incr; + out = count; + count += incr; =} reaction(inp) {= - let logical = util.getCurrentLogicalTime(); - let physical = util.getCurrentPhysicalTime(); + let logical = util.getCurrentLogicalTime(); + let physical = util.getCurrentPhysicalTime(); - let time_lag = physical.subtract(logical); + let time_lag = physical.subtract(logical); - console.log("Received " + inp + ". Logical time is behind physical time by " + time_lag + "."); + console.log("Received " + inp + ". Logical time is behind physical time by " + time_lag + "."); =} reaction(shutdown) {= - console.log("******* Shutdown invoked."); - // Stop the ping function that is scheduling actions. - stop = true; - if (count != 5 * incr) { - util.requestErrorStop("Failed to receive all five expected inputs."); - } + console.log("******* Shutdown invoked."); + // Stop the ping function that is scheduling actions. + stop = true; + if (count != 5 * incr) { + util.requestErrorStop("Failed to receive all five expected inputs."); + } =} } federated reactor LoopDistributedCentralized(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.inp right.out -> left.inp } diff --git a/test/TypeScript/src/federated/LoopDistributedDouble.lf b/test/TypeScript/src/federated/LoopDistributedDouble.lf index 081c070048..f6b5b39d50 100644 --- a/test/TypeScript/src/federated/LoopDistributedDouble.lf +++ b/test/TypeScript/src/federated/LoopDistributedDouble.lf @@ -8,7 +8,7 @@ target TypeScript { timeout: 5 sec, keepAlive: true, coordination-options: { - advance-message-interval: 100 msec + advance-message-interval: 100 msec } } @@ -22,57 +22,57 @@ reactor Looper(incr: number = 1, delay: time = 0 msec) { timer t(0, 1 sec) preamble {= - let stop = false; - // Function to trigger an action once every second. - function ping(act: any) { - if (!stop) { - console.log("Scheduling action."); - act.schedule(0, null); - setTimeout(ping, 1000, act); + let stop = false; + // Function to trigger an action once every second. + function ping(act: any) { + if (!stop) { + console.log("Scheduling action."); + act.schedule(0, null); + setTimeout(ping, 1000, act); + } } - } =} reaction(startup) -> a {= - // Start the ping function for triggering an action every second. - console.log("Starting ping function."); - ping(actions.a); + // Start the ping function for triggering an action every second. + console.log("Starting ping function."); + ping(actions.a); =} reaction(a) -> out, out2 {= - if (count % 2 == 0) { - out = count; - } else { - out2 = count; - } - count += incr; + if (count % 2 == 0) { + out = count; + } else { + out2 = count; + } + count += incr; =} reaction(inp) {= - console.log("Received " + inp + " on inp at logical time " + util.getElapsedLogicalTime() + "."); + console.log("Received " + inp + " on inp at logical time " + util.getElapsedLogicalTime() + "."); =} reaction(inp2) {= - console.log("Received " + inp2 + " on inp2 at logical time " + util.getElapsedLogicalTime() + "."); + console.log("Received " + inp2 + " on inp2 at logical time " + util.getElapsedLogicalTime() + "."); =} reaction(t) {= - console.log("Timer triggered at logical time " + util.getElapsedLogicalTime() + "."); + console.log("Timer triggered at logical time " + util.getElapsedLogicalTime() + "."); =} reaction(shutdown) {= - console.log("******* Shutdown invoked."); - // Stop the ping function that is scheduling actions. - stop = true; - if (count != 5 * incr) { - util.requestErrorStop("Failed to receive all five expected inputs."); - } + console.log("******* Shutdown invoked."); + // Stop the ping function that is scheduling actions. + stop = true; + if (count != 5 * incr) { + util.requestErrorStop("Failed to receive all five expected inputs."); + } =} } federated reactor(delay: time = 0) { left = new Looper() - right = new Looper(incr = -1) + right = new Looper(incr=-1) left.out -> right.inp right.out -> left.inp right.out2 -> left.inp2 diff --git a/test/TypeScript/src/federated/PingPongDistributed.lf b/test/TypeScript/src/federated/PingPongDistributed.lf index 42cceae73c..e189bd44e0 100644 --- a/test/TypeScript/src/federated/PingPongDistributed.lf +++ b/test/TypeScript/src/federated/PingPongDistributed.lf @@ -8,18 +8,18 @@ reactor Ping(count: number = 10) { logical action serve reaction(startup, serve) -> send {= - console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}`); - send = pingsLeft; - pingsLeft = pingsLeft - 1; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}`); + send = pingsLeft; + pingsLeft = pingsLeft - 1; =} reaction(receive) -> serve {= - if (pingsLeft > 0){ - actions.serve.schedule(0, null); - } - else{ - util.requestStop(); - } + if (pingsLeft > 0){ + actions.serve.schedule(0, null); + } + else{ + util.requestStop(); + } =} } @@ -29,25 +29,25 @@ reactor Pong(expected: number = 10) { state count: number = 0 reaction(receive) -> send {= - count += 1; - console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong received ${receive}`) - send = receive; - if (count == expected){ - util.requestStop(); - } + count += 1; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong received ${receive}`) + send = receive; + if (count == expected){ + util.requestStop(); + } =} reaction(shutdown) {= - if (count != expected){ - util.requestErrorStop(`Pong expected to receive ${expected} inputs, but it received ${count}`); - } - console.log(`Pong received ${count} pings.`); + if (count != expected){ + util.requestErrorStop(`Pong expected to receive ${expected} inputs, but it received ${count}`); + } + console.log(`Pong received ${count} pings.`); =} } federated reactor PingPongDistributed(count: number = 10) { - ping = new Ping(count = count) - pong = new Pong(expected = count) + ping = new Ping(count=count) + pong = new Pong(expected=count) ping.send -> pong.receive pong.send -> ping.receive } diff --git a/test/TypeScript/src/federated/PingPongDistributedPhysical.lf b/test/TypeScript/src/federated/PingPongDistributedPhysical.lf index 298a7298d4..ef773e2446 100644 --- a/test/TypeScript/src/federated/PingPongDistributedPhysical.lf +++ b/test/TypeScript/src/federated/PingPongDistributedPhysical.lf @@ -32,16 +32,16 @@ reactor Ping(count: number = 10) { logical action serve reaction(startup, serve) -> send {= - console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}.`); - send = pingsLeft--; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Ping sending ${pingsLeft}.`); + send = pingsLeft--; =} reaction(receive) -> serve {= - if (pingsLeft > 0) { - actions.serve.schedule(0, null); - } else { - util.requestStop(); - } + if (pingsLeft > 0) { + actions.serve.schedule(0, null); + } else { + util.requestStop(); + } =} } @@ -51,25 +51,25 @@ reactor Pong(expected: number = 10) { state count: number = 0 reaction(receive) -> send {= - count++; - console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong receivedd ${receive}.`); - send = receive; - if (count === expected) { - util.requestStop(); - } + count++; + console.log(`At logical time ${util.getElapsedLogicalTime()}, Pong receivedd ${receive}.`); + send = receive; + if (count === expected) { + util.requestStop(); + } =} reaction(shutdown) {= - if (count !== expected) { - util.requestErrorStop(`Pong expected to received ${expected} inputs, but it received ${count}.`); - } - console.log(`Pong received ${count} pings.`); + if (count !== expected) { + util.requestErrorStop(`Pong expected to received ${expected} inputs, but it received ${count}.`); + } + console.log(`Pong received ${count} pings.`); =} } federated reactor(count: number = 10) { - ping = new Ping(count = count) - pong = new Pong(expected = count) + ping = new Ping(count=count) + pong = new Pong(expected=count) ping.send ~> pong.receive pong.send ~> ping.receive } diff --git a/test/TypeScript/src/federated/SpuriousDependency.lf b/test/TypeScript/src/federated/SpuriousDependency.lf index dc16319a70..39da8f0ea5 100644 --- a/test/TypeScript/src/federated/SpuriousDependency.lf +++ b/test/TypeScript/src/federated/SpuriousDependency.lf @@ -1,8 +1,7 @@ /** * This checks that a federated program does not deadlock when it is ambiguous, given the structure * of a federate, whether it is permissible to require certain network sender/receiver reactions to - * precede others inp the execution of a given tag. The version of LFC that was inp the master branch - * on 4/15/2023 resolved the ambiguity inp a way that does appear to result inp deadlock. + * precede others in the execution of a given tag. */ target TypeScript { timeout: 1 sec @@ -13,9 +12,7 @@ reactor Passthrough(id: number = 0) { output out: number reaction(inp) -> out {= - //lf_print("Hello from passthrough %d", self->id); console.log("Hello from passthrough " + id); - //lf_set(out, inp->value); out = inp; =} } @@ -41,11 +38,7 @@ reactor Check { reaction(inp) {= console.log("count is now " + ++count); =} reaction(shutdown) {= - // lf_print("******* Shutdown invoked."); console.log("******* Shutdown invoked."); - // if (self->count != 1) { - // lf_print_error_and_exit("Failed to receive expected input."); - // } if (count != 1) { util.reportError("Failed to receieve expected input."); } From 021166557349e38776a91bcfc53a57d7d961b361 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Fri, 4 Aug 2023 11:19:24 +0900 Subject: [PATCH 007/141] Increment the port ID to match messages properly --- .../kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt | 2 +- .../src/federated/DistributedCountPhysicalAfterDelay.lf | 5 +---- test/TypeScript/src/federated/LoopDistributedDouble.lf | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt b/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt index 2911503159..3e01cdccbd 100644 --- a/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/ts/TSInstanceGenerator.kt @@ -78,7 +78,7 @@ class TSInstanceGenerator( // Assume that network receiver reactors are sorted by portID childReactorInstantiations.add( "this.registerNetworkReceiver(\n" - + "\t${portID},\n" + + "\t${portID++},\n" + "\tthis.${childReactor.name} as __NetworkReceiver\n)") } if (isNetworkSender) { diff --git a/test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf b/test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf index c6ab1190de..107cd847cb 100644 --- a/test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf +++ b/test/TypeScript/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -7,10 +7,7 @@ * @author Soroush Bateni * @author Byeong-gil Jun */ -target TypeScript { - logging: debug, - keepalive: true -} +target TypeScript import Count from "../lib/Count.lf" diff --git a/test/TypeScript/src/federated/LoopDistributedDouble.lf b/test/TypeScript/src/federated/LoopDistributedDouble.lf index f6b5b39d50..0facc3c6dc 100644 --- a/test/TypeScript/src/federated/LoopDistributedDouble.lf +++ b/test/TypeScript/src/federated/LoopDistributedDouble.lf @@ -6,7 +6,6 @@ */ target TypeScript { timeout: 5 sec, - keepAlive: true, coordination-options: { advance-message-interval: 100 msec } From 736abe7cf79d1142c815cca9f7e70e2664b3ef69 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Aug 2023 18:08:15 +0200 Subject: [PATCH 008/141] support named reactions --- core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt | 2 +- .../kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt | 3 +-- .../kotlin/org/lflang/generator/cpp/CppReactorGenerator.kt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt b/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt index 9c37bcd8ab..e9e3f9fd8a 100644 --- a/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt +++ b/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt @@ -47,7 +47,7 @@ import org.lflang.lf.WidthSpec /** Get the "name" a reaction is represented with in target code.*/ val Reaction.codeName - get(): String = "r$indexInContainer" + get(): String = name ?: "r$indexInContainer" /* ********************************************************************************************** * C++ specific extensions shared across classes diff --git a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt index 7d4dbdb13f..1b894378f3 100644 --- a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt @@ -45,8 +45,7 @@ import org.lflang.toText /** A C++ code generator for reactions and their function bodies */ class CppReactionGenerator( private val reactor: Reactor, - private val portGenerator: CppPortGenerator, - private val instanceGenerator: CppInstanceGenerator + private val portGenerator: CppPortGenerator ) { private val reactionsWithDeadlines = reactor.reactions.filter { it.deadline != null } diff --git a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactorGenerator.kt b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactorGenerator.kt index af65a4a790..a7d8f0e4ae 100644 --- a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactorGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactorGenerator.kt @@ -54,7 +54,7 @@ class CppReactorGenerator(private val reactor: Reactor, fileConfig: CppFileConfi private val timers = CppTimerGenerator(reactor) private val actions = CppActionGenerator(reactor, messageReporter) private val ports = CppPortGenerator(reactor) - private val reactions = CppReactionGenerator(reactor, ports, instances) + private val reactions = CppReactionGenerator(reactor, ports) private val assemble = CppAssembleMethodGenerator(reactor) private fun publicPreamble() = From 250e3abe330ae69131ece423dbb24363b5f7b73f Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Aug 2023 18:44:02 +0200 Subject: [PATCH 009/141] enable bodyless reactions in C++ --- core/src/main/java/org/lflang/Target.java | 2 +- .../org/lflang/generator/cpp/CppReactionGenerator.kt | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/lflang/Target.java b/core/src/main/java/org/lflang/Target.java index f95f991875..096788484e 100644 --- a/core/src/main/java/org/lflang/Target.java +++ b/core/src/main/java/org/lflang/Target.java @@ -494,7 +494,7 @@ public boolean supportsParameterizedWidths() { * this target. */ public boolean supportsReactionDeclarations() { - if (this.equals(Target.C)) return true; + if (this.equals(Target.C) || this.equals(Target.CPP)) return true; else return false; } diff --git a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt index 1b894378f3..489dd8c2ae 100644 --- a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt @@ -148,8 +148,9 @@ class CppReactionGenerator( } } - private fun generateBodyDefinition(reaction: Reaction): String { - return with(PrependOperator) { + private fun generateBodyDefinition(reaction: Reaction): String? { + return if (reaction.code == null) null + else with(PrependOperator) { """ |// reaction ${reaction.label} |${reactor.templateLine} @@ -252,7 +253,7 @@ class CppReactionGenerator( /** Get all definitions of reaction bodies. */ fun generateBodyDefinitions() = - reactor.reactions.joinToString(separator = "\n", postfix = "\n") { generateBodyDefinition(it) } + reactor.reactions.mapNotNull { generateBodyDefinition(it) }.joinToString(separator = "\n", postfix = "\n") /** Get all declarations of deadline handlers. */ fun generateDeadlineHandlerDeclarations(): String = From fac6624f84448fc6021684eab3fa8b08c4585cea Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Aug 2023 18:44:15 +0200 Subject: [PATCH 010/141] add testcase --- test/Cpp/src/HelloBodylessWorld.lf | 7 +++++++ test/Cpp/src/hello_bodyless_world.cc | 5 +++++ test/Cpp/src/hello_bodyless_world.cmake | 3 +++ 3 files changed, 15 insertions(+) create mode 100644 test/Cpp/src/HelloBodylessWorld.lf create mode 100644 test/Cpp/src/hello_bodyless_world.cc create mode 100644 test/Cpp/src/hello_bodyless_world.cmake diff --git a/test/Cpp/src/HelloBodylessWorld.lf b/test/Cpp/src/HelloBodylessWorld.lf new file mode 100644 index 0000000000..3825e1077f --- /dev/null +++ b/test/Cpp/src/HelloBodylessWorld.lf @@ -0,0 +1,7 @@ +target Cpp { + cmake-include: hello_bodyless_world.cmake +} + +main reactor { + reaction hello(startup) +} diff --git a/test/Cpp/src/hello_bodyless_world.cc b/test/Cpp/src/hello_bodyless_world.cc new file mode 100644 index 0000000000..782aeefc53 --- /dev/null +++ b/test/Cpp/src/hello_bodyless_world.cc @@ -0,0 +1,5 @@ +#include "HelloBodylessWorld/HelloBodylessWorld.hh" + +void HelloBodylessWorld::Inner::hello_body([[maybe_unused]] const reactor::StartupTrigger& startup) { + std::cout << "Hello World." << std::endl; +} diff --git a/test/Cpp/src/hello_bodyless_world.cmake b/test/Cpp/src/hello_bodyless_world.cmake new file mode 100644 index 0000000000..09e0a5cf3f --- /dev/null +++ b/test/Cpp/src/hello_bodyless_world.cmake @@ -0,0 +1,3 @@ +target_sources(${LF_MAIN_TARGET} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/hello_bodyless_world.cc) + + From 6f7e8140f9f55cfd461dc7b743163181488f1439 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Aug 2023 18:57:06 +0200 Subject: [PATCH 011/141] also base the reaction name (string) on the name in LF code --- core/src/main/kotlin/org/lflang/ast/AstExtensions.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/main/kotlin/org/lflang/ast/AstExtensions.kt b/core/src/main/kotlin/org/lflang/ast/AstExtensions.kt index 26678a2273..1f4f99a2c4 100644 --- a/core/src/main/kotlin/org/lflang/ast/AstExtensions.kt +++ b/core/src/main/kotlin/org/lflang/ast/AstExtensions.kt @@ -263,10 +263,11 @@ val Resource.model: Model get() = this.allContents.asSequence().filterIsInstance /** Get a label representing the receiving reaction. * - * If the reaction is annotated with a label, then the label is returned. Otherwise, a reaction name - * is generated based on its priority. + * If the reaction is named, then the name is returned. + * If it is not named but annotated with a label, then the label is returned. + * Otherwise, a reaction name is generated based on its priority. */ -val Reaction.label get(): String = AttributeUtils.getLabel(this) ?: "reaction_$priority" +val Reaction.label get(): String = name ?: AttributeUtils.getLabel(this) ?: "reaction_$priority" /** Get the priority of a receiving reaction */ val Reaction.priority From 3891436dbe002ed49fdb3efa4bfee063bbee256f Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun <78055940+byeong-gil@users.noreply.github.com> Date: Wed, 16 Aug 2023 10:58:00 +0900 Subject: [PATCH 012/141] Update package.json --- core/src/main/resources/lib/ts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/ts/package.json b/core/src/main/resources/lib/ts/package.json index 4797fd56ed..fc063d791e 100644 --- a/core/src/main/resources/lib/ts/package.json +++ b/core/src/main/resources/lib/ts/package.json @@ -2,7 +2,7 @@ "name": "LinguaFrancaDefault", "type": "commonjs", "dependencies": { - "@lf-lang/reactor-ts": "git://github.com/lf-lang/reactor-ts.git#ts-cyclic-dependencies", + "@lf-lang/reactor-ts": "git://github.com/lf-lang/reactor-ts.git#master", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.3" }, From 9e898ec3ced32771fd55550278c52ce07c4214d4 Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Wed, 16 Aug 2023 16:26:05 +0200 Subject: [PATCH 013/141] First prototype @layout annotation. --- .../main/java/org/lflang/AttributeUtils.java | 47 +++++++++++++++++++ .../synthesis/LinguaFrancaSynthesis.java | 26 +++++++++- .../org/lflang/validation/AttributeSpec.java | 5 ++ 3 files changed, 77 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/AttributeUtils.java b/core/src/main/java/org/lflang/AttributeUtils.java index f611e92cd7..c10258abe8 100644 --- a/core/src/main/java/org/lflang/AttributeUtils.java +++ b/core/src/main/java/org/lflang/AttributeUtils.java @@ -27,8 +27,11 @@ import static org.lflang.ast.ASTUtils.factory; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; + import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; @@ -101,6 +104,24 @@ public static Attribute findAttributeByName(EObject node, String name) { .orElse(null); } + /** + * Return the attributes with the given name. + * + * @throws IllegalArgumentException If the node cannot have attributes + */ + public static List findAttributesByName(EObject node, String name) { + List attrs = getAttributes(node); + if (!attrs.isEmpty()) { + System.out.println("Fun"); + } + return attrs.stream() + .filter( + it -> + it.getAttrName() + .equalsIgnoreCase(name)) // case-insensitive search (more user-friendly) + .toList(); + } + /** * Return the first argument specified for the attribute. * @@ -133,6 +154,24 @@ public static String getAttributeValue(EObject node, String attrName) { return value; } + /** + * Search for an attribute with the given name on the given AST node and return its first argument + * as a String. + * + *

This should only be used on attributes that are expected to have a single argument. + * + *

Returns null if the attribute is not found or if it does not have any arguments. + */ + public static Map getAttributeValues(EObject node, String attrName) { + final List attrs = findAttributesByName(node, attrName); + HashMap layoutOptions = new HashMap<>(); + for (Attribute attribute : attrs) { + layoutOptions.put(StringUtil.removeQuotes(attribute.getAttrParms().get(0).getValue()), + StringUtil.removeQuotes(attribute.getAttrParms().get(1).getValue())); + } + return layoutOptions; + } + /** * Retrieve a specific annotation in a comment associated with the given model element in the AST. * @@ -241,6 +280,14 @@ public static String getPortSide(EObject node) { return getAttributeValue(node, "side"); } + /** + * Return the {@code layout} annotation for the given element or null if there is + * no such annotation. + */ + public static Map getLayoutOption(EObject node) { + return getAttributeValues(node, "layout"); + } + /** * Return the {@code @enclave} attribute annotated on the given node. * diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 272b483607..0d0b5b93ad 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -32,6 +32,7 @@ import de.cau.cs.kieler.klighd.DisplayedActionData; import de.cau.cs.kieler.klighd.Klighd; import de.cau.cs.kieler.klighd.SynthesisOption; +import de.cau.cs.kieler.klighd.kgraph.EMapPropertyHolder; import de.cau.cs.kieler.klighd.kgraph.KEdge; import de.cau.cs.kieler.klighd.kgraph.KLabel; import de.cau.cs.kieler.klighd.kgraph.KNode; @@ -68,12 +69,16 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; + import javax.inject.Inject; + import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.elk.alg.layered.options.LayerConstraint; import org.eclipse.elk.alg.layered.options.LayeredOptions; import org.eclipse.elk.alg.layered.options.NodePlacementStrategy; +import org.eclipse.elk.core.data.LayoutMetaDataService; +import org.eclipse.elk.core.data.LayoutOptionData; import org.eclipse.elk.core.math.ElkMargin; import org.eclipse.elk.core.math.ElkPadding; import org.eclipse.elk.core.math.KVector; @@ -159,6 +164,9 @@ public class LinguaFrancaSynthesis extends AbstractDiagramSynthesis { // ------------------------------------------------------------------------- + /** Service class for accessing layout options by name */ + private static final LayoutMetaDataService LAYOUT_OPTIONS_SERVICE = LayoutMetaDataService.getInstance(); + public static final String ID = "org.lflang.diagram.synthesis.LinguaFrancaSynthesis"; // -- INTERNAL -- @@ -732,7 +740,7 @@ private Collection createReactorNode( nodes.add(errNode); } } - + setAnnotatedLayoutOptions(reactor, node); return nodes; } @@ -1722,4 +1730,20 @@ private Iterable createUserComments(EObject element, KNode targetNode) { } return List.of(); } + + /** + * Searches the "@layout" annotations and applies them to the corresponding element. + * + * @param kgraphElement The view model element to apply the layout options to, e.g. a KNode. + * @param modelElement The model element that has the annotations, e.g. a reactor. + */ + private void setAnnotatedLayoutOptions(EObject modelElement, EMapPropertyHolder kgraphElement) { + Map options = AttributeUtils.getLayoutOption(modelElement); + for (String key : options.keySet()) { + LayoutOptionData data = LAYOUT_OPTIONS_SERVICE.getOptionDataBySuffix(key); + if (data != null) { + kgraphElement.setProperty(data, data.parseValue(options.get(key))); + } + } + } } diff --git a/core/src/main/java/org/lflang/validation/AttributeSpec.java b/core/src/main/java/org/lflang/validation/AttributeSpec.java index 90e7f9cf6d..1df9a0c6ef 100644 --- a/core/src/main/java/org/lflang/validation/AttributeSpec.java +++ b/core/src/main/java/org/lflang/validation/AttributeSpec.java @@ -213,6 +213,11 @@ enum AttrParamType { ATTRIBUTE_SPECS_BY_NAME.put( "side", new AttributeSpec(List.of(new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); + // @layout("string", "any") e.g. @layout("port.side", "WEST") + ATTRIBUTE_SPECS_BY_NAME.put( + "layout", + new AttributeSpec(List.of(new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false), + new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); // @enclave(each=boolean) ATTRIBUTE_SPECS_BY_NAME.put( "enclave", From 6de9d85b425e050e26bc4005c9aaaa09334f27e5 Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Wed, 16 Aug 2023 17:18:25 +0200 Subject: [PATCH 014/141] Added annotation for all annotatable elements. --- .../lflang/diagram/synthesis/LinguaFrancaSynthesis.java | 9 +++++++-- .../main/java/org/lflang/validation/AttributeSpec.java | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 0d0b5b93ad..d10597f44a 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -491,6 +491,7 @@ private Collection createReactorNode( Iterables.addAll(nodes, createUserComments(reactor, node)); configureReactorNodeLayout(node, true); _layoutPostProcessing.configureMainReactor(node); + setAnnotatedLayoutOptions(reactor, node); } else { ReactorInstance instance = reactorInstance; @@ -731,6 +732,7 @@ private Collection createReactorNode( } configureReactorNodeLayout(node, false); _layoutPostProcessing.configureReactor(node); + setAnnotatedLayoutOptions(reactor, node); } // Find and annotate cycles @@ -740,7 +742,6 @@ private Collection createReactorNode( nodes.add(errNode); } } - setAnnotatedLayoutOptions(reactor, node); return nodes; } @@ -1043,6 +1044,7 @@ private Collection transformReactorNetwork( timerNodes.put(timer, node); _linguaFrancaShapeExtensions.addTimerFigure(node, timer); _layoutPostProcessing.configureTimer(node); + setAnnotatedLayoutOptions(timer.getDefinition(), node); } // Create reactions @@ -1057,6 +1059,7 @@ private Collection transformReactorNetwork( setLayoutOption(node, CoreOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); _layoutPostProcessing.configureReaction(node); + setAnnotatedLayoutOptions(reaction.getDefinition(), node); setLayoutOption( node, LayeredOptions.POSITION, @@ -1210,6 +1213,7 @@ private Collection transformReactorNetwork( Iterables.addAll(nodes, createUserComments(action.getDefinition(), node)); setLayoutOption(node, CoreOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_SIDE); _layoutPostProcessing.configureAction(node); + setAnnotatedLayoutOptions(action.getDefinition(), node); Pair ports = _linguaFrancaShapeExtensions.addActionFigureAndPorts( node, action.isPhysical() ? "P" : "L"); @@ -1666,6 +1670,7 @@ private KPort addIOPort( } } associateWith(_kLabelExtensions.addOutsidePortLabel(port, label, 8), lfPort.getDefinition()); + setAnnotatedLayoutOptions(lfPort.getDefinition(), port); return port; } @@ -1737,7 +1742,7 @@ private Iterable createUserComments(EObject element, KNode targetNode) { * @param kgraphElement The view model element to apply the layout options to, e.g. a KNode. * @param modelElement The model element that has the annotations, e.g. a reactor. */ - private void setAnnotatedLayoutOptions(EObject modelElement, EMapPropertyHolder kgraphElement) { + public void setAnnotatedLayoutOptions(EObject modelElement, EMapPropertyHolder kgraphElement) { Map options = AttributeUtils.getLayoutOption(modelElement); for (String key : options.keySet()) { LayoutOptionData data = LAYOUT_OPTIONS_SERVICE.getOptionDataBySuffix(key); diff --git a/core/src/main/java/org/lflang/validation/AttributeSpec.java b/core/src/main/java/org/lflang/validation/AttributeSpec.java index 1df9a0c6ef..6d1da3e0a3 100644 --- a/core/src/main/java/org/lflang/validation/AttributeSpec.java +++ b/core/src/main/java/org/lflang/validation/AttributeSpec.java @@ -50,6 +50,7 @@ public class AttributeSpec { public static final String VALUE_ATTR = "value"; public static final String NETWORK_MESSAGE_ACTIONS = "network_message_actions"; public static final String EACH_ATTR = "each"; + public static final String OPTION_ATTR = "option"; /** A map from a string to a supported AttributeSpec */ public static final Map ATTRIBUTE_SPECS_BY_NAME = new HashMap<>(); @@ -213,10 +214,10 @@ enum AttrParamType { ATTRIBUTE_SPECS_BY_NAME.put( "side", new AttributeSpec(List.of(new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); - // @layout("string", "any") e.g. @layout("port.side", "WEST") + // @layout(option="string", value="any") e.g. @layout(option="port.side", value="WEST") ATTRIBUTE_SPECS_BY_NAME.put( "layout", - new AttributeSpec(List.of(new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false), + new AttributeSpec(List.of(new AttrParamSpec(OPTION_ATTR, AttrParamType.STRING, false), new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); // @enclave(each=boolean) ATTRIBUTE_SPECS_BY_NAME.put( From b2e9b91759a51dc79c8dda76c9361150ef09bef7 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Thu, 17 Aug 2023 13:50:39 -0700 Subject: [PATCH 015/141] Closes #1942. --- .../org/lflang/federated/generator/FedASTUtils.java | 11 +++++++++-- .../org/lflang/federated/generator/FedGenerator.java | 6 +++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java b/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java index d38237c71b..5dfcc74368 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java +++ b/core/src/main/java/org/lflang/federated/generator/FedASTUtils.java @@ -657,8 +657,15 @@ private static Reactor getNetworkSenderReactor( Input in = factory.createInput(); in.setName("msg"); in.setType(type); - in.setWidthSpec( - EcoreUtil.copy(connection.getSourcePortInstance().getDefinition().getWidthSpec())); + var width = + ASTUtils.width( + connection.getSourcePortInstance().getDefinition().getWidthSpec(), + List.of(connection.getSrcFederate().instantiation)); + var widthSpec = factory.createWidthSpec(); + var widthTerm = factory.createWidthTerm(); + widthTerm.setWidth(width); + widthSpec.getTerms().add(widthTerm); + in.setWidthSpec(widthSpec); inRef.setVariable(in); destRef.setContainer(connection.getDestinationPortInstance().getParent().getDefinition()); diff --git a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java index ea1d960e0a..f885daabdf 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java +++ b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java @@ -553,7 +553,11 @@ private Reactor indexer(ReactorInstance reactorInstance, PortInstance input, Res FedASTUtils.addReactorDefinition( "_" + reactorInstance.getName() + input.getName(), resource); var output = LfFactory.eINSTANCE.createOutput(); - output.setWidthSpec(EcoreUtil.copy(input.getDefinition().getWidthSpec())); + var widthSpec = LfFactory.eINSTANCE.createWidthSpec(); + var widthTerm = LfFactory.eINSTANCE.createWidthTerm(); + widthTerm.setWidth(input.getWidth()); + widthSpec.getTerms().add(widthTerm); + output.setWidthSpec(widthSpec); output.setType(EcoreUtil.copy(input.getDefinition().getType())); output.setName("port"); indexer.getOutputs().add(output); From e7f5284c5e26c67b398db14fa8ead0d755a3ac97 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Thu, 17 Aug 2023 15:23:39 -0700 Subject: [PATCH 016/141] Fix unused multiports bug (#1957). --- .../org/lflang/generator/c/CTriggerObjectsGenerator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java b/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java index 4d1124a3b9..77e7eee22e 100644 --- a/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java @@ -785,10 +785,13 @@ private static String deferredOutputNumDestinations(ReactorInstance reactor) { if (output.eventualDestinations().size() == 0) { // Dangling output. Still set the source reactor code.pr( - CUtil.portRef(output) + "for (int index486184027c8990b = 0; index486184027c8990b < " + + output.getWidth() + + "; index486184027c8990b++) { " + + CUtil.portRef(output, false, true, null, null, "index486184027c8990b") + "._base.source_reactor = (self_base_t*)" + CUtil.reactorRef(reactor) - + ";"); + + "; }"); } } return code.toString(); From 49fae5a9cca4da41d173743fb50452694188ab52 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Thu, 17 Aug 2023 15:42:26 -0700 Subject: [PATCH 017/141] Make test more comprehensive. --- test/C/src/federated/DistributedMultiport.lf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/C/src/federated/DistributedMultiport.lf b/test/C/src/federated/DistributedMultiport.lf index fcd570d890..018a286360 100644 --- a/test/C/src/federated/DistributedMultiport.lf +++ b/test/C/src/federated/DistributedMultiport.lf @@ -4,8 +4,8 @@ target C { coordination: centralized } -reactor Source { - output[4] out: int +reactor Source(width: int = 2) { + output[width] out: int timer t(0, 100 msec) state count: int = 0 @@ -16,8 +16,8 @@ reactor Source { =} } -reactor Destination { - input[4] in: int +reactor Destination(width: int = 3) { + input[width] in: int state count: int = 0 reaction(in) {= @@ -39,7 +39,7 @@ reactor Destination { } federated reactor DistributedMultiport { - s = new Source() - d = new Destination() + s = new Source(width = 4) + d = new Destination(width = 4) s.out -> d.in } From 9e8fc2d8ced0c212fe05a345a80905dd64268926 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 18 Aug 2023 15:40:50 -0700 Subject: [PATCH 018/141] Format. --- test/C/src/federated/DistributedMultiport.lf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/C/src/federated/DistributedMultiport.lf b/test/C/src/federated/DistributedMultiport.lf index 018a286360..0d786e8357 100644 --- a/test/C/src/federated/DistributedMultiport.lf +++ b/test/C/src/federated/DistributedMultiport.lf @@ -39,7 +39,7 @@ reactor Destination(width: int = 3) { } federated reactor DistributedMultiport { - s = new Source(width = 4) - d = new Destination(width = 4) + s = new Source(width=4) + d = new Destination(width=4) s.out -> d.in } From d357aae6fdcb311387d63c3a70bd58008726874f Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 18 Aug 2023 18:18:48 -0700 Subject: [PATCH 019/141] Address width mismatch warning. --- .../src/docker/federated/DistributedMultiportContainerized.lf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/C/src/docker/federated/DistributedMultiportContainerized.lf b/test/C/src/docker/federated/DistributedMultiportContainerized.lf index ec27e0dea3..6250c105c4 100644 --- a/test/C/src/docker/federated/DistributedMultiportContainerized.lf +++ b/test/C/src/docker/federated/DistributedMultiportContainerized.lf @@ -8,7 +8,7 @@ target C { import Source, Destination from "../../federated/DistributedMultiport.lf" federated reactor DistributedMultiportContainerized at rti { - s = new Source() - d = new Destination() + s = new Source(width=4) + d = new Destination(width=4) s.out -> d.in } From 432ac5e19ebb27d1d98e86b9ddda1604d4f1241b Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Tue, 22 Aug 2023 15:13:13 -0700 Subject: [PATCH 020/141] Apply suggestions from code review --- core/src/main/resources/lib/ts/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/ts/package.json b/core/src/main/resources/lib/ts/package.json index fc063d791e..04978d7322 100644 --- a/core/src/main/resources/lib/ts/package.json +++ b/core/src/main/resources/lib/ts/package.json @@ -2,7 +2,7 @@ "name": "LinguaFrancaDefault", "type": "commonjs", "dependencies": { - "@lf-lang/reactor-ts": "git://github.com/lf-lang/reactor-ts.git#master", + "@lf-lang/reactor-ts": "^0.6.0", "command-line-args": "^5.1.1", "command-line-usage": "^6.1.3" }, From b28c61959a4053ba44b7cd06f3a5ed37cbbc3627 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Tue, 22 Aug 2023 20:32:32 -0700 Subject: [PATCH 021/141] Bugfix for TypeScript. --- .../java/org/lflang/federated/extensions/TSExtension.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/extensions/TSExtension.java b/core/src/main/java/org/lflang/federated/extensions/TSExtension.java index e62d1c29d1..f0000b7435 100644 --- a/core/src/main/java/org/lflang/federated/extensions/TSExtension.java +++ b/core/src/main/java/org/lflang/federated/extensions/TSExtension.java @@ -109,8 +109,8 @@ public String generateNetworkSenderBody( CoordinationType coordinationType, MessageReporter messageReporter) { return """ - if (%1$s%2$s !== undefined) { - this.util.sendRTITimedMessage(%1$s%2$s, %3$s, %4$s, %5$s); + if (%1$s%2$s[sender_index as number] !== undefined) { + this.util.sendRTITimedMessage(%1$s%2$s[sender_index as number], %3$s, %4$s, %5$s); } """ .formatted( From 24ed790df18681b1da39c33dcd23772ada1bba8f Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Tue, 22 Aug 2023 20:50:43 -0700 Subject: [PATCH 022/141] Generate one federate per federate. Fixes #1961. --- .../java/org/lflang/federated/generator/FedMainEmitter.java | 5 ++++- test/C/src/federated/DistributedBank.lf | 5 ++++- test/TypeScript/src/federated/DistributedCount.lf | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java b/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java index 7c78a10df7..f6e8f6e9c8 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java +++ b/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java @@ -3,6 +3,7 @@ import java.util.function.Function; import java.util.stream.Collectors; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.util.EcoreUtil; import org.lflang.MessageReporter; import org.lflang.ast.ASTUtils; import org.lflang.ast.FormattingUtil; @@ -27,13 +28,15 @@ String generateMainReactor( .error("Modes at the top level are not supported under federated execution."); } var renderer = FormattingUtil.renderer(federate.targetConfig.target); + var instantiation = EcoreUtil.copy(federate.instantiation); + instantiation.setWidthSpec(null); return String.join( "\n", generateMainSignature(federate, originalMainReactor, renderer), String.join( "\n", - renderer.apply(federate.instantiation), + renderer.apply(instantiation), ASTUtils.allStateVars(originalMainReactor).stream() .map(renderer) .collect(Collectors.joining("\n")), diff --git a/test/C/src/federated/DistributedBank.lf b/test/C/src/federated/DistributedBank.lf index 130ae95961..bb23df81d6 100644 --- a/test/C/src/federated/DistributedBank.lf +++ b/test/C/src/federated/DistributedBank.lf @@ -4,13 +4,16 @@ target C { coordination: centralized } -reactor Node { +reactor Node(bank_index: int = 0) { timer t(0, 100 msec) state count: int = 0 reaction(t) {= lf_print("Hello world %d.", self->count++); =} reaction(shutdown) {= + if (self->bank_index) { + lf_print_error_and_exit("The only bank index should be zero because there should be only one bank member per federate."); + } if (self->count == 0) { lf_print_error_and_exit("Timer reactions did not execute."); } diff --git a/test/TypeScript/src/federated/DistributedCount.lf b/test/TypeScript/src/federated/DistributedCount.lf index 49ccfafc09..d57e96d024 100644 --- a/test/TypeScript/src/federated/DistributedCount.lf +++ b/test/TypeScript/src/federated/DistributedCount.lf @@ -19,7 +19,7 @@ reactor Print { const elapsedTime = util.getElapsedLogicalTime(); console.log("At time " + elapsedTime + ", received " + inp); if (inp !== c) { - util.requestErrorStop("Expected to receive " + c + "."); + util.requestErrorStop("Expected to receive " + JSON.stringify(c) + " but received " + JSON.stringify(inp) + "."); } if (!elapsedTime.isEqualTo(TimeValue.msec(200).add(TimeValue.sec(c - 1)))) { util.requestErrorStop("Expected received time to be " + TimeValue.msec(200).add(TimeValue.sec(c - 1)) + "."); From 8baa059bebb9469e2f8d89bed77b3fa943806e5e Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Wed, 23 Aug 2023 18:22:27 +0200 Subject: [PATCH 023/141] Fixed compilation error in code for reset state variables with time type Fixes #1938 --- .../lflang/generator/c/CStateGenerator.java | 3 +- .../ResetStateVariableOfTypeTime.lf | 45 +++++++++++++++++++ ...esetStateVariableWithParameterizedValue.lf | 45 +++++++++++++++++++ 3 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 test/C/src/modal_models/ResetStateVariableOfTypeTime.lf create mode 100644 test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf diff --git a/core/src/main/java/org/lflang/generator/c/CStateGenerator.java b/core/src/main/java/org/lflang/generator/c/CStateGenerator.java index 225320bfe7..c8686173b6 100644 --- a/core/src/main/java/org/lflang/generator/c/CStateGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CStateGenerator.java @@ -88,8 +88,7 @@ private static String generateModalReset( + "]"; var type = types.getTargetType(instance.tpr.resolveType(ASTUtils.getInferredType(stateVar))); - if (ASTUtils.isOfTimeType(stateVar) - || ASTUtils.isParameterized(stateVar) && !stateVar.getInit().getExprs().isEmpty()) { + if (ASTUtils.isParameterized(stateVar) && !stateVar.getInit().getExprs().isEmpty()) { return CModesGenerator.generateStateResetStructure( instance, modeRef, selfRef, stateVar.getName(), initExpr, type); } else { diff --git a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf new file mode 100644 index 0000000000..72e2075d2c --- /dev/null +++ b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf @@ -0,0 +1,45 @@ +/** + * Modal Reactor Test. + * Tests state variable with type time. + * https://github.com/lf-lang/lingua-franca/issues/1938 + * Model by Edward Lee. + */ +target C { + timeout: 3s, + fast: true +} + +reactor C { + input trigger:bool + reset state t:time = 0s + + reaction(trigger) {= + lf_print("t = %ld", self->t); + if (self->t != SEC(0)) { + lf_print("Error: Missing reset"); + } + + self->t = lf_time_logical(); + =} +} + +main reactor { + timer t(0, 1s) + + initial mode A { + c = new C() + + reaction(t) -> reset(B), c.trigger {= + lf_print("In A"); + lf_set(c.trigger, true); + lf_set_mode(B); + =} + } + + mode B { + reaction(t) -> reset(A) {= + lf_print("In B"); + lf_set_mode(A); + =} + } +} \ No newline at end of file diff --git a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf new file mode 100644 index 0000000000..f7daaa8950 --- /dev/null +++ b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf @@ -0,0 +1,45 @@ +/** + * Modal Reactor Test. + * Tests state variable initialized via parameter. + * https://github.com/lf-lang/lingua-franca/issues/1938 + * Model by Edward Lee. + */ +target C { + timeout: 3s, + fast: true +} + +reactor C (init:int = 0) { + input trigger:bool + reset state i:int = init + + reaction(trigger) {= + lf_print("i = %d", self->i); + if (self->i != -1) { + lf_print("Error: Missing reset"); + } + + self->i += 10; + =} +} + +main reactor { + timer t(0, 1s) + + initial mode A { + c = new C(init = -1) + + reaction(t) -> reset(B), c.trigger {= + lf_print("In A"); + lf_set(c.trigger, true); + lf_set_mode(B); + =} + } + + mode B { + reaction(t) -> reset(A) {= + lf_print("In B"); + lf_set_mode(A); + =} + } +} \ No newline at end of file From abda76c8353aeb14300ea13c0bed52581cd10c9e Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Thu, 24 Aug 2023 09:29:16 +0200 Subject: [PATCH 024/141] Applied LF formatter --- .../ResetStateVariableOfTypeTime.lf | 27 +++++++--------- ...esetStateVariableWithParameterizedValue.lf | 31 +++++++++---------- 2 files changed, 26 insertions(+), 32 deletions(-) diff --git a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf index 72e2075d2c..f7d25c97d6 100644 --- a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf +++ b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf @@ -1,45 +1,42 @@ -/** - * Modal Reactor Test. - * Tests state variable with type time. +/** + * Modal Reactor Test. Tests state variable with type time. Model by Edward Lee. * https://github.com/lf-lang/lingua-franca/issues/1938 - * Model by Edward Lee. */ target C { - timeout: 3s, - fast: true + timeout: 3 s, + fast: true } reactor C { - input trigger:bool - reset state t:time = 0s - + input trigger: bool + reset state t: time = 0 s + reaction(trigger) {= lf_print("t = %ld", self->t); if (self->t != SEC(0)) { lf_print("Error: Missing reset"); } - + self->t = lf_time_logical(); =} } main reactor { - timer t(0, 1s) - + timer t(0, 1 s) + initial mode A { c = new C() - reaction(t) -> reset(B), c.trigger {= lf_print("In A"); lf_set(c.trigger, true); lf_set_mode(B); =} } - + mode B { reaction(t) -> reset(A) {= lf_print("In B"); lf_set_mode(A); =} } -} \ No newline at end of file +} diff --git a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf index f7daaa8950..3e0096e5e0 100644 --- a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf +++ b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf @@ -1,45 +1,42 @@ -/** - * Modal Reactor Test. - * Tests state variable initialized via parameter. +/** + * Modal Reactor Test. Tests state variable initialized via parameter. Model by Edward Lee. * https://github.com/lf-lang/lingua-franca/issues/1938 - * Model by Edward Lee. */ target C { - timeout: 3s, - fast: true + timeout: 3 s, + fast: true } -reactor C (init:int = 0) { - input trigger:bool - reset state i:int = init - +reactor C(init: int = 0) { + input trigger: bool + reset state i: int = init + reaction(trigger) {= lf_print("i = %d", self->i); if (self->i != -1) { lf_print("Error: Missing reset"); } - + self->i += 10; =} } main reactor { - timer t(0, 1s) - + timer t(0, 1 s) + initial mode A { - c = new C(init = -1) - + c = new C(init=-1) reaction(t) -> reset(B), c.trigger {= lf_print("In A"); lf_set(c.trigger, true); lf_set_mode(B); =} } - + mode B { reaction(t) -> reset(A) {= lf_print("In B"); lf_set_mode(A); =} } -} \ No newline at end of file +} From 7e7554e644e904f8208bb7ef2cc51effe45d1d9a Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Thu, 24 Aug 2023 09:31:33 +0200 Subject: [PATCH 025/141] Added newline --- test/C/src/modal_models/ResetStateVariableOfTypeTime.lf | 1 + .../src/modal_models/ResetStateVariableWithParameterizedValue.lf | 1 + 2 files changed, 2 insertions(+) diff --git a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf index f7d25c97d6..0b5f40df23 100644 --- a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf +++ b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf @@ -40,3 +40,4 @@ main reactor { =} } } + diff --git a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf index 3e0096e5e0..e3081a4d0a 100644 --- a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf +++ b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf @@ -40,3 +40,4 @@ main reactor { =} } } + From 9ec756ddae63de7b43c0444e929d8379183de5b0 Mon Sep 17 00:00:00 2001 From: Alexander Schulz-Rosengarten Date: Thu, 24 Aug 2023 11:09:30 +0200 Subject: [PATCH 026/141] Revert "Added newline" This reverts commit 7e7554e644e904f8208bb7ef2cc51effe45d1d9a. --- test/C/src/modal_models/ResetStateVariableOfTypeTime.lf | 1 - .../src/modal_models/ResetStateVariableWithParameterizedValue.lf | 1 - 2 files changed, 2 deletions(-) diff --git a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf index 0b5f40df23..f7d25c97d6 100644 --- a/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf +++ b/test/C/src/modal_models/ResetStateVariableOfTypeTime.lf @@ -40,4 +40,3 @@ main reactor { =} } } - diff --git a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf index e3081a4d0a..3e0096e5e0 100644 --- a/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf +++ b/test/C/src/modal_models/ResetStateVariableWithParameterizedValue.lf @@ -40,4 +40,3 @@ main reactor { =} } } - From b33ce99267ba4c845789b5a0691708a3253d29ab Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Thu, 24 Aug 2023 19:47:06 +0900 Subject: [PATCH 027/141] Index 0 should be used to check the output's status --- .../java/org/lflang/federated/extensions/TSExtension.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/extensions/TSExtension.java b/core/src/main/java/org/lflang/federated/extensions/TSExtension.java index f0000b7435..9ef81c6a23 100644 --- a/core/src/main/java/org/lflang/federated/extensions/TSExtension.java +++ b/core/src/main/java/org/lflang/federated/extensions/TSExtension.java @@ -109,8 +109,8 @@ public String generateNetworkSenderBody( CoordinationType coordinationType, MessageReporter messageReporter) { return """ - if (%1$s%2$s[sender_index as number] !== undefined) { - this.util.sendRTITimedMessage(%1$s%2$s[sender_index as number], %3$s, %4$s, %5$s); + if (%1$s%2$s[0] !== undefined) { + this.util.sendRTITimedMessage(%1$s%2$s[0], %3$s, %4$s, %5$s); } """ .formatted( @@ -136,7 +136,7 @@ public String generatePortAbsentReactionBody( return """ // If the output port has not been set for the current logical time, // send an ABSENT message to the receiving federate - if (%1$s%2$s === undefined) { + if (%1$s%2$s[0] === undefined) { this.util.sendRTIPortAbsent(%3$d, %4$d, %5$s); } """ From 294b32f85239b9b0b1579a50452443c8bfed28e7 Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Mon, 28 Aug 2023 08:21:48 +0200 Subject: [PATCH 028/141] Ran spotlessJavaApply. --- core/src/main/java/org/lflang/AttributeUtils.java | 8 ++++---- .../lflang/diagram/synthesis/LinguaFrancaSynthesis.java | 5 ++--- .../main/java/org/lflang/validation/AttributeSpec.java | 6 ++++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/lflang/AttributeUtils.java b/core/src/main/java/org/lflang/AttributeUtils.java index c10258abe8..ee9666f0b8 100644 --- a/core/src/main/java/org/lflang/AttributeUtils.java +++ b/core/src/main/java/org/lflang/AttributeUtils.java @@ -31,7 +31,6 @@ import java.util.List; import java.util.Map; import java.util.Objects; - import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.nodemodel.ICompositeNode; import org.eclipse.xtext.nodemodel.util.NodeModelUtils; @@ -166,7 +165,8 @@ public static Map getAttributeValues(EObject node, String attrNa final List attrs = findAttributesByName(node, attrName); HashMap layoutOptions = new HashMap<>(); for (Attribute attribute : attrs) { - layoutOptions.put(StringUtil.removeQuotes(attribute.getAttrParms().get(0).getValue()), + layoutOptions.put( + StringUtil.removeQuotes(attribute.getAttrParms().get(0).getValue()), StringUtil.removeQuotes(attribute.getAttrParms().get(1).getValue())); } return layoutOptions; @@ -281,8 +281,8 @@ public static String getPortSide(EObject node) { } /** - * Return the {@code layout} annotation for the given element or null if there is - * no such annotation. + * Return the {@code layout} annotation for the given element or null if there is no such + * annotation. */ public static Map getLayoutOption(EObject node) { return getAttributeValues(node, "layout"); diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index d10597f44a..a0f73dbabf 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -69,9 +69,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; - import javax.inject.Inject; - import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.elk.alg.layered.options.LayerConstraint; @@ -165,7 +163,8 @@ public class LinguaFrancaSynthesis extends AbstractDiagramSynthesis { // ------------------------------------------------------------------------- /** Service class for accessing layout options by name */ - private static final LayoutMetaDataService LAYOUT_OPTIONS_SERVICE = LayoutMetaDataService.getInstance(); + private static final LayoutMetaDataService LAYOUT_OPTIONS_SERVICE = + LayoutMetaDataService.getInstance(); public static final String ID = "org.lflang.diagram.synthesis.LinguaFrancaSynthesis"; diff --git a/core/src/main/java/org/lflang/validation/AttributeSpec.java b/core/src/main/java/org/lflang/validation/AttributeSpec.java index 6d1da3e0a3..5b9d6dc51b 100644 --- a/core/src/main/java/org/lflang/validation/AttributeSpec.java +++ b/core/src/main/java/org/lflang/validation/AttributeSpec.java @@ -217,8 +217,10 @@ enum AttrParamType { // @layout(option="string", value="any") e.g. @layout(option="port.side", value="WEST") ATTRIBUTE_SPECS_BY_NAME.put( "layout", - new AttributeSpec(List.of(new AttrParamSpec(OPTION_ATTR, AttrParamType.STRING, false), - new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); + new AttributeSpec( + List.of( + new AttrParamSpec(OPTION_ATTR, AttrParamType.STRING, false), + new AttrParamSpec(VALUE_ATTR, AttrParamType.STRING, false)))); // @enclave(each=boolean) ATTRIBUTE_SPECS_BY_NAME.put( "enclave", From b1f5cf617033a6bbd71f2638a8ee105edc089d11 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Mon, 28 Aug 2023 12:10:20 +0200 Subject: [PATCH 029/141] avoid the _body postfix for reaction functions --- .../org/lflang/generator/cpp/CppExtensions.kt | 2 +- .../generator/cpp/CppReactionGenerator.kt | 24 ++++++++++--------- test/Cpp/src/hello_bodyless_world.cc | 2 +- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt b/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt index e9e3f9fd8a..45a39eb68a 100644 --- a/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt +++ b/core/src/main/kotlin/org/lflang/generator/cpp/CppExtensions.kt @@ -47,7 +47,7 @@ import org.lflang.lf.WidthSpec /** Get the "name" a reaction is represented with in target code.*/ val Reaction.codeName - get(): String = name ?: "r$indexInContainer" + get(): String = name ?: "reaction_$priority" /* ********************************************************************************************** * C++ specific extensions shared across classes diff --git a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt index 489dd8c2ae..e0dc0c143d 100644 --- a/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt +++ b/core/src/main/kotlin/org/lflang/generator/cpp/CppReactionGenerator.kt @@ -102,7 +102,7 @@ class CppReactionGenerator( allUncontainedSources.map { it.name } + allUncontainedEffects.map { it.name } + allReferencedContainers.map { getViewInstanceName(it) } - val body = "void ${codeName}_body() { __lf_inner.${codeName}_body(${parameters.joinToString(", ")}); }" + val body = "void ${codeName}_body() { __lf_inner.${codeName}(${parameters.joinToString(", ")}); }" val deadlineHandler = "void ${codeName}_deadline_handler() { __lf_inner.${codeName}_deadline_handler(${parameters.joinToString(", ")}); }" @@ -120,28 +120,30 @@ class CppReactionGenerator( } } - private fun generateFunctionDeclaration(reaction: Reaction, postfix: String): String { + private fun generateFunctionDeclaration(reaction: Reaction, postfix: String?): String { val params = reaction.getBodyParameters() + val reactionName = reaction.codeName + if(postfix != null) "_$postfix" else "" return when (params.size) { - 0 -> "void ${reaction.codeName}_$postfix();" - 1 -> "void ${reaction.codeName}_$postfix(${params[0]});" + 0 -> "void $reactionName();" + 1 -> "void $reactionName(${params[0]});" else -> with(PrependOperator) { """ - |void ${reaction.codeName}_$postfix( + |void $reactionName( ${" | "..params.joinToString(",\n")}); """.trimMargin() } } } - private fun getFunctionDefinitionSignature(reaction: Reaction, postfix: String): String { + private fun getFunctionDefinitionSignature(reaction: Reaction, postfix: String?): String { val params = reaction.getBodyParameters() + val reactionName = "${reactor.templateName}::Inner::${reaction.codeName}" + if(postfix != null) "_$postfix" else "" return when (params.size) { - 0 -> "void ${reactor.templateName}::Inner::${reaction.codeName}_$postfix()" - 1 -> "void ${reactor.templateName}::Inner::${reaction.codeName}_$postfix(${params[0]})" + 0 -> "void $reactionName()" + 1 -> "void $reactionName(${params[0]})" else -> with(PrependOperator) { """ - |void ${reactor.templateName}::Inner::${reaction.codeName}_$postfix( + |void $reactionName( ${" | "..params.joinToString(",\n")}) """.trimMargin() } @@ -154,7 +156,7 @@ class CppReactionGenerator( """ |// reaction ${reaction.label} |${reactor.templateLine} - ${" |"..getFunctionDefinitionSignature(reaction, "body")} { + ${" |"..getFunctionDefinitionSignature(reaction, null)} { ${" | "..reaction.code.toText()} |} | @@ -248,7 +250,7 @@ class CppReactionGenerator( /** Get all declarations of reaction bodies. */ fun generateBodyDeclarations() = reactor.reactions.joinToString("\n", "// reaction bodies\n", "\n") { - generateFunctionDeclaration(it, "body") + generateFunctionDeclaration(it, null) } /** Get all definitions of reaction bodies. */ diff --git a/test/Cpp/src/hello_bodyless_world.cc b/test/Cpp/src/hello_bodyless_world.cc index 782aeefc53..278c8dbe5d 100644 --- a/test/Cpp/src/hello_bodyless_world.cc +++ b/test/Cpp/src/hello_bodyless_world.cc @@ -1,5 +1,5 @@ #include "HelloBodylessWorld/HelloBodylessWorld.hh" -void HelloBodylessWorld::Inner::hello_body([[maybe_unused]] const reactor::StartupTrigger& startup) { +void HelloBodylessWorld::Inner::hello([[maybe_unused]] const reactor::StartupTrigger& startup) { std::cout << "Hello World." << std::endl; } From 62968d444596ba1a36745e116ada63618d868010 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 28 Aug 2023 13:01:29 -0700 Subject: [PATCH 030/141] Simplify build environment setup and make caching more robust --- .github/actions/prepare-build-env/action.yml | 38 +++----------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/actions/prepare-build-env/action.yml b/.github/actions/prepare-build-env/action.yml index 2d0c82c78f..71ca8a50ee 100644 --- a/.github/actions/prepare-build-env/action.yml +++ b/.github/actions/prepare-build-env/action.yml @@ -1,5 +1,5 @@ -name: Prepare build environment (Linux only) -description: Set up Java, Maven, Gradle, etc. +name: Set up build environment +description: Set up Java and Gradle (including caching). runs: using: "composite" steps: @@ -8,35 +8,7 @@ runs: echo "$JAVA_HOME_17_X64/bin" >> $GITHUB_PATH echo "org.gradle.java.home=${JAVA_HOME_17_X64//\\/\/}" >> gradle.properties echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV + echo "$GRADLE_USER_HOME" shell: bash - - name: Check settings - run: | - echo $(which java) - cat gradle.properties - echo $JAVA_HOME - shell: bash - - name: Create hash of Gradle configuration (macOS only) - run: | - echo "gradle-hash"="$(find . -type f \( -name "gradle.properties" -o -name "gradle-wrapper.properties" \) -exec cat {} + | shasum -a 256 | cut -d ' ' -f 1)" >> $GITHUB_ENV - if: ${{ runner.os == 'macOS' }} - shell: bash - - name: Create hash of Gradle configuration (Linux and Windows only) - run: | - echo "gradle-hash"="$(find . -type f \( -name "gradle.properties" -o -name "gradle-wrapper.properties" \) -exec cat {} + | sha256sum | cut -d ' ' -f 1)" >> $GITHUB_ENV - if: ${{ runner.os == 'Windows' || runner.os == 'Linux' }} - shell: bash - - name: Cache - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: gradle-${{ runner.os }}-${{ env.gradle-hash }} - # restore-keys: | - # ${{ runner.os }}-gradle- - - name: Bring down Gradle daemon (Windows) - uses: webiny/action-post-run@3.0.0 - id: post-run-command - with: - run: ./gradlew --stop - if: ${{ runner.os == 'Windows' }} + - name: Gradle Build Action + uses: gradle/gradle-build-action@v2.8.0 From aca30ce98de3e6ac0fd316582a197938e8283238 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 28 Aug 2023 13:03:39 -0700 Subject: [PATCH 031/141] More standard way of setting up Java --- .github/actions/prepare-build-env/action.yml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/actions/prepare-build-env/action.yml b/.github/actions/prepare-build-env/action.yml index 71ca8a50ee..71013d2fbe 100644 --- a/.github/actions/prepare-build-env/action.yml +++ b/.github/actions/prepare-build-env/action.yml @@ -3,12 +3,9 @@ description: Set up Java and Gradle (including caching). runs: using: "composite" steps: - - name: Set up Java 17 - run: | - echo "$JAVA_HOME_17_X64/bin" >> $GITHUB_PATH - echo "org.gradle.java.home=${JAVA_HOME_17_X64//\\/\/}" >> gradle.properties - echo "JAVA_HOME=$JAVA_HOME_17_X64" >> $GITHUB_ENV - echo "$GRADLE_USER_HOME" - shell: bash + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 - name: Gradle Build Action uses: gradle/gradle-build-action@v2.8.0 From ccdd8b966030f1acae9483f214d0810fb4054dd4 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 28 Aug 2023 22:44:52 -0700 Subject: [PATCH 032/141] Update .github/actions/prepare-build-env/action.yml --- .github/actions/prepare-build-env/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/prepare-build-env/action.yml b/.github/actions/prepare-build-env/action.yml index 71013d2fbe..167e00bf62 100644 --- a/.github/actions/prepare-build-env/action.yml +++ b/.github/actions/prepare-build-env/action.yml @@ -9,3 +9,5 @@ runs: java-version: 17 - name: Gradle Build Action uses: gradle/gradle-build-action@v2.8.0 + with: + - cache-read-only: false From 2a76fe862b2ccd003620c4a32699876d268778e2 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 28 Aug 2023 22:49:05 -0700 Subject: [PATCH 033/141] Update action.yml --- .github/actions/prepare-build-env/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/prepare-build-env/action.yml b/.github/actions/prepare-build-env/action.yml index 167e00bf62..682be37dbb 100644 --- a/.github/actions/prepare-build-env/action.yml +++ b/.github/actions/prepare-build-env/action.yml @@ -10,4 +10,4 @@ runs: - name: Gradle Build Action uses: gradle/gradle-build-action@v2.8.0 with: - - cache-read-only: false + cache-read-only: false From d99f0a7f5c4f07defcb2dfff834677291ba335e4 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Tue, 29 Aug 2023 12:54:22 -0700 Subject: [PATCH 034/141] Build Epoch in CI --- .github/workflows/build.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e84f9fce42..7c8be826e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,3 +30,9 @@ jobs: uses: ./.github/actions/report-code-coverage with: files: core/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/base/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfc/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfd/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lff/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml + + build-epoch: + uses: lf-lang/epoch/.github/workflows/build.yml@main + with: + lingua-franca-ref: ${{ github.head_ref || github.ref_name }} + upload-artifacts: false From 58972c0d7c93243a0b1dca593673d7f401484dcf Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Tue, 29 Aug 2023 13:32:50 -0700 Subject: [PATCH 035/141] Rename job --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7c8be826e0..6d7edf2145 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,7 +31,7 @@ jobs: with: files: core/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/base/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfc/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfd/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lff/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml - build-epoch: + epoch: uses: lf-lang/epoch/.github/workflows/build.yml@main with: lingua-franca-ref: ${{ github.head_ref || github.ref_name }} From 2583b77f414c119b1aa7eb9300fcea7b49661359 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Tue, 29 Aug 2023 14:30:18 -0700 Subject: [PATCH 036/141] Add actions for setting up francabot --- .github/actions/setup-francabot/action.yml | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/actions/setup-francabot/action.yml diff --git a/.github/actions/setup-francabot/action.yml b/.github/actions/setup-francabot/action.yml new file mode 100644 index 0000000000..7f2e2b86ab --- /dev/null +++ b/.github/actions/setup-francabot/action.yml @@ -0,0 +1,34 @@ +name: Load global configuration settings for francabot +description: Set up author information and GPG signature +author: Marten Lohstroh + +inputs: + gpg-key: + description: 'francabot GPG key' + required: true + gpg-passphrase: + description: 'francabot GPG passphrase' + required: true + +runs: + using: composite + steps: + - name: Set environment variables + run: | + echo "username=lingua-franca[bot]" >> "$GITHUB_ENV" + echo "email=97201490+francabot@users.noreply.github.com" >> "$GITHUB_ENV" + echo "user-and-email=lingua-franca[bot] <97201490+francabot@users.noreply.github.com>" >> "$GITHUB_ENV" + shell: bash + - name: Configure git username and email + run: | + git config --global user.name '${{ env.username }}' + git config --global user.email '${{ env.email }}' + shell: bash + - name: Import GPG key + uses: crazy-max/ghaction-import-gpg@v5 + with: + gpg_private_key: ${{ inputs.gpg-key }} + passphrase: ${{ inputs.gpg-passphrase }} + git_config_global: true + git_user_signingkey: true + git_commit_gpgsign: true From 18b5547394059304ed10329278ba4c3e5fb25b43 Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Wed, 30 Aug 2023 05:22:39 +0000 Subject: [PATCH 037/141] Update CHANGELOG.md --- CHANGELOG.md | 236 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd8bbdb56..947b70314b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,240 @@ # Changelog + +## [v0.5.0](https://github.com/lf-lang/lingua-franca/tree/v0.5.0) (2023-08-30) + +**Highlights** + +This release introduces new syntax for initializers, includes a renovation of the C backend to let it generate more modular code, and brings new features like a watchdog construct, support for generics in C, support for SMT-solver-based formal verification using UCLID-5, and bare-iron support for the Raspberry Pi Pico platform. + +**🚀 New Features** + +- Types allowed in reactor type args [\#1639](https://github.com/lf-lang/lingua-franca/pull/1639) ([@oowekyala](https://github.com/oowekyala)) +- Tracing of federate interactions [\#1632](https://github.com/lf-lang/lingua-franca/pull/1632) ([@edwardalee](https://github.com/edwardalee)) +- Equals initializer syntax [\#1580](https://github.com/lf-lang/lingua-franca/pull/1580) ([@oowekyala](https://github.com/oowekyala)) +- `--json` and `--json-file` CLI args add to `lfc` [\#1686](https://github.com/lf-lang/lingua-franca/pull/1686) ([@patilatharva](https://github.com/patilatharva)) +- Generated structs exposed in header files, reactions linkable from separate source files, and updated C target preamble visibility [\#1599](https://github.com/lf-lang/lingua-franca/pull/1599) ([@petervdonovan](https://github.com/petervdonovan)) +- Preprocessor definition for `LF_PACKAGE_DIRECTORY` [\#1720](https://github.com/lf-lang/lingua-franca/pull/1720) ([@edwardalee](https://github.com/edwardalee)) +- Mechanism for printing execution statistics [\#1743](https://github.com/lf-lang/lingua-franca/pull/1743) ([@cmnrd](https://github.com/cmnrd)) +- Watchdog support for the C target [\#1730](https://github.com/lf-lang/lingua-franca/pull/1730) ([@Benichiwa](https://github.com/Benichiwa)) +- Automatically generated .vscode/settings.json file [\#1759](https://github.com/lf-lang/lingua-franca/pull/1759) ([@edwardalee](https://github.com/edwardalee)) +- C Generics [\#1681](https://github.com/lf-lang/lingua-franca/pull/1681) ([@mkhubaibumer](https://github.com/mkhubaibumer)) +- `USER_THREADS` specifiable in platform options [\#1721](https://github.com/lf-lang/lingua-franca/pull/1721) ([@siljesu](https://github.com/siljesu)) +- Generic params allowed as generic arguments in C target [\#1804](https://github.com/lf-lang/lingua-franca/pull/1804) ([@petervdonovan](https://github.com/petervdonovan)) +- New `--check` flag for `lff` [\#1822](https://github.com/lf-lang/lingua-franca/pull/1822) ([@cmnrd](https://github.com/cmnrd)) +- Environments in the C target [\#1772](https://github.com/lf-lang/lingua-franca/pull/1772) ([@erlingrj](https://github.com/erlingrj)) +- `lfd` binary for generating diagrams from the command line [\#1713](https://github.com/lf-lang/lingua-franca/pull/1713) ([@cmnrd](https://github.com/cmnrd)) +- `fedsd` utility updated to make the RTI optional and support enclaves visualization [\#1870](https://github.com/lf-lang/lingua-franca/pull/1870) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- C math lib always linked for C target [\#1894](https://github.com/lf-lang/lingua-franca/pull/1894) ([@cmnrd](https://github.com/cmnrd)) +- Critical sections enabled outside of the context of a reactor [\#1901](https://github.com/lf-lang/lingua-franca/pull/1901) ([@edwardalee](https://github.com/edwardalee)) +- Uclid5-based LF Verifier [\#1271](https://github.com/lf-lang/lingua-franca/pull/1271) ([@lsk567](https://github.com/lsk567)) +- Python launch scripts [\#1914](https://github.com/lf-lang/lingua-franca/pull/1914) ([@cmnrd](https://github.com/cmnrd)) +- Raspberry Pi Pico target support [\#1831](https://github.com/lf-lang/lingua-franca/pull/1831) ([@gundralaa](https://github.com/gundralaa)) +- Handling cyclic dependencies for TypeScript federated execution [\#1925](https://github.com/lf-lang/lingua-franca/pull/1925) ([@byeong-gil](https://github.com/byeong-gil)) + +**✨ Enhancements** + +- Keeplive natively inferred in the C++ runtime [\#1630](https://github.com/lf-lang/lingua-franca/pull/1630) ([@cmnrd](https://github.com/cmnrd)) +- File access [\#1715](https://github.com/lf-lang/lingua-franca/pull/1715) ([@edwardalee](https://github.com/edwardalee)) +- Faster building of TypeScript [\#1611](https://github.com/lf-lang/lingua-franca/pull/1611) ([@lhstrh](https://github.com/lhstrh)) +- Revised mechanism for handling the `files` target property [\#1700](https://github.com/lf-lang/lingua-franca/pull/1700) ([@lhstrh](https://github.com/lhstrh)) +- Validator rules to check if target supports federation or inheritance [\#1726](https://github.com/lf-lang/lingua-franca/pull/1726) ([@cmnrd](https://github.com/cmnrd)) +- Optimized Gradle configuration for faster building [\#1774](https://github.com/lf-lang/lingua-franca/pull/1774) ([@axmmisaka](https://github.com/axmmisaka)) +- Adjustable port sides for reactors [\#1807](https://github.com/lf-lang/lingua-franca/pull/1807) ([@a-sr](https://github.com/a-sr)) +- No more space inserted after `interleaved` keyword by formatter [\#1846](https://github.com/lf-lang/lingua-franca/pull/1846) ([@cmnrd](https://github.com/cmnrd)) +- More natural syntax for reaction declarations [\#1853](https://github.com/lf-lang/lingua-franca/pull/1853) ([@lhstrh](https://github.com/lhstrh)) +- Fix for extra whitespace around info messages [\#1879](https://github.com/lf-lang/lingua-franca/pull/1879) ([@oowekyala](https://github.com/oowekyala)) +- TypeScript runtime bumped to `v0.5.0` [\#1927](https://github.com/lf-lang/lingua-franca/pull/1927) ([@byeong-gil](https://github.com/byeong-gil)) +- Support for named and bodyless reactions in C++ [\#1933](https://github.com/lf-lang/lingua-franca/pull/1933) ([@cmnrd](https://github.com/cmnrd)) +- Added @layout annotation to add arbitrary layout options an elements [\#1951](https://github.com/lf-lang/lingua-franca/pull/1951) ([@soerendomroes](https://github.com/soerendomroes)) + +**🔧 Fixes** + +- Physical connections implemented as AST transformation [\#1596](https://github.com/lf-lang/lingua-franca/pull/1596) ([@erlingrj](https://github.com/erlingrj)) +- Fix for passing of command line options from lfc to the generator [\#1631](https://github.com/lf-lang/lingua-franca/pull/1631) ([@cmnrd](https://github.com/cmnrd)) +- Fix for validation of target properties [\#1629](https://github.com/lf-lang/lingua-franca/pull/1629) ([@cmnrd](https://github.com/cmnrd)) +- Fix in validation so that warnings are not reported as errors [\#1643](https://github.com/lf-lang/lingua-franca/pull/1643) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for NPE in lfc error reporting [\#1655](https://github.com/lf-lang/lingua-franca/pull/1655) ([@cmnrd](https://github.com/cmnrd)) +- Upstream connection delays now properly handled in the TypeScript federates [\#1607](https://github.com/lf-lang/lingua-franca/pull/1607) ([@byeong-gil](https://github.com/byeong-gil)) +- Fix for authenticated federation [\#1698](https://github.com/lf-lang/lingua-franca/pull/1698) ([@Jakio815](https://github.com/Jakio815)) +- Bugfixes in handling of `files` target property [\#1725](https://github.com/lf-lang/lingua-franca/pull/1725) ([@lhstrh](https://github.com/lhstrh)) +- Preambles properly inherited from superclasses [\#1732](https://github.com/lf-lang/lingua-franca/pull/1732) ([@edwardalee](https://github.com/edwardalee)) +- Reactor classes in the same file with the same name, up to case differences, are prohibited [\#1741](https://github.com/lf-lang/lingua-franca/pull/1741) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for ROS serialization [\#1755](https://github.com/lf-lang/lingua-franca/pull/1755) ([@petervdonovan](https://github.com/petervdonovan)) +- Improved line adjustment logic for federated programs [\#1760](https://github.com/lf-lang/lingua-franca/pull/1760) ([@petervdonovan](https://github.com/petervdonovan)) +- Fixed race condition in C++ enclave coordination [\#1778](https://github.com/lf-lang/lingua-franca/pull/1778) ([@cmnrd](https://github.com/cmnrd)) +- Fix for error reporting bug [\#1787](https://github.com/lf-lang/lingua-franca/pull/1787) ([@lhstrh](https://github.com/lhstrh)) +- Fix warnings reported on CliBase. [\#1793](https://github.com/lf-lang/lingua-franca/pull/1793) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix to allow CLI args to be passed to federates [\#1798](https://github.com/lf-lang/lingua-franca/pull/1798) ([@petervdonovan](https://github.com/petervdonovan)) +- Multiple fixes for federated programs with TypeScript target [\#1752](https://github.com/lf-lang/lingua-franca/pull/1752) ([@byeong-gil](https://github.com/byeong-gil)) +- Fix for race condition in `uniqueName` [\#1815](https://github.com/lf-lang/lingua-franca/pull/1815) ([@petervdonovan](https://github.com/petervdonovan)) +- Fedsd compatibility with pandas 2.0 [\#1836](https://github.com/lf-lang/lingua-franca/pull/1836) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Formatter fixes [\#1840](https://github.com/lf-lang/lingua-franca/pull/1840) ([@petervdonovan](https://github.com/petervdonovan)) +- Adjustments for running the LF compiler in Epoch [\#1844](https://github.com/lf-lang/lingua-franca/pull/1844) ([@a-sr](https://github.com/a-sr)) +- More formatter fixes [\#1850](https://github.com/lf-lang/lingua-franca/pull/1850) ([@petervdonovan](https://github.com/petervdonovan)) +- More formatter fixes [\#1851](https://github.com/lf-lang/lingua-franca/pull/1851) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for naming collision when generic reactor is instantiated with different parameters [\#1864](https://github.com/lf-lang/lingua-franca/pull/1864) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for inheritance problem exposed in examples [\#1891](https://github.com/lf-lang/lingua-franca/pull/1891) ([@lhstrh](https://github.com/lhstrh)) +- Fix verifier error when there is no main reactor [\#1916](https://github.com/lf-lang/lingua-franca/pull/1916) ([@lsk567](https://github.com/lsk567)) +- No more use of unordered reactions in federated programs; fix for deadlocks in some federated programs [\#1684](https://github.com/lf-lang/lingua-franca/pull/1684) ([@arengarajan99](https://github.com/arengarajan99)) +- Keyword `extends` added to tokens allowed in reaction bodies [\#1926](https://github.com/lf-lang/lingua-franca/pull/1926) ([@lhstrh](https://github.com/lhstrh)) +- Fix for edge case in which comments are dropped [\#1924](https://github.com/lf-lang/lingua-franca/pull/1924) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for IllegalArgumentException in diagram synthesis [\#1932](https://github.com/lf-lang/lingua-franca/pull/1932) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for STP violation [\#1935](https://github.com/lf-lang/lingua-franca/pull/1935) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for after delays that use user-provided declarations [\#1959](https://github.com/lf-lang/lingua-franca/pull/1959) ([@petervdonovan](https://github.com/petervdonovan)) +- Bugfix for when top-level multiport width in federation depends on parameter [\#1956](https://github.com/lf-lang/lingua-franca/pull/1956) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix compilation error in code for reset state variables with time type [\#1964](https://github.com/lf-lang/lingua-franca/pull/1964) ([@a-sr](https://github.com/a-sr)) + +**🚧 Maintenance and Refactoring** + +- Migration of Epoch into separate repository [\#1482](https://github.com/lf-lang/lingua-franca/pull/1482) ([@a-sr](https://github.com/a-sr)) +- Improved CLI argument handling using `picocli` [\#1534](https://github.com/lf-lang/lingua-franca/pull/1534) ([@patilatharva](https://github.com/patilatharva)) +- Compile definitions no longer hardcoded in generated CMakeLists.txt [\#1622](https://github.com/lf-lang/lingua-franca/pull/1622) ([@petervdonovan](https://github.com/petervdonovan)) +- Remove unchecked compilation warnings [\#1638](https://github.com/lf-lang/lingua-franca/pull/1638) ([@oowekyala](https://github.com/oowekyala)) +- Refactoring of part of the federated package [\#1663](https://github.com/lf-lang/lingua-franca/pull/1663) ([@lhstrh](https://github.com/lhstrh)) +- Removal of the use of non-API global variables in tests [\#1696](https://github.com/lf-lang/lingua-franca/pull/1696) ([@edwardalee](https://github.com/edwardalee)) +- Gradle bumped to version 8 [\#1691](https://github.com/lf-lang/lingua-franca/pull/1691) ([@lhstrh](https://github.com/lhstrh)) +- Removal of deprecated `build-lfc` script and `buildLfc` Gradle task [\#1714](https://github.com/lf-lang/lingua-franca/pull/1714) ([@cmnrd](https://github.com/cmnrd)) +- Delete unnecessary complexity from `build-lf-cli` [\#1745](https://github.com/lf-lang/lingua-franca/pull/1745) ([@petervdonovan](https://github.com/petervdonovan)) +- C files for Python support retrieved from reactor-c repo [\#1757](https://github.com/lf-lang/lingua-franca/pull/1757) ([@lhstrh](https://github.com/lhstrh)) +- Google autoformatter applied to all files [\#1766](https://github.com/lf-lang/lingua-franca/pull/1766) ([@lhstrh](https://github.com/lhstrh)) +- Struct refactoring for actions and ports [\#1756](https://github.com/lf-lang/lingua-franca/pull/1756) ([@edwardalee](https://github.com/edwardalee)) +- Redesign of the repository layout and gradle configuration [\#1779](https://github.com/lf-lang/lingua-franca/pull/1779) ([@cmnrd](https://github.com/cmnrd)) +- Removal of odd mechanism for loading target generators dynamically [\#1813](https://github.com/lf-lang/lingua-franca/pull/1813) ([@cmnrd](https://github.com/cmnrd)) +- Default line length set to 100 for LF files [\#1389](https://github.com/lf-lang/lingua-franca/pull/1389) ([@petervdonovan](https://github.com/petervdonovan)) +- KlighD bumped to `2.3.0` and now retrieved from Maven Central [\#1823](https://github.com/lf-lang/lingua-franca/pull/1823) ([@cmnrd](https://github.com/cmnrd)) +- Refactor error reporter [\#1527](https://github.com/lf-lang/lingua-franca/pull/1527) ([@oowekyala](https://github.com/oowekyala)) +- Unknown port types handled with `unknown` instead of `Present` [\#1857](https://github.com/lf-lang/lingua-franca/pull/1857) ([@lhstrh](https://github.com/lhstrh)) +- TS code generator adjusted to appease `eslint` [\#1878](https://github.com/lf-lang/lingua-franca/pull/1878) ([@lhstrh](https://github.com/lhstrh)) +- Minor fixes for the README in the test directory [\#1903](https://github.com/lf-lang/lingua-franca/pull/1903) ([@lsk567](https://github.com/lsk567)) +- Declarative Port Graph in C++ Runtime [\#1848](https://github.com/lf-lang/lingua-franca/pull/1848) ([@revol-xut](https://github.com/revol-xut)) +- No more use of unordered reactions in federated programs; fix for deadlocks in some federated programs [\#1684](https://github.com/lf-lang/lingua-franca/pull/1684) ([@arengarajan99](https://github.com/arengarajan99)) +- Tracing utils and Zephyr run scripts moved from `util` folder [\#1948](https://github.com/lf-lang/lingua-franca/pull/1948) ([@erlingrj](https://github.com/erlingrj)) + +**📖 Documentation** + +- Documentation about LSP tests in `README.md` [\#1587](https://github.com/lf-lang/lingua-franca/pull/1587) ([@petervdonovan](https://github.com/petervdonovan)) + +**🧪 Tests** + +- TypeScript tests for federates with physical connections [\#1623](https://github.com/lf-lang/lingua-franca/pull/1623) ([@byeong-gil](https://github.com/byeong-gil)) +- Zephyr tests pinned to particular version of docker image [\#1648](https://github.com/lf-lang/lingua-franca/pull/1648) ([@erlingrj](https://github.com/erlingrj)) +- Test for the support of delayed physical connections in the TypeScript target [\#1676](https://github.com/lf-lang/lingua-franca/pull/1676) ([@byeong-gil](https://github.com/byeong-gil)) +- Test for parsing CLI arguments in `lfc` [\#1668](https://github.com/lf-lang/lingua-franca/pull/1668) ([@patilatharva](https://github.com/patilatharva)) +- Zephyr regression tests executed on QEMU [\#1678](https://github.com/lf-lang/lingua-franca/pull/1678) ([@erlingrj](https://github.com/erlingrj)) +- CodeCov reporting for CLI tests [\#1688](https://github.com/lf-lang/lingua-franca/pull/1688) ([@lhstrh](https://github.com/lhstrh)) +- Test to help ensure that level-based scheduling does not cause deadlock [\#1703](https://github.com/lf-lang/lingua-franca/pull/1703) ([@edwardalee](https://github.com/edwardalee)) +- Flaky tests adjusted [\#1764](https://github.com/lf-lang/lingua-franca/pull/1764) ([@edwardalee](https://github.com/edwardalee)) +- Spurious dependency example [\#1707](https://github.com/lf-lang/lingua-franca/pull/1707) ([@petervdonovan](https://github.com/petervdonovan)) +- Added test of documented STP_offset parameter [\#1786](https://github.com/lf-lang/lingua-franca/pull/1786) ([@edwardalee](https://github.com/edwardalee)) +- `SimpleFederatedAuthenticated.lf` test passing [\#1776](https://github.com/lf-lang/lingua-franca/pull/1776) ([@Jakio815](https://github.com/Jakio815)) +- CI updates [\#1814](https://github.com/lf-lang/lingua-franca/pull/1814) ([@petervdonovan](https://github.com/petervdonovan)) +- Parallel execution of round trip tests [\#1845](https://github.com/lf-lang/lingua-franca/pull/1845) ([@oowekyala](https://github.com/oowekyala)) +- Tests for `lf_request_stop` with enclaves and federates [\#1871](https://github.com/lf-lang/lingua-franca/pull/1871) ([@edwardalee](https://github.com/edwardalee)) +- Fixed code coverage aggregation and reporting [\#1868](https://github.com/lf-lang/lingua-franca/pull/1868) ([@cmnrd](https://github.com/cmnrd)) +- New job for building `epoch` in CI [\#1974](https://github.com/lf-lang/lingua-franca/pull/1974) ([@lhstrh](https://github.com/lhstrh)) + +**⬆️ Updated Dependencies** + +- Update to Zephyr v3.3.0 and SDK v0.16.1 [\#1825](https://github.com/lf-lang/lingua-franca/pull/1825) ([@erlingrj](https://github.com/erlingrj)) +- Reactor-ts bumped to v0.4.0 [\#1749](https://github.com/lf-lang/lingua-franca/pull/1749) ([@lhstrh](https://github.com/lhstrh)) +- Gradle Wrapper bumped to `8.1.1` [\#1890](https://github.com/lf-lang/lingua-franca/pull/1890) ([@lhstrh](https://github.com/lhstrh)) +- Eclipse-related dependencies bumped to latest releases [\#1889](https://github.com/lf-lang/lingua-franca/pull/1889) ([@a-sr](https://github.com/a-sr)) +- TypeScript runtime bumped to `v0.5.0` [\#1927](https://github.com/lf-lang/lingua-franca/pull/1927) ([@byeong-gil](https://github.com/byeong-gil)) + + +### Submodule [lf-lang/reactor-c](http://github.com/lf-lang/reactor-c) + +**🚀 New Features** + +- New tracepoint for deadline misses [\#169](https://github.com/lf-lang/reactor-c/pull/169) ([@erlingrj](https://github.com/erlingrj)) +- Compile definitions for federated programs [\#179](https://github.com/lf-lang/reactor-c/pull/179) ([@petervdonovan](https://github.com/petervdonovan)) +- Tracing federate interactions [\#178](https://github.com/lf-lang/reactor-c/pull/178) ([@edwardalee](https://github.com/edwardalee)) +- CMake definition to find `FEDERATED_AUTHENTICATED` [\#196](https://github.com/lf-lang/reactor-c/pull/196) ([@Jakio815](https://github.com/Jakio815)) +- Memory reporting [\#201](https://github.com/lf-lang/reactor-c/pull/201) ([@edwardalee](https://github.com/edwardalee)) +- Added `LF_PACKAGE_DIRECTORY` [\#204](https://github.com/lf-lang/reactor-c/pull/204) ([@edwardalee](https://github.com/edwardalee)) +- Runtime support for watchdogs [\#177](https://github.com/lf-lang/reactor-c/pull/177) ([@Benichiwa](https://github.com/Benichiwa)) +- Environments [\#212](https://github.com/lf-lang/reactor-c/pull/212) ([@erlingrj](https://github.com/erlingrj)) +- Enclave request stop [\#244](https://github.com/lf-lang/reactor-c/pull/244) ([@edwardalee](https://github.com/edwardalee)) +- Critical sections enabled outside of the context of a reactor [\#249](https://github.com/lf-lang/reactor-c/pull/249) ([@edwardalee](https://github.com/edwardalee)) +- Rp2040 Target Support [\#253](https://github.com/lf-lang/reactor-c/pull/253) ([@gundralaa](https://github.com/gundralaa)) +- Platform support for Raspberry Pi Pico [\#233](https://github.com/lf-lang/reactor-c/pull/233) ([@gundralaa](https://github.com/gundralaa)) + +**✨ Enhancements** + +- Removal of unnecessary TAG messages [\#175](https://github.com/lf-lang/reactor-c/pull/175) ([@byeong-gil](https://github.com/byeong-gil)) +- Cleaner namespace [\#189](https://github.com/lf-lang/reactor-c/pull/189) ([@petervdonovan](https://github.com/petervdonovan)) +- File access and doc fixes [\#198](https://github.com/lf-lang/reactor-c/pull/198) ([@edwardalee](https://github.com/edwardalee)) +- Improvements of support for watchdogs [\#209](https://github.com/lf-lang/reactor-c/pull/209) ([@edwardalee](https://github.com/edwardalee)) +- Switch to more general thread creation in Zephyr support [\#194](https://github.com/lf-lang/reactor-c/pull/194) ([@siljesu](https://github.com/siljesu)) +- Minor improvements to Zephyr platform [\#187](https://github.com/lf-lang/reactor-c/pull/187) ([@erlingrj](https://github.com/erlingrj)) +- Output error when trying to use --auth (-a) for RTI built without -DAUTH=ON [\#222](https://github.com/lf-lang/reactor-c/pull/222) ([@hokeun](https://github.com/hokeun)) +- Change nanosleep to lf_sleep in federate and RTI code [\#219](https://github.com/lf-lang/reactor-c/pull/219) ([@siljesu](https://github.com/siljesu)) +- RTI exit while saving the trace file [\#228](https://github.com/lf-lang/reactor-c/pull/228) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Less namespace pollution [\#240](https://github.com/lf-lang/reactor-c/pull/240) ([@erlingrj](https://github.com/erlingrj)) +- Enclaves tuning [\#243](https://github.com/lf-lang/reactor-c/pull/243) ([@edwardalee](https://github.com/edwardalee)) +- If clock sync is on, link math [\#252](https://github.com/lf-lang/reactor-c/pull/252) ([@petervdonovan](https://github.com/petervdonovan)) +- No more use of unordered reactions in federated programs [\#191](https://github.com/lf-lang/reactor-c/pull/191) ([@arengarajan99](https://github.com/arengarajan99)) + +**🔧 Fixes** + +- Fix for definition of `LF_TIME_BUFFER_LENGTH` [\#197](https://github.com/lf-lang/reactor-c/pull/197) ([@edwardalee](https://github.com/edwardalee)) +- Scheduler leak fix [\#200](https://github.com/lf-lang/reactor-c/pull/200) ([@edwardalee](https://github.com/edwardalee)) +- Fix for Arduino to avoid duplicate definition of `timespec` [\#195](https://github.com/lf-lang/reactor-c/pull/195) ([@arengarajan99](https://github.com/arengarajan99)) +- Suppression of "no symbols" warnings emitted by ranlib [\#214](https://github.com/lf-lang/reactor-c/pull/214) ([@petervdonovan](https://github.com/petervdonovan)) +- Segfault fix [\#218](https://github.com/lf-lang/reactor-c/pull/218) ([@petervdonovan](https://github.com/petervdonovan)) +- Zephyr fixes on thread creation and deletion [\#223](https://github.com/lf-lang/reactor-c/pull/223) ([@erlingrj](https://github.com/erlingrj)) +- Minor fix of the federate id in the tracepoint [\#245](https://github.com/lf-lang/reactor-c/pull/245) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Fix protocol of HMAC authentication to start from federate. [\#231](https://github.com/lf-lang/reactor-c/pull/231) ([@Jakio815](https://github.com/Jakio815)) +- Use of correct federate ID in tracing of absent messages [\#248](https://github.com/lf-lang/reactor-c/pull/248) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Memory leak in Python target fixed [\#246](https://github.com/lf-lang/reactor-c/pull/246) ([@jackykwok2024](https://github.com/jackykwok2024)) +- Fix for fatal error raised during shutdown when decrementing a tag barrier that is zero [\#251](https://github.com/lf-lang/reactor-c/pull/251) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for STP violation [\#257](https://github.com/lf-lang/reactor-c/pull/257) ([@petervdonovan](https://github.com/petervdonovan)) + +**🚧 Maintenance and Refactoring** + +- Functions of rti.c moved to rti_lib.c to enable reuse [\#172](https://github.com/lf-lang/reactor-c/pull/172) ([@Jakio815](https://github.com/Jakio815)) +- Code in `rti.c` made available as library [\#174](https://github.com/lf-lang/reactor-c/pull/174) ([@Jakio815](https://github.com/Jakio815)) +- Documentation and code cleanup [\#193](https://github.com/lf-lang/reactor-c/pull/193) ([@edwardalee](https://github.com/edwardalee)) +- Platform abstraction layer for the RTI [\#213](https://github.com/lf-lang/reactor-c/pull/213) ([@siljesu](https://github.com/siljesu)) +- C files from reactor-c-py moved back into the reactor-c repo [\#217](https://github.com/lf-lang/reactor-c/pull/217) ([@lhstrh](https://github.com/lhstrh)) +- Struct refactoring for actions and ports [\#216](https://github.com/lf-lang/reactor-c/pull/216) ([@edwardalee](https://github.com/edwardalee)) +- Refactoring of the RTI implementation [\#224](https://github.com/lf-lang/reactor-c/pull/224) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- `_lf_count_token_allocations` made `extern` instead of `static` [\#236](https://github.com/lf-lang/reactor-c/pull/236) ([@erlingrj](https://github.com/erlingrj)) +- Refactoring of obsolete `gethostbyname()` in `connect_to_rti()` [\#220](https://github.com/lf-lang/reactor-c/pull/220) ([@siljesu](https://github.com/siljesu)) +- No more use of unordered reactions in federated programs [\#191](https://github.com/lf-lang/reactor-c/pull/191) ([@arengarajan99](https://github.com/arengarajan99)) +- Fewer warnings [\#258](https://github.com/lf-lang/reactor-c/pull/258) ([@edwardalee](https://github.com/edwardalee)) + +**📖 Documentation** + +- Documentation and code cleanup [\#193](https://github.com/lf-lang/reactor-c/pull/193) ([@edwardalee](https://github.com/edwardalee)) + + +### Submodule [lf-lang/reactor-cpp](http://github.com/lf-lang/reactor-cpp) + +**🚀 New Features** + +- Enclave connections and enclave coordination [\#44](https://github.com/lf-lang/reactor-cpp/pull/44) ([@cmnrd](https://github.com/cmnrd)) +- Simple mechanism for collecting statistics during execution [\#47](https://github.com/lf-lang/reactor-cpp/pull/47) ([@cmnrd](https://github.com/cmnrd)) +- Port graph [\#51](https://github.com/lf-lang/reactor-cpp/pull/51) ([@revol-xut](https://github.com/revol-xut)) + +**✨ Enhancements** + +- Keep track of input actions in the environment [\#42](https://github.com/lf-lang/reactor-cpp/pull/42) ([@cmnrd](https://github.com/cmnrd)) +- Factored event queue into its own class and fixed race condition between multiple starting enclaves [\#45](https://github.com/lf-lang/reactor-cpp/pull/45) ([@cmnrd](https://github.com/cmnrd)) + +**🔧 Fixes** + +- Fix race condition in time barriers [\#49](https://github.com/lf-lang/reactor-cpp/pull/49) ([@cmnrd](https://github.com/cmnrd)) +- Fix validate method and fix incorrect phase checks [\#50](https://github.com/lf-lang/reactor-cpp/pull/50) ([@cmnrd](https://github.com/cmnrd)) + + +### Submodule [lf-lang/reactor-rs](http://github.com/lf-lang/reactor-rs) + +- Use Cargo workspaces to directly include vecmap dependency [\#40](https://github.com/lf-lang/reactor-rs/pull/40) ([@jhaye](https://github.com/jhaye)) +- Fixes for current Clippy version [\#45](https://github.com/lf-lang/reactor-rs/pull/45) ([@jhaye](https://github.com/jhaye)) +- chore: Bump dependencies to avoid vulnerability in smallvec [\#44](https://github.com/lf-lang/reactor-rs/pull/44) ([@oowekyala](https://github.com/oowekyala)) +- Fix use of multiport as reaction source [\#43](https://github.com/lf-lang/reactor-rs/pull/43) ([@oowekyala](https://github.com/oowekyala)) + ## [v0.4.0](https://github.com/lf-lang/lingua-franca/tree/v0.4.0) (2023-03-01) From 313e0b2f34fe2e66a1f61a9ca003aa090e641eb2 Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Wed, 30 Aug 2023 05:24:55 +0000 Subject: [PATCH 038/141] Bump version to 0.5.0 --- CHANGELOG.md | 2 +- core/src/main/resources/org/lflang/StringsBundle.properties | 2 +- gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 947b70314b..5dd1e426ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog - + ## [v0.5.0](https://github.com/lf-lang/lingua-franca/tree/v0.5.0) (2023-08-30) **Highlights** diff --git a/core/src/main/resources/org/lflang/StringsBundle.properties b/core/src/main/resources/org/lflang/StringsBundle.properties index 29b191399c..b58621d407 100644 --- a/core/src/main/resources/org/lflang/StringsBundle.properties +++ b/core/src/main/resources/org/lflang/StringsBundle.properties @@ -1 +1 @@ -VERSION = 0.4.1-SNAPSHOT +VERSION = 0.5.0 diff --git a/gradle.properties b/gradle.properties index fd082fc31f..ce77106367 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ [header] group=org.lflang -version=0.4.1-SNAPSHOT +version=0.5.0 [versions] antlrVersion=4.7.2 From 15b514408c912f71910abae3036845e679bb2637 Mon Sep 17 00:00:00 2001 From: revol-xut Date: Thu, 31 Aug 2023 13:13:10 +0200 Subject: [PATCH 039/141] fixing using int for iterators --- test/Cpp/src/ArrayScale.lf | 2 +- test/Cpp/src/enclave/EnclaveMultiportToPort.lf | 2 +- test/Cpp/src/enclave/EnclaveMultiportToPort2.lf | 2 +- test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf | 2 +- test/Cpp/src/multiport/MultiportFromHierarchy.lf | 2 +- test/Cpp/src/multiport/MultiportIn.lf | 2 +- test/Cpp/src/multiport/MultiportToMultiportArray.lf | 2 +- test/Cpp/src/multiport/MultiportToPort.lf | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/test/Cpp/src/ArrayScale.lf b/test/Cpp/src/ArrayScale.lf index 9d0b3cf350..751a36c5a2 100644 --- a/test/Cpp/src/ArrayScale.lf +++ b/test/Cpp/src/ArrayScale.lf @@ -14,7 +14,7 @@ reactor Scale(scale: int = 2) { auto array = in.get().get_mutable_copy(); // NOTE: Ideally, no copy copy would be made here, as there is only // one recipient for the value, but this is not supported yet by the C++ runtime. - for(int i = 0; i < array->size(); i++) { + for(auto i = 0; i < array->size(); i++) { (*array)[i] = (*array)[i] * scale; } out.set(std::move(array)); diff --git a/test/Cpp/src/enclave/EnclaveMultiportToPort.lf b/test/Cpp/src/enclave/EnclaveMultiportToPort.lf index f20ad09633..53f5e8bfdb 100644 --- a/test/Cpp/src/enclave/EnclaveMultiportToPort.lf +++ b/test/Cpp/src/enclave/EnclaveMultiportToPort.lf @@ -8,7 +8,7 @@ reactor Source { output[2] out: int reaction(startup) -> out {= - for(int i = 0; i < out.size(); i++) { + for(auto i = 0; i < out.size(); i++) { std::cout << "Source sending " << i << ".\n"; out[i].set(i); } diff --git a/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf b/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf index 7e40a09623..257374001d 100644 --- a/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf +++ b/test/Cpp/src/enclave/EnclaveMultiportToPort2.lf @@ -8,7 +8,7 @@ reactor Source { output[2] out: int reaction(startup) -> out {= - for(int i = 0; i < out.size(); i++) { + for(auto i = 0; i < out.size(); i++) { std::cout << "Source sending " << i << ".\n"; out[i].set(i); } diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf index cb3eeaa0c4..bbd25fa5ce 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf @@ -22,7 +22,7 @@ reactor Destination { state received: bool = false reaction(in) {= - for (int i = 0; i < in.size(); i++) { + for (auto i = 0; i < in.size(); i++) { int value = *in[i].get(); std::cout << "Destination channel " << i << " received " << value << '\n'; if (i != value) { diff --git a/test/Cpp/src/multiport/MultiportFromHierarchy.lf b/test/Cpp/src/multiport/MultiportFromHierarchy.lf index 0615286dfc..1531af59a6 100644 --- a/test/Cpp/src/multiport/MultiportFromHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportFromHierarchy.lf @@ -10,7 +10,7 @@ reactor Source { state s: int = 0 reaction(t) -> out {= - for(int i = 0; i < 4; i++) { + for(auto i = 0; i < 4; i++) { out[i].set(s++); } =} diff --git a/test/Cpp/src/multiport/MultiportIn.lf b/test/Cpp/src/multiport/MultiportIn.lf index 6f4f63f74b..862549a7a0 100644 --- a/test/Cpp/src/multiport/MultiportIn.lf +++ b/test/Cpp/src/multiport/MultiportIn.lf @@ -26,7 +26,7 @@ reactor Destination { reaction(in) {= int sum = 0; - for (int i = 0; i < in.size(); i++) { + for (auto i = 0; i < in.size(); i++) { sum += *in[i].get(); } std::cout << "Sum of received: " << sum << ".\n"; diff --git a/test/Cpp/src/multiport/MultiportToMultiportArray.lf b/test/Cpp/src/multiport/MultiportToMultiportArray.lf index 3f95cd2c21..9ab9b4fba9 100644 --- a/test/Cpp/src/multiport/MultiportToMultiportArray.lf +++ b/test/Cpp/src/multiport/MultiportToMultiportArray.lf @@ -31,7 +31,7 @@ reactor Destination { int sum = 0; for (auto i : in.present_indices_unsorted()) { const auto& a = *in[i].get(); - for (int j = 0; j < a.size(); j++) { + for (auto j = 0; j < a.size(); j++) { sum += a[j]; } } diff --git a/test/Cpp/src/multiport/MultiportToPort.lf b/test/Cpp/src/multiport/MultiportToPort.lf index 31354d320c..5d32c6ee45 100644 --- a/test/Cpp/src/multiport/MultiportToPort.lf +++ b/test/Cpp/src/multiport/MultiportToPort.lf @@ -8,7 +8,7 @@ reactor Source { output[2] out: int reaction(startup) -> out {= - for(int i = 0; i < out.size(); i++) { + for(auto i = 0; i < out.size(); i++) { std::cout << "Source sending " << i << ".\n"; out[i].set(i); } From 4e1ca21a497a3ba6892e569f8523e7a9ab231526 Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Thu, 31 Aug 2023 21:44:24 -0700 Subject: [PATCH 040/141] Do not use gradlew to run dev version of lf cli tools --- util/scripts/launch.ps1 | 8 ++------ util/scripts/launch.sh | 7 ++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 index dda258cc44..bb14204f5c 100644 --- a/util/scripts/launch.ps1 +++ b/util/scripts/launch.ps1 @@ -29,9 +29,5 @@ $base="$PSScriptRoot\..\..\" $gradlew="${base}/gradlew.bat" # invoke script -if ($args.Length -eq 0) { - & "${gradlew}" -p "${base}" "cli:${tool}:run" -} else { - $argsString = $args -join " " - & "${gradlew}" -p "${base}" "cli:${tool}:run" --args="${argsString}" -} \ No newline at end of file +& "${gradlew}" assemble +& "${base}/build/install/lf-cli/bin/${tool}" @args \ No newline at end of file diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 36a342bd25..22a272f81f 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -72,8 +72,5 @@ fi gradlew="${base}/gradlew" # Launch the tool. -if [ $# -eq 0 ]; then - "${gradlew}" -p "${base}" "cli:${tool}:run" -else - "${gradlew}" -p "${base}" "cli:${tool}:run" --args="$*" -fi +"${gradlew}" assemble +"${base}/build/install/lf-cli/bin/${tool}" "$@" \ No newline at end of file From 3edc610040b396e0b44c95605b22fdd4479fb3dc Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Thu, 31 Aug 2023 23:05:29 -0700 Subject: [PATCH 041/141] Update reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 4e47b354bc..09b75edfdb 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 4e47b354bce833034faaad0567a65d5b60e60ccc +Subproject commit 09b75edfdbfcd0206a89199fcb65b1678398a0c7 From 4997ead45327df2148038ef9168842032be2a1f3 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Thu, 31 Aug 2023 23:59:28 -0700 Subject: [PATCH 042/141] Let the context be equal to the directory of the container --- core/src/main/java/org/lflang/generator/DockerGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/generator/DockerGenerator.java b/core/src/main/java/org/lflang/generator/DockerGenerator.java index d7d842d15e..4148eb42d1 100644 --- a/core/src/main/java/org/lflang/generator/DockerGenerator.java +++ b/core/src/main/java/org/lflang/generator/DockerGenerator.java @@ -38,7 +38,7 @@ public DockerData generateDockerData() { var dockerFilePath = context.getFileConfig().getSrcGenPath().resolve("Dockerfile"); var dockerFileContent = generateDockerFileContent(); - return new DockerData(name.replace("_", ""), dockerFilePath, dockerFileContent, context); + return new DockerData(name, dockerFilePath, dockerFileContent, context); } public static DockerGenerator dockerGeneratorFactory(LFGeneratorContext context) { From 18abbab2db12cecafc0439814fba2cf2ffa424a1 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 1 Sep 2023 10:54:08 -0400 Subject: [PATCH 043/141] Test lf_set_array --- test/C/src/ArraySet.lf | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/C/src/ArraySet.lf diff --git a/test/C/src/ArraySet.lf b/test/C/src/ArraySet.lf new file mode 100644 index 0000000000..c35bbb9750 --- /dev/null +++ b/test/C/src/ArraySet.lf @@ -0,0 +1,38 @@ +target C + +reactor Source { + output out: int[] + + reaction(startup) -> out {= + // Dynamically allocate an output array of length 3. + int* array = (int*)malloc(3 * sizeof(int)); + // Populate the array. + array[0] = 0; + array[1] = 1; + array[2] = 2; + // Set the output, specifying the array length. + lf_set_array(out, array, 3); + =} +} + +reactor Print { + input in: int[] + + reaction(in) {= + printf("Received: ["); + for (int i = 0; i < in->length; i++) { + if (i > 0) printf(", "); + printf("%d", in->value[i]); + if (in->value[i] != i) { + lf_print_error_and_exit("Expected %d.", i); + } + } + printf("]\n"); + =} +} + +main reactor { + s = new Source() + p = new Print() + s.out -> p.in +} From 8119a55a6c06fdf4470e8acae8838c2b66b58d4e Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 1 Sep 2023 11:24:41 -0400 Subject: [PATCH 044/141] Added test of persistent input to match docs --- test/C/src/PersistentInputs.lf | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/C/src/PersistentInputs.lf diff --git a/test/C/src/PersistentInputs.lf b/test/C/src/PersistentInputs.lf new file mode 100644 index 0000000000..55aa74540d --- /dev/null +++ b/test/C/src/PersistentInputs.lf @@ -0,0 +1,33 @@ +target C { + timeout: 400 ms, + fast: true +} +reactor Source { + output out: int + timer t(100 ms, 200 ms) + state count: int = 1 + reaction(t) -> out {= + lf_set(out, self->count++); + =} +} +reactor Sink { + input in: int + timer t(0, 100 ms) + // For testing, emulate the count variable of Source. + state count: int = 0 + timer t2(100 ms, 200 ms) + reaction(t2) {= + self->count++; + =} + reaction(t) in {= + printf("Value of the input is %d at time %lld\n", in->value, lf_time_logical_elapsed()); + if (in->value != self->count) { + lf_print_error_and_exit("Expected %d.", self->count); + } + =} +} +main reactor { + source = new Source() + sink = new Sink() + source.out -> sink.in +} \ No newline at end of file From 5ee6fec21557ccc2303a2d458091085ca5370f4d Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Fri, 1 Sep 2023 12:32:37 -0400 Subject: [PATCH 045/141] Formated --- test/C/src/PersistentInputs.lf | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/C/src/PersistentInputs.lf b/test/C/src/PersistentInputs.lf index 55aa74540d..8ff14e41b2 100644 --- a/test/C/src/PersistentInputs.lf +++ b/test/C/src/PersistentInputs.lf @@ -2,23 +2,23 @@ target C { timeout: 400 ms, fast: true } + reactor Source { output out: int timer t(100 ms, 200 ms) state count: int = 1 - reaction(t) -> out {= - lf_set(out, self->count++); - =} + + reaction(t) -> out {= lf_set(out, self->count++); =} } + reactor Sink { input in: int timer t(0, 100 ms) - // For testing, emulate the count variable of Source. - state count: int = 0 + state count: int = 0 // For testing, emulate the count variable of Source. timer t2(100 ms, 200 ms) - reaction(t2) {= - self->count++; - =} + + reaction(t2) {= self->count++; =} + reaction(t) in {= printf("Value of the input is %d at time %lld\n", in->value, lf_time_logical_elapsed()); if (in->value != self->count) { @@ -26,8 +26,9 @@ reactor Sink { } =} } + main reactor { source = new Source() sink = new Sink() source.out -> sink.in -} \ No newline at end of file +} From 3912e812bf0ce896cb822458d3938566b619356a Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Fri, 1 Sep 2023 22:58:58 +0000 Subject: [PATCH 046/141] Bump version to 0.5.1-SNAPSHOT --- core/src/main/resources/org/lflang/StringsBundle.properties | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/resources/org/lflang/StringsBundle.properties b/core/src/main/resources/org/lflang/StringsBundle.properties index 29b191399c..dc4f99684f 100644 --- a/core/src/main/resources/org/lflang/StringsBundle.properties +++ b/core/src/main/resources/org/lflang/StringsBundle.properties @@ -1 +1 @@ -VERSION = 0.4.1-SNAPSHOT +VERSION = 0.5.1-SNAPSHOT diff --git a/gradle.properties b/gradle.properties index fd082fc31f..245b5cb0ba 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ [header] group=org.lflang -version=0.4.1-SNAPSHOT +version=0.5.1-SNAPSHOT [versions] antlrVersion=4.7.2 From e9657310fb6a6d41ae018d7a39283204037b2d81 Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Fri, 1 Sep 2023 18:32:58 -0700 Subject: [PATCH 047/141] Update CHANGELOG.md --- CHANGELOG.md | 240 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fd8bbdb56..c469ed6334 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,244 @@ # Changelog + +## [v0.5.0](https://github.com/lf-lang/lingua-franca/tree/v0.5.0) (2023-09-01) + +**Highlights** + +This release introduces new syntax for initializers, includes a renovation of the C backend to let it generate more modular code, and brings new features like a watchdog construct, support for generics in C, support for SMT-solver-based formal verification using UCLID-5, and bare-iron support for the Raspberry Pi Pico platform. + +**🚀 New Features** + +- Types allowed in reactor type args [\#1639](https://github.com/lf-lang/lingua-franca/pull/1639) ([@oowekyala](https://github.com/oowekyala)) +- Equals initializer syntax [\#1580](https://github.com/lf-lang/lingua-franca/pull/1580) ([@oowekyala](https://github.com/oowekyala)) +- `--json` and `--json-file` CLI args add to `lfc` [\#1686](https://github.com/lf-lang/lingua-franca/pull/1686) ([@patilatharva](https://github.com/patilatharva)) +- Generated structs exposed in header files, reactions linkable from separate source files, and updated C target preamble visibility [\#1599](https://github.com/lf-lang/lingua-franca/pull/1599) ([@petervdonovan](https://github.com/petervdonovan)) +- Preprocessor definition for `LF_PACKAGE_DIRECTORY` [\#1720](https://github.com/lf-lang/lingua-franca/pull/1720) ([@edwardalee](https://github.com/edwardalee)) +- Enclave connections and enclave coordination in the C++ target [\#1665](https://github.com/lf-lang/lingua-franca/pull/1665) ([@cmnrd](https://github.com/cmnrd)) +- Mechanism for printing execution statistics [\#1743](https://github.com/lf-lang/lingua-franca/pull/1743) ([@cmnrd](https://github.com/cmnrd)) +- Watchdog support for the C target [\#1730](https://github.com/lf-lang/lingua-franca/pull/1730) ([@Benichiwa](https://github.com/Benichiwa)) +- Automatically generated .vscode/settings.json file [\#1759](https://github.com/lf-lang/lingua-franca/pull/1759) ([@edwardalee](https://github.com/edwardalee)) +- C Generics [\#1681](https://github.com/lf-lang/lingua-franca/pull/1681) ([@mkhubaibumer](https://github.com/mkhubaibumer)) +- Generic params allowed as generic arguments in C target [\#1804](https://github.com/lf-lang/lingua-franca/pull/1804) ([@petervdonovan](https://github.com/petervdonovan)) +- New `--check` flag for `lff` [\#1822](https://github.com/lf-lang/lingua-franca/pull/1822) ([@cmnrd](https://github.com/cmnrd)) +- Environments in the C target [\#1772](https://github.com/lf-lang/lingua-franca/pull/1772) ([@erlingrj](https://github.com/erlingrj)) +- `lfd` binary for generating diagrams from the command line [\#1713](https://github.com/lf-lang/lingua-franca/pull/1713) ([@cmnrd](https://github.com/cmnrd)) +- `fedsd` utility updated to make the RTI optional and support enclaves visualization [\#1870](https://github.com/lf-lang/lingua-franca/pull/1870) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- C math lib always linked for C target [\#1894](https://github.com/lf-lang/lingua-franca/pull/1894) ([@cmnrd](https://github.com/cmnrd)) +- Critical sections enabled outside of the context of a reactor [\#1901](https://github.com/lf-lang/lingua-franca/pull/1901) ([@edwardalee](https://github.com/edwardalee)) +- Uclid5-based LF Verifier [\#1271](https://github.com/lf-lang/lingua-franca/pull/1271) ([@lsk567](https://github.com/lsk567)) +- Python launch scripts [\#1914](https://github.com/lf-lang/lingua-franca/pull/1914) ([@cmnrd](https://github.com/cmnrd)) +- Raspberry Pi Pico target support [\#1831](https://github.com/lf-lang/lingua-franca/pull/1831) ([@gundralaa](https://github.com/gundralaa)) +- Handling cyclic dependencies for TypeScript federated execution [\#1925](https://github.com/lf-lang/lingua-franca/pull/1925) ([@byeong-gil](https://github.com/byeong-gil)) + +**✨ Enhancements** + +- Keeplive natively inferred in the C++ runtime [\#1630](https://github.com/lf-lang/lingua-franca/pull/1630) ([@cmnrd](https://github.com/cmnrd)) +- File access [\#1715](https://github.com/lf-lang/lingua-franca/pull/1715) ([@edwardalee](https://github.com/edwardalee)) +- Validator rules to check if target supports federation or inheritance [\#1726](https://github.com/lf-lang/lingua-franca/pull/1726) ([@cmnrd](https://github.com/cmnrd)) +- No more space inserted after `interleaved` keyword by formatter [\#1846](https://github.com/lf-lang/lingua-franca/pull/1846) ([@cmnrd](https://github.com/cmnrd)) +- More natural syntax for reaction declarations [\#1853](https://github.com/lf-lang/lingua-franca/pull/1853) ([@lhstrh](https://github.com/lhstrh)) +- Fix for extra whitespace around info messages [\#1879](https://github.com/lf-lang/lingua-franca/pull/1879) ([@oowekyala](https://github.com/oowekyala)) +- TypeScript runtime bumped to `v0.5.0` [\#1927](https://github.com/lf-lang/lingua-franca/pull/1927) ([@byeong-gil](https://github.com/byeong-gil)) +- Support for named and bodyless reactions in C++ [\#1933](https://github.com/lf-lang/lingua-franca/pull/1933) ([@cmnrd](https://github.com/cmnrd)) +- Added @layout annotation to add arbitrary layout options an elements [\#1951](https://github.com/lf-lang/lingua-franca/pull/1951) ([@soerendomroes](https://github.com/soerendomroes)) + +**🔧 Fixes** + +- Physical connections implemented as AST transformation [\#1596](https://github.com/lf-lang/lingua-franca/pull/1596) ([@erlingrj](https://github.com/erlingrj)) +- Fix for language server "Build and Run" command [\#1619](https://github.com/lf-lang/lingua-franca/pull/1619) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for passing of command line options from lfc to the generator [\#1631](https://github.com/lf-lang/lingua-franca/pull/1631) ([@cmnrd](https://github.com/cmnrd)) +- Fix for validation of target properties [\#1629](https://github.com/lf-lang/lingua-franca/pull/1629) ([@cmnrd](https://github.com/cmnrd)) +- Fix in validation so that warnings are not reported as errors [\#1643](https://github.com/lf-lang/lingua-franca/pull/1643) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for NPE in lfc error reporting [\#1655](https://github.com/lf-lang/lingua-franca/pull/1655) ([@cmnrd](https://github.com/cmnrd)) +- Upstream connection delays now properly handled in the TypeScript federates [\#1607](https://github.com/lf-lang/lingua-franca/pull/1607) ([@byeong-gil](https://github.com/byeong-gil)) +- Fix for authenticated federation [\#1698](https://github.com/lf-lang/lingua-franca/pull/1698) ([@Jakio815](https://github.com/Jakio815)) +- Bugfixes in handling of `files` target property [\#1725](https://github.com/lf-lang/lingua-franca/pull/1725) ([@lhstrh](https://github.com/lhstrh)) +- Preambles properly inherited from superclasses [\#1732](https://github.com/lf-lang/lingua-franca/pull/1732) ([@edwardalee](https://github.com/edwardalee)) +- Clean `Correspondence` tags out of generated C code [\#1737](https://github.com/lf-lang/lingua-franca/pull/1737) ([@petervdonovan](https://github.com/petervdonovan)) +- Reactor classes in the same file with the same name, up to case differences, are prohibited [\#1741](https://github.com/lf-lang/lingua-franca/pull/1741) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for ROS serialization [\#1755](https://github.com/lf-lang/lingua-franca/pull/1755) ([@petervdonovan](https://github.com/petervdonovan)) +- Improved line adjustment logic for federated programs [\#1760](https://github.com/lf-lang/lingua-franca/pull/1760) ([@petervdonovan](https://github.com/petervdonovan)) +- Multiple fixes for federated programs with TypeScript target [\#1752](https://github.com/lf-lang/lingua-franca/pull/1752) ([@byeong-gil](https://github.com/byeong-gil)) +- Fix for race condition in `uniqueName` [\#1815](https://github.com/lf-lang/lingua-franca/pull/1815) ([@petervdonovan](https://github.com/petervdonovan)) +- Bugfix in integration tests and fixed ROS2 tests [\#1841](https://github.com/lf-lang/lingua-franca/pull/1841) ([@cmnrd](https://github.com/cmnrd)) +- Formatter fixes [\#1840](https://github.com/lf-lang/lingua-franca/pull/1840) ([@petervdonovan](https://github.com/petervdonovan)) +- Adjustments for running the LF compiler in Epoch [\#1844](https://github.com/lf-lang/lingua-franca/pull/1844) ([@a-sr](https://github.com/a-sr)) +- More formatter fixes [\#1850](https://github.com/lf-lang/lingua-franca/pull/1850) ([@petervdonovan](https://github.com/petervdonovan)) +- More formatter fixes [\#1851](https://github.com/lf-lang/lingua-franca/pull/1851) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for naming collision when generic reactor is instantiated with different parameters [\#1864](https://github.com/lf-lang/lingua-franca/pull/1864) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for inheritance problem exposed in examples [\#1891](https://github.com/lf-lang/lingua-franca/pull/1891) ([@lhstrh](https://github.com/lhstrh)) +- Fix verifier error when there is no main reactor [\#1916](https://github.com/lf-lang/lingua-franca/pull/1916) ([@lsk567](https://github.com/lsk567)) +- No more use of unordered reactions in federated programs; fix for deadlocks in some federated programs [\#1684](https://github.com/lf-lang/lingua-franca/pull/1684) ([@arengarajan99](https://github.com/arengarajan99)) +- Keyword `extends` added to tokens allowed in reaction bodies [\#1926](https://github.com/lf-lang/lingua-franca/pull/1926) ([@lhstrh](https://github.com/lhstrh)) +- Fix for edge case in which comments are dropped [\#1924](https://github.com/lf-lang/lingua-franca/pull/1924) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for IllegalArgumentException in diagram synthesis [\#1932](https://github.com/lf-lang/lingua-franca/pull/1932) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for STP violation [\#1935](https://github.com/lf-lang/lingua-franca/pull/1935) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for after delays that use user-provided declarations [\#1959](https://github.com/lf-lang/lingua-franca/pull/1959) ([@petervdonovan](https://github.com/petervdonovan)) +- Bugfix for when top-level multiport width in federation depends on parameter [\#1956](https://github.com/lf-lang/lingua-franca/pull/1956) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix compilation error in code for reset state variables with time type [\#1964](https://github.com/lf-lang/lingua-franca/pull/1964) ([@a-sr](https://github.com/a-sr)) +- Fixed path issue in generated `docker-compose.yml` for federations [\#1983](https://github.com/lf-lang/lingua-franca/pull/1983) ([@lhstrh](https://github.com/lhstrh)) + +**🚧 Maintenance and Refactoring** + +- Migration of Epoch into separate repository [\#1482](https://github.com/lf-lang/lingua-franca/pull/1482) ([@a-sr](https://github.com/a-sr)) +- Improved CLI argument handling using `picocli` [\#1534](https://github.com/lf-lang/lingua-franca/pull/1534) ([@patilatharva](https://github.com/patilatharva)) +- Compile definitions no longer hardcoded in generated CMakeLists.txt [\#1622](https://github.com/lf-lang/lingua-franca/pull/1622) ([@petervdonovan](https://github.com/petervdonovan)) +- Remove unchecked compilation warnings [\#1638](https://github.com/lf-lang/lingua-franca/pull/1638) ([@oowekyala](https://github.com/oowekyala)) +- Refactoring of part of the federated package [\#1663](https://github.com/lf-lang/lingua-franca/pull/1663) ([@lhstrh](https://github.com/lhstrh)) +- Removal of the use of non-API global variables in tests [\#1696](https://github.com/lf-lang/lingua-franca/pull/1696) ([@edwardalee](https://github.com/edwardalee)) +- Gradle bumped to version 8 [\#1691](https://github.com/lf-lang/lingua-franca/pull/1691) ([@lhstrh](https://github.com/lhstrh)) +- Removal of deprecated `build-lfc` script and `buildLfc` Gradle task [\#1714](https://github.com/lf-lang/lingua-franca/pull/1714) ([@cmnrd](https://github.com/cmnrd)) +- Delete unnecessary complexity from `build-lf-cli` [\#1745](https://github.com/lf-lang/lingua-franca/pull/1745) ([@petervdonovan](https://github.com/petervdonovan)) +- C files for Python support retrieved from reactor-c repo [\#1757](https://github.com/lf-lang/lingua-franca/pull/1757) ([@lhstrh](https://github.com/lhstrh)) +- Google autoformatter applied to all files [\#1766](https://github.com/lf-lang/lingua-franca/pull/1766) ([@lhstrh](https://github.com/lhstrh)) +- Redesign of the repository layout and gradle configuration [\#1779](https://github.com/lf-lang/lingua-franca/pull/1779) ([@cmnrd](https://github.com/cmnrd)) +- Removal of odd mechanism for loading target generators dynamically [\#1813](https://github.com/lf-lang/lingua-franca/pull/1813) ([@cmnrd](https://github.com/cmnrd)) +- Default line length set to 100 for LF files [\#1389](https://github.com/lf-lang/lingua-franca/pull/1389) ([@petervdonovan](https://github.com/petervdonovan)) +- KlighD bumped to `2.3.0` and now retrieved from Maven Central [\#1823](https://github.com/lf-lang/lingua-franca/pull/1823) ([@cmnrd](https://github.com/cmnrd)) +- Refactor error reporter [\#1527](https://github.com/lf-lang/lingua-franca/pull/1527) ([@oowekyala](https://github.com/oowekyala)) +- Unknown port types handled with `unknown` instead of `Present` [\#1857](https://github.com/lf-lang/lingua-franca/pull/1857) ([@lhstrh](https://github.com/lhstrh)) +- TS code generator adjusted to appease `eslint` [\#1878](https://github.com/lf-lang/lingua-franca/pull/1878) ([@lhstrh](https://github.com/lhstrh)) +- Minor fixes for the README in the test directory [\#1903](https://github.com/lf-lang/lingua-franca/pull/1903) ([@lsk567](https://github.com/lsk567)) +- Declarative Port Graph in C++ Runtime [\#1848](https://github.com/lf-lang/lingua-franca/pull/1848) ([@revol-xut](https://github.com/revol-xut)) +- No more use of unordered reactions in federated programs; fix for deadlocks in some federated programs [\#1684](https://github.com/lf-lang/lingua-franca/pull/1684) ([@arengarajan99](https://github.com/arengarajan99)) +- Tracing utils and Zephyr run scripts moved from `util` folder [\#1948](https://github.com/lf-lang/lingua-franca/pull/1948) ([@erlingrj](https://github.com/erlingrj)) + +**📖 Documentation** + +- Documentation about LSP tests in `README.md` [\#1587](https://github.com/lf-lang/lingua-franca/pull/1587) ([@petervdonovan](https://github.com/petervdonovan)) +- Updated README for the federate trace visualizer [\#1735](https://github.com/lf-lang/lingua-franca/pull/1735) ([@ChadliaJerad](https://github.com/ChadliaJerad)) + +**🧪 Tests** + +- TypeScript tests for federates with physical connections [\#1623](https://github.com/lf-lang/lingua-franca/pull/1623) ([@byeong-gil](https://github.com/byeong-gil)) +- Zephyr tests pinned to particular version of docker image [\#1648](https://github.com/lf-lang/lingua-franca/pull/1648) ([@erlingrj](https://github.com/erlingrj)) +- Test for the support of delayed physical connections in the TypeScript target [\#1676](https://github.com/lf-lang/lingua-franca/pull/1676) ([@byeong-gil](https://github.com/byeong-gil)) +- Test for parsing CLI arguments in `lfc` [\#1668](https://github.com/lf-lang/lingua-franca/pull/1668) ([@patilatharva](https://github.com/patilatharva)) +- Zephyr regression tests executed on QEMU [\#1678](https://github.com/lf-lang/lingua-franca/pull/1678) ([@erlingrj](https://github.com/erlingrj)) +- CodeCov reporting for CLI tests [\#1688](https://github.com/lf-lang/lingua-franca/pull/1688) ([@lhstrh](https://github.com/lhstrh)) +- Test to help ensure that level-based scheduling does not cause deadlock [\#1703](https://github.com/lf-lang/lingua-franca/pull/1703) ([@edwardalee](https://github.com/edwardalee)) +- Flaky tests adjusted [\#1764](https://github.com/lf-lang/lingua-franca/pull/1764) ([@edwardalee](https://github.com/edwardalee)) +- `SimpleFederatedAuthenticated.lf` test passing [\#1776](https://github.com/lf-lang/lingua-franca/pull/1776) ([@Jakio815](https://github.com/Jakio815)) +- CI updates [\#1814](https://github.com/lf-lang/lingua-franca/pull/1814) ([@petervdonovan](https://github.com/petervdonovan)) +- Parallel execution of round trip tests [\#1845](https://github.com/lf-lang/lingua-franca/pull/1845) ([@oowekyala](https://github.com/oowekyala)) +- Tests for `lf_request_stop` with enclaves and federates [\#1871](https://github.com/lf-lang/lingua-franca/pull/1871) ([@edwardalee](https://github.com/edwardalee)) +- Fixed code coverage aggregation and reporting [\#1868](https://github.com/lf-lang/lingua-franca/pull/1868) ([@cmnrd](https://github.com/cmnrd)) +- New job for building `epoch` in CI [\#1974](https://github.com/lf-lang/lingua-franca/pull/1974) ([@lhstrh](https://github.com/lhstrh)) + +**⬆️ Updated Dependencies** + +- Update to Zephyr v3.3.0 and SDK v0.16.1 [\#1825](https://github.com/lf-lang/lingua-franca/pull/1825) ([@erlingrj](https://github.com/erlingrj)) +- Reactor-ts bumped to v0.4.0 [\#1749](https://github.com/lf-lang/lingua-franca/pull/1749) ([@lhstrh](https://github.com/lhstrh)) +- Gradle Wrapper bumped to `8.1.1` [\#1890](https://github.com/lf-lang/lingua-franca/pull/1890) ([@lhstrh](https://github.com/lhstrh)) +- Eclipse-related dependencies bumped to latest releases [\#1889](https://github.com/lf-lang/lingua-franca/pull/1889) ([@a-sr](https://github.com/a-sr)) +- TypeScript runtime bumped to `v0.5.0` [\#1927](https://github.com/lf-lang/lingua-franca/pull/1927) ([@byeong-gil](https://github.com/byeong-gil)) + + +### Submodule [lf-lang/reactor-c](http://github.com/lf-lang/reactor-c) + +**🚀 New Features** + +- New tracepoint for deadline misses [\#169](https://github.com/lf-lang/reactor-c/pull/169) ([@erlingrj](https://github.com/erlingrj)) +- Compile definitions for federated programs [\#179](https://github.com/lf-lang/reactor-c/pull/179) ([@petervdonovan](https://github.com/petervdonovan)) +- Tracing federate interactions [\#178](https://github.com/lf-lang/reactor-c/pull/178) ([@edwardalee](https://github.com/edwardalee)) +- CMake definition to find `FEDERATED_AUTHENTICATED` [\#196](https://github.com/lf-lang/reactor-c/pull/196) ([@Jakio815](https://github.com/Jakio815)) +- Memory reporting [\#201](https://github.com/lf-lang/reactor-c/pull/201) ([@edwardalee](https://github.com/edwardalee)) +- Added `LF_PACKAGE_DIRECTORY` [\#204](https://github.com/lf-lang/reactor-c/pull/204) ([@edwardalee](https://github.com/edwardalee)) +- Runtime support for watchdogs [\#177](https://github.com/lf-lang/reactor-c/pull/177) ([@Benichiwa](https://github.com/Benichiwa)) +- Environments [\#212](https://github.com/lf-lang/reactor-c/pull/212) ([@erlingrj](https://github.com/erlingrj)) +- Enclave request stop [\#244](https://github.com/lf-lang/reactor-c/pull/244) ([@edwardalee](https://github.com/edwardalee)) +- Critical sections enabled outside of the context of a reactor [\#249](https://github.com/lf-lang/reactor-c/pull/249) ([@edwardalee](https://github.com/edwardalee)) +- Rp2040 Target Support [\#253](https://github.com/lf-lang/reactor-c/pull/253) ([@gundralaa](https://github.com/gundralaa)) +- Platform support for Raspberry Pi Pico [\#233](https://github.com/lf-lang/reactor-c/pull/233) ([@gundralaa](https://github.com/gundralaa)) + +**✨ Enhancements** + +- Removal of unnecessary TAG messages [\#175](https://github.com/lf-lang/reactor-c/pull/175) ([@byeong-gil](https://github.com/byeong-gil)) +- Cleaner namespace [\#189](https://github.com/lf-lang/reactor-c/pull/189) ([@petervdonovan](https://github.com/petervdonovan)) +- File access and doc fixes [\#198](https://github.com/lf-lang/reactor-c/pull/198) ([@edwardalee](https://github.com/edwardalee)) +- Improvements of support for watchdogs [\#209](https://github.com/lf-lang/reactor-c/pull/209) ([@edwardalee](https://github.com/edwardalee)) +- Switch to more general thread creation in Zephyr support [\#194](https://github.com/lf-lang/reactor-c/pull/194) ([@siljesu](https://github.com/siljesu)) +- Minor improvements to Zephyr platform [\#187](https://github.com/lf-lang/reactor-c/pull/187) ([@erlingrj](https://github.com/erlingrj)) +- Output error when trying to use --auth (-a) for RTI built without -DAUTH=ON [\#222](https://github.com/lf-lang/reactor-c/pull/222) ([@hokeun](https://github.com/hokeun)) +- Change nanosleep to lf_sleep in federate and RTI code [\#219](https://github.com/lf-lang/reactor-c/pull/219) ([@siljesu](https://github.com/siljesu)) +- [C-Generics] Helper Macros [\#190](https://github.com/lf-lang/reactor-c/pull/190) ([@mkhubaibumer](https://github.com/mkhubaibumer)) +- RTI exit while saving the trace file [\#228](https://github.com/lf-lang/reactor-c/pull/228) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Less namespace pollution [\#240](https://github.com/lf-lang/reactor-c/pull/240) ([@erlingrj](https://github.com/erlingrj)) +- Enclaves tuning [\#243](https://github.com/lf-lang/reactor-c/pull/243) ([@edwardalee](https://github.com/edwardalee)) +- If clock sync is on, link math [\#252](https://github.com/lf-lang/reactor-c/pull/252) ([@petervdonovan](https://github.com/petervdonovan)) +- No more use of unordered reactions in federated programs [\#191](https://github.com/lf-lang/reactor-c/pull/191) ([@arengarajan99](https://github.com/arengarajan99)) + +**🔧 Fixes** + +- Fix for definition of `LF_TIME_BUFFER_LENGTH` [\#197](https://github.com/lf-lang/reactor-c/pull/197) ([@edwardalee](https://github.com/edwardalee)) +- Scheduler leak fix [\#200](https://github.com/lf-lang/reactor-c/pull/200) ([@edwardalee](https://github.com/edwardalee)) +- Fix for Arduino to avoid duplicate definition of `timespec` [\#195](https://github.com/lf-lang/reactor-c/pull/195) ([@arengarajan99](https://github.com/arengarajan99)) +- Suppression of "no symbols" warnings emitted by ranlib [\#214](https://github.com/lf-lang/reactor-c/pull/214) ([@petervdonovan](https://github.com/petervdonovan)) +- Segfault fix [\#218](https://github.com/lf-lang/reactor-c/pull/218) ([@petervdonovan](https://github.com/petervdonovan)) +- Zephyr fixes on thread creation and deletion [\#223](https://github.com/lf-lang/reactor-c/pull/223) ([@erlingrj](https://github.com/erlingrj)) +- Minor fix of the federate id in the tracepoint [\#245](https://github.com/lf-lang/reactor-c/pull/245) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Fix protocol of HMAC authentication to start from federate. [\#231](https://github.com/lf-lang/reactor-c/pull/231) ([@Jakio815](https://github.com/Jakio815)) +- Use of correct federate ID in tracing of absent messages [\#248](https://github.com/lf-lang/reactor-c/pull/248) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- Memory leak in Python target fixed [\#246](https://github.com/lf-lang/reactor-c/pull/246) ([@jackykwok2024](https://github.com/jackykwok2024)) +- Fix for fatal error raised during shutdown when decrementing a tag barrier that is zero [\#251](https://github.com/lf-lang/reactor-c/pull/251) ([@petervdonovan](https://github.com/petervdonovan)) +- Fix for STP violation [\#257](https://github.com/lf-lang/reactor-c/pull/257) ([@petervdonovan](https://github.com/petervdonovan)) +- Updated Makefile and docs for fedsd utility [\#262](https://github.com/lf-lang/reactor-c/pull/262) ([@ChadliaJerad](https://github.com/ChadliaJerad)) + +**🚧 Maintenance and Refactoring** + +- Functions of rti.c moved to rti_lib.c to enable reuse [\#172](https://github.com/lf-lang/reactor-c/pull/172) ([@Jakio815](https://github.com/Jakio815)) +- Code in `rti.c` made available as library [\#174](https://github.com/lf-lang/reactor-c/pull/174) ([@Jakio815](https://github.com/Jakio815)) +- Documentation and code cleanup [\#193](https://github.com/lf-lang/reactor-c/pull/193) ([@edwardalee](https://github.com/edwardalee)) +- Platform abstraction layer for the RTI [\#213](https://github.com/lf-lang/reactor-c/pull/213) ([@siljesu](https://github.com/siljesu)) +- C files from reactor-c-py moved back into the reactor-c repo [\#217](https://github.com/lf-lang/reactor-c/pull/217) ([@lhstrh](https://github.com/lhstrh)) +- Struct refactoring for actions and ports [\#216](https://github.com/lf-lang/reactor-c/pull/216) ([@edwardalee](https://github.com/edwardalee)) +- Refactoring of the RTI implementation [\#224](https://github.com/lf-lang/reactor-c/pull/224) ([@ChadliaJerad](https://github.com/ChadliaJerad)) +- `_lf_count_token_allocations` made `extern` instead of `static` [\#236](https://github.com/lf-lang/reactor-c/pull/236) ([@erlingrj](https://github.com/erlingrj)) +- Refactoring of obsolete `gethostbyname()` in `connect_to_rti()` [\#220](https://github.com/lf-lang/reactor-c/pull/220) ([@siljesu](https://github.com/siljesu)) +- No more use of unordered reactions in federated programs [\#191](https://github.com/lf-lang/reactor-c/pull/191) ([@arengarajan99](https://github.com/arengarajan99)) +- Fewer warnings [\#258](https://github.com/lf-lang/reactor-c/pull/258) ([@edwardalee](https://github.com/edwardalee)) +- Tracing utils moved into reactor-c [\#259](https://github.com/lf-lang/reactor-c/pull/259) ([@erlingrj](https://github.com/erlingrj)) + +**📖 Documentation** + +- Documentation and code cleanup [\#193](https://github.com/lf-lang/reactor-c/pull/193) ([@edwardalee](https://github.com/edwardalee)) + + +### Submodule [lf-lang/reactor-cpp](http://github.com/lf-lang/reactor-cpp) + +**🚀 New Features** + +- Enclave connections and enclave coordination [\#44](https://github.com/lf-lang/reactor-cpp/pull/44) ([@cmnrd](https://github.com/cmnrd)) +- Simple mechanism for collecting statistics during execution [\#47](https://github.com/lf-lang/reactor-cpp/pull/47) ([@cmnrd](https://github.com/cmnrd)) +- Port graph [\#51](https://github.com/lf-lang/reactor-cpp/pull/51) ([@revol-xut](https://github.com/revol-xut)) + +**✨ Enhancements** + +- Keep track of input actions in the environment [\#42](https://github.com/lf-lang/reactor-cpp/pull/42) ([@cmnrd](https://github.com/cmnrd)) +- Factored event queue into its own class and fixed race condition between multiple starting enclaves [\#45](https://github.com/lf-lang/reactor-cpp/pull/45) ([@cmnrd](https://github.com/cmnrd)) + +**🔧 Fixes** + +- Fix race condition in time barriers [\#49](https://github.com/lf-lang/reactor-cpp/pull/49) ([@cmnrd](https://github.com/cmnrd)) +- Fix validate method and fix incorrect phase checks [\#50](https://github.com/lf-lang/reactor-cpp/pull/50) ([@cmnrd](https://github.com/cmnrd)) + + +### Submodule [lf-lang/reactor-rs](http://github.com/lf-lang/reactor-rs) + +**🔧 Fixes** + +- Fix use of multiport as reaction source [\#43](https://github.com/lf-lang/reactor-rs/pull/43) ([@oowekyala](https://github.com/oowekyala)) + +**🚧 Maintenance and Refactoring** + +- Use Cargo workspaces to directly include vecmap dependency [\#40](https://github.com/lf-lang/reactor-rs/pull/40) ([@jhaye](https://github.com/jhaye)) +- Fixes for current Clippy version [\#45](https://github.com/lf-lang/reactor-rs/pull/45) ([@jhaye](https://github.com/jhaye)) + +**⬆️ Updated Dependencies** + +- Dependencies bumped to avoid vulnerability in smallvec [\#44](https://github.com/lf-lang/reactor-rs/pull/44) ([@oowekyala](https://github.com/oowekyala)) + + ## [v0.4.0](https://github.com/lf-lang/lingua-franca/tree/v0.4.0) (2023-03-01) From 5d6d8843b4aadb4826872c4b009805a179450720 Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Fri, 1 Sep 2023 18:35:07 -0700 Subject: [PATCH 048/141] Bump version to 0.5.0 --- CHANGELOG.md | 2 +- core/src/main/resources/org/lflang/StringsBundle.properties | 2 +- gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c469ed6334..f916e8496d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog - + ## [v0.5.0](https://github.com/lf-lang/lingua-franca/tree/v0.5.0) (2023-09-01) **Highlights** diff --git a/core/src/main/resources/org/lflang/StringsBundle.properties b/core/src/main/resources/org/lflang/StringsBundle.properties index 29b191399c..b58621d407 100644 --- a/core/src/main/resources/org/lflang/StringsBundle.properties +++ b/core/src/main/resources/org/lflang/StringsBundle.properties @@ -1 +1 @@ -VERSION = 0.4.1-SNAPSHOT +VERSION = 0.5.0 diff --git a/gradle.properties b/gradle.properties index fd082fc31f..ce77106367 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ [header] group=org.lflang -version=0.4.1-SNAPSHOT +version=0.5.0 [versions] antlrVersion=4.7.2 From fbaa670090e3704f38883047fc1a4c2cf06f12ba Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 1 Sep 2023 21:00:09 -0700 Subject: [PATCH 049/141] Do not squeeze reaction bodies onto one line. This adds state, but it is a private non-static member and the formatter is not parallelized, so it should be OK. The technique employed here is I think the most reasonable way to account for context-sensitive formatting rules. --- core/src/main/java/org/lflang/ast/ToLf.java | 17 ++++++++++ test/C/src/ActionDelay.lf | 8 +++-- test/C/src/ActionWithNoReaction.lf | 4 ++- test/C/src/After.lf | 8 +++-- test/C/src/AfterCycles.lf | 8 +++-- test/C/src/AfterZero.lf | 8 +++-- test/C/src/Alignment.lf | 4 ++- test/C/src/CompositionGain.lf | 4 ++- test/C/src/DanglingOutput.lf | 4 ++- test/C/src/DeadlineAnytime.lf | 8 +++-- test/C/src/DeadlineInherited.lf | 12 +++++-- test/C/src/DeadlinePriority.lf | 12 +++++-- test/C/src/DeadlineWithAfterDelay.lf | 8 +++-- test/C/src/DeadlineWithBanks.lf | 8 +++-- test/C/src/DeadlineZero.lf | 8 +++-- test/C/src/DelayArray.lf | 8 +++-- test/C/src/DelayInt.lf | 8 +++-- test/C/src/DelayString.lf | 8 +++-- test/C/src/DelayedAction.lf | 4 ++- test/C/src/DelayedReaction.lf | 4 ++- test/C/src/Determinism.lf | 8 +++-- test/C/src/DoublePort.lf | 12 +++++-- test/C/src/Gain.lf | 8 +++-- test/C/src/GetMicroStep.lf | 4 ++- test/C/src/Hierarchy.lf | 4 ++- test/C/src/Hierarchy2.lf | 4 ++- test/C/src/Import.lf | 4 ++- test/C/src/ImportComposition.lf | 4 ++- test/C/src/ImportRenamed.lf | 4 ++- test/C/src/InheritanceAction.lf | 8 +++-- test/C/src/ManualDelayedReaction.lf | 9 ++++-- test/C/src/Methods.lf | 8 +++-- test/C/src/MethodsRecursive.lf | 4 ++- test/C/src/MethodsSameName.lf | 8 +++-- test/C/src/Microsteps.lf | 4 ++- test/C/src/Minimal.lf | 4 ++- test/C/src/MultipleContained.lf | 4 ++- test/C/src/NestedTriggeredReactions.lf | 12 +++++-- test/C/src/ParameterizedState.lf | 4 ++- test/C/src/PhysicalConnection.lf | 4 ++- test/C/src/PingPong.lf | 4 ++- test/C/src/PreambleInherited.lf | 4 ++- test/C/src/ReadOutputOfContainedReactor.lf | 4 ++- test/C/src/RepeatedInheritance.lf | 4 ++- test/C/src/Schedule.lf | 8 +++-- test/C/src/ScheduleLogicalAction.lf | 8 +++-- test/C/src/SelfLoop.lf | 4 ++- test/C/src/SendingInside2.lf | 4 ++- test/C/src/SendsPointerTest.lf | 4 ++- test/C/src/SetToken.lf | 8 +++-- test/C/src/SlowingClock.lf | 4 ++- test/C/src/StartupOutFromInside.lf | 4 ++- test/C/src/TimeLimit.lf | 4 ++- test/C/src/TimeState.lf | 4 ++- test/C/src/UnconnectedInput.lf | 4 ++- test/C/src/Wcet.lf | 4 ++- test/C/src/arduino/Blink.lf | 12 +++++-- test/C/src/arduino/BlinkAttemptThreading.lf | 12 +++++-- test/C/src/arduino/BlinkMBED.lf | 12 +++++-- test/C/src/arduino/DigitalReadSerial.lf | 4 ++- test/C/src/arduino/Fade.lf | 4 ++- test/C/src/arduino/ReadAnalogVoltage.lf | 4 ++- test/C/src/concurrent/DelayIntThreaded.lf | 8 +++-- test/C/src/concurrent/DeterminismThreaded.lf | 8 +++-- test/C/src/concurrent/GainThreaded.lf | 8 +++-- test/C/src/concurrent/ImportThreaded.lf | 4 ++- test/C/src/concurrent/MinimalThreaded.lf | 4 ++- test/C/src/concurrent/PingPongThreaded.lf | 4 ++- test/C/src/concurrent/TimeLimitThreaded.lf | 4 ++- test/C/src/enclave/EnclaveRequestStop.lf | 4 ++- test/C/src/federated/BroadcastFeedback.lf | 4 ++- .../BroadcastFeedbackWithHierarchy.lf | 4 ++- test/C/src/federated/CycleDetection.lf | 12 +++++-- test/C/src/federated/DecentralizedP2PComm.lf | 4 ++- .../DecentralizedP2PUnbalancedTimeout.lf | 4 ++- ...centralizedP2PUnbalancedTimeoutPhysical.lf | 4 ++- test/C/src/federated/DistributedBank.lf | 4 ++- test/C/src/federated/DistributedDoublePort.lf | 12 +++++-- .../DistributedPhysicalActionUpstream.lf | 4 ++- .../DistributedPhysicalActionUpstreamLong.lf | 4 ++- .../federated/EnclaveFederatedRequestStop.lf | 4 ++- test/C/src/federated/FeedbackDelay.lf | 8 +++-- test/C/src/federated/FeedbackDelaySimple.lf | 4 ++- test/C/src/federated/HelloDistributed.lf | 8 +++-- test/C/src/federated/InheritanceFederated.lf | 4 ++- .../federated/InheritanceFederatedImport.lf | 4 ++- test/C/src/federated/LevelPattern.lf | 12 +++++-- ...stributedCentralizedPrecedenceHierarchy.lf | 8 +++-- test/C/src/federated/SpuriousDependency.lf | 8 +++-- test/C/src/federated/StopAtShutdown.lf | 20 +++++++++--- test/C/src/federated/TopLevelArtifacts.lf | 8 +++-- test/C/src/generics/ParameterAsArgument.lf | 4 ++- test/C/src/generics/TypeCheck.lf | 4 ++- test/C/src/lib/Count.lf | 4 ++- test/C/src/lib/FileLevelPreamble.lf | 4 ++- test/C/src/lib/GenDelay.lf | 12 +++++-- test/C/src/lib/Imported.lf | 4 ++- test/C/src/lib/ImportedComposition.lf | 4 ++- test/C/src/lib/InternalDelay.lf | 8 +++-- test/C/src/lib/PassThrough.lf | 4 ++- .../modal_models/BanksCount3ModesComplex.lf | 8 +++-- test/C/src/modal_models/ConvertCaseTest.lf | 28 ++++++++++++---- test/C/src/modal_models/Count3Modes.lf | 5 ++- test/C/src/modal_models/MixedReactions.lf | 16 +++++++--- test/C/src/modal_models/ModalActions.lf | 5 ++- test/C/src/modal_models/ModalAfter.lf | 5 ++- test/C/src/modal_models/ModalCycleBreaker.lf | 13 ++++++-- .../src/modal_models/ModalNestedReactions.lf | 13 ++++++-- .../src/modal_models/ModalStartupShutdown.lf | 5 ++- test/C/src/modal_models/ModalStateReset.lf | 13 ++++++-- .../C/src/modal_models/ModalStateResetAuto.lf | 5 ++- test/C/src/modal_models/ModalTimers.lf | 5 ++- .../MultipleOutputFeeder_2Connections.lf | 22 ++++++++++--- ...ultipleOutputFeeder_ReactionConnections.lf | 26 +++++++++++---- test/C/src/modal_models/util/TraceTesting.lf | 4 ++- test/C/src/multiport/BankGangedConnections.lf | 4 ++- test/C/src/multiport/BankIndexInitializer.lf | 12 +++++-- test/C/src/multiport/BankSelfBroadcast.lf | 4 ++- test/C/src/multiport/BankToMultiport.lf | 4 ++- test/C/src/multiport/Broadcast.lf | 4 ++- test/C/src/multiport/BroadcastAfter.lf | 4 ++- .../C/src/multiport/BroadcastMultipleAfter.lf | 4 ++- test/C/src/multiport/MultiportFromBank.lf | 4 ++- test/C/src/multiport/MultiportIn.lf | 4 ++- .../src/multiport/MultiportInParameterized.lf | 4 ++- test/C/src/multiport/PipelineAfter.lf | 8 +++-- test/C/src/multiport/ReactionsToNested.lf | 8 +++-- test/C/src/no_inlining/Count.lf | 4 ++- test/C/src/no_inlining/CountHierarchy.lf | 8 +++-- test/C/src/target/FederatedFiles.lf | 4 ++- test/C/src/target/Math.lf | 4 ++- test/C/src/target/Platform.lf | 4 ++- test/C/src/token/lib/Token.lf | 8 +++-- test/C/src/verifier/ADASModel.lf | 32 ++++++++++++++----- test/C/src/verifier/AircraftDoor.lf | 4 ++- test/C/src/verifier/CoopSchedule.lf | 4 ++- test/C/src/verifier/ProcessMsg.lf | 8 +++-- test/C/src/verifier/Ring.lf | 8 +++-- test/C/src/verifier/SafeSend.lf | 5 ++- test/C/src/verifier/Thermostat.lf | 12 +++++-- test/C/src/verifier/TrainDoor.lf | 8 +++-- test/C/src/verifier/UnsafeSend.lf | 5 ++- test/C/src/zephyr/unthreaded/HelloZephyr.lf | 4 ++- test/C/src/zephyr/unthreaded/Timer.lf | 4 ++- test/Cpp/src/ActionDelay.lf | 8 +++-- test/Cpp/src/ActionWithNoReaction.lf | 4 ++- test/Cpp/src/After.lf | 4 ++- test/Cpp/src/AfterZero.lf | 4 ++- test/Cpp/src/Alignment.lf | 4 ++- test/Cpp/src/CompositionGain.lf | 4 ++- test/Cpp/src/DanglingOutput.lf | 4 ++- test/Cpp/src/DelayInt.lf | 12 +++++-- test/Cpp/src/DelayedAction.lf | 4 ++- test/Cpp/src/DelayedReaction.lf | 4 ++- test/Cpp/src/Determinism.lf | 8 +++-- test/Cpp/src/DoublePort.lf | 4 ++- test/Cpp/src/Gain.lf | 8 +++-- test/Cpp/src/GetMicroStep.lf | 8 +++-- test/Cpp/src/Hello.lf | 8 +++-- test/Cpp/src/HelloWorld.lf | 4 ++- test/Cpp/src/Hierarchy.lf | 8 +++-- test/Cpp/src/Hierarchy2.lf | 4 ++- test/Cpp/src/Import.lf | 4 ++- test/Cpp/src/ImportComposition.lf | 4 ++- test/Cpp/src/ImportRenamed.lf | 4 ++- test/Cpp/src/ManualDelayedReaction.lf | 13 ++++++-- test/Cpp/src/Methods.lf | 8 +++-- test/Cpp/src/Microsteps.lf | 4 ++- test/Cpp/src/Minimal.lf | 4 ++- test/Cpp/src/MultipleContained.lf | 4 ++- test/Cpp/src/NativeListsAndTimes.lf | 9 ++++-- test/Cpp/src/NestedTriggeredReactions.lf | 12 +++++-- test/Cpp/src/PeriodicDesugared.lf | 4 ++- test/Cpp/src/PhysicalConnection.lf | 4 ++- test/Cpp/src/Pipeline.lf | 4 ++- test/Cpp/src/PreambleTest.lf | 4 ++- test/Cpp/src/ReadOutputOfContainedReactor.lf | 4 ++- test/Cpp/src/Schedule.lf | 8 +++-- test/Cpp/src/ScheduleLogicalAction.lf | 8 +++-- test/Cpp/src/SelfLoop.lf | 4 ++- test/Cpp/src/SendingInside2.lf | 4 ++- test/Cpp/src/SlowingClock.lf | 4 ++- test/Cpp/src/StartupOutFromInside.lf | 4 ++- test/Cpp/src/Stride.lf | 4 ++- test/Cpp/src/StructPrint.lf | 4 ++- test/Cpp/src/TimeLimit.lf | 4 ++- test/Cpp/src/TimeState.lf | 4 ++- test/Cpp/src/concurrent/AsyncCallback.lf | 4 ++- test/Cpp/src/concurrent/DelayIntThreaded.lf | 12 +++++-- .../Cpp/src/concurrent/DeterminismThreaded.lf | 8 +++-- test/Cpp/src/concurrent/GainThreaded.lf | 8 +++-- test/Cpp/src/concurrent/HelloThreaded.lf | 12 +++++-- test/Cpp/src/concurrent/ImportThreaded.lf | 4 ++- test/Cpp/src/concurrent/MinimalThreaded.lf | 4 ++- test/Cpp/src/concurrent/TimeLimitThreaded.lf | 4 ++- test/Cpp/src/enclave/EnclaveBankEach.lf | 8 +++-- test/Cpp/src/enclave/EnclaveBroadcast.lf | 4 ++- test/Cpp/src/enclave/EnclaveCommunication.lf | 4 ++- test/Cpp/src/enclave/EnclaveCommunication2.lf | 4 ++- .../enclave/EnclaveCommunicationDelayed.lf | 4 ++- .../enclave/EnclaveCommunicationDelayed2.lf | 4 ++- .../EnclaveCommunicationDelayedLocalEvents.lf | 8 +++-- .../EnclaveCommunicationLocalEvents.lf | 8 +++-- .../EnclaveCommunicationMultiportToBank.lf | 4 ++- ...laveCommunicationMultiportToBankDelayed.lf | 4 ++- ...EnclaveCommunicationMultiportToBankEach.lf | 4 ++- ...CommunicationMultiportToBankEachDelayed.lf | 4 ++- ...ommunicationMultiportToBankEachPhysical.lf | 4 ++- ...aveCommunicationMultiportToBankPhysical.lf | 4 ++- .../enclave/EnclaveCommunicationPhysical.lf | 4 ++- ...EnclaveCommunicationPhysicalLocalEvents.lf | 8 +++-- test/Cpp/src/enclave/EnclaveCycle.lf | 4 ++- test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf | 8 +++-- test/Cpp/src/enclave/EnclaveHelloWorld.lf | 4 ++- test/Cpp/src/enclave/EnclaveShutdown.lf | 8 +++-- .../enclave/EnclaveSparseUpstreamEvents.lf | 8 +++-- .../EnclaveSparseUpstreamEventsDelayed.lf | 8 +++-- .../EnclaveSparseUpstreamEventsPhysical.lf | 8 +++-- test/Cpp/src/enclave/EnclaveTimeout.lf | 4 ++- .../enclave/EnclaveUpstreamPhysicalAction.lf | 4 ++- .../EnclaveUpstreamPhysicalActionDelayed.lf | 4 ++- test/Cpp/src/enclave/FastAndSlow.lf | 4 ++- test/Cpp/src/lib/Imported.lf | 4 ++- test/Cpp/src/lib/ImportedComposition.lf | 4 ++- test/Cpp/src/multiport/BankSelfBroadcast.lf | 4 ++- test/Cpp/src/multiport/BankToMultiport.lf | 4 ++- test/Cpp/src/multiport/Broadcast.lf | 4 ++- test/Cpp/src/multiport/BroadcastAfter.lf | 4 ++- .../src/multiport/BroadcastMultipleAfter.lf | 4 ++- .../src/multiport/IndexIntoMultiportInput.lf | 12 +++++-- test/Cpp/src/multiport/MultiportFromBank.lf | 4 ++- .../multiport/MultiportFromBankHierarchy.lf | 4 ++- .../MultiportFromBankHierarchyAfter.lf | 4 ++- test/Cpp/src/multiport/MultiportIn.lf | 8 +++-- test/Cpp/src/multiport/PipelineAfter.lf | 8 +++-- .../multiport/ReadOutputOfContainedBank.lf | 4 ++- test/Cpp/src/multiport/WidthGivenByCode.lf | 12 +++++-- test/Cpp/src/properties/Fast.lf | 4 ++- test/Cpp/src/target/AfterVoid.lf | 4 ++- .../src/target/CliParserGenericArguments.lf | 24 ++++++++++---- test/Cpp/src/target/CombinedTypeNames.lf | 18 ++++++++--- test/Cpp/src/target/GenericAfter.lf | 12 +++++-- test/Cpp/src/target/GenericDelay.lf | 12 +++++-- .../src/target/MultipleContainedGeneric.lf | 4 ++- test/Cpp/src/target/PointerParameters.lf | 4 ++- test/Python/src/ActionDelay.lf | 8 +++-- test/Python/src/ActionWithNoReaction.lf | 4 ++- test/Python/src/After.lf | 8 +++-- test/Python/src/AfterCycles.lf | 8 +++-- test/Python/src/CompareTags.lf | 4 ++- test/Python/src/CompositionGain.lf | 4 ++- test/Python/src/DanglingOutput.lf | 4 ++- test/Python/src/Deadline.lf | 4 ++- test/Python/src/DeadlineHandledAbove.lf | 4 ++- test/Python/src/DelayArray.lf | 4 ++- test/Python/src/DelayInt.lf | 8 +++-- test/Python/src/DelayString.lf | 12 +++++-- test/Python/src/DelayStruct.lf | 12 +++++-- test/Python/src/DelayStructWithAfter.lf | 8 +++-- .../src/DelayStructWithAfterOverlapped.lf | 4 ++- test/Python/src/DelayedAction.lf | 4 ++- test/Python/src/DelayedReaction.lf | 4 ++- test/Python/src/Determinism.lf | 8 +++-- test/Python/src/Gain.lf | 8 +++-- test/Python/src/GetMicroStep.lf | 8 +++-- test/Python/src/Hierarchy.lf | 4 ++- test/Python/src/Hierarchy2.lf | 4 ++- test/Python/src/Import.lf | 4 ++- test/Python/src/ImportComposition.lf | 4 ++- test/Python/src/ImportRenamed.lf | 4 ++- test/Python/src/ManualDelayedReaction.lf | 9 ++++-- test/Python/src/Methods.lf | 8 +++-- test/Python/src/MethodsRecursive.lf | 4 ++- test/Python/src/MethodsSameName.lf | 8 +++-- test/Python/src/Microsteps.lf | 4 ++- test/Python/src/Minimal.lf | 4 ++- test/Python/src/MultipleContained.lf | 4 ++- test/Python/src/ParameterizedState.lf | 4 ++- .../src/ReadOutputOfContainedReactor.lf | 4 ++- test/Python/src/Schedule.lf | 8 +++-- test/Python/src/ScheduleLogicalAction.lf | 8 +++-- test/Python/src/SelfLoop.lf | 4 ++- test/Python/src/SendingInside2.lf | 4 ++- test/Python/src/SetArray.lf | 4 ++- test/Python/src/SimpleDeadline.lf | 4 ++- test/Python/src/SlowingClock.lf | 4 ++- test/Python/src/StartupOutFromInside.lf | 4 ++- test/Python/src/StructAsType.lf | 4 ++- test/Python/src/StructAsTypeDirect.lf | 4 ++- test/Python/src/StructParallel.lf | 4 ++- test/Python/src/StructPrint.lf | 8 +++-- test/Python/src/StructScale.lf | 8 +++-- test/Python/src/TestForPreviousOutput.lf | 4 ++- test/Python/src/TimeLimit.lf | 4 ++- test/Python/src/TimeState.lf | 4 ++- test/Python/src/Timers.lf | 8 +++-- .../src/TriggerDownstreamOnlyIfPresent2.lf | 4 ++- test/Python/src/Wcet.lf | 4 ++- .../src/docker/FilesPropertyContainerized.lf | 4 ++- .../Python/src/federated/BroadcastFeedback.lf | 4 ++- .../BroadcastFeedbackWithHierarchy.lf | 8 +++-- test/Python/src/federated/CycleDetection.lf | 16 +++++++--- .../src/federated/DecentralizedP2PComm.lf | 4 ++- .../DecentralizedP2PUnbalancedTimeout.lf | 12 +++++-- ...centralizedP2PUnbalancedTimeoutPhysical.lf | 8 +++-- test/Python/src/federated/DistributedBank.lf | 4 ++- .../federated/DistributedBankToMultiport.lf | 4 ++- test/Python/src/federated/DistributedCount.lf | 4 ++- .../DistributedCountDecentralized.lf | 4 ++- .../DistributedCountDecentralizedLate.lf | 4 ++- .../src/federated/DistributedCountPhysical.lf | 4 ++- .../DistributedCountPhysicalAfterDelay.lf | 4 ++- .../DistributedCountPhysicalDecentralized.lf | 4 ++- .../src/federated/DistributedDoublePort.lf | 12 +++++-- .../src/federated/DistributedLoopedAction.lf | 4 ++- .../DistributedLoopedPhysicalAction.lf | 8 +++-- .../src/federated/DistributedMultiport.lf | 4 ++- .../federated/DistributedMultiportToBank.lf | 4 ++- .../src/federated/DistributedNoReact.lf | 4 ++- .../src/federated/DistributedSendClass.lf | 8 +++-- test/Python/src/federated/DistributedStop.lf | 4 ++- .../src/federated/DistributedStopZero.lf | 12 +++++-- .../src/federated/DistributedStructAsType.lf | 4 ++- .../DistributedStructAsTypeDirect.lf | 4 ++- .../federated/DistributedStructParallel.lf | 4 ++- .../src/federated/DistributedStructPrint.lf | 4 ++- .../src/federated/DistributedStructScale.lf | 4 ++- test/Python/src/federated/HelloDistributed.lf | 4 ++- ...stributedCentralizedPrecedenceHierarchy.lf | 8 +++-- test/Python/src/federated/PhysicalSTP.lf | 4 ++- .../src/federated/PingPongDistributed.lf | 4 ++- test/Python/src/federated/StopAtShutdown.lf | 20 +++++++++--- test/Python/src/lib/Imported.lf | 4 ++- test/Python/src/lib/ImportedComposition.lf | 4 ++- test/Python/src/lib/InternalDelay.lf | 8 +++-- test/Python/src/lib/TestCount.lf | 4 ++- test/Python/src/lib/TestCountMultiport.lf | 4 ++- .../modal_models/BanksCount3ModesComplex.lf | 8 +++-- .../src/modal_models/ConvertCaseTest.lf | 32 ++++++++++++++----- test/Python/src/modal_models/Count3Modes.lf | 5 ++- test/Python/src/modal_models/ModalActions.lf | 5 ++- test/Python/src/modal_models/ModalAfter.lf | 5 ++- .../src/modal_models/ModalCycleBreaker.lf | 9 ++++-- .../src/modal_models/ModalNestedReactions.lf | 13 ++++++-- .../src/modal_models/ModalStartupShutdown.lf | 5 ++- .../src/modal_models/ModalStateReset.lf | 13 ++++++-- .../src/modal_models/ModalStateResetAuto.lf | 5 ++- test/Python/src/modal_models/ModalTimers.lf | 5 ++- .../MultipleOutputFeeder_2Connections.lf | 18 ++++++++--- ...ultipleOutputFeeder_ReactionConnections.lf | 22 ++++++++++--- .../src/modal_models/util/TraceTesting.lf | 4 ++- .../src/multiport/BankIndexInitializer.lf | 8 +++-- test/Python/src/multiport/BankToMultiport.lf | 4 ++- test/Python/src/multiport/Broadcast.lf | 4 ++- .../Python/src/multiport/MultiportFromBank.lf | 4 ++- .../multiport/MultiportFromBankHierarchy.lf | 4 ++- test/Python/src/multiport/MultiportIn.lf | 4 ++- .../src/multiport/MultiportInParameterized.lf | 4 ++- test/Python/src/multiport/MultiportOut.lf | 4 ++- test/Python/src/multiport/PipelineAfter.lf | 8 +++-- .../Python/src/multiport/ReactionsToNested.lf | 8 +++-- test/Python/src/target/AfterNoTypes.lf | 8 +++-- test/Rust/src/ActionImplicitDelay.lf | 4 ++- test/Rust/src/ActionValuesCleanup.lf | 4 ++- .../src/CompositionInitializationOrder.lf | 12 +++++-- test/Rust/src/CompositionWithPorts.lf | 4 ++- test/Rust/src/DependencyOnChildPort.lf | 8 +++-- test/Rust/src/DependencyThroughChildPort.lf | 4 ++- test/Rust/src/DependencyUseAccessible.lf | 13 ++++++-- test/Rust/src/DependencyUseNonTrigger.lf | 12 +++++-- test/Rust/src/Import.lf | 4 ++- test/Rust/src/ImportPreambleItem.lf | 4 ++- test/Rust/src/MainReactorParam.lf | 4 ++- test/Rust/src/Minimal.lf | 4 ++- test/Rust/src/MovingAverage.lf | 8 +++-- test/Rust/src/NativeListsAndTimes.lf | 5 ++- test/Rust/src/PortConnectionInSelfOutSelf.lf | 4 ++- .../Rust/src/PortConnectionOutChildOutSelf.lf | 8 +++-- test/Rust/src/PortValueCleanup.lf | 4 ++- test/Rust/src/Preamble.lf | 4 ++- test/Rust/src/ReactionLabels.lf | 5 ++- test/Rust/src/SingleFileGeneration.lf | 4 ++- test/Rust/src/StopNoEvent.lf | 4 ++- test/Rust/src/StructAsType.lf | 4 ++- test/Rust/src/TimeState.lf | 4 ++- test/Rust/src/Timers.lf | 8 +++-- test/Rust/src/concurrent/AsyncCallback.lf | 4 ++- test/Rust/src/generics/CtorParamGeneric.lf | 9 ++++-- .../Rust/src/generics/CtorParamGenericInst.lf | 14 +++++--- test/Rust/src/generics/GenericComplexType.lf | 4 ++- test/Rust/src/generics/GenericReactor.lf | 12 +++++-- test/Rust/src/lib/Imported.lf | 4 ++- .../src/multiport/ConnectionToSelfBank.lf | 4 ++- test/Rust/src/multiport/CycledLhs_SelfLoop.lf | 8 +++-- test/Rust/src/multiport/CycledLhs_Single.lf | 8 +++-- test/Rust/src/multiport/FullyConnected.lf | 4 ++- test/Rust/src/multiport/MultiportFromBank.lf | 4 ++- .../multiport/ReadOutputOfContainedBank.lf | 4 ++- test/Rust/src/multiport/WidthWithParameter.lf | 4 ++- .../multiport/WriteInputOfContainedBank.lf | 4 ++- .../src/target/CargoDependencyOnRuntime.lf | 4 ++- test/Rust/src/target/CliFeature.lf | 4 ++- test/TypeScript/src/ActionDelay.lf | 8 +++-- test/TypeScript/src/ActionWithNoReaction.lf | 4 ++- test/TypeScript/src/After.lf | 8 +++-- test/TypeScript/src/ArrayAsParameter.lf | 4 ++- test/TypeScript/src/ArrayAsType.lf | 8 +++-- test/TypeScript/src/ArrayPrint.lf | 8 +++-- test/TypeScript/src/ArrayScale.lf | 8 +++-- test/TypeScript/src/DanglingOutput.lf | 4 ++- test/TypeScript/src/DelayInt.lf | 8 +++-- test/TypeScript/src/DelayedAction.lf | 4 ++- test/TypeScript/src/DelayedReaction.lf | 4 ++- test/TypeScript/src/Determinism.lf | 8 +++-- test/TypeScript/src/Gain.lf | 8 +++-- test/TypeScript/src/HelloWorld.lf | 4 ++- test/TypeScript/src/Hierarchy2.lf | 4 ++- test/TypeScript/src/Import.lf | 4 ++- test/TypeScript/src/Microsteps.lf | 4 ++- test/TypeScript/src/Minimal.lf | 4 ++- test/TypeScript/src/MovingAverage.lf | 4 ++- test/TypeScript/src/MultipleContained.lf | 4 ++- test/TypeScript/src/ParameterizedState.lf | 4 ++- test/TypeScript/src/PhysicalConnection.lf | 4 ++- .../src/ReadOutputOfContainedReactor.lf | 4 ++- test/TypeScript/src/Schedule.lf | 8 +++-- test/TypeScript/src/ScheduleLogicalAction.lf | 8 +++-- test/TypeScript/src/SendingInside2.lf | 4 ++- test/TypeScript/src/SendsPointerTest.lf | 12 +++++-- test/TypeScript/src/SlowingClock.lf | 4 ++- test/TypeScript/src/Stride.lf | 4 ++- test/TypeScript/src/TimeLimit.lf | 4 ++- test/TypeScript/src/TimeState.lf | 4 ++- test/TypeScript/src/Wcet.lf | 4 ++- .../src/federated/DistributedDoublePort.lf | 12 +++++-- .../src/federated/HelloDistributed.lf | 8 +++-- .../src/federated/SpuriousDependency.lf | 8 +++-- .../src/federated/StopAtShutdown.lf | 20 +++++++++--- .../src/federated/TopLevelArtifacts.lf | 8 +++-- test/TypeScript/src/lib/Count.lf | 4 ++- test/TypeScript/src/lib/Imported.lf | 4 ++- test/TypeScript/src/lib/InternalDelay.lf | 8 +++-- .../src/multiport/BankSelfBroadcast.lf | 4 ++- .../src/multiport/BankToMultiport.lf | 4 ++- test/TypeScript/src/multiport/Broadcast.lf | 4 ++- .../src/multiport/BroadcastAfter.lf | 4 ++- .../src/multiport/BroadcastMultipleAfter.lf | 4 ++- .../src/multiport/MultiportFromBank.lf | 4 ++- test/TypeScript/src/multiport/MultiportIn.lf | 8 +++-- .../src/multiport/MultiportInParameterized.lf | 4 ++- .../multiport/MultiportMutableInputArray.lf | 16 +++++++--- .../multiport/MultiportToMultiportArray.lf | 8 +++-- .../TypeScript/src/multiport/PipelineAfter.lf | 8 +++-- .../src/multiport/ReactionsToNested.lf | 8 +++-- 454 files changed, 2181 insertions(+), 712 deletions(-) diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index 9646bea79c..50ffb442ea 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -1,5 +1,6 @@ package org.lflang.ast; +import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -91,6 +92,12 @@ public class ToLf extends LfSwitch { /// public instance initialized when loading the class public static final ToLf instance = new ToLf(); + /** + * The eObjects in the syntax tree on the path from the root up to and including the current + * eObject. + */ + private final ArrayDeque callStack = new ArrayDeque<>(); + // private constructor private ToLf() { super(); @@ -104,6 +111,13 @@ public MalleableString caseArraySpec(ArraySpec spec) { @Override public MalleableString doSwitch(EObject eObject) { + callStack.push(eObject); + var ret = doSwitchHelper(eObject); + callStack.pop(); + return ret; + } + + private MalleableString doSwitchHelper(EObject eObject) { ICompositeNode node = NodeModelUtils.findActualNodeFor(eObject); if (node == null) return super.doSwitch(eObject); var ancestorComments = getAncestorComments(node); @@ -257,6 +271,9 @@ public MalleableString caseCode(Code code) { if (content.lines().count() > 1 || content.contains("#") || content.contains("//")) { return multilineRepresentation; } + if (callStack.stream().anyMatch(it -> it instanceof Code) && !content.isBlank()) { + return MalleableString.anyOf(multilineRepresentation); + } return MalleableString.anyOf(singleLineRepresentation, multilineRepresentation); } diff --git a/test/C/src/ActionDelay.lf b/test/C/src/ActionDelay.lf index 90847eb9d5..d1f94cb3e5 100644 --- a/test/C/src/ActionDelay.lf +++ b/test/C/src/ActionDelay.lf @@ -12,13 +12,17 @@ reactor GeneratedDelay { lf_schedule(act, MSEC(0)); =} - reaction(act) -> y_out {= lf_set(y_out, self->y_state); =} + reaction(act) -> y_out {= + lf_set(y_out, self->y_state); + =} } reactor Source { output out: int - reaction(startup) -> out {= lf_set(out, 1); =} + reaction(startup) -> out {= + lf_set(out, 1); + =} } reactor Sink { diff --git a/test/C/src/ActionWithNoReaction.lf b/test/C/src/ActionWithNoReaction.lf index 0143d67cce..e1f19c7ffe 100644 --- a/test/C/src/ActionWithNoReaction.lf +++ b/test/C/src/ActionWithNoReaction.lf @@ -33,5 +33,7 @@ main reactor ActionWithNoReaction { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= lf_set(f.x, 42); =} + reaction(t) -> f.x {= + lf_set(f.x, 42); + =} } diff --git a/test/C/src/After.lf b/test/C/src/After.lf index f21c6b7f76..60816c7f78 100644 --- a/test/C/src/After.lf +++ b/test/C/src/After.lf @@ -8,7 +8,9 @@ reactor foo { input x: int output y: int - reaction(x) -> y {= lf_set(y, 2*x->value); =} + reaction(x) -> y {= + lf_set(y, 2*x->value); + =} } reactor print { @@ -47,5 +49,7 @@ main reactor After { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= lf_set(f.x, 42); =} + reaction(t) -> f.x {= + lf_set(f.x, 42); + =} } diff --git a/test/C/src/AfterCycles.lf b/test/C/src/AfterCycles.lf index cc2eab638e..3e75f8fded 100644 --- a/test/C/src/AfterCycles.lf +++ b/test/C/src/AfterCycles.lf @@ -5,14 +5,18 @@ target C reactor Source { output out: unsigned - reaction(startup) -> out {= lf_set(out, 1); =} + reaction(startup) -> out {= + lf_set(out, 1); + =} } reactor Work { input in: unsigned output out: unsigned - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } main reactor AfterCycles { diff --git a/test/C/src/AfterZero.lf b/test/C/src/AfterZero.lf index 10fc9d7a8b..ce6cedbe90 100644 --- a/test/C/src/AfterZero.lf +++ b/test/C/src/AfterZero.lf @@ -8,7 +8,9 @@ reactor foo { input x: int output y: int - reaction(x) -> y {= SET(y, 2*x->value); =} + reaction(x) -> y {= + SET(y, 2*x->value); + =} } reactor print { @@ -52,5 +54,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x after 0 - reaction(t) -> f.x {= SET(f.x, 42); =} + reaction(t) -> f.x {= + SET(f.x, 42); + =} } diff --git a/test/C/src/Alignment.lf b/test/C/src/Alignment.lf index c1cba1b948..5884126d58 100644 --- a/test/C/src/Alignment.lf +++ b/test/C/src/Alignment.lf @@ -9,7 +9,9 @@ reactor Source { state count: int = 1 timer t(0, 100 msec) - reaction(t) -> out {= lf_set(out, self->count++); =} + reaction(t) -> out {= + lf_set(out, self->count++); + =} } reactor Sieve { diff --git a/test/C/src/CompositionGain.lf b/test/C/src/CompositionGain.lf index a34c95c10c..43220614f4 100644 --- a/test/C/src/CompositionGain.lf +++ b/test/C/src/CompositionGain.lf @@ -22,7 +22,9 @@ reactor Wrapper { main reactor CompositionGain { wrapper = new Wrapper() - reaction(startup) -> wrapper.x {= lf_set(wrapper.x, 42); =} + reaction(startup) -> wrapper.x {= + lf_set(wrapper.x, 42); + =} reaction(wrapper.y) {= printf("Received %d\n", wrapper.y->value); diff --git a/test/C/src/DanglingOutput.lf b/test/C/src/DanglingOutput.lf index 8c39ad5612..2167d3556f 100644 --- a/test/C/src/DanglingOutput.lf +++ b/test/C/src/DanglingOutput.lf @@ -6,7 +6,9 @@ reactor Source { output out: int timer t - reaction(t) -> out {= lf_set(out, 1); =} + reaction(t) -> out {= + lf_set(out, 1); + =} } reactor Gain { diff --git a/test/C/src/DeadlineAnytime.lf b/test/C/src/DeadlineAnytime.lf index 5ba39e36e0..fcb84e7a4e 100644 --- a/test/C/src/DeadlineAnytime.lf +++ b/test/C/src/DeadlineAnytime.lf @@ -8,9 +8,13 @@ reactor A { reaction(startup) -> a {= self->i = 0; while (!lf_check_deadline(self, true)); - =} deadline(10 msec) {= lf_schedule(a, 0); =} + =} deadline(10 msec) {= + lf_schedule(a, 0); + =} - reaction(a) {= self->i = 42; =} + reaction(a) {= + self->i = 42; + =} reaction(shutdown) {= if (self->i == 42) { diff --git a/test/C/src/DeadlineInherited.lf b/test/C/src/DeadlineInherited.lf index 5c99bd56a6..785087b18b 100644 --- a/test/C/src/DeadlineInherited.lf +++ b/test/C/src/DeadlineInherited.lf @@ -4,13 +4,19 @@ target C { threading: false } -preamble {= extern int global_cnt; =} +preamble {= + extern int global_cnt; +=} reactor NoDeadline { - preamble {= int global_cnt = 0; =} + preamble {= + int global_cnt = 0; + =} timer t(0 msec, 100 msec) - reaction(t) {= global_cnt++; =} + reaction(t) {= + global_cnt++; + =} } reactor WithDeadline { diff --git a/test/C/src/DeadlinePriority.lf b/test/C/src/DeadlinePriority.lf index 58761975ac..95db38a259 100644 --- a/test/C/src/DeadlinePriority.lf +++ b/test/C/src/DeadlinePriority.lf @@ -4,13 +4,19 @@ target C { threading: false } -preamble {= extern int global_cnt; =} +preamble {= + extern int global_cnt; +=} reactor NoDeadline { - preamble {= int global_cnt = 0; =} + preamble {= + int global_cnt = 0; + =} timer t(0 msec, 100 msec) - reaction(t) {= global_cnt++; =} + reaction(t) {= + global_cnt++; + =} } reactor WithDeadline { diff --git a/test/C/src/DeadlineWithAfterDelay.lf b/test/C/src/DeadlineWithAfterDelay.lf index 9478d8e00f..12bd80425b 100644 --- a/test/C/src/DeadlineWithAfterDelay.lf +++ b/test/C/src/DeadlineWithAfterDelay.lf @@ -4,10 +4,14 @@ target C { threading: false } -preamble {= extern int global_cnt; =} +preamble {= + extern int global_cnt; +=} reactor Source { - preamble {= int global_cnt = 0; =} + preamble {= + int global_cnt = 0; + =} output out: int timer t(0 msec, 100 msec) diff --git a/test/C/src/DeadlineWithBanks.lf b/test/C/src/DeadlineWithBanks.lf index 471d22682e..7d8c06b8fd 100644 --- a/test/C/src/DeadlineWithBanks.lf +++ b/test/C/src/DeadlineWithBanks.lf @@ -8,10 +8,14 @@ target C { build-type: Debug } -preamble {= extern volatile int global_cnt; =} +preamble {= + extern volatile int global_cnt; +=} reactor Bank(bank_index: int = 0) { - preamble {= volatile int global_cnt = 0; =} + preamble {= + volatile int global_cnt = 0; + =} timer t(0, 100 msec) output out: int diff --git a/test/C/src/DeadlineZero.lf b/test/C/src/DeadlineZero.lf index 26f556a800..e4408d3917 100644 --- a/test/C/src/DeadlineZero.lf +++ b/test/C/src/DeadlineZero.lf @@ -10,14 +10,18 @@ reactor Detector { reaction(trigger) {= printf("ERROR: failed to detect zero-duration deadline at iteration %d.\n", self->cnt); exit(1); - =} deadline(0 msec) {= self->cnt++; =} + =} deadline(0 msec) {= + self->cnt++; + =} } reactor Generator { output pulse: int timer t(0, 100 msec) - reaction(t) -> pulse {= lf_set(pulse, 0); =} + reaction(t) -> pulse {= + lf_set(pulse, 0); + =} } main reactor { diff --git a/test/C/src/DelayArray.lf b/test/C/src/DelayArray.lf index 6f4bd6a754..7e024b1133 100644 --- a/test/C/src/DelayArray.lf +++ b/test/C/src/DelayArray.lf @@ -8,9 +8,13 @@ reactor DelayPointer(delay: time = 100 msec) { output out: int[] logical action a: int[] - reaction(in) -> a {= lf_schedule_token(a, self->delay, in->token); =} + reaction(in) -> a {= + lf_schedule_token(a, self->delay, in->token); + =} - reaction(a) -> out {= lf_set_token(out, a->token); =} + reaction(a) -> out {= + lf_set_token(out, a->token); + =} } reactor Source { diff --git a/test/C/src/DelayInt.lf b/test/C/src/DelayInt.lf index 58e74b2b8a..f3e1501414 100644 --- a/test/C/src/DelayInt.lf +++ b/test/C/src/DelayInt.lf @@ -6,7 +6,9 @@ reactor Delay(delay: time = 100 msec) { output out: int logical action a: int - reaction(a) -> out {= if (a->has_value && a->is_present) lf_set(out, a->value); =} + reaction(a) -> out {= + if (a->has_value && a->is_present) lf_set(out, a->value); + =} reaction(in) -> a {= // Use specialized form of schedule for integer payloads. @@ -55,5 +57,7 @@ main reactor DelayInt { t = new Test() d.out -> t.in - reaction(startup) -> d.in {= lf_set(d.in, 42); =} + reaction(startup) -> d.in {= + lf_set(d.in, 42); + =} } diff --git a/test/C/src/DelayString.lf b/test/C/src/DelayString.lf index f49cd270de..052e304ac3 100644 --- a/test/C/src/DelayString.lf +++ b/test/C/src/DelayString.lf @@ -16,7 +16,9 @@ reactor DelayString2(delay: time = 100 msec) { output out: string logical action a: string - reaction(a) -> out {= lf_set(out, a->value); =} + reaction(a) -> out {= + lf_set(out, a->value); + =} reaction(in) -> a {= // The following copies the char*, not the string. @@ -48,5 +50,7 @@ main reactor { t = new Test() d.out -> t.in - reaction(startup) -> d.in {= lf_set(d.in, "Hello"); =} + reaction(startup) -> d.in {= + lf_set(d.in, "Hello"); + =} } diff --git a/test/C/src/DelayedAction.lf b/test/C/src/DelayedAction.lf index 529f92badf..3b3b3a9f7a 100644 --- a/test/C/src/DelayedAction.lf +++ b/test/C/src/DelayedAction.lf @@ -8,7 +8,9 @@ main reactor DelayedAction { logical action a state count: int = 0 - reaction(t) -> a {= lf_schedule(a, MSEC(100)); =} + reaction(t) -> a {= + lf_schedule(a, MSEC(100)); + =} reaction(a) {= interval_t elapsed = lf_time_logical_elapsed(); diff --git a/test/C/src/DelayedReaction.lf b/test/C/src/DelayedReaction.lf index 41cb9f3052..2b9bf0a275 100644 --- a/test/C/src/DelayedReaction.lf +++ b/test/C/src/DelayedReaction.lf @@ -5,7 +5,9 @@ reactor Source { output out: int timer t - reaction(t) -> out {= lf_set(out, 1); =} + reaction(t) -> out {= + lf_set(out, 1); + =} } reactor Sink { diff --git a/test/C/src/Determinism.lf b/test/C/src/Determinism.lf index 6ccc7dde34..c6e66c521c 100644 --- a/test/C/src/Determinism.lf +++ b/test/C/src/Determinism.lf @@ -4,7 +4,9 @@ reactor Source { output y: int timer t - reaction(t) -> y {= lf_set(y, 1); =} + reaction(t) -> y {= + lf_set(y, 1); + =} } reactor Destination { @@ -31,7 +33,9 @@ reactor Pass { input x: int output y: int - reaction(x) -> y {= lf_set(y, x->value); =} + reaction(x) -> y {= + lf_set(y, x->value); + =} } main reactor Determinism { diff --git a/test/C/src/DoublePort.lf b/test/C/src/DoublePort.lf index 046a4f951f..b17bf6d71b 100644 --- a/test/C/src/DoublePort.lf +++ b/test/C/src/DoublePort.lf @@ -17,9 +17,13 @@ reactor CountMicrostep { logical action act: int timer t(0, 1 sec) - reaction(t) -> act {= lf_schedule_int(act, 0, self->count++); =} + reaction(t) -> act {= + lf_schedule_int(act, 0, self->count++); + =} - reaction(act) -> out {= lf_set(out, act->value); =} + reaction(act) -> out {= + lf_set(out, act->value); + =} } reactor Print { @@ -35,7 +39,9 @@ reactor Print { } =} - reaction(shutdown) {= printf("SUCCESS: messages were at least one microstep apart.\n"); =} + reaction(shutdown) {= + printf("SUCCESS: messages were at least one microstep apart.\n"); + =} } main reactor DoublePort { diff --git a/test/C/src/Gain.lf b/test/C/src/Gain.lf index bc096cf77c..d2ea2e4893 100644 --- a/test/C/src/Gain.lf +++ b/test/C/src/Gain.lf @@ -5,7 +5,9 @@ reactor Scale(scale: int = 2) { input x: int output y: int - reaction(x) -> y {= lf_set(y, x->value * self->scale); =} + reaction(x) -> y {= + lf_set(y, x->value * self->scale); + =} } reactor Test { @@ -35,5 +37,7 @@ main reactor Gain { d = new Test() g.y -> d.x - reaction(startup) -> g.x {= lf_set(g.x, 1); =} + reaction(startup) -> g.x {= + lf_set(g.x, 1); + =} } diff --git a/test/C/src/GetMicroStep.lf b/test/C/src/GetMicroStep.lf index 4f0fda5e9f..eb5e3d0a49 100644 --- a/test/C/src/GetMicroStep.lf +++ b/test/C/src/GetMicroStep.lf @@ -6,7 +6,9 @@ main reactor GetMicroStep { logical action l - reaction(startup) -> l {= lf_schedule(l, 0); =} + reaction(startup) -> l {= + lf_schedule(l, 0); + =} reaction(l) -> l {= microstep_t microstep = lf_tag().microstep; diff --git a/test/C/src/Hierarchy.lf b/test/C/src/Hierarchy.lf index 47efcf6b65..8049f6b755 100644 --- a/test/C/src/Hierarchy.lf +++ b/test/C/src/Hierarchy.lf @@ -5,7 +5,9 @@ reactor Source { output out: int timer t - reaction(t) -> out {= lf_set(out, 1); =} + reaction(t) -> out {= + lf_set(out, 1); + =} } reactor Gain { diff --git a/test/C/src/Hierarchy2.lf b/test/C/src/Hierarchy2.lf index 7e361dc580..bb565c72ae 100644 --- a/test/C/src/Hierarchy2.lf +++ b/test/C/src/Hierarchy2.lf @@ -8,7 +8,9 @@ reactor Source { output out: int timer t(0, 1 sec) - reaction(t) -> out {= lf_set(out, 1); =} + reaction(t) -> out {= + lf_set(out, 1); + =} } reactor Count { diff --git a/test/C/src/Import.lf b/test/C/src/Import.lf index 812f14edaa..afcd6e585b 100644 --- a/test/C/src/Import.lf +++ b/test/C/src/Import.lf @@ -7,5 +7,7 @@ main reactor Import { timer t a = new Imported() - reaction(t) -> a.x {= lf_set(a.x, 42); =} + reaction(t) -> a.x {= + lf_set(a.x, 42); + =} } diff --git a/test/C/src/ImportComposition.lf b/test/C/src/ImportComposition.lf index 41e493f8d9..654a1d9283 100644 --- a/test/C/src/ImportComposition.lf +++ b/test/C/src/ImportComposition.lf @@ -7,7 +7,9 @@ main reactor ImportComposition { a = new ImportedComposition() state received: bool = false - reaction(startup) -> a.x {= lf_set(a.x, 42); =} + reaction(startup) -> a.x {= + lf_set(a.x, 42); + =} reaction(a.y) {= interval_t receive_time = lf_time_logical_elapsed(); diff --git a/test/C/src/ImportRenamed.lf b/test/C/src/ImportRenamed.lf index 6ddee69dfa..8158f74da7 100644 --- a/test/C/src/ImportRenamed.lf +++ b/test/C/src/ImportRenamed.lf @@ -11,5 +11,7 @@ main reactor { b = new Y() c = new Z() - reaction(t) -> a.x {= lf_set(a.x, 42); =} + reaction(t) -> a.x {= + lf_set(a.x, 42); + =} } diff --git a/test/C/src/InheritanceAction.lf b/test/C/src/InheritanceAction.lf index e2b5857ff7..7e60ea23c3 100644 --- a/test/C/src/InheritanceAction.lf +++ b/test/C/src/InheritanceAction.lf @@ -7,11 +7,15 @@ reactor Source { logical action foo: int output y: int - reaction(foo) -> y {= lf_set(y, foo->value); =} + reaction(foo) -> y {= + lf_set(y, foo->value); + =} } reactor SourceExtended extends Source { - reaction(startup) -> foo {= lf_schedule_int(foo, 0, 42); =} + reaction(startup) -> foo {= + lf_schedule_int(foo, 0, 42); + =} } reactor Test { diff --git a/test/C/src/ManualDelayedReaction.lf b/test/C/src/ManualDelayedReaction.lf index 24f5cc3d23..c81dabb590 100644 --- a/test/C/src/ManualDelayedReaction.lf +++ b/test/C/src/ManualDelayedReaction.lf @@ -18,14 +18,19 @@ reactor GeneratedDelay { lf_schedule(act, MSEC(100)); =} - reaction(act) -> y_out {= lf_set(y_out, self->y_state); =} + reaction(act) -> y_out {= + lf_set(y_out, self->y_state); + =} } reactor Source { output out: int timer t - reaction(t) -> out {= lf_set(out, 1); =} // reaction(t) -> out after 100 msec + // reaction(t) -> out after 100 msec + reaction(t) -> out {= + lf_set(out, 1); + =} } reactor Sink { diff --git a/test/C/src/Methods.lf b/test/C/src/Methods.lf index 2d69d5c77d..6409cb1a27 100644 --- a/test/C/src/Methods.lf +++ b/test/C/src/Methods.lf @@ -3,9 +3,13 @@ target C main reactor { state foo: int = 2 - method getFoo(): int {= return self->foo; =} + method getFoo(): int {= + return self->foo; + =} - method add(x: int) {= self->foo += x; =} + method add(x: int) {= + self->foo += x; + =} reaction(startup) {= lf_print("Foo is initialized to %d", getFoo()); diff --git a/test/C/src/MethodsRecursive.lf b/test/C/src/MethodsRecursive.lf index 4e04a0a901..09761cc279 100644 --- a/test/C/src/MethodsRecursive.lf +++ b/test/C/src/MethodsRecursive.lf @@ -10,7 +10,9 @@ main reactor { return add(fib(n-1), fib(n-2)); =} - method add(x: int, y: int): int {= return x + y; =} + method add(x: int, y: int): int {= + return x + y; + =} reaction(startup) {= for (int n = 1; n < 10; n++) { diff --git a/test/C/src/MethodsSameName.lf b/test/C/src/MethodsSameName.lf index db07a5cd75..e4683d8f7f 100644 --- a/test/C/src/MethodsSameName.lf +++ b/test/C/src/MethodsSameName.lf @@ -4,7 +4,9 @@ target C reactor Foo { state foo: int = 2 - method add(x: int) {= self->foo += x; =} + method add(x: int) {= + self->foo += x; + =} reaction(startup) {= add(40); @@ -20,7 +22,9 @@ main reactor { a = new Foo() - method add(x: int) {= self->foo += x; =} + method add(x: int) {= + self->foo += x; + =} reaction(startup) {= add(40); diff --git a/test/C/src/Microsteps.lf b/test/C/src/Microsteps.lf index 6a2915b53f..12515731e3 100644 --- a/test/C/src/Microsteps.lf +++ b/test/C/src/Microsteps.lf @@ -37,5 +37,7 @@ main reactor Microsteps { lf_schedule(repeat, 0); =} - reaction(repeat) -> d.y {= lf_set(d.y, 1); =} + reaction(repeat) -> d.y {= + lf_set(d.y, 1); + =} } diff --git a/test/C/src/Minimal.lf b/test/C/src/Minimal.lf index b2534ab993..4b38e6a61e 100644 --- a/test/C/src/Minimal.lf +++ b/test/C/src/Minimal.lf @@ -2,5 +2,7 @@ target C main reactor Minimal { - reaction(startup) {= printf("Hello World.\n"); =} + reaction(startup) {= + printf("Hello World.\n"); + =} } diff --git a/test/C/src/MultipleContained.lf b/test/C/src/MultipleContained.lf index 1e98bff1fb..6354101b93 100644 --- a/test/C/src/MultipleContained.lf +++ b/test/C/src/MultipleContained.lf @@ -7,7 +7,9 @@ reactor Contained { input in2: int state count: int = 0 - reaction(startup) -> trigger {= lf_set(trigger, 42); =} + reaction(startup) -> trigger {= + lf_set(trigger, 42); + =} reaction(in1) {= printf("in1 received %d.\n", in1->value); diff --git a/test/C/src/NestedTriggeredReactions.lf b/test/C/src/NestedTriggeredReactions.lf index ca9ce7476c..59364c2b22 100644 --- a/test/C/src/NestedTriggeredReactions.lf +++ b/test/C/src/NestedTriggeredReactions.lf @@ -9,7 +9,9 @@ reactor Container { in -> contained.in - reaction(in) {= self->triggered = true; =} + reaction(in) {= + self->triggered = true; + =} reaction(shutdown) {= if (!self->triggered) { @@ -23,7 +25,9 @@ reactor Contained { state triggered: bool = false - reaction(in) {= self->triggered = true; =} + reaction(in) {= + self->triggered = true; + =} reaction(shutdown) {= if (!self->triggered) { @@ -35,5 +39,7 @@ reactor Contained { main reactor { container = new Container() - reaction(startup) -> container.in {= lf_set(container.in, true); =} + reaction(startup) -> container.in {= + lf_set(container.in, true); + =} } diff --git a/test/C/src/ParameterizedState.lf b/test/C/src/ParameterizedState.lf index 5b601a740b..78ace1c297 100644 --- a/test/C/src/ParameterizedState.lf +++ b/test/C/src/ParameterizedState.lf @@ -3,7 +3,9 @@ target C reactor Foo(bar: int = 42) { state baz = bar - reaction(startup) {= printf("Baz: %d\n", self->baz); =} + reaction(startup) {= + printf("Baz: %d\n", self->baz); + =} } main reactor { diff --git a/test/C/src/PhysicalConnection.lf b/test/C/src/PhysicalConnection.lf index af478e0425..4a7959a947 100644 --- a/test/C/src/PhysicalConnection.lf +++ b/test/C/src/PhysicalConnection.lf @@ -4,7 +4,9 @@ target C reactor Source { output out: int - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } reactor Destination { diff --git a/test/C/src/PingPong.lf b/test/C/src/PingPong.lf index c38bd36683..404fd9c798 100644 --- a/test/C/src/PingPong.lf +++ b/test/C/src/PingPong.lf @@ -28,7 +28,9 @@ reactor Ping(count: int = 10) { state pingsLeft: int = count logical action serve - reaction(startup, serve) -> send {= lf_set(send, self->pingsLeft--); =} + reaction(startup, serve) -> send {= + lf_set(send, self->pingsLeft--); + =} reaction(receive) -> serve {= if (self->pingsLeft > 0) { diff --git a/test/C/src/PreambleInherited.lf b/test/C/src/PreambleInherited.lf index 83f4a59d44..771185bdbc 100644 --- a/test/C/src/PreambleInherited.lf +++ b/test/C/src/PreambleInherited.lf @@ -6,7 +6,9 @@ reactor A { #define FOO 2 =} - reaction(startup) {= printf("FOO: %d\n", FOO); =} + reaction(startup) {= + printf("FOO: %d\n", FOO); + =} } reactor B extends A { diff --git a/test/C/src/ReadOutputOfContainedReactor.lf b/test/C/src/ReadOutputOfContainedReactor.lf index 0625d9ccf3..4ae3ae44f9 100644 --- a/test/C/src/ReadOutputOfContainedReactor.lf +++ b/test/C/src/ReadOutputOfContainedReactor.lf @@ -4,7 +4,9 @@ target C reactor Contained { output out: int - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } main reactor ReadOutputOfContainedReactor { diff --git a/test/C/src/RepeatedInheritance.lf b/test/C/src/RepeatedInheritance.lf index 7de84864cd..b6ff4cbc34 100644 --- a/test/C/src/RepeatedInheritance.lf +++ b/test/C/src/RepeatedInheritance.lf @@ -27,7 +27,9 @@ reactor A extends B, C { input a: int output out: int - reaction(a, b, c, d) -> out {= lf_set(out, a->value + b->value + c->value + d->value); =} + reaction(a, b, c, d) -> out {= + lf_set(out, a->value + b->value + c->value + d->value); + =} } main reactor { diff --git a/test/C/src/Schedule.lf b/test/C/src/Schedule.lf index 09f9de5bd9..e0d1db3fcc 100644 --- a/test/C/src/Schedule.lf +++ b/test/C/src/Schedule.lf @@ -5,7 +5,9 @@ reactor Schedule2 { input x: int logical action a - reaction(x) -> a {= lf_schedule(a, MSEC(200)); =} + reaction(x) -> a {= + lf_schedule(a, MSEC(200)); + =} reaction(a) {= interval_t elapsed_time = lf_time_logical_elapsed(); @@ -21,5 +23,7 @@ main reactor { a = new Schedule2() timer t - reaction(t) -> a.x {= lf_set(a.x, 1); =} + reaction(t) -> a.x {= + lf_set(a.x, 1); + =} } diff --git a/test/C/src/ScheduleLogicalAction.lf b/test/C/src/ScheduleLogicalAction.lf index 72835f8a96..9b85f443b7 100644 --- a/test/C/src/ScheduleLogicalAction.lf +++ b/test/C/src/ScheduleLogicalAction.lf @@ -16,7 +16,9 @@ reactor foo { lf_schedule(a, MSEC(500)); =} - reaction(a) -> y {= lf_set(y, -42); =} + reaction(a) -> y {= + lf_set(y, -42); + =} } reactor print { @@ -42,5 +44,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x - reaction(t) -> f.x {= lf_set(f.x, 42); =} + reaction(t) -> f.x {= + lf_set(f.x, 42); + =} } diff --git a/test/C/src/SelfLoop.lf b/test/C/src/SelfLoop.lf index 204a5e856c..f6671dc225 100644 --- a/test/C/src/SelfLoop.lf +++ b/test/C/src/SelfLoop.lf @@ -24,7 +24,9 @@ reactor Self { lf_schedule_int(a, MSEC(100), x->value); =} - reaction(startup) -> a {= lf_schedule_int(a, 0, 42); =} + reaction(startup) -> a {= + lf_schedule_int(a, 0, 42); + =} reaction(shutdown) {= if (self->expected <= 43) { diff --git a/test/C/src/SendingInside2.lf b/test/C/src/SendingInside2.lf index ab15278044..ea016a6307 100644 --- a/test/C/src/SendingInside2.lf +++ b/test/C/src/SendingInside2.lf @@ -16,5 +16,7 @@ main reactor SendingInside2 { timer t p = new Printer() - reaction(t) -> p.x {= lf_set(p.x, 1); =} + reaction(t) -> p.x {= + lf_set(p.x, 1); + =} } diff --git a/test/C/src/SendsPointerTest.lf b/test/C/src/SendsPointerTest.lf index f05bec4934..d4478e75ed 100644 --- a/test/C/src/SendsPointerTest.lf +++ b/test/C/src/SendsPointerTest.lf @@ -2,7 +2,9 @@ // ensures that the struct is freed. target C -preamble {= typedef int* int_pointer; =} +preamble {= + typedef int* int_pointer; +=} reactor SendsPointer { output out: int_pointer diff --git a/test/C/src/SetToken.lf b/test/C/src/SetToken.lf index 6b589c6e57..6dc7badada 100644 --- a/test/C/src/SetToken.lf +++ b/test/C/src/SetToken.lf @@ -5,9 +5,13 @@ reactor Source { output out: int* logical action a: int - reaction(startup) -> a {= lf_schedule_int(a, MSEC(200), 42); =} + reaction(startup) -> a {= + lf_schedule_int(a, MSEC(200), 42); + =} - reaction(a) -> out {= lf_set_token(out, a->token); =} + reaction(a) -> out {= + lf_set_token(out, a->token); + =} } // expected parameter is for testing. diff --git a/test/C/src/SlowingClock.lf b/test/C/src/SlowingClock.lf index 36cb07c553..24d832149f 100644 --- a/test/C/src/SlowingClock.lf +++ b/test/C/src/SlowingClock.lf @@ -13,7 +13,9 @@ main reactor SlowingClock { state interval: time = 100 msec state expected_time: time = 100 msec - reaction(startup) -> a {= lf_schedule(a, 0); =} + reaction(startup) -> a {= + lf_schedule(a, 0); + =} reaction(a) -> a {= instant_t elapsed_logical_time = lf_time_logical_elapsed(); diff --git a/test/C/src/StartupOutFromInside.lf b/test/C/src/StartupOutFromInside.lf index 6233e0968f..b23ac76a55 100644 --- a/test/C/src/StartupOutFromInside.lf +++ b/test/C/src/StartupOutFromInside.lf @@ -3,7 +3,9 @@ target C reactor Bar { output out: int - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } main reactor StartupOutFromInside { diff --git a/test/C/src/TimeLimit.lf b/test/C/src/TimeLimit.lf index 4b1ea4f248..340cfff7f2 100644 --- a/test/C/src/TimeLimit.lf +++ b/test/C/src/TimeLimit.lf @@ -44,5 +44,7 @@ main reactor TimeLimit(period: time = 1 sec) { d = new Destination() c.y -> d.x - reaction(stop) {= lf_request_stop(); =} + reaction(stop) {= + lf_request_stop(); + =} } diff --git a/test/C/src/TimeState.lf b/test/C/src/TimeState.lf index d3aaf2029a..18447e4769 100644 --- a/test/C/src/TimeState.lf +++ b/test/C/src/TimeState.lf @@ -3,7 +3,9 @@ target C reactor Foo(bar: int = 42) { state baz: time = 500 msec - reaction(startup) {= printf("Baz: %lld\n", self->baz); =} + reaction(startup) {= + printf("Baz: %lld\n", self->baz); + =} } main reactor { diff --git a/test/C/src/UnconnectedInput.lf b/test/C/src/UnconnectedInput.lf index 71a141f158..87ea298959 100644 --- a/test/C/src/UnconnectedInput.lf +++ b/test/C/src/UnconnectedInput.lf @@ -9,7 +9,9 @@ reactor Source { timer t(0, 1 sec) state s: int = 1 - reaction(t) -> out {= lf_set(out, self->s++); =} + reaction(t) -> out {= + lf_set(out, self->s++); + =} } reactor Add { diff --git a/test/C/src/Wcet.lf b/test/C/src/Wcet.lf index 9e6f84be6a..d1aa88ae1b 100644 --- a/test/C/src/Wcet.lf +++ b/test/C/src/Wcet.lf @@ -31,7 +31,9 @@ reactor Work { reactor Print { input in: int - reaction(in) {= printf("Received: %d\n", in->value); =} + reaction(in) {= + printf("Received: %d\n", in->value); + =} } main reactor Wcet { diff --git a/test/C/src/arduino/Blink.lf b/test/C/src/arduino/Blink.lf index 2612e72a62..8fa855c03a 100644 --- a/test/C/src/arduino/Blink.lf +++ b/test/C/src/arduino/Blink.lf @@ -13,9 +13,15 @@ main reactor Blink { timer t1(0, 1 sec) timer t2(500 msec, 1 sec) - reaction(startup) {= pinMode(LED_BUILTIN, OUTPUT); =} + reaction(startup) {= + pinMode(LED_BUILTIN, OUTPUT); + =} - reaction(t1) {= digitalWrite(LED_BUILTIN, HIGH); =} + reaction(t1) {= + digitalWrite(LED_BUILTIN, HIGH); + =} - reaction(t2) {= digitalWrite(LED_BUILTIN, LOW); =} + reaction(t2) {= + digitalWrite(LED_BUILTIN, LOW); + =} } diff --git a/test/C/src/arduino/BlinkAttemptThreading.lf b/test/C/src/arduino/BlinkAttemptThreading.lf index 4c4dac927c..fb08214d26 100644 --- a/test/C/src/arduino/BlinkAttemptThreading.lf +++ b/test/C/src/arduino/BlinkAttemptThreading.lf @@ -15,9 +15,15 @@ main reactor BlinkAttemptThreading { timer t1(0, 1 sec) timer t2(500 msec, 1 sec) - reaction(startup) {= pinMode(LED_BUILTIN, OUTPUT); =} + reaction(startup) {= + pinMode(LED_BUILTIN, OUTPUT); + =} - reaction(t1) {= digitalWrite(LED_BUILTIN, HIGH); =} + reaction(t1) {= + digitalWrite(LED_BUILTIN, HIGH); + =} - reaction(t2) {= digitalWrite(LED_BUILTIN, LOW); =} + reaction(t2) {= + digitalWrite(LED_BUILTIN, LOW); + =} } diff --git a/test/C/src/arduino/BlinkMBED.lf b/test/C/src/arduino/BlinkMBED.lf index 3b2c84427e..2d7e4e329c 100644 --- a/test/C/src/arduino/BlinkMBED.lf +++ b/test/C/src/arduino/BlinkMBED.lf @@ -13,9 +13,15 @@ main reactor BlinkMBED { timer t1(0, 1 sec) timer t2(500 msec, 1 sec) - reaction(startup) {= pinMode(LED_BUILTIN, OUTPUT); =} + reaction(startup) {= + pinMode(LED_BUILTIN, OUTPUT); + =} - reaction(t1) {= digitalWrite(LED_BUILTIN, HIGH); =} + reaction(t1) {= + digitalWrite(LED_BUILTIN, HIGH); + =} - reaction(t2) {= digitalWrite(LED_BUILTIN, LOW); =} + reaction(t2) {= + digitalWrite(LED_BUILTIN, LOW); + =} } diff --git a/test/C/src/arduino/DigitalReadSerial.lf b/test/C/src/arduino/DigitalReadSerial.lf index e521585a5d..54a9af1e85 100644 --- a/test/C/src/arduino/DigitalReadSerial.lf +++ b/test/C/src/arduino/DigitalReadSerial.lf @@ -10,7 +10,9 @@ main reactor DigitalReadSerial { timer t1(0, 1 msec) state pushButton: int = 2 - reaction(startup) {= pinMode(self->pushButton, INPUT); =} + reaction(startup) {= + pinMode(self->pushButton, INPUT); + =} reaction(t1) {= int buttonState = digitalRead(self->pushButton); diff --git a/test/C/src/arduino/Fade.lf b/test/C/src/arduino/Fade.lf index 2684ef2dd7..4c74a3dca1 100644 --- a/test/C/src/arduino/Fade.lf +++ b/test/C/src/arduino/Fade.lf @@ -17,7 +17,9 @@ main reactor Fade { state brightness: int = 9 state fadeAmount: int = 5 - reaction(startup) {= pinMode(self->led, OUTPUT); =} + reaction(startup) {= + pinMode(self->led, OUTPUT); + =} reaction(t1) {= analogWrite(self->led, self->brightness); diff --git a/test/C/src/arduino/ReadAnalogVoltage.lf b/test/C/src/arduino/ReadAnalogVoltage.lf index 4dbffbbb83..0f48633939 100644 --- a/test/C/src/arduino/ReadAnalogVoltage.lf +++ b/test/C/src/arduino/ReadAnalogVoltage.lf @@ -14,7 +14,9 @@ target C { main reactor ReadAnalogVoltage { logical action a - reaction(startup) -> a {= lf_schedule(a, 0); =} + reaction(startup) -> a {= + lf_schedule(a, 0); + =} reaction(a) -> a {= int sensorValue = analogRead(A0); diff --git a/test/C/src/concurrent/DelayIntThreaded.lf b/test/C/src/concurrent/DelayIntThreaded.lf index d328954454..a75b82ab6e 100644 --- a/test/C/src/concurrent/DelayIntThreaded.lf +++ b/test/C/src/concurrent/DelayIntThreaded.lf @@ -6,7 +6,9 @@ reactor Delay(delay: time = 100 msec) { output out: int logical action a: int - reaction(a) -> out {= lf_set(out, a->value); =} + reaction(a) -> out {= + lf_set(out, a->value); + =} reaction(in) -> a {= // Use specialized form of schedule for integer payloads. @@ -55,5 +57,7 @@ main reactor { t = new Test() d.out -> t.in - reaction(startup) -> d.in {= lf_set(d.in, 42); =} + reaction(startup) -> d.in {= + lf_set(d.in, 42); + =} } diff --git a/test/C/src/concurrent/DeterminismThreaded.lf b/test/C/src/concurrent/DeterminismThreaded.lf index 813405f25f..2f73e3beaf 100644 --- a/test/C/src/concurrent/DeterminismThreaded.lf +++ b/test/C/src/concurrent/DeterminismThreaded.lf @@ -4,7 +4,9 @@ reactor Source { output y: int timer t - reaction(t) -> y {= lf_set(y, 1); =} + reaction(t) -> y {= + lf_set(y, 1); + =} } reactor Destination { @@ -31,7 +33,9 @@ reactor Pass { input x: int output y: int - reaction(x) -> y {= lf_set(y, x->value); =} + reaction(x) -> y {= + lf_set(y, x->value); + =} } main reactor { diff --git a/test/C/src/concurrent/GainThreaded.lf b/test/C/src/concurrent/GainThreaded.lf index 688a36eabd..d501f9c108 100644 --- a/test/C/src/concurrent/GainThreaded.lf +++ b/test/C/src/concurrent/GainThreaded.lf @@ -5,7 +5,9 @@ reactor Scale(scale: int = 2) { input x: int output y: int - reaction(x) -> y {= lf_set(y, x->value * self->scale); =} + reaction(x) -> y {= + lf_set(y, x->value * self->scale); + =} } reactor Test { @@ -35,5 +37,7 @@ main reactor { d = new Test() g.y -> d.x - reaction(startup) -> g.x {= lf_set(g.x, 1); =} + reaction(startup) -> g.x {= + lf_set(g.x, 1); + =} } diff --git a/test/C/src/concurrent/ImportThreaded.lf b/test/C/src/concurrent/ImportThreaded.lf index a40fd11fb7..cb4a0cad6b 100644 --- a/test/C/src/concurrent/ImportThreaded.lf +++ b/test/C/src/concurrent/ImportThreaded.lf @@ -7,5 +7,7 @@ main reactor ImportThreaded { timer t a = new Imported() - reaction(t) -> a.x {= lf_set(a.x, 42); =} + reaction(t) -> a.x {= + lf_set(a.x, 42); + =} } diff --git a/test/C/src/concurrent/MinimalThreaded.lf b/test/C/src/concurrent/MinimalThreaded.lf index dacafdcb73..8782c28ff6 100644 --- a/test/C/src/concurrent/MinimalThreaded.lf +++ b/test/C/src/concurrent/MinimalThreaded.lf @@ -4,5 +4,7 @@ target C main reactor MinimalThreaded { timer t - reaction(t) {= printf("Hello World.\n"); =} + reaction(t) {= + printf("Hello World.\n"); + =} } diff --git a/test/C/src/concurrent/PingPongThreaded.lf b/test/C/src/concurrent/PingPongThreaded.lf index 69d7b512a2..59de2bb7bc 100644 --- a/test/C/src/concurrent/PingPongThreaded.lf +++ b/test/C/src/concurrent/PingPongThreaded.lf @@ -27,7 +27,9 @@ reactor Ping(count: int = 10) { state pingsLeft: int = count logical action serve - reaction(startup, serve) -> send {= lf_set(send, self->pingsLeft--); =} + reaction(startup, serve) -> send {= + lf_set(send, self->pingsLeft--); + =} reaction(receive) -> serve {= if (self->pingsLeft > 0) { diff --git a/test/C/src/concurrent/TimeLimitThreaded.lf b/test/C/src/concurrent/TimeLimitThreaded.lf index 8ada5f42f5..f2b7be9559 100644 --- a/test/C/src/concurrent/TimeLimitThreaded.lf +++ b/test/C/src/concurrent/TimeLimitThreaded.lf @@ -44,5 +44,7 @@ main reactor(period: time = 1 sec) { d = new Destination() c.y -> d.x - reaction(stop) {= lf_request_stop(); =} + reaction(stop) {= + lf_request_stop(); + =} } diff --git a/test/C/src/enclave/EnclaveRequestStop.lf b/test/C/src/enclave/EnclaveRequestStop.lf index 781fb2811a..aea05a874d 100644 --- a/test/C/src/enclave/EnclaveRequestStop.lf +++ b/test/C/src/enclave/EnclaveRequestStop.lf @@ -9,7 +9,9 @@ reactor Stop(stop_time: time = 5 s) { =} timer t(stop_time) - reaction(t) {= lf_request_stop(); =} + reaction(t) {= + lf_request_stop(); + =} reaction(shutdown) {= lf_print("Stopped at tag (" PRINTF_TIME ", %d)", lf_time_logical_elapsed(), lf_tag().microstep); diff --git a/test/C/src/federated/BroadcastFeedback.lf b/test/C/src/federated/BroadcastFeedback.lf index 179d49edc7..66a93c275b 100644 --- a/test/C/src/federated/BroadcastFeedback.lf +++ b/test/C/src/federated/BroadcastFeedback.lf @@ -9,7 +9,9 @@ reactor SenderAndReceiver { input[2] in: int state received: bool = false - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} reaction(in) {= if (in[0]->is_present && in[1]->is_present && in[0]->value == 42 && in[1]->value == 42) { diff --git a/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf b/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf index 9896c1fdf8..114e42cfd7 100644 --- a/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf +++ b/test/C/src/federated/BroadcastFeedbackWithHierarchy.lf @@ -11,7 +11,9 @@ reactor SenderAndReceiver { r = new Receiver() in -> r.in - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } reactor Receiver { diff --git a/test/C/src/federated/CycleDetection.lf b/test/C/src/federated/CycleDetection.lf index 6d7c818882..8128147bfe 100644 --- a/test/C/src/federated/CycleDetection.lf +++ b/test/C/src/federated/CycleDetection.lf @@ -23,14 +23,18 @@ reactor CAReplica { } =} - reaction(query) -> response {= lf_set(response, self->balance); =} + reaction(query) -> response {= + lf_set(response, self->balance); + =} } reactor UserInput { input balance: int output deposit: int - reaction(startup) -> deposit {= lf_set(deposit, 100); =} + reaction(startup) -> deposit {= + lf_set(deposit, 100); + =} reaction(balance) {= if (balance->value != 200) { @@ -45,7 +49,9 @@ reactor UserInput { lf_request_stop(); =} - reaction(shutdown) {= lf_print("Shutdown reaction invoked."); =} + reaction(shutdown) {= + lf_print("Shutdown reaction invoked."); + =} } federated reactor { diff --git a/test/C/src/federated/DecentralizedP2PComm.lf b/test/C/src/federated/DecentralizedP2PComm.lf index 63163bd98b..4cf42ce5e8 100644 --- a/test/C/src/federated/DecentralizedP2PComm.lf +++ b/test/C/src/federated/DecentralizedP2PComm.lf @@ -12,7 +12,9 @@ reactor Platform(start: int = 0, expected_start: int = 0, stp_offset_param: time state count: int = start state expected: int = expected_start - reaction(t) -> out {= lf_set(out, self->count++); =} + reaction(t) -> out {= + lf_set(out, self->count++); + =} reaction(in) {= lf_print("Received %d.", in->value); diff --git a/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf b/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf index 0ebed39189..6c45870898 100644 --- a/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf +++ b/test/C/src/federated/DecentralizedP2PUnbalancedTimeout.lf @@ -21,7 +21,9 @@ reactor Clock(offset: time = 0, period: time = 1 sec) { lf_set(y, self->count); =} - reaction(shutdown) {= lf_print("SUCCESS: the source exited successfully."); =} + reaction(shutdown) {= + lf_print("SUCCESS: the source exited successfully."); + =} } reactor Destination { diff --git a/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf b/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf index 356222a266..ce7f42a1f5 100644 --- a/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf +++ b/test/C/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf @@ -22,7 +22,9 @@ reactor Clock(offset: time = 0, period: time = 1 sec) { lf_set(y, self->count); =} - reaction(shutdown) {= lf_print("SUCCESS: the source exited successfully."); =} + reaction(shutdown) {= + lf_print("SUCCESS: the source exited successfully."); + =} } reactor Destination { diff --git a/test/C/src/federated/DistributedBank.lf b/test/C/src/federated/DistributedBank.lf index bb23df81d6..f934bd7361 100644 --- a/test/C/src/federated/DistributedBank.lf +++ b/test/C/src/federated/DistributedBank.lf @@ -8,7 +8,9 @@ reactor Node(bank_index: int = 0) { timer t(0, 100 msec) state count: int = 0 - reaction(t) {= lf_print("Hello world %d.", self->count++); =} + reaction(t) {= + lf_print("Hello world %d.", self->count++); + =} reaction(shutdown) {= if (self->bank_index) { diff --git a/test/C/src/federated/DistributedDoublePort.lf b/test/C/src/federated/DistributedDoublePort.lf index 5885d20a7e..ced1663dba 100644 --- a/test/C/src/federated/DistributedDoublePort.lf +++ b/test/C/src/federated/DistributedDoublePort.lf @@ -18,9 +18,13 @@ reactor CountMicrostep { logical action act: int timer t(0, 1 sec) - reaction(t) -> act {= lf_schedule_int(act, 0, self->count++); =} + reaction(t) -> act {= + lf_schedule_int(act, 0, self->count++); + =} - reaction(act) -> out {= lf_set(out, act->value); =} + reaction(act) -> out {= + lf_set(out, act->value); + =} } reactor Print { @@ -35,7 +39,9 @@ reactor Print { } =} - reaction(shutdown) {= lf_print("SUCCESS: messages were at least one microstep apart."); =} + reaction(shutdown) {= + lf_print("SUCCESS: messages were at least one microstep apart."); + =} } federated reactor DistributedDoublePort { diff --git a/test/C/src/federated/DistributedPhysicalActionUpstream.lf b/test/C/src/federated/DistributedPhysicalActionUpstream.lf index 847e9547ed..3a85c9b3d1 100644 --- a/test/C/src/federated/DistributedPhysicalActionUpstream.lf +++ b/test/C/src/federated/DistributedPhysicalActionUpstream.lf @@ -44,7 +44,9 @@ reactor WithPhysicalAction { lf_thread_create(&self->thread_id, &take_time, act); =} - reaction(act) -> out {= lf_set(out, act->value); =} + reaction(act) -> out {= + lf_set(out, act->value); + =} } federated reactor { diff --git a/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf b/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf index 180e05be47..99154b1ad2 100644 --- a/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf +++ b/test/C/src/federated/DistributedPhysicalActionUpstreamLong.lf @@ -43,7 +43,9 @@ reactor WithPhysicalAction { lf_thread_create(&self->thread_id, &take_time, act); =} - reaction(act) -> out {= lf_set(out, act->value); =} + reaction(act) -> out {= + lf_set(out, act->value); + =} } federated reactor { diff --git a/test/C/src/federated/EnclaveFederatedRequestStop.lf b/test/C/src/federated/EnclaveFederatedRequestStop.lf index cb92f4f20d..1a3a590308 100644 --- a/test/C/src/federated/EnclaveFederatedRequestStop.lf +++ b/test/C/src/federated/EnclaveFederatedRequestStop.lf @@ -12,7 +12,9 @@ reactor Stop(stop_time: time = 5 s) { =} timer t(stop_time) - reaction(t) {= lf_request_stop(); =} + reaction(t) {= + lf_request_stop(); + =} reaction(shutdown) {= lf_print("Stopped at tag (" PRINTF_TIME ", %d)", lf_time_logical_elapsed(), lf_tag().microstep); diff --git a/test/C/src/federated/FeedbackDelay.lf b/test/C/src/federated/FeedbackDelay.lf index ed458a9749..8bec54dc9f 100644 --- a/test/C/src/federated/FeedbackDelay.lf +++ b/test/C/src/federated/FeedbackDelay.lf @@ -20,7 +20,9 @@ reactor PhysicalPlant { instant_t control_time = lf_time_physical(); lf_print("Latency %lld.", control_time - self->previous_sensor_time); lf_print("Logical time: %lld.", lf_time_logical_elapsed()); - =} STP(33 msec) {= lf_print_warning("STP violation."); =} + =} STP(33 msec) {= + lf_print_warning("STP violation."); + =} } reactor Controller { @@ -33,7 +35,9 @@ reactor Controller { output request_for_planning: double input planning: double - reaction(planning) {= self->latest_control = planning->value; =} + reaction(planning) {= + self->latest_control = planning->value; + =} reaction(sensor) -> control, request_for_planning {= if (!self->first) { diff --git a/test/C/src/federated/FeedbackDelaySimple.lf b/test/C/src/federated/FeedbackDelaySimple.lf index ece831bf11..655fbe0762 100644 --- a/test/C/src/federated/FeedbackDelaySimple.lf +++ b/test/C/src/federated/FeedbackDelaySimple.lf @@ -20,7 +20,9 @@ reactor Loop { self->count++; =} - reaction(t) -> out {= lf_set(out, self->count); =} + reaction(t) -> out {= + lf_set(out, self->count); + =} reaction(shutdown) {= if (self->count != 11) { diff --git a/test/C/src/federated/HelloDistributed.lf b/test/C/src/federated/HelloDistributed.lf index 4b06399fa4..8fa47c22c9 100644 --- a/test/C/src/federated/HelloDistributed.lf +++ b/test/C/src/federated/HelloDistributed.lf @@ -24,7 +24,9 @@ reactor Destination { input in: string state received: bool = false - reaction(startup) {= lf_print("Destination started."); =} + reaction(startup) {= + lf_print("Destination started."); + =} reaction(in) {= lf_print("At logical time %lld, destination received: %s", lf_time_logical_elapsed(), in->value); @@ -48,5 +50,7 @@ federated reactor HelloDistributed at localhost { d = new Destination() // Reactor d is in federate Destination s.out -> d.in // This version preserves the timestamp. - reaction(startup) {= lf_print("Printing something in top-level federated reactor."); =} + reaction(startup) {= + lf_print("Printing something in top-level federated reactor."); + =} } diff --git a/test/C/src/federated/InheritanceFederated.lf b/test/C/src/federated/InheritanceFederated.lf index 70f429dbc8..90098b29bb 100644 --- a/test/C/src/federated/InheritanceFederated.lf +++ b/test/C/src/federated/InheritanceFederated.lf @@ -6,7 +6,9 @@ target C { } reactor A { - reaction(startup) {= printf("Hello\n"); =} + reaction(startup) {= + printf("Hello\n"); + =} } reactor B { diff --git a/test/C/src/federated/InheritanceFederatedImport.lf b/test/C/src/federated/InheritanceFederatedImport.lf index 0918e6809b..37da485956 100644 --- a/test/C/src/federated/InheritanceFederatedImport.lf +++ b/test/C/src/federated/InheritanceFederatedImport.lf @@ -7,7 +7,9 @@ target C { import HelloWorld2 from "../HelloWorld.lf" reactor Print extends HelloWorld2 { - reaction(startup) {= printf("Foo\n"); =} + reaction(startup) {= + printf("Foo\n"); + =} } federated reactor { diff --git a/test/C/src/federated/LevelPattern.lf b/test/C/src/federated/LevelPattern.lf index da47325ba1..1721861b14 100644 --- a/test/C/src/federated/LevelPattern.lf +++ b/test/C/src/federated/LevelPattern.lf @@ -15,7 +15,9 @@ reactor Through { input in: int output out: int - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } reactor A { @@ -30,9 +32,13 @@ reactor A { i2 = new Through() i2.out -> out2 - reaction(in1) -> i1.in {= lf_set(i1.in, in1->value); =} + reaction(in1) -> i1.in {= + lf_set(i1.in, in1->value); + =} - reaction(in2) -> i2.in {= lf_set(i2.in, in2->value); =} + reaction(in2) -> i2.in {= + lf_set(i2.in, in2->value); + =} } federated reactor { diff --git a/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf b/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf index 9e8fb02059..82adfca699 100644 --- a/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf +++ b/test/C/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf @@ -20,9 +20,13 @@ reactor Contained(incr: int = 1) { state count: int = 0 state received_count: int = 0 - reaction(t) {= self->count += self->incr; =} + reaction(t) {= + self->count += self->incr; + =} - reaction(in) {= self->received_count = self->count; =} + reaction(in) {= + self->received_count = self->count; + =} reaction(t) {= if (self->received_count != self->count) { diff --git a/test/C/src/federated/SpuriousDependency.lf b/test/C/src/federated/SpuriousDependency.lf index cf0deb6380..b810d5288f 100644 --- a/test/C/src/federated/SpuriousDependency.lf +++ b/test/C/src/federated/SpuriousDependency.lf @@ -35,7 +35,9 @@ reactor Check { state count: int = 0 - reaction(in) {= lf_print("count is now %d", ++self->count); =} + reaction(in) {= + lf_print("count is now %d", ++self->count); + =} reaction(shutdown) {= lf_print("******* Shutdown invoked."); @@ -55,5 +57,7 @@ federated reactor { t1.out0 -> check.in - reaction(startup) -> t0.in1 {= lf_set(t0.in1, 0); =} + reaction(startup) -> t0.in1 {= + lf_set(t0.in1, 0); + =} } diff --git a/test/C/src/federated/StopAtShutdown.lf b/test/C/src/federated/StopAtShutdown.lf index 2ac97d6805..2fad7db3d0 100644 --- a/test/C/src/federated/StopAtShutdown.lf +++ b/test/C/src/federated/StopAtShutdown.lf @@ -12,20 +12,30 @@ target C { reactor A { input in: int - reaction(startup) {= lf_print("Hello World!"); =} + reaction(startup) {= + lf_print("Hello World!"); + =} - reaction(in) {= lf_print("Got it"); =} + reaction(in) {= + lf_print("Got it"); + =} - reaction(shutdown) {= lf_request_stop(); =} + reaction(shutdown) {= + lf_request_stop(); + =} } reactor B { output out: int timer t(1 sec) - reaction(t) -> out {= lf_set(out, 1); =} + reaction(t) -> out {= + lf_set(out, 1); + =} - reaction(shutdown) {= lf_request_stop(); =} + reaction(shutdown) {= + lf_request_stop(); + =} } federated reactor { diff --git a/test/C/src/federated/TopLevelArtifacts.lf b/test/C/src/federated/TopLevelArtifacts.lf index b2e486b31d..d73ea35967 100644 --- a/test/C/src/federated/TopLevelArtifacts.lf +++ b/test/C/src/federated/TopLevelArtifacts.lf @@ -22,14 +22,18 @@ federated reactor { tc = new TestCount() c.out -> tc.in - reaction(startup) {= self->successes++; =} + reaction(startup) {= + self->successes++; + =} reaction(t) -> act {= self->successes++; lf_schedule(act, 0); =} - reaction(act) {= self->successes++; =} + reaction(act) {= + self->successes++; + =} reaction(shutdown) {= if (self->successes != 3) { diff --git a/test/C/src/generics/ParameterAsArgument.lf b/test/C/src/generics/ParameterAsArgument.lf index f6d460279e..47b3c3c903 100644 --- a/test/C/src/generics/ParameterAsArgument.lf +++ b/test/C/src/generics/ParameterAsArgument.lf @@ -23,5 +23,7 @@ reactor Super { main reactor { cc = new Super() - reaction(startup) -> cc.in {= lf_set(cc.in, 42); =} + reaction(startup) -> cc.in {= + lf_set(cc.in, 42); + =} } diff --git a/test/C/src/generics/TypeCheck.lf b/test/C/src/generics/TypeCheck.lf index db3524798e..d04e2dfa87 100644 --- a/test/C/src/generics/TypeCheck.lf +++ b/test/C/src/generics/TypeCheck.lf @@ -9,7 +9,9 @@ reactor Count(offset: time = 0, period: time = 1 sec) { output out: int timer t(offset, period) - reaction(t) -> out {= lf_set(out, self->count++); =} + reaction(t) -> out {= + lf_set(out, self->count++); + =} } reactor TestCount(start: int = 1, num_inputs: int = 1) { diff --git a/test/C/src/lib/Count.lf b/test/C/src/lib/Count.lf index 5b8d7b5844..ee3953b021 100644 --- a/test/C/src/lib/Count.lf +++ b/test/C/src/lib/Count.lf @@ -5,5 +5,7 @@ reactor Count(offset: time = 0, period: time = 1 sec) { output out: int timer t(offset, period) - reaction(t) -> out {= lf_set(out, self->count++); =} + reaction(t) -> out {= + lf_set(out, self->count++); + =} } diff --git a/test/C/src/lib/FileLevelPreamble.lf b/test/C/src/lib/FileLevelPreamble.lf index f11186979d..11067d5e63 100644 --- a/test/C/src/lib/FileLevelPreamble.lf +++ b/test/C/src/lib/FileLevelPreamble.lf @@ -6,5 +6,7 @@ preamble {= =} reactor FileLevelPreamble { - reaction(startup) {= printf("FOO: %d\n", FOO); =} + reaction(startup) {= + printf("FOO: %d\n", FOO); + =} } diff --git a/test/C/src/lib/GenDelay.lf b/test/C/src/lib/GenDelay.lf index a9d607db75..8f21c3de1b 100644 --- a/test/C/src/lib/GenDelay.lf +++ b/test/C/src/lib/GenDelay.lf @@ -1,15 +1,21 @@ target C -preamble {= typedef int message_t; =} +preamble {= + typedef int message_t; +=} reactor Source { output out: message_t - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } reactor Sink { input in: message_t - reaction(in) {= lf_print("Received %d at time %lld", in->value, lf_time_logical_elapsed()); =} + reaction(in) {= + lf_print("Received %d at time %lld", in->value, lf_time_logical_elapsed()); + =} } diff --git a/test/C/src/lib/Imported.lf b/test/C/src/lib/Imported.lf index 30e17cd94e..85d0a2b493 100644 --- a/test/C/src/lib/Imported.lf +++ b/test/C/src/lib/Imported.lf @@ -8,5 +8,7 @@ reactor Imported { input x: int a = new ImportedAgain() - reaction(x) -> a.x {= lf_set(a.x, x->value); =} + reaction(x) -> a.x {= + lf_set(a.x, x->value); + =} } diff --git a/test/C/src/lib/ImportedComposition.lf b/test/C/src/lib/ImportedComposition.lf index d434f4eb6a..e5524f3d22 100644 --- a/test/C/src/lib/ImportedComposition.lf +++ b/test/C/src/lib/ImportedComposition.lf @@ -6,7 +6,9 @@ reactor Gain { input x: int output y: int - reaction(x) -> y {= lf_set(y, x->value * 2); =} + reaction(x) -> y {= + lf_set(y, x->value * 2); + =} } reactor ImportedComposition { diff --git a/test/C/src/lib/InternalDelay.lf b/test/C/src/lib/InternalDelay.lf index 33ccf9e230..fb7124a4ec 100644 --- a/test/C/src/lib/InternalDelay.lf +++ b/test/C/src/lib/InternalDelay.lf @@ -5,7 +5,11 @@ reactor InternalDelay(delay: time = 10 msec) { output out: int logical action d: int - reaction(in) -> d {= lf_schedule_int(d, self->delay, in->value); =} + reaction(in) -> d {= + lf_schedule_int(d, self->delay, in->value); + =} - reaction(d) -> out {= lf_set(out, d->value); =} + reaction(d) -> out {= + lf_set(out, d->value); + =} } diff --git a/test/C/src/lib/PassThrough.lf b/test/C/src/lib/PassThrough.lf index 90d9138c09..389905489a 100644 --- a/test/C/src/lib/PassThrough.lf +++ b/test/C/src/lib/PassThrough.lf @@ -5,5 +5,7 @@ reactor PassThrough { input in: int output out: int - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } diff --git a/test/C/src/modal_models/BanksCount3ModesComplex.lf b/test/C/src/modal_models/BanksCount3ModesComplex.lf index e548d28cef..48774e0b80 100644 --- a/test/C/src/modal_models/BanksCount3ModesComplex.lf +++ b/test/C/src/modal_models/BanksCount3ModesComplex.lf @@ -25,7 +25,9 @@ reactor MetaCounter { mode1_counters.count -> mode1 timer t1(500 msec, 250 msec) - reaction(t1) -> reset(Two) {= lf_set_mode(Two); =} + reaction(t1) -> reset(Two) {= + lf_set_mode(Two); + =} } mode Two { @@ -35,7 +37,9 @@ reactor MetaCounter { mode2_counters.count -> mode2 timer t2(500 msec, 250 msec) - reaction(t2) -> history(One) {= lf_set_mode(One); =} + reaction(t2) -> history(One) {= + lf_set_mode(One); + =} } mode Three { diff --git a/test/C/src/modal_models/ConvertCaseTest.lf b/test/C/src/modal_models/ConvertCaseTest.lf index 09cb159f2d..eeab275996 100644 --- a/test/C/src/modal_models/ConvertCaseTest.lf +++ b/test/C/src/modal_models/ConvertCaseTest.lf @@ -15,13 +15,19 @@ reactor ResetProcessor { converter = new Converter() character -> converter.raw converter.converted -> converted - reaction(discard) -> reset(Discarding) {= lf_set_mode(Discarding); =} + reaction(discard) -> reset(Discarding) {= + lf_set_mode(Discarding); + =} } mode Discarding { - reaction(character) -> converted {= lf_set(converted, '_'); =} + reaction(character) -> converted {= + lf_set(converted, '_'); + =} - reaction(character) -> reset(Converting) {= lf_set_mode(Converting); =} + reaction(character) -> reset(Converting) {= + lf_set_mode(Converting); + =} } } @@ -34,13 +40,19 @@ reactor HistoryProcessor { converter = new Converter() character -> converter.raw converter.converted -> converted - reaction(discard) -> reset(Discarding) {= lf_set_mode(Discarding); =} + reaction(discard) -> reset(Discarding) {= + lf_set_mode(Discarding); + =} } mode Discarding { - reaction(character) -> converted {= lf_set(converted, '_'); =} + reaction(character) -> converted {= + lf_set(converted, '_'); + =} - reaction(character) -> history(Converting) {= lf_set_mode(Converting); =} + reaction(character) -> history(Converting) {= + lf_set_mode(Converting); + =} } } @@ -128,7 +140,9 @@ main reactor { lf_set(history_processor.discard, true); =} - reaction(reset_processor.converted) {= printf("Reset: %c\n", reset_processor.converted->value); =} + reaction(reset_processor.converted) {= + printf("Reset: %c\n", reset_processor.converted->value); + =} reaction(history_processor.converted) {= printf("History: %c\n", history_processor.converted->value); diff --git a/test/C/src/modal_models/Count3Modes.lf b/test/C/src/modal_models/Count3Modes.lf index 3c2b419a00..232482e009 100644 --- a/test/C/src/modal_models/Count3Modes.lf +++ b/test/C/src/modal_models/Count3Modes.lf @@ -36,7 +36,10 @@ main reactor { state expected_value: int = 1 - reaction(stepper) -> counter.next {= lf_set(counter.next, true); =} // Trigger + // Trigger + reaction(stepper) -> counter.next {= + lf_set(counter.next, true); + =} // Check reaction(stepper) counter.count {= diff --git a/test/C/src/modal_models/MixedReactions.lf b/test/C/src/modal_models/MixedReactions.lf index ed9ae422f3..a67d470b91 100644 --- a/test/C/src/modal_models/MixedReactions.lf +++ b/test/C/src/modal_models/MixedReactions.lf @@ -13,9 +13,13 @@ main reactor { timer t(0, 100 msec) - reaction(t) {= self->x = self->x * 10 + 1; =} + reaction(t) {= + self->x = self->x * 10 + 1; + =} - reaction(t) {= self->x = self->x * 10 + 2; =} + reaction(t) {= + self->x = self->x * 10 + 2; + =} initial mode A { reaction(t) -> reset(B) {= @@ -24,10 +28,14 @@ main reactor { =} } - reaction(t) {= self->x = self->x * 10 + 4; =} + reaction(t) {= + self->x = self->x * 10 + 4; + =} mode B { - reaction(t) {= self->x = self->x * 10 + 5; =} + reaction(t) {= + self->x = self->x * 10 + 5; + =} } reaction(t) {= diff --git a/test/C/src/modal_models/ModalActions.lf b/test/C/src/modal_models/ModalActions.lf index cf473cd125..3cebd07b30 100644 --- a/test/C/src/modal_models/ModalActions.lf +++ b/test/C/src/modal_models/ModalActions.lf @@ -89,5 +89,8 @@ main reactor { modal.action2_sched, modal.action2_exec -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} } diff --git a/test/C/src/modal_models/ModalAfter.lf b/test/C/src/modal_models/ModalAfter.lf index 0b0c7251fc..fb2b36d71e 100644 --- a/test/C/src/modal_models/ModalAfter.lf +++ b/test/C/src/modal_models/ModalAfter.lf @@ -91,5 +91,8 @@ main reactor { modal.mode_switch, modal.produced1, modal.consumed1, modal.produced2, modal.consumed2 -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} } diff --git a/test/C/src/modal_models/ModalCycleBreaker.lf b/test/C/src/modal_models/ModalCycleBreaker.lf index 428555e165..0f90275bee 100644 --- a/test/C/src/modal_models/ModalCycleBreaker.lf +++ b/test/C/src/modal_models/ModalCycleBreaker.lf @@ -30,7 +30,9 @@ reactor Modal { } initial mode One { - reaction(in1) -> out {= lf_set(out, in1->value); =} + reaction(in1) -> out {= + lf_set(out, in1->value); + =} reaction(in1) -> reset(Two) {= if (in1->value % 5 == 4) { @@ -47,7 +49,9 @@ reactor Counter(period: time = 1 sec) { timer t(0, period) state curval: int = 0 - reaction(t) -> value {= lf_set(value, self->curval++); =} + reaction(t) -> value {= + lf_set(value, self->curval++); + =} } main reactor { @@ -70,5 +74,8 @@ main reactor { modal.out -> test.events - reaction(modal.out) {= printf("%d\n", modal.out->value); =} // Print + // Print + reaction(modal.out) {= + printf("%d\n", modal.out->value); + =} } diff --git a/test/C/src/modal_models/ModalNestedReactions.lf b/test/C/src/modal_models/ModalNestedReactions.lf index e796c3df31..88bb61c8bb 100644 --- a/test/C/src/modal_models/ModalNestedReactions.lf +++ b/test/C/src/modal_models/ModalNestedReactions.lf @@ -29,7 +29,9 @@ reactor CounterCycle { } mode Three { - reaction(next) -> never {= lf_set(never, true); =} + reaction(next) -> never {= + lf_set(never, true); + =} } } @@ -37,14 +39,19 @@ reactor Forward { input in: bool output out: bool - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } main reactor { timer stepper(0, 250 msec) counter = new CounterCycle() - reaction(stepper) -> counter.next {= lf_set(counter.next, true); =} // Trigger + // Trigger + reaction(stepper) -> counter.next {= + lf_set(counter.next, true); + =} // Check reaction(stepper) counter.count, counter.only_in_two {= diff --git a/test/C/src/modal_models/ModalStartupShutdown.lf b/test/C/src/modal_models/ModalStartupShutdown.lf index d26a743ec7..2c0e974c67 100644 --- a/test/C/src/modal_models/ModalStartupShutdown.lf +++ b/test/C/src/modal_models/ModalStartupShutdown.lf @@ -137,5 +137,8 @@ main reactor { modal.reset5, modal.shutdown5 -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} } diff --git a/test/C/src/modal_models/ModalStateReset.lf b/test/C/src/modal_models/ModalStateReset.lf index 181a8b1189..c8cf41d351 100644 --- a/test/C/src/modal_models/ModalStateReset.lf +++ b/test/C/src/modal_models/ModalStateReset.lf @@ -24,7 +24,9 @@ reactor Modal { initial mode One { state counter1: int = 0 timer T1(0 msec, 250 msec) - reaction(reset) {= self->counter1 = 0; =} + reaction(reset) {= + self->counter1 = 0; + =} reaction(T1) -> count1 {= printf("Counter1: %d\n", self->counter1); @@ -41,7 +43,9 @@ reactor Modal { mode Two { state counter2: int = -2 timer T2(0 msec, 250 msec) - reaction(reset) {= self->counter2 = -2; =} + reaction(reset) {= + self->counter2 = -2; + =} reaction(T2) -> count2 {= printf("Counter2: %d\n", self->counter2); @@ -84,5 +88,8 @@ main reactor { modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} } diff --git a/test/C/src/modal_models/ModalStateResetAuto.lf b/test/C/src/modal_models/ModalStateResetAuto.lf index 82832da72d..3fd6ec739d 100644 --- a/test/C/src/modal_models/ModalStateResetAuto.lf +++ b/test/C/src/modal_models/ModalStateResetAuto.lf @@ -80,5 +80,8 @@ main reactor { modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} } diff --git a/test/C/src/modal_models/ModalTimers.lf b/test/C/src/modal_models/ModalTimers.lf index 8e67b6aa75..89287c0819 100644 --- a/test/C/src/modal_models/ModalTimers.lf +++ b/test/C/src/modal_models/ModalTimers.lf @@ -62,5 +62,8 @@ main reactor { modal.mode_switch, modal.timer1, modal.timer2 -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} } diff --git a/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf b/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf index 637f546498..b84184619b 100644 --- a/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf +++ b/test/C/src/modal_models/MultipleOutputFeeder_2Connections.lf @@ -18,13 +18,17 @@ reactor Modal { initial mode One { counter1 = new Counter(period = 250 msec) counter1.value -> count - reaction(next) -> reset(Two) {= lf_set_mode(Two); =} + reaction(next) -> reset(Two) {= + lf_set_mode(Two); + =} } mode Two { counter2 = new Counter(period = 100 msec) counter2.value -> count - reaction(next) -> history(One) {= lf_set_mode(One); =} + reaction(next) -> history(One) {= + lf_set_mode(One); + =} } } @@ -34,7 +38,9 @@ reactor Counter(period: time = 1 sec) { timer t(0, period) reset state curval: int = 0 - reaction(t) -> value {= lf_set(value, self->curval++); =} + reaction(t) -> value {= + lf_set(value, self->curval++); + =} } main reactor { @@ -63,7 +69,13 @@ main reactor { modal.count -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} - reaction(modal.count) {= printf("%d\n", modal.count->value); =} // Print + // Print + reaction(modal.count) {= + printf("%d\n", modal.count->value); + =} } diff --git a/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf b/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf index 1281b3f490..90615541f4 100644 --- a/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf +++ b/test/C/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf @@ -18,14 +18,20 @@ reactor Modal { initial mode One { counter1 = new Counter(period = 250 msec) counter1.value -> count - reaction(next) -> reset(Two) {= lf_set_mode(Two); =} + reaction(next) -> reset(Two) {= + lf_set_mode(Two); + =} } mode Two { counter2 = new Counter(period = 100 msec) - reaction(counter2.value) -> count {= lf_set(count, counter2.value->value * 10); =} + reaction(counter2.value) -> count {= + lf_set(count, counter2.value->value * 10); + =} - reaction(next) -> history(One) {= lf_set_mode(One); =} + reaction(next) -> history(One) {= + lf_set_mode(One); + =} } } @@ -35,7 +41,9 @@ reactor Counter(period: time = 1 sec) { timer t(0, period) reset state curval: int = 0 - reaction(t) -> value {= lf_set(value, self->curval++); =} + reaction(t) -> value {= + lf_set(value, self->curval++); + =} } main reactor { @@ -64,7 +72,13 @@ main reactor { modal.count -> test.events - reaction(stepper) -> modal.next {= lf_set(modal.next, true); =} // Trigger mode change + // Trigger mode change + reaction(stepper) -> modal.next {= + lf_set(modal.next, true); + =} - reaction(modal.count) {= printf("%d\n", modal.count->value); =} // Print + // Print + reaction(modal.count) {= + printf("%d\n", modal.count->value); + =} } diff --git a/test/C/src/modal_models/util/TraceTesting.lf b/test/C/src/modal_models/util/TraceTesting.lf index 86908ad2e5..f317c3579d 100644 --- a/test/C/src/modal_models/util/TraceTesting.lf +++ b/test/C/src/modal_models/util/TraceTesting.lf @@ -13,7 +13,9 @@ reactor TraceTesting( state recorded_events: int* = 0 state recorded_events_next: int = 0 - reaction(startup) {= self->last_reaction_time = lf_time_logical(); =} + reaction(startup) {= + self->last_reaction_time = lf_time_logical(); + =} reaction(events) {= // Time passed since last reaction diff --git a/test/C/src/multiport/BankGangedConnections.lf b/test/C/src/multiport/BankGangedConnections.lf index 231014c55e..e2e20c78ad 100644 --- a/test/C/src/multiport/BankGangedConnections.lf +++ b/test/C/src/multiport/BankGangedConnections.lf @@ -9,7 +9,9 @@ reactor Through { input in: int output out: int - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } reactor Bank { diff --git a/test/C/src/multiport/BankIndexInitializer.lf b/test/C/src/multiport/BankIndexInitializer.lf index 434e59104a..ef8c181e90 100644 --- a/test/C/src/multiport/BankIndexInitializer.lf +++ b/test/C/src/multiport/BankIndexInitializer.lf @@ -1,14 +1,20 @@ // Test bank of reactors to multiport input with id parameter in the bank. target C -preamble {= extern int table[4]; =} +preamble {= + extern int table[4]; +=} reactor Source(bank_index: int = 0, value: int = 0) { - preamble {= int table[] = {4, 3, 2, 1}; =} + preamble {= + int table[] = {4, 3, 2, 1}; + =} output out: int - reaction(startup) -> out {= lf_set(out, self->value); =} + reaction(startup) -> out {= + lf_set(out, self->value); + =} } reactor Sink(width: int = 4) { diff --git a/test/C/src/multiport/BankSelfBroadcast.lf b/test/C/src/multiport/BankSelfBroadcast.lf index f9a52af044..07c4492f4e 100644 --- a/test/C/src/multiport/BankSelfBroadcast.lf +++ b/test/C/src/multiport/BankSelfBroadcast.lf @@ -12,7 +12,9 @@ reactor A(bank_index: int = 0) { output out: int state received: bool = false - reaction(startup) -> out {= lf_set(out, self->bank_index); =} + reaction(startup) -> out {= + lf_set(out, self->bank_index); + =} reaction(in) {= for (int i = 0; i < in_width; i++) { diff --git a/test/C/src/multiport/BankToMultiport.lf b/test/C/src/multiport/BankToMultiport.lf index 4506cee0c1..c6be3c0adc 100644 --- a/test/C/src/multiport/BankToMultiport.lf +++ b/test/C/src/multiport/BankToMultiport.lf @@ -4,7 +4,9 @@ target C reactor Source(bank_index: int = 0) { output out: int - reaction(startup) -> out {= lf_set(out, self->bank_index); =} + reaction(startup) -> out {= + lf_set(out, self->bank_index); + =} } reactor Sink(width: int = 4) { diff --git a/test/C/src/multiport/Broadcast.lf b/test/C/src/multiport/Broadcast.lf index 27092a4366..3750ec347d 100644 --- a/test/C/src/multiport/Broadcast.lf +++ b/test/C/src/multiport/Broadcast.lf @@ -6,7 +6,9 @@ target C { reactor Source { output out: int - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } reactor Destination(bank_index: int = 0) { diff --git a/test/C/src/multiport/BroadcastAfter.lf b/test/C/src/multiport/BroadcastAfter.lf index 48b5850b7c..b7e4114046 100644 --- a/test/C/src/multiport/BroadcastAfter.lf +++ b/test/C/src/multiport/BroadcastAfter.lf @@ -6,7 +6,9 @@ target C { reactor Source { output out: int - reaction(startup) -> out {= lf_set(out, 42); =} + reaction(startup) -> out {= + lf_set(out, 42); + =} } reactor Destination(bank_index: int = 0) { diff --git a/test/C/src/multiport/BroadcastMultipleAfter.lf b/test/C/src/multiport/BroadcastMultipleAfter.lf index 809c03448c..3f32a51263 100644 --- a/test/C/src/multiport/BroadcastMultipleAfter.lf +++ b/test/C/src/multiport/BroadcastMultipleAfter.lf @@ -6,7 +6,9 @@ target C { reactor Source(value: int = 42) { output out: int - reaction(startup) -> out {= lf_set(out, self->value); =} + reaction(startup) -> out {= + lf_set(out, self->value); + =} } reactor Destination(bank_index: int = 0) { diff --git a/test/C/src/multiport/MultiportFromBank.lf b/test/C/src/multiport/MultiportFromBank.lf index 3969da111d..77482f6730 100644 --- a/test/C/src/multiport/MultiportFromBank.lf +++ b/test/C/src/multiport/MultiportFromBank.lf @@ -8,7 +8,9 @@ target C { reactor Source(check_override: int = 0, bank_index: int = 0) { output out: int - reaction(startup) -> out {= lf_set(out, self->bank_index * self->check_override); =} + reaction(startup) -> out {= + lf_set(out, self->bank_index * self->check_override); + =} } reactor Destination(port_width: int = 3) { diff --git a/test/C/src/multiport/MultiportIn.lf b/test/C/src/multiport/MultiportIn.lf index caea737d76..53e18b52ef 100644 --- a/test/C/src/multiport/MultiportIn.lf +++ b/test/C/src/multiport/MultiportIn.lf @@ -20,7 +20,9 @@ reactor Computation { input in: int output out: int - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } reactor Destination { diff --git a/test/C/src/multiport/MultiportInParameterized.lf b/test/C/src/multiport/MultiportInParameterized.lf index fbf1b4b6f1..172d0f15ec 100644 --- a/test/C/src/multiport/MultiportInParameterized.lf +++ b/test/C/src/multiport/MultiportInParameterized.lf @@ -20,7 +20,9 @@ reactor Computation { input in: int output out: int - reaction(in) -> out {= lf_set(out, in->value); =} + reaction(in) -> out {= + lf_set(out, in->value); + =} } reactor Destination(width: int = 1) { diff --git a/test/C/src/multiport/PipelineAfter.lf b/test/C/src/multiport/PipelineAfter.lf index bbcbaebc49..2f5e2a7c0c 100644 --- a/test/C/src/multiport/PipelineAfter.lf +++ b/test/C/src/multiport/PipelineAfter.lf @@ -3,14 +3,18 @@ target C reactor Source { output out: unsigned - reaction(startup) -> out {= lf_set(out, 40); =} + reaction(startup) -> out {= + lf_set(out, 40); + =} } reactor Compute { input in: unsigned output out: unsigned - reaction(in) -> out {= lf_set(out, in->value + 2); =} + reaction(in) -> out {= + lf_set(out, in->value + 2); + =} } reactor Sink { diff --git a/test/C/src/multiport/ReactionsToNested.lf b/test/C/src/multiport/ReactionsToNested.lf index 2b07e948de..276c91fce3 100644 --- a/test/C/src/multiport/ReactionsToNested.lf +++ b/test/C/src/multiport/ReactionsToNested.lf @@ -32,7 +32,11 @@ reactor D { main reactor { d = new D() - reaction(startup) -> d.y {= lf_set(d.y[0], 42); =} + reaction(startup) -> d.y {= + lf_set(d.y[0], 42); + =} - reaction(startup) -> d.y {= lf_set(d.y[1], 43); =} + reaction(startup) -> d.y {= + lf_set(d.y[1], 43); + =} } diff --git a/test/C/src/no_inlining/Count.lf b/test/C/src/no_inlining/Count.lf index 49ceb04482..86155385c3 100644 --- a/test/C/src/no_inlining/Count.lf +++ b/test/C/src/no_inlining/Count.lf @@ -12,5 +12,7 @@ main reactor Count { reaction check_done(t) - reaction(shutdown) {= printf("%s", "shutting down\n"); =} + reaction(shutdown) {= + printf("%s", "shutting down\n"); + =} } diff --git a/test/C/src/no_inlining/CountHierarchy.lf b/test/C/src/no_inlining/CountHierarchy.lf index 42d7eb2bd7..5ac6726001 100644 --- a/test/C/src/no_inlining/CountHierarchy.lf +++ b/test/C/src/no_inlining/CountHierarchy.lf @@ -7,7 +7,9 @@ reactor Timer(m: time = 0, n: time = 0) { output out: int timer t(m, n) - reaction(t) -> out {= lf_set(out, 0); =} + reaction(t) -> out {= + lf_set(out, 0); + =} } main reactor { @@ -19,5 +21,7 @@ main reactor { reaction check_done(t.out) - reaction(shutdown) {= printf("%s", "shutting down\n"); =} + reaction(shutdown) {= + printf("%s", "shutting down\n"); + =} } diff --git a/test/C/src/target/FederatedFiles.lf b/test/C/src/target/FederatedFiles.lf index 9fb4440a02..ef606bff05 100644 --- a/test/C/src/target/FederatedFiles.lf +++ b/test/C/src/target/FederatedFiles.lf @@ -6,7 +6,9 @@ target C { } reactor Foo { - reaction(startup) {= lf_print("Hello World"); =} + reaction(startup) {= + lf_print("Hello World"); + =} } federated reactor { diff --git a/test/C/src/target/Math.lf b/test/C/src/target/Math.lf index 68a4a13b6f..4185a19f6a 100644 --- a/test/C/src/target/Math.lf +++ b/test/C/src/target/Math.lf @@ -6,5 +6,7 @@ preamble {= =} main reactor { - reaction(startup) {= lf_print("Maximum of 42.0 and 75 is %.2f", fmax(4.20, 75)); =} + reaction(startup) {= + lf_print("Maximum of 42.0 and 75 is %.2f", fmax(4.20, 75)); + =} } diff --git a/test/C/src/target/Platform.lf b/test/C/src/target/Platform.lf index 00895a749f..68a444c9f0 100644 --- a/test/C/src/target/Platform.lf +++ b/test/C/src/target/Platform.lf @@ -4,5 +4,7 @@ target C { } main reactor { - reaction(startup) {= lf_print("Hello, Mac!"); =} + reaction(startup) {= + lf_print("Hello, Mac!"); + =} } diff --git a/test/C/src/token/lib/Token.lf b/test/C/src/token/lib/Token.lf index 3bfabd9b1c..3ef7003836 100644 --- a/test/C/src/token/lib/Token.lf +++ b/test/C/src/token/lib/Token.lf @@ -95,7 +95,11 @@ reactor TokenDelay { output out: int_array_t* logical action a: int_array_t* - reaction(a) -> out {= lf_set_token(out, a->token); =} + reaction(a) -> out {= + lf_set_token(out, a->token); + =} - reaction(in) -> a {= lf_schedule_token(a, MSEC(1), in->token); =} + reaction(in) -> a {= + lf_schedule_token(a, MSEC(1), in->token); + =} } diff --git a/test/C/src/verifier/ADASModel.lf b/test/C/src/verifier/ADASModel.lf index 41f8e27ace..b127c1d1a8 100644 --- a/test/C/src/verifier/ADASModel.lf +++ b/test/C/src/verifier/ADASModel.lf @@ -6,8 +6,12 @@ preamble {= =} reactor Camera { - output out: {= c_frame_t =} - state frame: {= c_frame_t =} + output out: {= + c_frame_t + =} + state frame: {= + c_frame_t + =} timer t(0, 17 msec) // 60 fps reaction(t) -> out {= @@ -18,8 +22,12 @@ reactor Camera { } reactor LiDAR { - output out: {= l_frame_t =} - state frame: {= l_frame_t =} + output out: {= + l_frame_t + =} + state frame: {= + l_frame_t + =} timer t(0, 34 msec) // 30 fps reaction(t) -> out {= @@ -33,7 +41,9 @@ reactor Pedal { output out: int physical action a - reaction(a) -> out {= lf_set(out, 1); =} + reaction(a) -> out {= + lf_set(out, 1); + =} } reactor Brakes { @@ -48,8 +58,12 @@ reactor Brakes { } reactor ADASProcessor { - input in1: {= l_frame_t =} - input in2: {= c_frame_t =} + input in1: {= + l_frame_t + =} + input in2: {= + c_frame_t + =} output out1: int output out2: int logical action a(50 msec) @@ -72,7 +86,9 @@ reactor Dashboard { input in: int state received: int - reaction(in) {= self->received = 1; =} + reaction(in) {= + self->received = 1; + =} } @property( diff --git a/test/C/src/verifier/AircraftDoor.lf b/test/C/src/verifier/AircraftDoor.lf index ab6390ffbe..168bcca437 100644 --- a/test/C/src/verifier/AircraftDoor.lf +++ b/test/C/src/verifier/AircraftDoor.lf @@ -3,7 +3,9 @@ target C reactor Controller { output out: int - reaction(startup) -> out {= lf_set(out, 1); =} + reaction(startup) -> out {= + lf_set(out, 1); + =} } reactor Vision { diff --git a/test/C/src/verifier/CoopSchedule.lf b/test/C/src/verifier/CoopSchedule.lf index c755ef7559..8634143158 100644 --- a/test/C/src/verifier/CoopSchedule.lf +++ b/test/C/src/verifier/CoopSchedule.lf @@ -4,7 +4,9 @@ reactor Trigger { output out: int timer t(0, 1 usec) - reaction(t) -> out {= lf_set(out, 1); =} + reaction(t) -> out {= + lf_set(out, 1); + =} } reactor Task { diff --git a/test/C/src/verifier/ProcessMsg.lf b/test/C/src/verifier/ProcessMsg.lf index ce9a2090d7..22b06d2276 100644 --- a/test/C/src/verifier/ProcessMsg.lf +++ b/test/C/src/verifier/ProcessMsg.lf @@ -12,9 +12,13 @@ reactor Task { logical action updateMessage - reaction(startup) {= self->messageSent = 0; =} + reaction(startup) {= + self->messageSent = 0; + =} - reaction(t) -> out {= lf_set(out, self->messageSent); =} + reaction(t) -> out {= + lf_set(out, self->messageSent); + =} reaction(in) -> updateMessage {= /* Check for invalid message. */ diff --git a/test/C/src/verifier/Ring.lf b/test/C/src/verifier/Ring.lf index eb289e1f24..ac0c03907f 100644 --- a/test/C/src/verifier/Ring.lf +++ b/test/C/src/verifier/Ring.lf @@ -12,7 +12,9 @@ reactor Source { lf_schedule(start, 0); =} - reaction(start) -> out {= lf_set(out, self->received); =} + reaction(start) -> out {= + lf_set(out, self->received); + =} /** Uncomment the following to debug feedback loops. */ // reaction(in) -> start {= @@ -26,7 +28,9 @@ reactor Node { input in: int output out: int - reaction(in) -> out {= lf_set(out, in->value + 1); =} + reaction(in) -> out {= + lf_set(out, in->value + 1); + =} } @property( diff --git a/test/C/src/verifier/SafeSend.lf b/test/C/src/verifier/SafeSend.lf index da21ef589f..29b77dd43c 100644 --- a/test/C/src/verifier/SafeSend.lf +++ b/test/C/src/verifier/SafeSend.lf @@ -41,7 +41,10 @@ reactor Server { } =} - reaction(err) {= self->error = 1; =} // Error handling logic. + // Error handling logic. + reaction(err) {= + self->error = 1; + =} } @property( diff --git a/test/C/src/verifier/Thermostat.lf b/test/C/src/verifier/Thermostat.lf index 0b583d307d..17c08f256f 100644 --- a/test/C/src/verifier/Thermostat.lf +++ b/test/C/src/verifier/Thermostat.lf @@ -8,7 +8,9 @@ reactor Environment { state _heatOn: int state _temperature: int - reaction(startup) {= self->_temperature = 19; =} + reaction(startup) {= + self->_temperature = 19; + =} reaction(t) -> temperature {= if (self->_heatOn == 0) { @@ -20,7 +22,9 @@ reactor Environment { lf_set(temperature, self->_temperature); =} - reaction(heatOn) {= self->_heatOn = heatOn->value; =} + reaction(heatOn) {= + self->_heatOn = heatOn->value; + =} } reactor _Thermostat { @@ -29,7 +33,9 @@ reactor _Thermostat { state _mode: int // 0 = COOLING, 1 = HEATING logical action changeMode - reaction(startup) {= self->_mode = 0; =} + reaction(startup) {= + self->_mode = 0; + =} reaction(temperature) -> heatOn, changeMode {= if (self->_mode == 0) { diff --git a/test/C/src/verifier/TrainDoor.lf b/test/C/src/verifier/TrainDoor.lf index d39f473bea..176f83cbf9 100644 --- a/test/C/src/verifier/TrainDoor.lf +++ b/test/C/src/verifier/TrainDoor.lf @@ -14,14 +14,18 @@ reactor Train { input in: int state received: int - reaction(in) {= self->received = in->value; =} + reaction(in) {= + self->received = in->value; + =} } reactor Door { input in: int state received: int - reaction(in) {= self->received = in->value; =} + reaction(in) {= + self->received = in->value; + =} } @property( diff --git a/test/C/src/verifier/UnsafeSend.lf b/test/C/src/verifier/UnsafeSend.lf index 73c3585885..2033888ae4 100644 --- a/test/C/src/verifier/UnsafeSend.lf +++ b/test/C/src/verifier/UnsafeSend.lf @@ -41,7 +41,10 @@ reactor Server { } =} - reaction(err) {= self->error = 1; =} // Error handling logic. + // Error handling logic. + reaction(err) {= + self->error = 1; + =} } @property( diff --git a/test/C/src/zephyr/unthreaded/HelloZephyr.lf b/test/C/src/zephyr/unthreaded/HelloZephyr.lf index aae4f62252..9d73982db6 100644 --- a/test/C/src/zephyr/unthreaded/HelloZephyr.lf +++ b/test/C/src/zephyr/unthreaded/HelloZephyr.lf @@ -3,5 +3,7 @@ target C { } main reactor { - reaction(startup) {= printf("Hello World!\n"); =} + reaction(startup) {= + printf("Hello World!\n"); + =} } diff --git a/test/C/src/zephyr/unthreaded/Timer.lf b/test/C/src/zephyr/unthreaded/Timer.lf index 17ca51b842..2d5a22d775 100644 --- a/test/C/src/zephyr/unthreaded/Timer.lf +++ b/test/C/src/zephyr/unthreaded/Timer.lf @@ -7,5 +7,7 @@ target C { main reactor { timer t(0, 1 sec) - reaction(t) {= printf("Hello\n"); =} + reaction(t) {= + printf("Hello\n"); + =} } diff --git a/test/Cpp/src/ActionDelay.lf b/test/Cpp/src/ActionDelay.lf index 98cbd11790..b953d8f522 100644 --- a/test/Cpp/src/ActionDelay.lf +++ b/test/Cpp/src/ActionDelay.lf @@ -12,13 +12,17 @@ reactor GeneratedDelay { act.schedule(); =} - reaction(act) -> y_out {= y_out.set(y_state); =} + reaction(act) -> y_out {= + y_out.set(y_state); + =} } reactor Source { output out: int - reaction(startup) -> out {= out.set(1); =} + reaction(startup) -> out {= + out.set(1); + =} } reactor Sink { diff --git a/test/Cpp/src/ActionWithNoReaction.lf b/test/Cpp/src/ActionWithNoReaction.lf index 78f1011544..3dd6e3f236 100644 --- a/test/Cpp/src/ActionWithNoReaction.lf +++ b/test/Cpp/src/ActionWithNoReaction.lf @@ -32,5 +32,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x - reaction(t) -> f.x {= f.x.set(42); =} + reaction(t) -> f.x {= + f.x.set(42); + =} } diff --git a/test/Cpp/src/After.lf b/test/Cpp/src/After.lf index 49ef7fbe6e..4308ed156d 100644 --- a/test/Cpp/src/After.lf +++ b/test/Cpp/src/After.lf @@ -8,7 +8,9 @@ reactor foo { input x: int output y: int - reaction(x) -> y {= y.set(2*(*x.get())); =} + reaction(x) -> y {= + y.set(2*(*x.get())); + =} } reactor print { diff --git a/test/Cpp/src/AfterZero.lf b/test/Cpp/src/AfterZero.lf index ce3c6dd5c7..f80ffe01bf 100644 --- a/test/Cpp/src/AfterZero.lf +++ b/test/Cpp/src/AfterZero.lf @@ -8,7 +8,9 @@ reactor foo { input x: int output y: int - reaction(x) -> y {= y.set(2*(*x.get())); =} + reaction(x) -> y {= + y.set(2*(*x.get())); + =} } reactor print { diff --git a/test/Cpp/src/Alignment.lf b/test/Cpp/src/Alignment.lf index 00f4ce0936..7eaa596379 100644 --- a/test/Cpp/src/Alignment.lf +++ b/test/Cpp/src/Alignment.lf @@ -78,7 +78,9 @@ reactor Sieve { reactor Destination { input ok: bool input in: int - state last_invoked: {= reactor::TimePoint =} + state last_invoked: {= + reactor::TimePoint + =} reaction(ok, in) {= if (ok.is_present() && in.is_present()) { diff --git a/test/Cpp/src/CompositionGain.lf b/test/Cpp/src/CompositionGain.lf index db02a4ad55..fc8182bab1 100644 --- a/test/Cpp/src/CompositionGain.lf +++ b/test/Cpp/src/CompositionGain.lf @@ -22,7 +22,9 @@ reactor Wrapper { main reactor CompositionGain { wrapper = new Wrapper() - reaction(startup) -> wrapper.x {= wrapper.x.set(42); =} + reaction(startup) -> wrapper.x {= + wrapper.x.set(42); + =} reaction(wrapper.y) {= reactor::log::Info() << "Received " << *wrapper.y.get(); diff --git a/test/Cpp/src/DanglingOutput.lf b/test/Cpp/src/DanglingOutput.lf index 537eff1cde..fe392b0a90 100644 --- a/test/Cpp/src/DanglingOutput.lf +++ b/test/Cpp/src/DanglingOutput.lf @@ -6,7 +6,9 @@ reactor Source { output out: int timer t - reaction(t) -> out {= out.set(1); =} + reaction(t) -> out {= + out.set(1); + =} } reactor Gain { diff --git a/test/Cpp/src/DelayInt.lf b/test/Cpp/src/DelayInt.lf index 757890db20..5111e26ee6 100644 --- a/test/Cpp/src/DelayInt.lf +++ b/test/Cpp/src/DelayInt.lf @@ -6,7 +6,9 @@ reactor Delay(delay: time = 100 msec) { output out: int logical action d: int - reaction(in) -> d {= d.schedule(in.get(), delay); =} + reaction(in) -> d {= + d.schedule(in.get(), delay); + =} reaction(d) -> out {= if (d.is_present()) { @@ -17,7 +19,9 @@ reactor Delay(delay: time = 100 msec) { reactor Test { input in: int - state start_time: {= reactor::TimePoint =} + state start_time: {= + reactor::TimePoint + =} timer start reaction(start) {= @@ -50,5 +54,7 @@ main reactor DelayInt { test = new Test() d.out -> test.in - reaction(t) -> d.in {= d.in.set(42); =} + reaction(t) -> d.in {= + d.in.set(42); + =} } diff --git a/test/Cpp/src/DelayedAction.lf b/test/Cpp/src/DelayedAction.lf index deb3745a97..3ee931d484 100644 --- a/test/Cpp/src/DelayedAction.lf +++ b/test/Cpp/src/DelayedAction.lf @@ -8,7 +8,9 @@ main reactor DelayedAction { logical action a: void state count: int = 0 - reaction(t) -> a {= a.schedule(100ms); =} + reaction(t) -> a {= + a.schedule(100ms); + =} reaction(a) {= auto elapsed = get_elapsed_logical_time(); diff --git a/test/Cpp/src/DelayedReaction.lf b/test/Cpp/src/DelayedReaction.lf index c975246d23..df7214a9eb 100644 --- a/test/Cpp/src/DelayedReaction.lf +++ b/test/Cpp/src/DelayedReaction.lf @@ -4,7 +4,9 @@ target Cpp reactor Source { output out: void - reaction(startup) -> out {= out.set(); =} + reaction(startup) -> out {= + out.set(); + =} } reactor Sink { diff --git a/test/Cpp/src/Determinism.lf b/test/Cpp/src/Determinism.lf index 43577397e9..1cb77d70a3 100644 --- a/test/Cpp/src/Determinism.lf +++ b/test/Cpp/src/Determinism.lf @@ -4,7 +4,9 @@ reactor Source { output y: int timer t - reaction(t) -> y {= y.set(1); =} + reaction(t) -> y {= + y.set(1); + =} } reactor Destination { @@ -31,7 +33,9 @@ reactor Pass { input x: int output y: int - reaction(x) -> y {= y.set(x.get()); =} + reaction(x) -> y {= + y.set(x.get()); + =} } main reactor Determinism { diff --git a/test/Cpp/src/DoublePort.lf b/test/Cpp/src/DoublePort.lf index fed174dbe5..73eecfa24e 100644 --- a/test/Cpp/src/DoublePort.lf +++ b/test/Cpp/src/DoublePort.lf @@ -22,7 +22,9 @@ reactor CountMicrostep { count++; =} - reaction(act) -> out {= out.set(act.get()); =} + reaction(act) -> out {= + out.set(act.get()); + =} } reactor Print { diff --git a/test/Cpp/src/Gain.lf b/test/Cpp/src/Gain.lf index 6bc9794951..ea38301191 100644 --- a/test/Cpp/src/Gain.lf +++ b/test/Cpp/src/Gain.lf @@ -5,7 +5,9 @@ reactor Scale(scale: int = 2) { input x: int output y: int - reaction(x) -> y {= y.set(*x.get() * scale); =} + reaction(x) -> y {= + y.set(*x.get() * scale); + =} } reactor Test { @@ -27,5 +29,7 @@ main reactor Gain { g.y -> t.x timer tim - reaction(tim) -> g.x {= g.x.set(1); =} + reaction(tim) -> g.x {= + g.x.set(1); + =} } diff --git a/test/Cpp/src/GetMicroStep.lf b/test/Cpp/src/GetMicroStep.lf index 5552d57ef9..bc541db26a 100644 --- a/test/Cpp/src/GetMicroStep.lf +++ b/test/Cpp/src/GetMicroStep.lf @@ -2,11 +2,15 @@ target Cpp main reactor GetMicroStep { - state s: {= reactor::mstep_t =} = 1 + state s: {= + reactor::mstep_t + =} = 1 logical action l - reaction(startup) -> l {= l.schedule(reactor::Duration::zero()); =} + reaction(startup) -> l {= + l.schedule(reactor::Duration::zero()); + =} reaction(l) -> l {= auto microstep = get_microstep(); diff --git a/test/Cpp/src/Hello.lf b/test/Cpp/src/Hello.lf index 022b9a7383..483d15b166 100644 --- a/test/Cpp/src/Hello.lf +++ b/test/Cpp/src/Hello.lf @@ -7,9 +7,13 @@ target Cpp { fast: true } -reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") { +reactor HelloCpp(period: time = 2 sec, message: {= + std::string +=} = "Hello C++") { state count: int = 0 - state previous_time: {= reactor::TimePoint =} + state previous_time: {= + reactor::TimePoint + =} timer t(1 sec, period) logical action a: void diff --git a/test/Cpp/src/HelloWorld.lf b/test/Cpp/src/HelloWorld.lf index 071cc5c968..b0a5ec1109 100644 --- a/test/Cpp/src/HelloWorld.lf +++ b/test/Cpp/src/HelloWorld.lf @@ -3,7 +3,9 @@ target Cpp reactor HelloWorld2 { timer t - reaction(t) {= std::cout << "Hello World." << std::endl; =} + reaction(t) {= + std::cout << "Hello World." << std::endl; + =} } main reactor { diff --git a/test/Cpp/src/Hierarchy.lf b/test/Cpp/src/Hierarchy.lf index ba92775c1c..090962b379 100644 --- a/test/Cpp/src/Hierarchy.lf +++ b/test/Cpp/src/Hierarchy.lf @@ -5,14 +5,18 @@ reactor Source { output out: int timer t - reaction(t) -> out {= out.set(1); =} + reaction(t) -> out {= + out.set(1); + =} } reactor Gain { input in: int output out: int - reaction(in) -> out {= out.set((*in.get()) * 2); =} + reaction(in) -> out {= + out.set((*in.get()) * 2); + =} } reactor Print { diff --git a/test/Cpp/src/Hierarchy2.lf b/test/Cpp/src/Hierarchy2.lf index e21a966c54..e94929486a 100644 --- a/test/Cpp/src/Hierarchy2.lf +++ b/test/Cpp/src/Hierarchy2.lf @@ -8,7 +8,9 @@ reactor Source { output out: int timer t(0, 1 sec) - reaction(t) -> out {= out.set(1); =} + reaction(t) -> out {= + out.set(1); + =} } reactor Count { diff --git a/test/Cpp/src/Import.lf b/test/Cpp/src/Import.lf index c77f8382c5..046af870d4 100644 --- a/test/Cpp/src/Import.lf +++ b/test/Cpp/src/Import.lf @@ -7,5 +7,7 @@ main reactor Import { timer t a = new Imported() - reaction(t) -> a.x {= a.x.set(42); =} + reaction(t) -> a.x {= + a.x.set(42); + =} } diff --git a/test/Cpp/src/ImportComposition.lf b/test/Cpp/src/ImportComposition.lf index 390f02bee3..8d8f13ae9b 100644 --- a/test/Cpp/src/ImportComposition.lf +++ b/test/Cpp/src/ImportComposition.lf @@ -17,7 +17,9 @@ main reactor ImportComposition { imp_comp = new ImportedComposition() state received: bool = false - reaction(startup) -> imp_comp.x {= imp_comp.x.set(42); =} + reaction(startup) -> imp_comp.x {= + imp_comp.x.set(42); + =} reaction(imp_comp.y) {= auto receive_time = get_elapsed_logical_time(); diff --git a/test/Cpp/src/ImportRenamed.lf b/test/Cpp/src/ImportRenamed.lf index 4ec5dc132e..0f6f447e7e 100644 --- a/test/Cpp/src/ImportRenamed.lf +++ b/test/Cpp/src/ImportRenamed.lf @@ -17,5 +17,7 @@ main reactor { b = new Y() c = new Z() - reaction(t) -> a.x {= a.x.set(42); =} + reaction(t) -> a.x {= + a.x.set(42); + =} } diff --git a/test/Cpp/src/ManualDelayedReaction.lf b/test/Cpp/src/ManualDelayedReaction.lf index e7bb1190ba..2f01d4c753 100644 --- a/test/Cpp/src/ManualDelayedReaction.lf +++ b/test/Cpp/src/ManualDelayedReaction.lf @@ -8,16 +8,23 @@ reactor GeneratedDelay { logical action act(100 msec): int - reaction(y_in) -> act {= act.schedule(y_in.get()); =} + reaction(y_in) -> act {= + act.schedule(y_in.get()); + =} - reaction(act) -> y_out {= y_out.set(act.get()); =} + reaction(act) -> y_out {= + y_out.set(act.get()); + =} } reactor Source { output out: int timer t - reaction(t) -> out {= out.set(1); =} // reaction(t) -> out after 100 msec {= + // reaction(t) -> out after 100 msec {= + reaction(t) -> out {= + out.set(1); + =} } reactor Sink { diff --git a/test/Cpp/src/Methods.lf b/test/Cpp/src/Methods.lf index c39b0dff4d..79720b555a 100644 --- a/test/Cpp/src/Methods.lf +++ b/test/Cpp/src/Methods.lf @@ -3,9 +3,13 @@ target Cpp main reactor { state foo: int = 2 - const method getFoo(): int {= return foo; =} + const method getFoo(): int {= + return foo; + =} - method add(x: int) {= foo += x; =} + method add(x: int) {= + foo += x; + =} reaction(startup) {= std::cout << "Foo is initialized to " << getFoo() << '\n'; diff --git a/test/Cpp/src/Microsteps.lf b/test/Cpp/src/Microsteps.lf index 51a61e508a..43a5f374aa 100644 --- a/test/Cpp/src/Microsteps.lf +++ b/test/Cpp/src/Microsteps.lf @@ -39,5 +39,7 @@ main reactor Microsteps { repeat.schedule(); =} - reaction(repeat) -> d.y {= d.y.set(1); =} + reaction(repeat) -> d.y {= + d.y.set(1); + =} } diff --git a/test/Cpp/src/Minimal.lf b/test/Cpp/src/Minimal.lf index d49bea2620..2706976fe8 100644 --- a/test/Cpp/src/Minimal.lf +++ b/test/Cpp/src/Minimal.lf @@ -2,5 +2,7 @@ target Cpp main reactor Minimal { - reaction(startup) {= std::cout << "Hello World!\n"; =} + reaction(startup) {= + std::cout << "Hello World!\n"; + =} } diff --git a/test/Cpp/src/MultipleContained.lf b/test/Cpp/src/MultipleContained.lf index df168ca394..ecc38ae22b 100644 --- a/test/Cpp/src/MultipleContained.lf +++ b/test/Cpp/src/MultipleContained.lf @@ -6,7 +6,9 @@ reactor Contained { input in1: int input in2: int - reaction(startup) -> trigger {= trigger.set(42); =} + reaction(startup) -> trigger {= + trigger.set(42); + =} reaction(in1) {= std::cout << "in1 received " << *in1.get() << '\n'; diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index b6e8550c50..b786edc7a5 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -6,7 +6,9 @@ reactor Foo( y: time = 0, // Units are missing but not required z = 1 msec, // Type is missing but not required p: int[]{1, 2, 3, 4}, // List of integers - q: {= std::vector =}{1 msec, 2 msec, 3 msec}, + q: {= + std::vector + =}{1 msec, 2 msec, 3 msec}, g: time[]{1 msec, 2 msec}, // List of time values g2: int[] = {}) { state s: time = y // Reference to explicitly typed time parameter @@ -18,7 +20,10 @@ reactor Foo( timer toe(z) // Implicit type time state baz = p // Implicit type int[] state period = z // Implicit type time - state times: std::vector>{q, g} // a list of lists + // a list of lists + state times: std::vector>{q, g} state empty_list: int[] = {} reaction(tick) {= diff --git a/test/Cpp/src/NestedTriggeredReactions.lf b/test/Cpp/src/NestedTriggeredReactions.lf index 7cd16fad2e..5b95df380d 100644 --- a/test/Cpp/src/NestedTriggeredReactions.lf +++ b/test/Cpp/src/NestedTriggeredReactions.lf @@ -9,7 +9,9 @@ reactor Container { in -> contained.in - reaction(in) {= triggered = true; =} + reaction(in) {= + triggered = true; + =} reaction(shutdown) {= if (!triggered) { @@ -24,7 +26,9 @@ reactor Contained { state triggered: bool = false - reaction(in) {= triggered = true; =} + reaction(in) {= + triggered = true; + =} reaction(shutdown) {= if (!triggered) { @@ -37,5 +41,7 @@ reactor Contained { main reactor { container = new Container() - reaction(startup) -> container.in {= container.in.set(); =} + reaction(startup) -> container.in {= + container.in.set(); + =} } diff --git a/test/Cpp/src/PeriodicDesugared.lf b/test/Cpp/src/PeriodicDesugared.lf index 1e5dad1b7d..868c14bad1 100644 --- a/test/Cpp/src/PeriodicDesugared.lf +++ b/test/Cpp/src/PeriodicDesugared.lf @@ -13,7 +13,9 @@ main reactor(offset: time = 50 msec, period: time = 500 msec) { init.schedule(); =} - reaction(init) -> recur {= recur.schedule(); =} + reaction(init) -> recur {= + recur.schedule(); + =} reaction(init, recur) -> recur {= std::cout << "Periodic trigger!\n"; diff --git a/test/Cpp/src/PhysicalConnection.lf b/test/Cpp/src/PhysicalConnection.lf index 7957b5460f..6e28e8e3da 100644 --- a/test/Cpp/src/PhysicalConnection.lf +++ b/test/Cpp/src/PhysicalConnection.lf @@ -4,7 +4,9 @@ target Cpp reactor Source { output out: int - reaction(startup) -> out {= out.set(42); =} + reaction(startup) -> out {= + out.set(42); + =} } reactor Destination { diff --git a/test/Cpp/src/Pipeline.lf b/test/Cpp/src/Pipeline.lf index 00e9e3f48e..b4adbfd826 100644 --- a/test/Cpp/src/Pipeline.lf +++ b/test/Cpp/src/Pipeline.lf @@ -40,5 +40,7 @@ main reactor Pipeline { c3.out -> c4.in after 200 msec c4.out -> p.in - reaction(t) -> c1.in {= c1.in.set(count++); =} + reaction(t) -> c1.in {= + c1.in.set(count++); + =} } diff --git a/test/Cpp/src/PreambleTest.lf b/test/Cpp/src/PreambleTest.lf index b82e393a8e..9039a1ef1b 100644 --- a/test/Cpp/src/PreambleTest.lf +++ b/test/Cpp/src/PreambleTest.lf @@ -20,7 +20,9 @@ main reactor { =} logical action a: MyStruct - reaction(startup) -> a {= a.schedule({add_42(42), "baz"}); =} + reaction(startup) -> a {= + a.schedule({add_42(42), "baz"}); + =} reaction(a) {= auto& value = *a.get(); diff --git a/test/Cpp/src/ReadOutputOfContainedReactor.lf b/test/Cpp/src/ReadOutputOfContainedReactor.lf index 885fbad734..ee542683ba 100644 --- a/test/Cpp/src/ReadOutputOfContainedReactor.lf +++ b/test/Cpp/src/ReadOutputOfContainedReactor.lf @@ -4,7 +4,9 @@ target Cpp reactor Contained { output out: int - reaction(startup) -> out {= out.set(42); =} + reaction(startup) -> out {= + out.set(42); + =} } main reactor ReadOutputOfContainedReactor { diff --git a/test/Cpp/src/Schedule.lf b/test/Cpp/src/Schedule.lf index c62b1bf701..320cf02baf 100644 --- a/test/Cpp/src/Schedule.lf +++ b/test/Cpp/src/Schedule.lf @@ -5,7 +5,9 @@ reactor ScheduleTest { input x: int logical action a: void - reaction(x) -> a {= a.schedule(200ms); =} + reaction(x) -> a {= + a.schedule(200ms); + =} reaction(a) {= auto elapsed_time = get_elapsed_logical_time(); @@ -23,5 +25,7 @@ main reactor Schedule { a = new ScheduleTest() timer t - reaction(t) -> a.x {= a.x.set(1); =} + reaction(t) -> a.x {= + a.x.set(1); + =} } diff --git a/test/Cpp/src/ScheduleLogicalAction.lf b/test/Cpp/src/ScheduleLogicalAction.lf index f8092b3f09..b47a199b79 100644 --- a/test/Cpp/src/ScheduleLogicalAction.lf +++ b/test/Cpp/src/ScheduleLogicalAction.lf @@ -22,7 +22,9 @@ reactor foo { a.schedule(500ms); =} - reaction(a) -> y {= y.set(-42); =} + reaction(a) -> y {= + y.set(-42); + =} } reactor print { @@ -48,5 +50,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x - reaction(t) -> f.x {= f.x.set(42); =} + reaction(t) -> f.x {= + f.x.set(42); + =} } diff --git a/test/Cpp/src/SelfLoop.lf b/test/Cpp/src/SelfLoop.lf index 0fd8fe4d6b..48c180a156 100644 --- a/test/Cpp/src/SelfLoop.lf +++ b/test/Cpp/src/SelfLoop.lf @@ -29,7 +29,9 @@ reactor Self { a.schedule(x.get(), 100ms); =} - reaction(startup) -> a {= a.schedule(42, 0ns); =} + reaction(startup) -> a {= + a.schedule(42, 0ns); + =} reaction(shutdown) {= if(expected <= 43) { diff --git a/test/Cpp/src/SendingInside2.lf b/test/Cpp/src/SendingInside2.lf index d2b62982b2..a083443b94 100644 --- a/test/Cpp/src/SendingInside2.lf +++ b/test/Cpp/src/SendingInside2.lf @@ -16,5 +16,7 @@ main reactor SendingInside2 { timer t p = new Printer() - reaction(t) -> p.x {= p.x.set(1); =} + reaction(t) -> p.x {= + p.x.set(1); + =} } diff --git a/test/Cpp/src/SlowingClock.lf b/test/Cpp/src/SlowingClock.lf index 913768dada..cb79c80b75 100644 --- a/test/Cpp/src/SlowingClock.lf +++ b/test/Cpp/src/SlowingClock.lf @@ -17,7 +17,9 @@ main reactor SlowingClock { state interval: time = 100 msec state expected_time: time = 100 msec - reaction(startup) -> a {= a.schedule(0ns); =} + reaction(startup) -> a {= + a.schedule(0ns); + =} reaction(a) -> a {= auto elapsed_logical_time = get_elapsed_logical_time(); diff --git a/test/Cpp/src/StartupOutFromInside.lf b/test/Cpp/src/StartupOutFromInside.lf index 0d3502c8c5..d36441934b 100644 --- a/test/Cpp/src/StartupOutFromInside.lf +++ b/test/Cpp/src/StartupOutFromInside.lf @@ -8,7 +8,9 @@ target Cpp reactor Bar { output out: int - reaction(startup) -> out {= out.set(42); =} + reaction(startup) -> out {= + out.set(42); + =} } main reactor StartupOutFromInside { diff --git a/test/Cpp/src/Stride.lf b/test/Cpp/src/Stride.lf index 85b6c1ef0d..9ebb61c91f 100644 --- a/test/Cpp/src/Stride.lf +++ b/test/Cpp/src/Stride.lf @@ -19,7 +19,9 @@ reactor Count(stride: int = 1) { reactor Display { input x: int - reaction(x) {= std::cout << "Received " << *x.get() << std::endl; =} + reaction(x) {= + std::cout << "Received " << *x.get() << std::endl; + =} } main reactor Stride { diff --git a/test/Cpp/src/StructPrint.lf b/test/Cpp/src/StructPrint.lf index 807dba8e85..6e0fba1199 100644 --- a/test/Cpp/src/StructPrint.lf +++ b/test/Cpp/src/StructPrint.lf @@ -18,7 +18,9 @@ reactor Source { =} } -reactor Print(expected_value: int = 42, expected_name: {= std::string =} = "Earth") { +reactor Print(expected_value: int = 42, expected_name: {= + std::string +=} = "Earth") { input in: Hello reaction(in) {= diff --git a/test/Cpp/src/TimeLimit.lf b/test/Cpp/src/TimeLimit.lf index 0249285e6b..1d11882740 100644 --- a/test/Cpp/src/TimeLimit.lf +++ b/test/Cpp/src/TimeLimit.lf @@ -44,5 +44,7 @@ main reactor TimeLimit(period: time = 1 sec) { d = new Destination() c.y -> d.x - reaction(stop) {= environment()->sync_shutdown(); =} + reaction(stop) {= + environment()->sync_shutdown(); + =} } diff --git a/test/Cpp/src/TimeState.lf b/test/Cpp/src/TimeState.lf index 01f28e7f85..c08f081ba7 100644 --- a/test/Cpp/src/TimeState.lf +++ b/test/Cpp/src/TimeState.lf @@ -3,7 +3,9 @@ target Cpp reactor Foo(bar: time = 42 msec) { state baz = bar - reaction(startup) {= std::cout << "Baz: " << baz << std::endl; =} + reaction(startup) {= + std::cout << "Baz: " << baz << std::endl; + =} } main reactor { diff --git a/test/Cpp/src/concurrent/AsyncCallback.lf b/test/Cpp/src/concurrent/AsyncCallback.lf index b9d655ca75..07eb85ca3a 100644 --- a/test/Cpp/src/concurrent/AsyncCallback.lf +++ b/test/Cpp/src/concurrent/AsyncCallback.lf @@ -10,7 +10,9 @@ main reactor AsyncCallback { =} timer t(0, 200 msec) - state thread: {= std::thread =} + state thread: {= + std::thread + =} state expected_time: time = 100 msec state toggle: bool = false diff --git a/test/Cpp/src/concurrent/DelayIntThreaded.lf b/test/Cpp/src/concurrent/DelayIntThreaded.lf index 33db1411de..e090af0b89 100644 --- a/test/Cpp/src/concurrent/DelayIntThreaded.lf +++ b/test/Cpp/src/concurrent/DelayIntThreaded.lf @@ -6,7 +6,9 @@ reactor Delay(delay: time = 100 msec) { output out: int logical action d: int - reaction(in) -> d {= d.schedule(in.get(), delay); =} + reaction(in) -> d {= + d.schedule(in.get(), delay); + =} reaction(d) -> out {= if (d.is_present()) { @@ -17,7 +19,9 @@ reactor Delay(delay: time = 100 msec) { reactor Test { input in: int - state start_time: {= reactor::TimePoint =} + state start_time: {= + reactor::TimePoint + =} timer start reaction(start) {= @@ -50,5 +54,7 @@ main reactor { test = new Test() d.out -> test.in - reaction(t) -> d.in {= d.in.set(42); =} + reaction(t) -> d.in {= + d.in.set(42); + =} } diff --git a/test/Cpp/src/concurrent/DeterminismThreaded.lf b/test/Cpp/src/concurrent/DeterminismThreaded.lf index c0de1858c1..4fc1e5ba5b 100644 --- a/test/Cpp/src/concurrent/DeterminismThreaded.lf +++ b/test/Cpp/src/concurrent/DeterminismThreaded.lf @@ -4,7 +4,9 @@ reactor Source { output y: int timer t - reaction(t) -> y {= y.set(1); =} + reaction(t) -> y {= + y.set(1); + =} } reactor Destination { @@ -31,7 +33,9 @@ reactor Pass { input x: int output y: int - reaction(x) -> y {= y.set(x.get()); =} + reaction(x) -> y {= + y.set(x.get()); + =} } main reactor { diff --git a/test/Cpp/src/concurrent/GainThreaded.lf b/test/Cpp/src/concurrent/GainThreaded.lf index 112f97632b..379a441ff1 100644 --- a/test/Cpp/src/concurrent/GainThreaded.lf +++ b/test/Cpp/src/concurrent/GainThreaded.lf @@ -5,7 +5,9 @@ reactor Scale(scale: int = 2) { input x: int output y: int - reaction(x) -> y {= y.set(*x.get() * scale); =} + reaction(x) -> y {= + y.set(*x.get() * scale); + =} } reactor Test { @@ -27,5 +29,7 @@ main reactor { g.y -> t.x timer tim - reaction(tim) -> g.x {= g.x.set(1); =} + reaction(tim) -> g.x {= + g.x.set(1); + =} } diff --git a/test/Cpp/src/concurrent/HelloThreaded.lf b/test/Cpp/src/concurrent/HelloThreaded.lf index 35e2261048..ca08070d87 100644 --- a/test/Cpp/src/concurrent/HelloThreaded.lf +++ b/test/Cpp/src/concurrent/HelloThreaded.lf @@ -7,9 +7,13 @@ target Cpp { fast: true } -reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") { +reactor HelloCpp(period: time = 2 sec, message: {= + std::string +=} = "Hello C++") { state count: int = 0 - state previous_time: {= reactor::TimePoint =} + state previous_time: {= + reactor::TimePoint + =} timer t(1 sec, period) logical action a: void @@ -35,7 +39,9 @@ reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") =} } -reactor Inside(period: time = 1 sec, message: {= std::string =} = "Composite default message.") { +reactor Inside(period: time = 1 sec, message: {= + std::string +=} = "Composite default message.") { third_instance = new HelloCpp(period=period, message=message) } diff --git a/test/Cpp/src/concurrent/ImportThreaded.lf b/test/Cpp/src/concurrent/ImportThreaded.lf index 791291fc10..73dac5911c 100644 --- a/test/Cpp/src/concurrent/ImportThreaded.lf +++ b/test/Cpp/src/concurrent/ImportThreaded.lf @@ -7,5 +7,7 @@ main reactor { timer t a = new Imported() - reaction(t) -> a.x {= a.x.set(42); =} + reaction(t) -> a.x {= + a.x.set(42); + =} } diff --git a/test/Cpp/src/concurrent/MinimalThreaded.lf b/test/Cpp/src/concurrent/MinimalThreaded.lf index a0184d5261..421eb45d57 100644 --- a/test/Cpp/src/concurrent/MinimalThreaded.lf +++ b/test/Cpp/src/concurrent/MinimalThreaded.lf @@ -2,5 +2,7 @@ target Cpp main reactor { - reaction(startup) {= std::cout << "Hello World!\n"; =} + reaction(startup) {= + std::cout << "Hello World!\n"; + =} } diff --git a/test/Cpp/src/concurrent/TimeLimitThreaded.lf b/test/Cpp/src/concurrent/TimeLimitThreaded.lf index ecff6ecfc9..6d561cca38 100644 --- a/test/Cpp/src/concurrent/TimeLimitThreaded.lf +++ b/test/Cpp/src/concurrent/TimeLimitThreaded.lf @@ -45,5 +45,7 @@ main reactor(period: time = 1 sec) { d = new Destination() c.y -> d.x - reaction(stop) {= environment()->sync_shutdown(); =} + reaction(stop) {= + environment()->sync_shutdown(); + =} } diff --git a/test/Cpp/src/enclave/EnclaveBankEach.lf b/test/Cpp/src/enclave/EnclaveBankEach.lf index d1b94748ba..c220a082c5 100644 --- a/test/Cpp/src/enclave/EnclaveBankEach.lf +++ b/test/Cpp/src/enclave/EnclaveBankEach.lf @@ -6,8 +6,12 @@ target Cpp { reactor Node( bank_index: size_t = 0, id: std::string = {= "node" + std::to_string(bank_index) =}, - period: {= reactor::Duration =} = {= 100ms * (bank_index+1) =}, - duration: {= reactor::Duration =} = {= 50ms + 100ms * bank_index =}) { + period: {= + reactor::Duration + =} = {= 100ms * (bank_index+1) =}, + duration: {= + reactor::Duration + =} = {= 50ms + 100ms * bank_index =}) { logical action a: void reaction(startup, a) -> a {= diff --git a/test/Cpp/src/enclave/EnclaveBroadcast.lf b/test/Cpp/src/enclave/EnclaveBroadcast.lf index a54452b2ea..389179429e 100644 --- a/test/Cpp/src/enclave/EnclaveBroadcast.lf +++ b/test/Cpp/src/enclave/EnclaveBroadcast.lf @@ -5,7 +5,9 @@ target Cpp { reactor Source { output out: unsigned - reaction(startup) -> out {= out.set(42); =} + reaction(startup) -> out {= + out.set(42); + =} } reactor Sink(bank_index: size_t = 0) { diff --git a/test/Cpp/src/enclave/EnclaveCommunication.lf b/test/Cpp/src/enclave/EnclaveCommunication.lf index 9bf2af20cc..338be8a66c 100644 --- a/test/Cpp/src/enclave/EnclaveCommunication.lf +++ b/test/Cpp/src/enclave/EnclaveCommunication.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { diff --git a/test/Cpp/src/enclave/EnclaveCommunication2.lf b/test/Cpp/src/enclave/EnclaveCommunication2.lf index bb60949645..dae4722da8 100644 --- a/test/Cpp/src/enclave/EnclaveCommunication2.lf +++ b/test/Cpp/src/enclave/EnclaveCommunication2.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf b/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf index 9adad03ebb..d9cea724bf 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationDelayed.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf b/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf index 6272a7aa00..89467ae0a5 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationDelayed2.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf b/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf index 31939cf447..ae2b28da08 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationDelayedLocalEvents.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { @@ -34,7 +36,9 @@ reactor Sink { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf b/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf index 342a6e7eaf..ac830a86c0 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationLocalEvents.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { @@ -34,7 +36,9 @@ reactor Sink { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf index e315632425..134a53b9ef 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBank.lf @@ -44,7 +44,9 @@ reactor Sink(bank_index: std::size_t = 0) { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf index 4eda00fd38..60776a4db0 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankDelayed.lf @@ -44,7 +44,9 @@ reactor Sink(bank_index: std::size_t = 0) { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf index 1016beffce..4acce71e86 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEach.lf @@ -44,7 +44,9 @@ reactor Sink(bank_index: std::size_t = 0) { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf index 97ad53108a..4eb175dc6c 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachDelayed.lf @@ -44,7 +44,9 @@ reactor Sink(bank_index: std::size_t = 0) { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf index e7b9ab3288..3a8e7d2dfd 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankEachPhysical.lf @@ -44,7 +44,9 @@ reactor Sink(bank_index: std::size_t = 0) { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf index ece73aab30..257ce163f4 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationMultiportToBankPhysical.lf @@ -44,7 +44,9 @@ reactor Sink(bank_index: std::size_t = 0) { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf b/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf index 65a2b44825..9abb687b07 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationPhysical.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { diff --git a/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf b/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf index c413345f16..1bdb3e8323 100644 --- a/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf +++ b/test/Cpp/src/enclave/EnclaveCommunicationPhysicalLocalEvents.lf @@ -8,7 +8,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { @@ -34,7 +36,9 @@ reactor Sink { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} + reaction(t) {= + reactor::log::Info() << "Tick"; + =} } main reactor { diff --git a/test/Cpp/src/enclave/EnclaveCycle.lf b/test/Cpp/src/enclave/EnclaveCycle.lf index 15d68b99cc..960866e59f 100644 --- a/test/Cpp/src/enclave/EnclaveCycle.lf +++ b/test/Cpp/src/enclave/EnclaveCycle.lf @@ -10,7 +10,9 @@ reactor Ping { state counter: int = 0 state received: bool = false - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} reaction(in) {= received = true; diff --git a/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf b/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf index 8c4ce316a3..5ba4ea4916 100644 --- a/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf +++ b/test/Cpp/src/enclave/EnclaveCycleTwoTimers.lf @@ -10,7 +10,9 @@ reactor Ping { state counter: int = 0 state received: bool = false - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} reaction(in) {= received = true; @@ -38,7 +40,9 @@ reactor Pong { state counter: int = 0 state received: bool = false - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} reaction(in) {= received = true; diff --git a/test/Cpp/src/enclave/EnclaveHelloWorld.lf b/test/Cpp/src/enclave/EnclaveHelloWorld.lf index 21b7374a09..e33c56ed93 100644 --- a/test/Cpp/src/enclave/EnclaveHelloWorld.lf +++ b/test/Cpp/src/enclave/EnclaveHelloWorld.lf @@ -1,7 +1,9 @@ target Cpp reactor Hello(msg: std::string = "World") { - reaction(startup) {= reactor::log::Info() << "Hello " << msg << '!'; =} + reaction(startup) {= + reactor::log::Info() << "Hello " << msg << '!'; + =} } main reactor(msg1: std::string = "World", msg2: std::string = "Enclave") { diff --git a/test/Cpp/src/enclave/EnclaveShutdown.lf b/test/Cpp/src/enclave/EnclaveShutdown.lf index ab56d58b08..a949cc88be 100644 --- a/test/Cpp/src/enclave/EnclaveShutdown.lf +++ b/test/Cpp/src/enclave/EnclaveShutdown.lf @@ -4,9 +4,13 @@ reactor Node(message: std::string = "Hello", period: time = 1 sec, stop: time = timer t(0, period) timer s(stop) - reaction(t) {= reactor::log::Info() << message; =} + reaction(t) {= + reactor::log::Info() << message; + =} - reaction(s) {= request_stop(); =} + reaction(s) {= + request_stop(); + =} reaction(shutdown) {= reactor::log::Info() << "Goodbye!"; diff --git a/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf b/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf index 047910fd91..33d0c8e0e6 100644 --- a/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf +++ b/test/Cpp/src/enclave/EnclaveSparseUpstreamEvents.lf @@ -10,7 +10,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { @@ -36,7 +38,9 @@ reactor Sink { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} deadline(2 s) {= + reaction(t) {= + reactor::log::Info() << "Tick"; + =} deadline(2 s) {= reactor::log::Error() << "Deadline violated."; exit(2); =} diff --git a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf index 486655ddd6..1a02db98a5 100644 --- a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsDelayed.lf @@ -10,7 +10,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { @@ -36,7 +38,9 @@ reactor Sink { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} deadline(2 s) {= + reaction(t) {= + reactor::log::Info() << "Tick"; + =} deadline(2 s) {= reactor::log::Error() << "Deadline violated."; exit(2); =} diff --git a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf index d2f0a78e3f..b73152954b 100644 --- a/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf +++ b/test/Cpp/src/enclave/EnclaveSparseUpstreamEventsPhysical.lf @@ -10,7 +10,9 @@ reactor Src { output out: int state counter: int = 0 - reaction(t) -> out {= out.set(counter++); =} + reaction(t) -> out {= + out.set(counter++); + =} } reactor Sink { @@ -36,7 +38,9 @@ reactor Sink { } =} - reaction(t) {= reactor::log::Info() << "Tick"; =} deadline(2 s) {= + reaction(t) {= + reactor::log::Info() << "Tick"; + =} deadline(2 s) {= reactor::log::Error() << "Deadline violated."; exit(2); =} diff --git a/test/Cpp/src/enclave/EnclaveTimeout.lf b/test/Cpp/src/enclave/EnclaveTimeout.lf index b05e6b7b1e..2ba4a59464 100644 --- a/test/Cpp/src/enclave/EnclaveTimeout.lf +++ b/test/Cpp/src/enclave/EnclaveTimeout.lf @@ -5,7 +5,9 @@ target Cpp { reactor Node(message: std::string = "Hello", period: time = 1 sec) { timer t(0, period) - reaction(t) {= reactor::log::Info() << message; =} + reaction(t) {= + reactor::log::Info() << message; + =} reaction(shutdown) {= reactor::log::Info() << "Goodbye!"; diff --git a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf index 16d0d55586..0097a1e4ae 100644 --- a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf +++ b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalAction.lf @@ -25,7 +25,9 @@ reactor Src { }); =} - reaction(a) -> out {= out.set(a.get()); =} + reaction(a) -> out {= + out.set(a.get()); + =} reaction(shutdown) {= // make sure to join the thread before shutting down diff --git a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf index 4e7b138c90..936e692a71 100644 --- a/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf +++ b/test/Cpp/src/enclave/EnclaveUpstreamPhysicalActionDelayed.lf @@ -25,7 +25,9 @@ reactor Src { }); =} - reaction(a) -> out {= out.set(a.get()); =} + reaction(a) -> out {= + out.set(a.get()); + =} reaction(shutdown) {= // make sure to join the thread before shutting down diff --git a/test/Cpp/src/enclave/FastAndSlow.lf b/test/Cpp/src/enclave/FastAndSlow.lf index 3d421223e6..554f07073b 100644 --- a/test/Cpp/src/enclave/FastAndSlow.lf +++ b/test/Cpp/src/enclave/FastAndSlow.lf @@ -20,7 +20,9 @@ reactor Slow { reactor Fast { timer t(0 msec, 100 msec) - reaction(t) {= reactor::log::Info() << "Fast reaction executes"; =} deadline(200 msec) {= + reaction(t) {= + reactor::log::Info() << "Fast reaction executes"; + =} deadline(200 msec) {= reactor::log::Error() << "Fast deadline was violated!"; exit(2); =} diff --git a/test/Cpp/src/lib/Imported.lf b/test/Cpp/src/lib/Imported.lf index abf2464b96..f1ce5ae3aa 100644 --- a/test/Cpp/src/lib/Imported.lf +++ b/test/Cpp/src/lib/Imported.lf @@ -8,5 +8,7 @@ reactor Imported { input x: int a = new ImportedAgain() - reaction(x) -> a.x {= a.x.set(x.get()); =} + reaction(x) -> a.x {= + a.x.set(x.get()); + =} } diff --git a/test/Cpp/src/lib/ImportedComposition.lf b/test/Cpp/src/lib/ImportedComposition.lf index cc3ccba591..eec583e8a6 100644 --- a/test/Cpp/src/lib/ImportedComposition.lf +++ b/test/Cpp/src/lib/ImportedComposition.lf @@ -12,7 +12,9 @@ reactor Gain { input x: int output y: int - reaction(x) -> y {= y.set(*x.get() * 2); =} + reaction(x) -> y {= + y.set(*x.get() * 2); + =} } reactor ImportedComposition { diff --git a/test/Cpp/src/multiport/BankSelfBroadcast.lf b/test/Cpp/src/multiport/BankSelfBroadcast.lf index 2961e3a55c..a7f81fcff9 100644 --- a/test/Cpp/src/multiport/BankSelfBroadcast.lf +++ b/test/Cpp/src/multiport/BankSelfBroadcast.lf @@ -13,7 +13,9 @@ reactor A(bank_index: size_t = 0) { output out: size_t state received: bool = false - reaction(startup) -> out {= out.set(bank_index); =} + reaction(startup) -> out {= + out.set(bank_index); + =} reaction(in) {= for (size_t i = 0; i < in.size(); i++) { diff --git a/test/Cpp/src/multiport/BankToMultiport.lf b/test/Cpp/src/multiport/BankToMultiport.lf index 93b476c235..bf283164de 100644 --- a/test/Cpp/src/multiport/BankToMultiport.lf +++ b/test/Cpp/src/multiport/BankToMultiport.lf @@ -4,7 +4,9 @@ target Cpp reactor Source(bank_index: size_t = 0) { output out: unsigned - reaction(startup) -> out {= out.set(bank_index); =} + reaction(startup) -> out {= + out.set(bank_index); + =} } reactor Sink { diff --git a/test/Cpp/src/multiport/Broadcast.lf b/test/Cpp/src/multiport/Broadcast.lf index 0ae960053b..2289cbb596 100644 --- a/test/Cpp/src/multiport/Broadcast.lf +++ b/test/Cpp/src/multiport/Broadcast.lf @@ -3,7 +3,9 @@ target Cpp reactor Source { output out: unsigned - reaction(startup) -> out {= out.set(42); =} + reaction(startup) -> out {= + out.set(42); + =} } reactor Sink(bank_index: size_t = 0) { diff --git a/test/Cpp/src/multiport/BroadcastAfter.lf b/test/Cpp/src/multiport/BroadcastAfter.lf index 50b8d5bb59..bdf5274229 100644 --- a/test/Cpp/src/multiport/BroadcastAfter.lf +++ b/test/Cpp/src/multiport/BroadcastAfter.lf @@ -5,7 +5,9 @@ target Cpp { reactor Source { output out: unsigned - reaction(startup) -> out {= out.set(42); =} + reaction(startup) -> out {= + out.set(42); + =} } reactor Sink(bank_index: size_t = 0) { diff --git a/test/Cpp/src/multiport/BroadcastMultipleAfter.lf b/test/Cpp/src/multiport/BroadcastMultipleAfter.lf index da2af4e9cf..6d37fedc72 100644 --- a/test/Cpp/src/multiport/BroadcastMultipleAfter.lf +++ b/test/Cpp/src/multiport/BroadcastMultipleAfter.lf @@ -5,7 +5,9 @@ target Cpp { reactor Source(value: unsigned = 42) { output out: unsigned - reaction(startup) -> out {= out.set(value); =} + reaction(startup) -> out {= + out.set(value); + =} } reactor Sink(bank_index: size_t = 0) { diff --git a/test/Cpp/src/multiport/IndexIntoMultiportInput.lf b/test/Cpp/src/multiport/IndexIntoMultiportInput.lf index 39baee6b6b..a167edf8df 100644 --- a/test/Cpp/src/multiport/IndexIntoMultiportInput.lf +++ b/test/Cpp/src/multiport/IndexIntoMultiportInput.lf @@ -45,9 +45,15 @@ main reactor IndexIntoMultiportInput { splitter.out -> receiver.in - reaction(startup) -> splitter.in0 {= splitter.in0.set(0); =} + reaction(startup) -> splitter.in0 {= + splitter.in0.set(0); + =} - reaction(startup) -> splitter.in1 {= splitter.in1.set(1); =} + reaction(startup) -> splitter.in1 {= + splitter.in1.set(1); + =} - reaction(startup) -> splitter.in2 {= splitter.in2.set(2); =} + reaction(startup) -> splitter.in2 {= + splitter.in2.set(2); + =} } diff --git a/test/Cpp/src/multiport/MultiportFromBank.lf b/test/Cpp/src/multiport/MultiportFromBank.lf index e3f6a23b30..6d952ccbbf 100644 --- a/test/Cpp/src/multiport/MultiportFromBank.lf +++ b/test/Cpp/src/multiport/MultiportFromBank.lf @@ -8,7 +8,9 @@ target Cpp { reactor Source(bank_index: size_t = 0) { output out: unsigned - reaction(startup) -> out {= out.set(bank_index); =} + reaction(startup) -> out {= + out.set(bank_index); + =} } reactor Destination(port_width: size_t = 2) { diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf index c6ffb52819..bd4a5ab263 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchy.lf @@ -8,7 +8,9 @@ target Cpp { reactor Source(bank_index: size_t = 0) { output out: unsigned - reaction(startup) -> out {= out.set(bank_index); =} + reaction(startup) -> out {= + out.set(bank_index); + =} } reactor Container { diff --git a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf index cb3eeaa0c4..e3d76d4e51 100644 --- a/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf +++ b/test/Cpp/src/multiport/MultiportFromBankHierarchyAfter.lf @@ -8,7 +8,9 @@ target Cpp { reactor Source(bank_index: size_t = 0) { output out: int - reaction(startup) -> out {= out.set(bank_index); =} + reaction(startup) -> out {= + out.set(bank_index); + =} } reactor Container { diff --git a/test/Cpp/src/multiport/MultiportIn.lf b/test/Cpp/src/multiport/MultiportIn.lf index 6f4f63f74b..8b01ff6712 100644 --- a/test/Cpp/src/multiport/MultiportIn.lf +++ b/test/Cpp/src/multiport/MultiportIn.lf @@ -10,14 +10,18 @@ reactor Source { output out: int state s: int = 0 - reaction(t) -> out {= out.set(s++); =} + reaction(t) -> out {= + out.set(s++); + =} } reactor Computation { input in: int output out: int - reaction(in) -> out {= out.set(*in.get()); =} + reaction(in) -> out {= + out.set(*in.get()); + =} } reactor Destination { diff --git a/test/Cpp/src/multiport/PipelineAfter.lf b/test/Cpp/src/multiport/PipelineAfter.lf index 8fb6418e65..e164210de2 100644 --- a/test/Cpp/src/multiport/PipelineAfter.lf +++ b/test/Cpp/src/multiport/PipelineAfter.lf @@ -3,14 +3,18 @@ target Cpp reactor Source { output out: unsigned - reaction(startup) -> out {= out.set(40); =} + reaction(startup) -> out {= + out.set(40); + =} } reactor Compute { input in: unsigned output out: unsigned - reaction(in) -> out {= out.set(*in.get() + 2); =} + reaction(in) -> out {= + out.set(*in.get() + 2); + =} } reactor Sink { diff --git a/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf b/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf index c0fb6d59ee..02293cc44e 100644 --- a/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf +++ b/test/Cpp/src/multiport/ReadOutputOfContainedBank.lf @@ -4,7 +4,9 @@ target Cpp reactor Contained(bank_index: size_t = 0) { output out: unsigned - reaction(startup) -> out {= out.set(42 * bank_index); =} + reaction(startup) -> out {= + out.set(42 * bank_index); + =} } main reactor { diff --git a/test/Cpp/src/multiport/WidthGivenByCode.lf b/test/Cpp/src/multiport/WidthGivenByCode.lf index 5e9ed80eb3..3580a9696c 100644 --- a/test/Cpp/src/multiport/WidthGivenByCode.lf +++ b/test/Cpp/src/multiport/WidthGivenByCode.lf @@ -1,8 +1,12 @@ target Cpp reactor Foo(a: size_t = 8, b: size_t = 2) { - input[{= a*b =}] in: size_t - output[{= a/b =}] out: size_t + input[{= + a*b + =}] in: size_t + output[{= + a/b + =}] out: size_t reaction(startup) in -> out {= if (in.size() != a*b) { @@ -20,7 +24,9 @@ main reactor { foo1 = new Foo() foo2 = new Foo(a=10, b=3) foo3 = new Foo(a=9, b=9) - foo_bank = new[{= 42 =}] Foo() + foo_bank = new[{= + 42 + =}] Foo() reaction(startup) foo_bank.out {= if (foo_bank.size() != 42) { diff --git a/test/Cpp/src/properties/Fast.lf b/test/Cpp/src/properties/Fast.lf index a44d1fb7e5..0f7e5e8e15 100644 --- a/test/Cpp/src/properties/Fast.lf +++ b/test/Cpp/src/properties/Fast.lf @@ -7,7 +7,9 @@ main reactor { state triggered: bool = false - reaction(startup) -> a {= a.schedule(2s); =} + reaction(startup) -> a {= + a.schedule(2s); + =} reaction(a) {= triggered = true; diff --git a/test/Cpp/src/target/AfterVoid.lf b/test/Cpp/src/target/AfterVoid.lf index 5b208b4008..cacc98e892 100644 --- a/test/Cpp/src/target/AfterVoid.lf +++ b/test/Cpp/src/target/AfterVoid.lf @@ -8,7 +8,9 @@ reactor foo { timer t(0, 1 sec) output y: void - reaction(t) -> y {= y.set(); =} + reaction(t) -> y {= + y.set(); + =} } reactor print { diff --git a/test/Cpp/src/target/CliParserGenericArguments.lf b/test/Cpp/src/target/CliParserGenericArguments.lf index 8028776e07..42c8bd6c2a 100644 --- a/test/Cpp/src/target/CliParserGenericArguments.lf +++ b/test/Cpp/src/target/CliParserGenericArguments.lf @@ -47,15 +47,27 @@ main reactor CliParserGenericArguments( signed_value: signed = -10, unsigned_value: unsigned = 11, long_value: long = -100, - unsigned_long_value: {= unsigned_long =} = 42, - long_long_value: {= long_long =} = -42, - ull_value: {= uns_long_long =} = 42, + unsigned_long_value: {= + unsigned_long + =} = 42, + long_long_value: {= + long_long + =} = -42, + ull_value: {= + uns_long_long + =} = 42, bool_value: bool = false, char_value: char = 'T', double_value: double = 4.2, - long_double_value: {= long_double =} = 4.2, + long_double_value: {= + long_double + =} = 4.2, float_value: float = 10.5, string_value: string = "This is a testvalue", - custom_class_value: {= CustomClass =}("Peter")) { - reaction(startup) {= std::cout << "Hello World!\n"; =} + custom_class_value: {= + CustomClass + =}("Peter")) { + reaction(startup) {= + std::cout << "Hello World!\n"; + =} } diff --git a/test/Cpp/src/target/CombinedTypeNames.lf b/test/Cpp/src/target/CombinedTypeNames.lf index f64116eb4a..5caa22f70a 100644 --- a/test/Cpp/src/target/CombinedTypeNames.lf +++ b/test/Cpp/src/target/CombinedTypeNames.lf @@ -2,9 +2,17 @@ // int`) can be used correctly in LF code. target Cpp -reactor Foo(bar: {= unsigned int =} = 0, baz: {= const unsigned int* =} = {= nullptr =}) { - state s_bar: {= unsigned int =} = bar - state s_baz: {= const unsigned int* =} = baz +reactor Foo(bar: {= + unsigned int +=} = 0, baz: {= + const unsigned int* +=} = {= nullptr =}) { + state s_bar: {= + unsigned int + =} = bar + state s_baz: {= + const unsigned int* + =} = baz reaction(startup) {= if (bar != 42 || s_bar != 42 || *baz != 42 || *s_baz != 42) { @@ -14,6 +22,8 @@ reactor Foo(bar: {= unsigned int =} = 0, baz: {= const unsigned int* =} = {= nul =} } -main reactor(bar: {= unsigned int =} = 42) { +main reactor(bar: {= + unsigned int +=} = 42) { foo = new Foo(bar=bar, baz = {= &bar =}) } diff --git a/test/Cpp/src/target/GenericAfter.lf b/test/Cpp/src/target/GenericAfter.lf index 3de5c1dba8..9957ea6e16 100644 --- a/test/Cpp/src/target/GenericAfter.lf +++ b/test/Cpp/src/target/GenericAfter.lf @@ -7,9 +7,13 @@ reactor Delay(delay: time(0)) { input in: T logical action a(delay): T - reaction(a) -> out {= out.set(a.get()); =} + reaction(a) -> out {= + out.set(a.get()); + =} - reaction(in) -> a {= a.schedule(in.get()); =} + reaction(in) -> a {= + a.schedule(in.get()); + =} } main reactor { @@ -17,5 +21,7 @@ main reactor { test = new Test() d.out -> test.in after 50 msec - reaction(startup) -> d.in {= d.in.set(42); =} + reaction(startup) -> d.in {= + d.in.set(42); + =} } diff --git a/test/Cpp/src/target/GenericDelay.lf b/test/Cpp/src/target/GenericDelay.lf index 5134f8cde6..0c7a63b8ab 100644 --- a/test/Cpp/src/target/GenericDelay.lf +++ b/test/Cpp/src/target/GenericDelay.lf @@ -7,9 +7,13 @@ reactor Delay(delay: time = 0) { input in: T logical action a(delay): T - reaction(a) -> out {= out.set(a.get()); =} + reaction(a) -> out {= + out.set(a.get()); + =} - reaction(in) -> a {= a.schedule(in.get()); =} + reaction(in) -> a {= + a.schedule(in.get()); + =} } main reactor { @@ -17,5 +21,7 @@ main reactor { test = new Test() d.out -> test.in - reaction(startup) -> d.in {= d.in.set(42); =} + reaction(startup) -> d.in {= + d.in.set(42); + =} } diff --git a/test/Cpp/src/target/MultipleContainedGeneric.lf b/test/Cpp/src/target/MultipleContainedGeneric.lf index da4e28081c..8a7ad42cd3 100644 --- a/test/Cpp/src/target/MultipleContainedGeneric.lf +++ b/test/Cpp/src/target/MultipleContainedGeneric.lf @@ -6,7 +6,9 @@ reactor Contained { input in1: T input in2: T - reaction(startup) -> trigger {= trigger.set(42); =} + reaction(startup) -> trigger {= + trigger.set(42); + =} reaction(in1) {= std::cout << "in1 received " << *in1.get() << '\n'; diff --git a/test/Cpp/src/target/PointerParameters.lf b/test/Cpp/src/target/PointerParameters.lf index 007fb1a816..fcd7454d52 100644 --- a/test/Cpp/src/target/PointerParameters.lf +++ b/test/Cpp/src/target/PointerParameters.lf @@ -12,7 +12,9 @@ reactor Foo(ptr: int* = {= nullptr =}) { } main reactor { - private preamble {= int a{42}; =} + private preamble {= + int a{42}; + =} foo = new Foo(ptr = {= &a =}) } diff --git a/test/Python/src/ActionDelay.lf b/test/Python/src/ActionDelay.lf index 0c063f6f1d..93d8ceea81 100644 --- a/test/Python/src/ActionDelay.lf +++ b/test/Python/src/ActionDelay.lf @@ -12,13 +12,17 @@ reactor GeneratedDelay { act.schedule(MSEC(0)) =} - reaction(act) -> y_out {= y_out.set(self.y_state) =} + reaction(act) -> y_out {= + y_out.set(self.y_state) + =} } reactor Source { output out - reaction(startup) -> out {= out.set(1) =} + reaction(startup) -> out {= + out.set(1) + =} } reactor Sink { diff --git a/test/Python/src/ActionWithNoReaction.lf b/test/Python/src/ActionWithNoReaction.lf index 5e9456356d..d4ebf49fa7 100644 --- a/test/Python/src/ActionWithNoReaction.lf +++ b/test/Python/src/ActionWithNoReaction.lf @@ -33,5 +33,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= f.x.set(42) =} + reaction(t) -> f.x {= + f.x.set(42) + =} } diff --git a/test/Python/src/After.lf b/test/Python/src/After.lf index 765f9ef990..3fba861dbf 100644 --- a/test/Python/src/After.lf +++ b/test/Python/src/After.lf @@ -8,7 +8,9 @@ reactor foo { input x output y - reaction(x) -> y {= y.set(2*x.value) =} + reaction(x) -> y {= + y.set(2*x.value) + =} } reactor print { @@ -45,5 +47,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= f.x.set(42) =} + reaction(t) -> f.x {= + f.x.set(42) + =} } diff --git a/test/Python/src/AfterCycles.lf b/test/Python/src/AfterCycles.lf index 4aa2ed0d39..8e1c72032d 100644 --- a/test/Python/src/AfterCycles.lf +++ b/test/Python/src/AfterCycles.lf @@ -5,14 +5,18 @@ target Python reactor Source { output out - reaction(startup) -> out {= out.set(1) =} + reaction(startup) -> out {= + out.set(1) + =} } reactor Work { input _in output out - reaction(_in) -> out {= out.set(_in.value) =} + reaction(_in) -> out {= + out.set(_in.value) + =} } main reactor AfterCycles { diff --git a/test/Python/src/CompareTags.lf b/test/Python/src/CompareTags.lf index 38366d2742..2283b68722 100644 --- a/test/Python/src/CompareTags.lf +++ b/test/Python/src/CompareTags.lf @@ -5,7 +5,9 @@ target Python { } main reactor CompareTags { - preamble {= import sys =} + preamble {= + import sys + =} timer t(0, 1 msec) logical action l diff --git a/test/Python/src/CompositionGain.lf b/test/Python/src/CompositionGain.lf index 067d662bdf..540cffc258 100644 --- a/test/Python/src/CompositionGain.lf +++ b/test/Python/src/CompositionGain.lf @@ -22,7 +22,9 @@ reactor Wrapper { main reactor { wrapper = new Wrapper() - reaction(startup) -> wrapper.x {= wrapper_x.set(42) =} + reaction(startup) -> wrapper.x {= + wrapper_x.set(42) + =} reaction(wrapper.y) {= print("Received " + str(wrapper_y.value)) diff --git a/test/Python/src/DanglingOutput.lf b/test/Python/src/DanglingOutput.lf index f6fe938765..97011c7f90 100644 --- a/test/Python/src/DanglingOutput.lf +++ b/test/Python/src/DanglingOutput.lf @@ -6,7 +6,9 @@ reactor Source { output out timer t - reaction(t) -> out {= out.set(1); =} + reaction(t) -> out {= + out.set(1); + =} } reactor Gain { diff --git a/test/Python/src/Deadline.lf b/test/Python/src/Deadline.lf index 7dfde79a35..7e1772e622 100644 --- a/test/Python/src/Deadline.lf +++ b/test/Python/src/Deadline.lf @@ -4,7 +4,9 @@ target Python { timeout: 6 sec } -preamble {= import time =} +preamble {= + import time +=} reactor Source(period = 3 sec) { output y diff --git a/test/Python/src/DeadlineHandledAbove.lf b/test/Python/src/DeadlineHandledAbove.lf index 80a5f847f6..08f97eb25c 100644 --- a/test/Python/src/DeadlineHandledAbove.lf +++ b/test/Python/src/DeadlineHandledAbove.lf @@ -2,7 +2,9 @@ # output. target Python -preamble {= import time =} +preamble {= + import time +=} reactor Deadline(threshold = 100 msec) { input x diff --git a/test/Python/src/DelayArray.lf b/test/Python/src/DelayArray.lf index aa7e66cb6e..a4adeb717b 100644 --- a/test/Python/src/DelayArray.lf +++ b/test/Python/src/DelayArray.lf @@ -12,7 +12,9 @@ reactor DelayPointer(delay = 100 msec) { a.schedule(self.delay, _in.value); =} - reaction(a) -> out {= out.set(a.value); =} + reaction(a) -> out {= + out.set(a.value); + =} } reactor Source { diff --git a/test/Python/src/DelayInt.lf b/test/Python/src/DelayInt.lf index 0432a5c18a..c58e2eef6f 100644 --- a/test/Python/src/DelayInt.lf +++ b/test/Python/src/DelayInt.lf @@ -11,7 +11,9 @@ reactor Delay(delay = 100 msec) { out.set(a.value) =} - reaction(_in) -> a {= a.schedule(self.delay, _in.value) =} + reaction(_in) -> a {= + a.schedule(self.delay, _in.value) + =} } reactor Test { @@ -52,5 +54,7 @@ main reactor DelayInt { t = new Test() d.out -> t._in - reaction(startup) -> d._in {= d._in.set(42) =} + reaction(startup) -> d._in {= + d._in.set(42) + =} } diff --git a/test/Python/src/DelayString.lf b/test/Python/src/DelayString.lf index 1faf80e31f..0873220fcf 100644 --- a/test/Python/src/DelayString.lf +++ b/test/Python/src/DelayString.lf @@ -6,9 +6,13 @@ reactor DelayString2(delay = 100 msec) { output out logical action a - reaction(a) -> out {= out.set(a.value) =} + reaction(a) -> out {= + out.set(a.value) + =} - reaction(_in) -> a {= a.schedule(self.delay, _in.value) =} + reaction(_in) -> a {= + a.schedule(self.delay, _in.value) + =} } reactor Test { @@ -34,5 +38,7 @@ main reactor { t = new Test() d.out -> t._in - reaction(startup) -> d._in {= d._in.set("Hello") =} + reaction(startup) -> d._in {= + d._in.set("Hello") + =} } diff --git a/test/Python/src/DelayStruct.lf b/test/Python/src/DelayStruct.lf index dcf1a8be7c..7a3ae51ba8 100644 --- a/test/Python/src/DelayStruct.lf +++ b/test/Python/src/DelayStruct.lf @@ -3,14 +3,18 @@ target Python { files: ["include/hello.py"] } -preamble {= import hello =} +preamble {= + import hello +=} reactor DelayPointer(delay = 100 msec) { input _in output out logical action a - reaction(a) -> out {= out.set(a.value); =} + reaction(a) -> out {= + out.set(a.value); + =} reaction(_in) -> a {= # Schedule the actual token from the input rather than @@ -22,7 +26,9 @@ reactor DelayPointer(delay = 100 msec) { reactor Source { output out - reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} + reaction(startup) -> out {= + out.set(hello.hello("Earth", 42)) + =} } # expected parameter is for testing. diff --git a/test/Python/src/DelayStructWithAfter.lf b/test/Python/src/DelayStructWithAfter.lf index c6f27a0775..feb2c471f2 100644 --- a/test/Python/src/DelayStructWithAfter.lf +++ b/test/Python/src/DelayStructWithAfter.lf @@ -3,12 +3,16 @@ target Python { files: include/hello.py } -preamble {= import hello =} +preamble {= + import hello +=} reactor Source { output out - reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} + reaction(startup) -> out {= + out.set(hello.hello("Earth", 42)) + =} } # expected parameter is for testing. diff --git a/test/Python/src/DelayStructWithAfterOverlapped.lf b/test/Python/src/DelayStructWithAfterOverlapped.lf index 73fd60c504..e11572dbc6 100644 --- a/test/Python/src/DelayStructWithAfterOverlapped.lf +++ b/test/Python/src/DelayStructWithAfterOverlapped.lf @@ -5,7 +5,9 @@ target Python { files: ["include/hello.py"] } -preamble {= import hello =} +preamble {= + import hello +=} reactor Source { output out diff --git a/test/Python/src/DelayedAction.lf b/test/Python/src/DelayedAction.lf index 1a461eccff..d95ceb6a99 100644 --- a/test/Python/src/DelayedAction.lf +++ b/test/Python/src/DelayedAction.lf @@ -8,7 +8,9 @@ main reactor DelayedAction { logical action a state count = 0 - reaction(t) -> a {= a.schedule(MSEC(100)) =} + reaction(t) -> a {= + a.schedule(MSEC(100)) + =} reaction(a) {= elapsed = lf.time.logical_elapsed() diff --git a/test/Python/src/DelayedReaction.lf b/test/Python/src/DelayedReaction.lf index 2ebde05b5a..d4af80394c 100644 --- a/test/Python/src/DelayedReaction.lf +++ b/test/Python/src/DelayedReaction.lf @@ -5,7 +5,9 @@ reactor Source { output out timer t - reaction(t) -> out {= out.set(1) =} + reaction(t) -> out {= + out.set(1) + =} } reactor Sink { diff --git a/test/Python/src/Determinism.lf b/test/Python/src/Determinism.lf index f200c141f5..17b0f3922d 100644 --- a/test/Python/src/Determinism.lf +++ b/test/Python/src/Determinism.lf @@ -4,7 +4,9 @@ reactor Source { output y timer t - reaction(t) -> y {= y.set(1) =} + reaction(t) -> y {= + y.set(1) + =} } reactor Destination { @@ -28,7 +30,9 @@ reactor Pass { input x output y - reaction(x) -> y {= y.set(x.value) =} + reaction(x) -> y {= + y.set(x.value) + =} } main reactor Determinism { diff --git a/test/Python/src/Gain.lf b/test/Python/src/Gain.lf index 34e9229748..baab5d1cb1 100644 --- a/test/Python/src/Gain.lf +++ b/test/Python/src/Gain.lf @@ -5,7 +5,9 @@ reactor Scale(scale=2) { input x output y - reaction(x) -> y {= y.set(x.value * self.scale) =} + reaction(x) -> y {= + y.set(x.value * self.scale) + =} } reactor Test { @@ -33,5 +35,7 @@ main reactor Gain { d = new Test() g.y -> d.x - reaction(startup) -> g.x {= g.x.set(1) =} + reaction(startup) -> g.x {= + g.x.set(1) + =} } diff --git a/test/Python/src/GetMicroStep.lf b/test/Python/src/GetMicroStep.lf index b137b8cd94..c82c3f6399 100644 --- a/test/Python/src/GetMicroStep.lf +++ b/test/Python/src/GetMicroStep.lf @@ -4,12 +4,16 @@ target Python { } main reactor GetMicroStep { - preamble {= import sys =} + preamble {= + import sys + =} state s = 1 logical action l # timer t(0, 1 msec); - reaction(startup) -> l {= l.schedule(0); =} + reaction(startup) -> l {= + l.schedule(0); + =} reaction(l) -> l {= microstep = lf.tag().microstep diff --git a/test/Python/src/Hierarchy.lf b/test/Python/src/Hierarchy.lf index 4d92568592..4686842131 100644 --- a/test/Python/src/Hierarchy.lf +++ b/test/Python/src/Hierarchy.lf @@ -5,7 +5,9 @@ reactor Source { output out timer t - reaction(t) -> out {= out.set(1) =} + reaction(t) -> out {= + out.set(1) + =} } reactor Gain { diff --git a/test/Python/src/Hierarchy2.lf b/test/Python/src/Hierarchy2.lf index 2172396617..49ed0d54dd 100644 --- a/test/Python/src/Hierarchy2.lf +++ b/test/Python/src/Hierarchy2.lf @@ -8,7 +8,9 @@ reactor Source { output out timer t(0, 1 sec) - reaction(t) -> out {= out.set(1) =} + reaction(t) -> out {= + out.set(1) + =} } reactor Count { diff --git a/test/Python/src/Import.lf b/test/Python/src/Import.lf index fc225f1cb0..990453efa5 100644 --- a/test/Python/src/Import.lf +++ b/test/Python/src/Import.lf @@ -7,5 +7,7 @@ main reactor Import { timer t a = new Imported() - reaction(t) -> a.x {= a.x.set(42) =} + reaction(t) -> a.x {= + a.x.set(42) + =} } diff --git a/test/Python/src/ImportComposition.lf b/test/Python/src/ImportComposition.lf index cbdeeb5c6c..15149283e8 100644 --- a/test/Python/src/ImportComposition.lf +++ b/test/Python/src/ImportComposition.lf @@ -7,7 +7,9 @@ main reactor ImportComposition { a = new ImportedComposition() state received = False - reaction(startup) -> a.x {= a.x.set(42) =} + reaction(startup) -> a.x {= + a.x.set(42) + =} reaction(a.y) {= receive_time = lf.time.logical_elapsed() diff --git a/test/Python/src/ImportRenamed.lf b/test/Python/src/ImportRenamed.lf index 0d7433028f..d032dd8fcb 100644 --- a/test/Python/src/ImportRenamed.lf +++ b/test/Python/src/ImportRenamed.lf @@ -11,5 +11,7 @@ main reactor { b = new Y() c = new Z() - reaction(t) -> a.x {= a.x.set(42) =} + reaction(t) -> a.x {= + a.x.set(42) + =} } diff --git a/test/Python/src/ManualDelayedReaction.lf b/test/Python/src/ManualDelayedReaction.lf index a9863589ff..79d3398a08 100644 --- a/test/Python/src/ManualDelayedReaction.lf +++ b/test/Python/src/ManualDelayedReaction.lf @@ -18,14 +18,19 @@ reactor GeneratedDelay { act.schedule(MSEC(100)) =} - reaction(act) -> y_out {= y_out.set(self.y_state) =} + reaction(act) -> y_out {= + y_out.set(self.y_state) + =} } reactor Source { output out timer t - reaction(t) -> out {= out.set(1) =} # reaction(t) -> out after 100 msec + # reaction(t) -> out after 100 msec + reaction(t) -> out {= + out.set(1) + =} } reactor Sink { diff --git a/test/Python/src/Methods.lf b/test/Python/src/Methods.lf index ad158e72b3..3d678b7ed1 100644 --- a/test/Python/src/Methods.lf +++ b/test/Python/src/Methods.lf @@ -4,9 +4,13 @@ target Python main reactor { state foo = 2 - method getFoo() {= return self.foo =} + method getFoo() {= + return self.foo + =} - method add(x) {= self.foo += x =} + method add(x) {= + self.foo += x + =} reaction(startup) {= print(f"Foo is initialized to {self.getFoo()}") diff --git a/test/Python/src/MethodsRecursive.lf b/test/Python/src/MethodsRecursive.lf index cc6a9ccb85..59686a522c 100644 --- a/test/Python/src/MethodsRecursive.lf +++ b/test/Python/src/MethodsRecursive.lf @@ -11,7 +11,9 @@ main reactor { return self.add(self.fib(n-1), self.fib(n-2)) =} - method add(x, y) {= return x + y =} + method add(x, y) {= + return x + y + =} reaction(startup) {= for n in range(1, 10): diff --git a/test/Python/src/MethodsSameName.lf b/test/Python/src/MethodsSameName.lf index e842912e84..c3c0178eac 100644 --- a/test/Python/src/MethodsSameName.lf +++ b/test/Python/src/MethodsSameName.lf @@ -4,7 +4,9 @@ target Python reactor Foo { state foo = 2 - method add(x) {= self.foo += x =} + method add(x) {= + self.foo += x + =} reaction(startup) {= self.add(40) @@ -20,7 +22,9 @@ main reactor { a = new Foo() - method add(x) {= self.foo += x =} + method add(x) {= + self.foo += x + =} reaction(startup) {= self.add(40) diff --git a/test/Python/src/Microsteps.lf b/test/Python/src/Microsteps.lf index 871ad321bc..bcb8003cd8 100644 --- a/test/Python/src/Microsteps.lf +++ b/test/Python/src/Microsteps.lf @@ -33,5 +33,7 @@ main reactor Microsteps { repeat.schedule(0) =} - reaction(repeat) -> d.y {= d.y.set(1) =} + reaction(repeat) -> d.y {= + d.y.set(1) + =} } diff --git a/test/Python/src/Minimal.lf b/test/Python/src/Minimal.lf index c0f3f9f6fa..3cc2aeaf8f 100644 --- a/test/Python/src/Minimal.lf +++ b/test/Python/src/Minimal.lf @@ -2,5 +2,7 @@ target Python main reactor Minimal { - reaction(startup) {= print("Hello World.") =} + reaction(startup) {= + print("Hello World.") + =} } diff --git a/test/Python/src/MultipleContained.lf b/test/Python/src/MultipleContained.lf index 8d0afa0a12..c15339e4ae 100644 --- a/test/Python/src/MultipleContained.lf +++ b/test/Python/src/MultipleContained.lf @@ -7,7 +7,9 @@ reactor Contained { input in1 input in2 - reaction(startup) -> trigger {= trigger.set(42) =} + reaction(startup) -> trigger {= + trigger.set(42) + =} reaction(in1) {= print("in1 received ", in1.value); diff --git a/test/Python/src/ParameterizedState.lf b/test/Python/src/ParameterizedState.lf index 2553cfcfd2..75f1a4fd15 100644 --- a/test/Python/src/ParameterizedState.lf +++ b/test/Python/src/ParameterizedState.lf @@ -3,7 +3,9 @@ target Python reactor Foo(bar=42) { state baz = bar - reaction(startup) {= print("Baz: ", self.baz) =} + reaction(startup) {= + print("Baz: ", self.baz) + =} } main reactor { diff --git a/test/Python/src/ReadOutputOfContainedReactor.lf b/test/Python/src/ReadOutputOfContainedReactor.lf index 0a086c9514..02a70b34f1 100644 --- a/test/Python/src/ReadOutputOfContainedReactor.lf +++ b/test/Python/src/ReadOutputOfContainedReactor.lf @@ -4,7 +4,9 @@ target Python reactor Contained { output out - reaction(startup) -> out {= out.set(42) =} + reaction(startup) -> out {= + out.set(42) + =} } main reactor ReadOutputOfContainedReactor { diff --git a/test/Python/src/Schedule.lf b/test/Python/src/Schedule.lf index 5d42888c2e..3738b63e92 100644 --- a/test/Python/src/Schedule.lf +++ b/test/Python/src/Schedule.lf @@ -5,7 +5,9 @@ reactor Schedule2 { input x logical action a - reaction(x) -> a {= a.schedule(MSEC(200)) =} + reaction(x) -> a {= + a.schedule(MSEC(200)) + =} reaction(a) {= elapsed_time = lf.time.logical_elapsed() @@ -20,5 +22,7 @@ main reactor { a = new Schedule2() timer t - reaction(t) -> a.x {= a.x.set(1) =} + reaction(t) -> a.x {= + a.x.set(1) + =} } diff --git a/test/Python/src/ScheduleLogicalAction.lf b/test/Python/src/ScheduleLogicalAction.lf index 37eeb8ab6d..31b2151da7 100644 --- a/test/Python/src/ScheduleLogicalAction.lf +++ b/test/Python/src/ScheduleLogicalAction.lf @@ -16,7 +16,9 @@ reactor foo { a.schedule(MSEC(500)) =} - reaction(a) -> y {= y.set(-42) =} + reaction(a) -> y {= + y.set(-42) + =} } reactor print { @@ -41,5 +43,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x - reaction(t) -> f.x {= f.x.set(42) =} + reaction(t) -> f.x {= + f.x.set(42) + =} } diff --git a/test/Python/src/SelfLoop.lf b/test/Python/src/SelfLoop.lf index 6362c77373..5d79493ec5 100644 --- a/test/Python/src/SelfLoop.lf +++ b/test/Python/src/SelfLoop.lf @@ -23,7 +23,9 @@ reactor Self { a.schedule(MSEC(100), x.value) =} - reaction(startup) -> a {= a.schedule(0, 42) =} + reaction(startup) -> a {= + a.schedule(0, 42) + =} reaction(shutdown) {= if self.expected <= 43: diff --git a/test/Python/src/SendingInside2.lf b/test/Python/src/SendingInside2.lf index 8ceb1ba5cc..3ddb25102c 100644 --- a/test/Python/src/SendingInside2.lf +++ b/test/Python/src/SendingInside2.lf @@ -15,5 +15,7 @@ main reactor SendingInside2 { timer t p = new Printer() - reaction(t) -> p.x {= p.x.set(1) =} + reaction(t) -> p.x {= + p.x.set(1) + =} } diff --git a/test/Python/src/SetArray.lf b/test/Python/src/SetArray.lf index 931260ab9b..73f80cf380 100644 --- a/test/Python/src/SetArray.lf +++ b/test/Python/src/SetArray.lf @@ -5,7 +5,9 @@ target Python reactor Source { output out - reaction(startup) -> out {= out.set([0,1,2]) =} + reaction(startup) -> out {= + out.set([0,1,2]) + =} } # The scale parameter is just for testing. diff --git a/test/Python/src/SimpleDeadline.lf b/test/Python/src/SimpleDeadline.lf index 2b6adbf942..c405774390 100644 --- a/test/Python/src/SimpleDeadline.lf +++ b/test/Python/src/SimpleDeadline.lf @@ -29,7 +29,9 @@ main reactor SimpleDeadline { d = new Deadline(threshold = 10 msec) p = new Print() d.deadlineViolation -> p._in - preamble {= import time =} + preamble {= + import time + =} reaction(start) -> d.x {= self.time.sleep(0.02) diff --git a/test/Python/src/SlowingClock.lf b/test/Python/src/SlowingClock.lf index 8298135c62..7d156b9be5 100644 --- a/test/Python/src/SlowingClock.lf +++ b/test/Python/src/SlowingClock.lf @@ -13,7 +13,9 @@ main reactor SlowingClock { state interval = 100 msec state expected_time = 100 msec - reaction(startup) -> a {= a.schedule(0) =} + reaction(startup) -> a {= + a.schedule(0) + =} reaction(a) -> a {= elapsed_logical_time = lf.time.logical_elapsed() diff --git a/test/Python/src/StartupOutFromInside.lf b/test/Python/src/StartupOutFromInside.lf index ce2025278f..c20a48773e 100644 --- a/test/Python/src/StartupOutFromInside.lf +++ b/test/Python/src/StartupOutFromInside.lf @@ -3,7 +3,9 @@ target Python reactor Bar { output out - reaction(startup) -> out {= out.set(42) =} + reaction(startup) -> out {= + out.set(42) + =} } main reactor StartupOutFromInside { diff --git a/test/Python/src/StructAsType.lf b/test/Python/src/StructAsType.lf index e1b089df5b..e20c3e4f8e 100644 --- a/test/Python/src/StructAsType.lf +++ b/test/Python/src/StructAsType.lf @@ -2,7 +2,9 @@ target Python { files: include/hello.py } -preamble {= import hello =} +preamble {= + import hello +=} reactor Source { output out diff --git a/test/Python/src/StructAsTypeDirect.lf b/test/Python/src/StructAsTypeDirect.lf index 132ef78948..c60241c914 100644 --- a/test/Python/src/StructAsTypeDirect.lf +++ b/test/Python/src/StructAsTypeDirect.lf @@ -2,7 +2,9 @@ target Python { files: include/hello.py } -preamble {= import hello =} +preamble {= + import hello +=} reactor Source { output out diff --git a/test/Python/src/StructParallel.lf b/test/Python/src/StructParallel.lf index 4e2024d99e..46514a2154 100644 --- a/test/Python/src/StructParallel.lf +++ b/test/Python/src/StructParallel.lf @@ -6,7 +6,9 @@ target Python { import Source from "StructScale.lf" -preamble {= import hello =} +preamble {= + import hello +=} reactor Check(expected=42) { input _in diff --git a/test/Python/src/StructPrint.lf b/test/Python/src/StructPrint.lf index 968a3e9d27..ebd6c82122 100644 --- a/test/Python/src/StructPrint.lf +++ b/test/Python/src/StructPrint.lf @@ -4,12 +4,16 @@ target Python { files: ["include/hello.py"] } -preamble {= import hello =} +preamble {= + import hello +=} reactor Print { output out - reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} + reaction(startup) -> out {= + out.set(hello.hello("Earth", 42)) + =} } # expected parameter is for testing. diff --git a/test/Python/src/StructScale.lf b/test/Python/src/StructScale.lf index f2ec9162d4..d5400e3750 100644 --- a/test/Python/src/StructScale.lf +++ b/test/Python/src/StructScale.lf @@ -4,12 +4,16 @@ target Python { files: ["include/hello.py"] } -preamble {= import hello =} +preamble {= + import hello +=} reactor Source { output out - reaction(startup) -> out {= out.set(hello.hello("Earth", 42)) =} + reaction(startup) -> out {= + out.set(hello.hello("Earth", 42)) + =} } # expected parameter is for testing. diff --git a/test/Python/src/TestForPreviousOutput.lf b/test/Python/src/TestForPreviousOutput.lf index 7f10c13482..eaa0593a58 100644 --- a/test/Python/src/TestForPreviousOutput.lf +++ b/test/Python/src/TestForPreviousOutput.lf @@ -4,7 +4,9 @@ target Python reactor Source { output out - preamble {= import random =} + preamble {= + import random + =} reaction(startup) -> out {= # Set a seed for random number generation based on the current time. diff --git a/test/Python/src/TimeLimit.lf b/test/Python/src/TimeLimit.lf index 64c5fa6a71..4f3f1b0306 100644 --- a/test/Python/src/TimeLimit.lf +++ b/test/Python/src/TimeLimit.lf @@ -42,5 +42,7 @@ main reactor TimeLimit(period = 1 sec) { d = new Destination() c.y -> d.x - reaction(stop) {= request_stop() =} + reaction(stop) {= + request_stop() + =} } diff --git a/test/Python/src/TimeState.lf b/test/Python/src/TimeState.lf index ab6d435633..86e9946f17 100644 --- a/test/Python/src/TimeState.lf +++ b/test/Python/src/TimeState.lf @@ -3,7 +3,9 @@ target Python reactor Foo(bar=42) { state baz = 500 msec - reaction(startup) {= print("Baz: ", self.baz) =} + reaction(startup) {= + print("Baz: ", self.baz) + =} } main reactor { diff --git a/test/Python/src/Timers.lf b/test/Python/src/Timers.lf index 88a10bb367..1ba75599ab 100644 --- a/test/Python/src/Timers.lf +++ b/test/Python/src/Timers.lf @@ -8,9 +8,13 @@ main reactor { timer t2(0, 2 sec) state counter = 0 - reaction(t2) {= self.counter += 2 =} + reaction(t2) {= + self.counter += 2 + =} - reaction(t) {= self.counter -= 1 =} + reaction(t) {= + self.counter -= 1 + =} reaction(shutdown) {= if self.counter != 1: diff --git a/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf b/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf index 4bcba7d298..2fddd52aa2 100644 --- a/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf +++ b/test/Python/src/TriggerDownstreamOnlyIfPresent2.lf @@ -27,7 +27,9 @@ reactor Destination { exit(1) =} - reaction(shutdown) {= print("SUCCESS.") =} + reaction(shutdown) {= + print("SUCCESS.") + =} } main reactor TriggerDownstreamOnlyIfPresent2 { diff --git a/test/Python/src/Wcet.lf b/test/Python/src/Wcet.lf index d1a3e41e18..4d6637ce13 100644 --- a/test/Python/src/Wcet.lf +++ b/test/Python/src/Wcet.lf @@ -30,7 +30,9 @@ reactor Work { reactor Print { input p_in - reaction(p_in) {= print("Received: ", p_in.value) =} + reaction(p_in) {= + print("Received: ", p_in.value) + =} } main reactor Wcet { diff --git a/test/Python/src/docker/FilesPropertyContainerized.lf b/test/Python/src/docker/FilesPropertyContainerized.lf index afbf76f8a8..139f1b682a 100644 --- a/test/Python/src/docker/FilesPropertyContainerized.lf +++ b/test/Python/src/docker/FilesPropertyContainerized.lf @@ -20,7 +20,9 @@ main reactor { state passed = False timer t(1 msec) - reaction(t) {= self.passed = True =} + reaction(t) {= + self.passed = True + =} reaction(shutdown) {= if not self.passed: diff --git a/test/Python/src/federated/BroadcastFeedback.lf b/test/Python/src/federated/BroadcastFeedback.lf index facc896800..dc5c88ccf6 100644 --- a/test/Python/src/federated/BroadcastFeedback.lf +++ b/test/Python/src/federated/BroadcastFeedback.lf @@ -8,7 +8,9 @@ reactor SenderAndReceiver { input[2] inp state received = False - reaction(startup) -> out {= out.set(42) =} + reaction(startup) -> out {= + out.set(42) + =} reaction(inp) {= if inp[0].is_present and inp[1].is_present and inp[0].value == 42 and inp[1].value == 42: diff --git a/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf b/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf index c0cc71ab5b..8c6339170a 100644 --- a/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf +++ b/test/Python/src/federated/BroadcastFeedbackWithHierarchy.lf @@ -11,11 +11,15 @@ reactor SenderAndReceiver { r = new Receiver() in_ -> r.in_ - reaction(startup) -> out {= out.set(42) =} + reaction(startup) -> out {= + out.set(42) + =} } reactor Receiver { - preamble {= import sys =} + preamble {= + import sys + =} input[2] in_ state received = False diff --git a/test/Python/src/federated/CycleDetection.lf b/test/Python/src/federated/CycleDetection.lf index c4eaac6904..cf6dd7f661 100644 --- a/test/Python/src/federated/CycleDetection.lf +++ b/test/Python/src/federated/CycleDetection.lf @@ -21,15 +21,21 @@ reactor CAReplica { self.balance += remote_update.value =} - reaction(query) -> response {= response.set(self.balance) =} + reaction(query) -> response {= + response.set(self.balance) + =} } reactor UserInput { - preamble {= import sys =} + preamble {= + import sys + =} input balance output deposit - reaction(startup) -> deposit {= deposit.set(100) =} + reaction(startup) -> deposit {= + deposit.set(100) + =} reaction(balance) {= if balance.value != 200: @@ -39,7 +45,9 @@ reactor UserInput { request_stop() =} - reaction(shutdown) {= print("Test passed!") =} + reaction(shutdown) {= + print("Test passed!") + =} } federated reactor { diff --git a/test/Python/src/federated/DecentralizedP2PComm.lf b/test/Python/src/federated/DecentralizedP2PComm.lf index 5bc2cc61a2..b3804c23b4 100644 --- a/test/Python/src/federated/DecentralizedP2PComm.lf +++ b/test/Python/src/federated/DecentralizedP2PComm.lf @@ -6,7 +6,9 @@ target Python { } reactor Platform(start=0, expected_start=0, stp_offset_param=0) { - preamble {= import sys =} + preamble {= + import sys + =} input in_ output out timer t(0, 100 msec) diff --git a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf index 9b4883e730..088c71c086 100644 --- a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf +++ b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeout.lf @@ -22,16 +22,22 @@ reactor Clock(offset=0, period = 1 sec) { y.set(self.count) =} - reaction(shutdown) {= print("SUCCESS: the source exited successfully.") =} + reaction(shutdown) {= + print("SUCCESS: the source exited successfully.") + =} } reactor Destination { - preamble {= import sys =} + preamble {= + import sys + =} input x state s = 1 state startup_logical_time - reaction(startup) {= self.startup_logical_time = lf.time.logical() =} + reaction(startup) {= + self.startup_logical_time = lf.time.logical() + =} reaction(x) {= print("Received {}".format(x.value)) diff --git a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf index a47d362140..86c2dffdd4 100644 --- a/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf +++ b/test/Python/src/federated/DecentralizedP2PUnbalancedTimeoutPhysical.lf @@ -21,11 +21,15 @@ reactor Clock(offset=0, period = 1 sec) { y.set(self.count) =} - reaction(shutdown) {= print("SUCCESS: the source exited successfully.") =} + reaction(shutdown) {= + print("SUCCESS: the source exited successfully.") + =} } reactor Destination { - preamble {= import sys =} + preamble {= + import sys + =} input x state s = 1 diff --git a/test/Python/src/federated/DistributedBank.lf b/test/Python/src/federated/DistributedBank.lf index 9fb4720d59..3dfd8d7c32 100644 --- a/test/Python/src/federated/DistributedBank.lf +++ b/test/Python/src/federated/DistributedBank.lf @@ -5,7 +5,9 @@ target Python { } reactor Node { - preamble {= import sys =} + preamble {= + import sys + =} timer t(0, 100 msec) state count = 0 diff --git a/test/Python/src/federated/DistributedBankToMultiport.lf b/test/Python/src/federated/DistributedBankToMultiport.lf index 1171c1b1b4..9f65f2f065 100644 --- a/test/Python/src/federated/DistributedBankToMultiport.lf +++ b/test/Python/src/federated/DistributedBankToMultiport.lf @@ -6,7 +6,9 @@ target Python { import Count from "../lib/Count.lf" reactor Destination { - preamble {= import sys =} + preamble {= + import sys + =} input[2] in_ state count = 1 diff --git a/test/Python/src/federated/DistributedCount.lf b/test/Python/src/federated/DistributedCount.lf index 6b08b7e7fe..7a9bedf97c 100644 --- a/test/Python/src/federated/DistributedCount.lf +++ b/test/Python/src/federated/DistributedCount.lf @@ -12,7 +12,9 @@ target Python { import Count from "../lib/Count.lf" reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state c = 1 diff --git a/test/Python/src/federated/DistributedCountDecentralized.lf b/test/Python/src/federated/DistributedCountDecentralized.lf index 62f2921282..7c95336e1c 100644 --- a/test/Python/src/federated/DistributedCountDecentralized.lf +++ b/test/Python/src/federated/DistributedCountDecentralized.lf @@ -13,7 +13,9 @@ target Python { import Count from "../lib/Count.lf" reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state c = 1 diff --git a/test/Python/src/federated/DistributedCountDecentralizedLate.lf b/test/Python/src/federated/DistributedCountDecentralizedLate.lf index fe52eec1b7..c03c38600f 100644 --- a/test/Python/src/federated/DistributedCountDecentralizedLate.lf +++ b/test/Python/src/federated/DistributedCountDecentralizedLate.lf @@ -13,7 +13,9 @@ target Python { import Count from "../lib/Count.lf" reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ # STP () state success = 0 # STP(in, 30 msec); state success_stp_violation = 0 diff --git a/test/Python/src/federated/DistributedCountPhysical.lf b/test/Python/src/federated/DistributedCountPhysical.lf index a55dcf06dd..acfb512897 100644 --- a/test/Python/src/federated/DistributedCountPhysical.lf +++ b/test/Python/src/federated/DistributedCountPhysical.lf @@ -23,7 +23,9 @@ reactor Count { } reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state c = 0 diff --git a/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf b/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf index f18f5dc997..7c3c17ec35 100644 --- a/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf +++ b/test/Python/src/federated/DistributedCountPhysicalAfterDelay.lf @@ -23,7 +23,9 @@ reactor Count { } reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state c = 0 diff --git a/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf b/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf index 71048dfa38..5eafa49e5d 100644 --- a/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf +++ b/test/Python/src/federated/DistributedCountPhysicalDecentralized.lf @@ -24,7 +24,9 @@ reactor Count { } reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state c = 0 diff --git a/test/Python/src/federated/DistributedDoublePort.lf b/test/Python/src/federated/DistributedDoublePort.lf index 3c09373ad1..a90ec7b40f 100644 --- a/test/Python/src/federated/DistributedDoublePort.lf +++ b/test/Python/src/federated/DistributedDoublePort.lf @@ -23,11 +23,15 @@ reactor CountMicrostep { self.count += 1 =} - reaction(act) -> out {= out.set(act.value) =} + reaction(act) -> out {= + out.set(act.value) + =} } reactor Print { - preamble {= import sys =} + preamble {= + import sys + =} input in_ input in2 @@ -39,7 +43,9 @@ reactor Print { self.sys.exit(1) =} - reaction(shutdown) {= print("SUCCESS: messages were at least one microstep apart.") =} + reaction(shutdown) {= + print("SUCCESS: messages were at least one microstep apart.") + =} } federated reactor DistributedDoublePort { diff --git a/test/Python/src/federated/DistributedLoopedAction.lf b/test/Python/src/federated/DistributedLoopedAction.lf index 81394d62d0..37551a36d8 100644 --- a/test/Python/src/federated/DistributedLoopedAction.lf +++ b/test/Python/src/federated/DistributedLoopedAction.lf @@ -10,7 +10,9 @@ target Python { import Sender from "../lib/LoopedActionSender.lf" reactor Receiver(take_a_break_after=10, break_interval = 400 msec) { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state received_messages = 0 state total_received_messages = 0 diff --git a/test/Python/src/federated/DistributedLoopedPhysicalAction.lf b/test/Python/src/federated/DistributedLoopedPhysicalAction.lf index fa88bb3700..79a3be24ec 100644 --- a/test/Python/src/federated/DistributedLoopedPhysicalAction.lf +++ b/test/Python/src/federated/DistributedLoopedPhysicalAction.lf @@ -32,7 +32,9 @@ reactor Sender(take_a_break_after=10, break_interval = 550 msec) { } reactor Receiver(take_a_break_after=10, break_interval = 550 msec) { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state received_messages = 0 state total_received_messages = 0 @@ -42,7 +44,9 @@ reactor Receiver(take_a_break_after=10, break_interval = 550 msec) { # but forces the logical time to advance Comment this line for a more sensible log output. state base_logical_time - reaction(startup) {= self.base_logical_time = lf.time.logical() =} + reaction(startup) {= + self.base_logical_time = lf.time.logical() + =} reaction(in_) {= current_tag = lf.tag() diff --git a/test/Python/src/federated/DistributedMultiport.lf b/test/Python/src/federated/DistributedMultiport.lf index 6c67e0e90f..952021df01 100644 --- a/test/Python/src/federated/DistributedMultiport.lf +++ b/test/Python/src/federated/DistributedMultiport.lf @@ -17,7 +17,9 @@ reactor Source { } reactor Destination { - preamble {= import sys =} + preamble {= + import sys + =} input[4] in_ state count = 0 diff --git a/test/Python/src/federated/DistributedMultiportToBank.lf b/test/Python/src/federated/DistributedMultiportToBank.lf index c94e4ec49b..93e1daf076 100644 --- a/test/Python/src/federated/DistributedMultiportToBank.lf +++ b/test/Python/src/federated/DistributedMultiportToBank.lf @@ -16,7 +16,9 @@ reactor Source { } reactor Destination { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state count = 0 diff --git a/test/Python/src/federated/DistributedNoReact.lf b/test/Python/src/federated/DistributedNoReact.lf index e28f5ae253..afbcd3aeed 100644 --- a/test/Python/src/federated/DistributedNoReact.lf +++ b/test/Python/src/federated/DistributedNoReact.lf @@ -15,7 +15,9 @@ reactor A { reactor B { output o - reaction(startup) -> o {= o.set(C()) =} + reaction(startup) -> o {= + o.set(C()) + =} } federated reactor { diff --git a/test/Python/src/federated/DistributedSendClass.lf b/test/Python/src/federated/DistributedSendClass.lf index 9f77259b37..6cdb4e013d 100644 --- a/test/Python/src/federated/DistributedSendClass.lf +++ b/test/Python/src/federated/DistributedSendClass.lf @@ -9,13 +9,17 @@ preamble {= reactor A { input o - reaction(o) {= request_stop() =} + reaction(o) {= + request_stop() + =} } reactor B { output o - reaction(startup) -> o {= o.set(C()) =} + reaction(startup) -> o {= + o.set(C()) + =} } federated reactor { diff --git a/test/Python/src/federated/DistributedStop.lf b/test/Python/src/federated/DistributedStop.lf index 0171a2bbfb..6aea789049 100644 --- a/test/Python/src/federated/DistributedStop.lf +++ b/test/Python/src/federated/DistributedStop.lf @@ -5,7 +5,9 @@ */ target Python -preamble {= import sys =} +preamble {= + import sys +=} reactor Sender { output out diff --git a/test/Python/src/federated/DistributedStopZero.lf b/test/Python/src/federated/DistributedStopZero.lf index 845f099698..ad4820eb03 100644 --- a/test/Python/src/federated/DistributedStopZero.lf +++ b/test/Python/src/federated/DistributedStopZero.lf @@ -6,14 +6,18 @@ # reason for failing: lf_tag().microstep and lf.tag_compare() are not not supported in python target target Python -preamble {= import sys =} +preamble {= + import sys +=} reactor Sender { output out timer t(0, 1 usec) state startup_logical_time - reaction(startup) {= self.startup_logical_time = lf.time.logical() =} + reaction(startup) {= + self.startup_logical_time = lf.time.logical() + =} reaction(t) -> out {= tag = lf.tag() @@ -47,7 +51,9 @@ reactor Receiver { input in_ state startup_logical_time - reaction(startup) {= self.startup_logical_time = lf.time.logical() =} + reaction(startup) {= + self.startup_logical_time = lf.time.logical() + =} reaction(in_) {= tag = lf.tag() diff --git a/test/Python/src/federated/DistributedStructAsType.lf b/test/Python/src/federated/DistributedStructAsType.lf index 36a3151289..b3a83cc600 100644 --- a/test/Python/src/federated/DistributedStructAsType.lf +++ b/test/Python/src/federated/DistributedStructAsType.lf @@ -5,7 +5,9 @@ target Python { import Source, Print from "../StructAsType.lf" -preamble {= import hello =} +preamble {= + import hello +=} federated reactor { s = new Source() diff --git a/test/Python/src/federated/DistributedStructAsTypeDirect.lf b/test/Python/src/federated/DistributedStructAsTypeDirect.lf index b74ba275b5..7463672366 100644 --- a/test/Python/src/federated/DistributedStructAsTypeDirect.lf +++ b/test/Python/src/federated/DistributedStructAsTypeDirect.lf @@ -5,7 +5,9 @@ target Python { import Source, Print from "../StructAsTypeDirect.lf" -preamble {= import hello =} +preamble {= + import hello +=} federated reactor { s = new Source() diff --git a/test/Python/src/federated/DistributedStructParallel.lf b/test/Python/src/federated/DistributedStructParallel.lf index e20bb21030..9577231955 100644 --- a/test/Python/src/federated/DistributedStructParallel.lf +++ b/test/Python/src/federated/DistributedStructParallel.lf @@ -8,7 +8,9 @@ target Python { import Source from "../StructScale.lf" import Check, Print from "../StructParallel.lf" -preamble {= import hello =} +preamble {= + import hello +=} federated reactor { s = new Source() diff --git a/test/Python/src/federated/DistributedStructPrint.lf b/test/Python/src/federated/DistributedStructPrint.lf index 829b298b28..d3dbfe398b 100644 --- a/test/Python/src/federated/DistributedStructPrint.lf +++ b/test/Python/src/federated/DistributedStructPrint.lf @@ -7,7 +7,9 @@ target Python { import Print, Check from "../StructPrint.lf" -preamble {= import hello =} +preamble {= + import hello +=} federated reactor { s = new Print() diff --git a/test/Python/src/federated/DistributedStructScale.lf b/test/Python/src/federated/DistributedStructScale.lf index 1551035c29..34a4977d05 100644 --- a/test/Python/src/federated/DistributedStructScale.lf +++ b/test/Python/src/federated/DistributedStructScale.lf @@ -7,7 +7,9 @@ target Python { import Source, TestInput, Print from "../StructScale.lf" -preamble {= import hello =} +preamble {= + import hello +=} federated reactor { s = new Source() diff --git a/test/Python/src/federated/HelloDistributed.lf b/test/Python/src/federated/HelloDistributed.lf index 7bbfa49368..300af9c78a 100644 --- a/test/Python/src/federated/HelloDistributed.lf +++ b/test/Python/src/federated/HelloDistributed.lf @@ -20,7 +20,9 @@ reactor Destination { input _in state received = False - reaction(startup) {= print("Destination started.") =} + reaction(startup) {= + print("Destination started.") + =} reaction(_in) {= print(f"At logical time {lf.time.logical_elapsed()}, destination received {_in.value}") diff --git a/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf b/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf index 3d4564fc45..1d996147a7 100644 --- a/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf +++ b/test/Python/src/federated/LoopDistributedCentralizedPrecedenceHierarchy.lf @@ -19,9 +19,13 @@ reactor Contained(incr=1) { state count = 0 state received_count = 0 - reaction(t) {= self.count += self.incr =} + reaction(t) {= + self.count += self.incr + =} - reaction(inp) {= self.received_count = self.count =} + reaction(inp) {= + self.received_count = self.count + =} reaction(t) {= if self.received_count != self.count: diff --git a/test/Python/src/federated/PhysicalSTP.lf b/test/Python/src/federated/PhysicalSTP.lf index 20d61df25b..e00fda3f36 100644 --- a/test/Python/src/federated/PhysicalSTP.lf +++ b/test/Python/src/federated/PhysicalSTP.lf @@ -7,7 +7,9 @@ target Python { import Count from "../lib/Count.lf" reactor Print(STP_offset=0) { - preamble {= import sys =} + preamble {= + import sys + =} input in_ state c = 1 diff --git a/test/Python/src/federated/PingPongDistributed.lf b/test/Python/src/federated/PingPongDistributed.lf index 4bd0cde285..a2c334ab57 100644 --- a/test/Python/src/federated/PingPongDistributed.lf +++ b/test/Python/src/federated/PingPongDistributed.lf @@ -40,7 +40,9 @@ reactor Ping(count=10) { } reactor Pong(expected=10) { - preamble {= import sys =} + preamble {= + import sys + =} input receive output send diff --git a/test/Python/src/federated/StopAtShutdown.lf b/test/Python/src/federated/StopAtShutdown.lf index 55708d038e..f5a784185d 100644 --- a/test/Python/src/federated/StopAtShutdown.lf +++ b/test/Python/src/federated/StopAtShutdown.lf @@ -12,20 +12,30 @@ target Python { reactor A { input in_ - reaction(startup) {= print("Hello World!") =} + reaction(startup) {= + print("Hello World!") + =} - reaction(in_) {= print("Got it") =} + reaction(in_) {= + print("Got it") + =} - reaction(shutdown) {= request_stop() =} + reaction(shutdown) {= + request_stop() + =} } reactor B { output out timer t(1 sec) - reaction(t) -> out {= out.set(1) =} + reaction(t) -> out {= + out.set(1) + =} - reaction(shutdown) {= request_stop() =} + reaction(shutdown) {= + request_stop() + =} } federated reactor { diff --git a/test/Python/src/lib/Imported.lf b/test/Python/src/lib/Imported.lf index e23b300991..e98af204a3 100644 --- a/test/Python/src/lib/Imported.lf +++ b/test/Python/src/lib/Imported.lf @@ -8,5 +8,7 @@ reactor Imported { input x a = new ImportedAgain() - reaction(x) -> a.x {= a.x.set(x.value) =} + reaction(x) -> a.x {= + a.x.set(x.value) + =} } diff --git a/test/Python/src/lib/ImportedComposition.lf b/test/Python/src/lib/ImportedComposition.lf index 5eeb39420f..9d55449db1 100644 --- a/test/Python/src/lib/ImportedComposition.lf +++ b/test/Python/src/lib/ImportedComposition.lf @@ -6,7 +6,9 @@ reactor Gain { input x output y - reaction(x) -> y {= y.set(x.value * 2) =} + reaction(x) -> y {= + y.set(x.value * 2) + =} } reactor ImportedComposition { diff --git a/test/Python/src/lib/InternalDelay.lf b/test/Python/src/lib/InternalDelay.lf index 964ec6b5a3..0438e1d877 100644 --- a/test/Python/src/lib/InternalDelay.lf +++ b/test/Python/src/lib/InternalDelay.lf @@ -5,7 +5,11 @@ reactor InternalDelay(delay = 10 msec) { output out logical action d - reaction(in_) -> d {= d.schedule(self.delay, in_.value) =} + reaction(in_) -> d {= + d.schedule(self.delay, in_.value) + =} - reaction(d) -> out {= out.set(d.value) =} + reaction(d) -> out {= + out.set(d.value) + =} } diff --git a/test/Python/src/lib/TestCount.lf b/test/Python/src/lib/TestCount.lf index 28dcf74ba0..75d9c96d9e 100644 --- a/test/Python/src/lib/TestCount.lf +++ b/test/Python/src/lib/TestCount.lf @@ -9,7 +9,9 @@ target Python reactor TestCount(start=1, stride=1, num_inputs=1) { - preamble {= import sys =} + preamble {= + import sys + =} state count = start state inputs_received = 0 input in_ diff --git a/test/Python/src/lib/TestCountMultiport.lf b/test/Python/src/lib/TestCountMultiport.lf index 0514bc2472..38bedbdbfd 100644 --- a/test/Python/src/lib/TestCountMultiport.lf +++ b/test/Python/src/lib/TestCountMultiport.lf @@ -11,7 +11,9 @@ target Python reactor TestCountMultiport(start=1, stride=1, num_inputs=1, width=2) { - preamble {= import sys =} + preamble {= + import sys + =} state count = start state inputs_received = 0 input[width] inp diff --git a/test/Python/src/modal_models/BanksCount3ModesComplex.lf b/test/Python/src/modal_models/BanksCount3ModesComplex.lf index 757331dd7d..3ea6d112ee 100644 --- a/test/Python/src/modal_models/BanksCount3ModesComplex.lf +++ b/test/Python/src/modal_models/BanksCount3ModesComplex.lf @@ -25,7 +25,9 @@ reactor MetaCounter { mode1_counters.count -> mode1 timer t1(500 msec, 250 msec) - reaction(t1) -> reset(Two) {= Two.set() =} + reaction(t1) -> reset(Two) {= + Two.set() + =} } mode Two { @@ -35,7 +37,9 @@ reactor MetaCounter { mode2_counters.count -> mode2 timer t2(500 msec, 250 msec) - reaction(t2) -> history(One) {= One.set() =} + reaction(t2) -> history(One) {= + One.set() + =} } mode Three { diff --git a/test/Python/src/modal_models/ConvertCaseTest.lf b/test/Python/src/modal_models/ConvertCaseTest.lf index f063da7e34..70eec263f5 100644 --- a/test/Python/src/modal_models/ConvertCaseTest.lf +++ b/test/Python/src/modal_models/ConvertCaseTest.lf @@ -15,13 +15,19 @@ reactor ResetProcessor { converter = new Converter() character -> converter.raw converter.converted -> converted - reaction(discard) -> reset(Discarding) {= Discarding.set() =} + reaction(discard) -> reset(Discarding) {= + Discarding.set() + =} } mode Discarding { - reaction(character) -> converted {= converted.set('_') =} + reaction(character) -> converted {= + converted.set('_') + =} - reaction(character) -> reset(Converting) {= Converting.set() =} + reaction(character) -> reset(Converting) {= + Converting.set() + =} } } @@ -34,13 +40,19 @@ reactor HistoryProcessor { converter = new Converter() character -> converter.raw converter.converted -> converted - reaction(discard) -> reset(Discarding) {= Discarding.set() =} + reaction(discard) -> reset(Discarding) {= + Discarding.set() + =} } mode Discarding { - reaction(character) -> converted {= converted.set('_') =} + reaction(character) -> converted {= + converted.set('_') + =} - reaction(character) -> history(Converting) {= Converting.set() =} + reaction(character) -> history(Converting) {= + Converting.set() + =} } } @@ -113,7 +125,11 @@ main reactor { history_processor.discard.set(True) =} - reaction(reset_processor.converted) {= print(f"Reset: {reset_processor.converted.value}") =} + reaction(reset_processor.converted) {= + print(f"Reset: {reset_processor.converted.value}") + =} - reaction(history_processor.converted) {= print(f"History: {history_processor.converted.value}") =} + reaction(history_processor.converted) {= + print(f"History: {history_processor.converted.value}") + =} } diff --git a/test/Python/src/modal_models/Count3Modes.lf b/test/Python/src/modal_models/Count3Modes.lf index 8d67270300..6f19128ca3 100644 --- a/test/Python/src/modal_models/Count3Modes.lf +++ b/test/Python/src/modal_models/Count3Modes.lf @@ -36,7 +36,10 @@ main reactor { state expected_value = 1 - reaction(stepper) -> counter.next {= counter.next.set(True) =} # Trigger + # Trigger + reaction(stepper) -> counter.next {= + counter.next.set(True) + =} # Check reaction(stepper) counter.count {= diff --git a/test/Python/src/modal_models/ModalActions.lf b/test/Python/src/modal_models/ModalActions.lf index 5218a1428e..5938061a51 100644 --- a/test/Python/src/modal_models/ModalActions.lf +++ b/test/Python/src/modal_models/ModalActions.lf @@ -89,5 +89,8 @@ main reactor { modal.action2_sched, modal.action2_exec -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} } diff --git a/test/Python/src/modal_models/ModalAfter.lf b/test/Python/src/modal_models/ModalAfter.lf index f5e8141e00..a437052dcc 100644 --- a/test/Python/src/modal_models/ModalAfter.lf +++ b/test/Python/src/modal_models/ModalAfter.lf @@ -91,5 +91,8 @@ main reactor { modal.mode_switch, modal.produced1, modal.consumed1, modal.produced2, modal.consumed2 -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} } diff --git a/test/Python/src/modal_models/ModalCycleBreaker.lf b/test/Python/src/modal_models/ModalCycleBreaker.lf index 2475366927..61ce4c60d7 100644 --- a/test/Python/src/modal_models/ModalCycleBreaker.lf +++ b/test/Python/src/modal_models/ModalCycleBreaker.lf @@ -28,7 +28,9 @@ reactor Modal { } initial mode One { - reaction(in1) -> out {= out.set(in1.value) =} + reaction(in1) -> out {= + out.set(in1.value) + =} reaction(in1) -> reset(Two) {= if in1.value % 5 == 4: @@ -70,5 +72,8 @@ main reactor { modal.out -> test.events - reaction(modal.out) {= print(modal.out.value) =} # Print + # Print + reaction(modal.out) {= + print(modal.out.value) + =} } diff --git a/test/Python/src/modal_models/ModalNestedReactions.lf b/test/Python/src/modal_models/ModalNestedReactions.lf index 5f30da93b8..a3b89c997a 100644 --- a/test/Python/src/modal_models/ModalNestedReactions.lf +++ b/test/Python/src/modal_models/ModalNestedReactions.lf @@ -29,7 +29,9 @@ reactor CounterCycle { } mode Three { - reaction(next) -> never {= never.set(True) =} + reaction(next) -> never {= + never.set(True) + =} } } @@ -37,14 +39,19 @@ reactor Forward { input inp output out - reaction(inp) -> out {= out.set(inp.value) =} + reaction(inp) -> out {= + out.set(inp.value) + =} } main reactor { timer stepper(0, 250 msec) counter = new CounterCycle() - reaction(stepper) -> counter.next {= counter.next.set(True) =} # Trigger + # Trigger + reaction(stepper) -> counter.next {= + counter.next.set(True) + =} # Check reaction(stepper) counter.count, counter.only_in_two {= diff --git a/test/Python/src/modal_models/ModalStartupShutdown.lf b/test/Python/src/modal_models/ModalStartupShutdown.lf index 8dc7eb8dd1..cd77eb2b1f 100644 --- a/test/Python/src/modal_models/ModalStartupShutdown.lf +++ b/test/Python/src/modal_models/ModalStartupShutdown.lf @@ -137,5 +137,8 @@ main reactor { modal.reset5, modal.shutdown5 -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} } diff --git a/test/Python/src/modal_models/ModalStateReset.lf b/test/Python/src/modal_models/ModalStateReset.lf index 5de6b61e35..7ae20ad095 100644 --- a/test/Python/src/modal_models/ModalStateReset.lf +++ b/test/Python/src/modal_models/ModalStateReset.lf @@ -25,7 +25,9 @@ reactor Modal { initial mode One { state counter1 = 0 timer T1(0 msec, 250 msec) - reaction(reset) {= self.counter1 = 0 =} + reaction(reset) {= + self.counter1 = 0 + =} reaction(T1) -> count1 {= print(f"Counter1: {self.counter1}") @@ -43,7 +45,9 @@ reactor Modal { mode Two { state counter2 = -2 timer T2(0 msec, 250 msec) - reaction(reset) {= self.counter2 = -2 =} + reaction(reset) {= + self.counter2 = -2 + =} reaction(T2) -> count2 {= print(f"Counter2: {self.counter2}") @@ -87,5 +91,8 @@ main reactor { modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} } diff --git a/test/Python/src/modal_models/ModalStateResetAuto.lf b/test/Python/src/modal_models/ModalStateResetAuto.lf index 492d02f234..947fc4e924 100644 --- a/test/Python/src/modal_models/ModalStateResetAuto.lf +++ b/test/Python/src/modal_models/ModalStateResetAuto.lf @@ -83,5 +83,8 @@ main reactor { modal.mode_switch, modal.count0, modal.count1, modal.count2 -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} } diff --git a/test/Python/src/modal_models/ModalTimers.lf b/test/Python/src/modal_models/ModalTimers.lf index f752e025d8..7d2d6c5707 100644 --- a/test/Python/src/modal_models/ModalTimers.lf +++ b/test/Python/src/modal_models/ModalTimers.lf @@ -62,5 +62,8 @@ main reactor { modal.mode_switch, modal.timer1, modal.timer2 -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} } diff --git a/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf b/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf index 47e9c0b783..573d35f432 100644 --- a/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf +++ b/test/Python/src/modal_models/MultipleOutputFeeder_2Connections.lf @@ -18,13 +18,17 @@ reactor Modal { initial mode One { counter1 = new Counter(period = 250 msec) counter1.value -> count - reaction(next) -> reset(Two) {= Two.set() =} + reaction(next) -> reset(Two) {= + Two.set() + =} } mode Two { counter2 = new Counter(period = 100 msec) counter2.value -> count - reaction(next) -> history(One) {= One.set() =} + reaction(next) -> history(One) {= + One.set() + =} } } @@ -66,7 +70,13 @@ main reactor { modal.count -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} - reaction(modal.count) {= print(modal.count.value) =} # Print + # Print + reaction(modal.count) {= + print(modal.count.value) + =} } diff --git a/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf b/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf index 5d77127f86..213db4693b 100644 --- a/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf +++ b/test/Python/src/modal_models/MultipleOutputFeeder_ReactionConnections.lf @@ -18,14 +18,20 @@ reactor Modal { initial mode One { counter1 = new Counter(period = 250 msec) counter1.value -> count - reaction(next) -> reset(Two) {= Two.set() =} + reaction(next) -> reset(Two) {= + Two.set() + =} } mode Two { counter2 = new Counter(period = 100 msec) - reaction(counter2.value) -> count {= count.set(counter2.value.value * 10) =} + reaction(counter2.value) -> count {= + count.set(counter2.value.value * 10) + =} - reaction(next) -> history(One) {= One.set() =} + reaction(next) -> history(One) {= + One.set() + =} } } @@ -67,7 +73,13 @@ main reactor { modal.count -> test.events - reaction(stepper) -> modal.next {= modal.next.set(True) =} # Trigger mode change + # Trigger mode change + reaction(stepper) -> modal.next {= + modal.next.set(True) + =} - reaction(modal.count) {= print(modal.count.value) =} # Print + # Print + reaction(modal.count) {= + print(modal.count.value) + =} } diff --git a/test/Python/src/modal_models/util/TraceTesting.lf b/test/Python/src/modal_models/util/TraceTesting.lf index 833ffa0ca6..0d5053b844 100644 --- a/test/Python/src/modal_models/util/TraceTesting.lf +++ b/test/Python/src/modal_models/util/TraceTesting.lf @@ -9,7 +9,9 @@ reactor TraceTesting(events_size=0, trace = {= [] =}, training=False) { state recorded_events = {= [] =} state recorded_events_next = 0 - reaction(startup) {= self.last_reaction_time = lf.time.logical() =} + reaction(startup) {= + self.last_reaction_time = lf.time.logical() + =} reaction(events) {= # Time passed since last reaction diff --git a/test/Python/src/multiport/BankIndexInitializer.lf b/test/Python/src/multiport/BankIndexInitializer.lf index babef36a7c..2e02c9f498 100644 --- a/test/Python/src/multiport/BankIndexInitializer.lf +++ b/test/Python/src/multiport/BankIndexInitializer.lf @@ -1,12 +1,16 @@ # Test bank of reactors to multiport input with id parameter in the bank. target Python -preamble {= table = [4, 3, 2, 1] =} +preamble {= + table = [4, 3, 2, 1] +=} reactor Source(bank_index=0, value=0) { output out - reaction(startup) -> out {= out.set(self.value) =} + reaction(startup) -> out {= + out.set(self.value) + =} } reactor Sink(width=4) { diff --git a/test/Python/src/multiport/BankToMultiport.lf b/test/Python/src/multiport/BankToMultiport.lf index 7be7e38e21..bd276a2aa8 100644 --- a/test/Python/src/multiport/BankToMultiport.lf +++ b/test/Python/src/multiport/BankToMultiport.lf @@ -4,7 +4,9 @@ target Python reactor Source(bank_index=0) { output out - reaction(startup) -> out {= out.set(self.bank_index) =} + reaction(startup) -> out {= + out.set(self.bank_index) + =} } reactor Sink(width=4) { diff --git a/test/Python/src/multiport/Broadcast.lf b/test/Python/src/multiport/Broadcast.lf index ad10435c7b..f54f8f4730 100644 --- a/test/Python/src/multiport/Broadcast.lf +++ b/test/Python/src/multiport/Broadcast.lf @@ -6,7 +6,9 @@ target Python { reactor Source(value=42) { output out - reaction(startup) -> out {= out.set(self.value) =} + reaction(startup) -> out {= + out.set(self.value) + =} } reactor Destination(bank_index=0, delay=0) { diff --git a/test/Python/src/multiport/MultiportFromBank.lf b/test/Python/src/multiport/MultiportFromBank.lf index 447f10154a..d41d247fc7 100644 --- a/test/Python/src/multiport/MultiportFromBank.lf +++ b/test/Python/src/multiport/MultiportFromBank.lf @@ -8,7 +8,9 @@ target Python { reactor Source(check_override=0, bank_index=0) { output out - reaction(startup) -> out {= out.set(self.bank_index * self.check_override) =} + reaction(startup) -> out {= + out.set(self.bank_index * self.check_override) + =} } reactor Destination { diff --git a/test/Python/src/multiport/MultiportFromBankHierarchy.lf b/test/Python/src/multiport/MultiportFromBankHierarchy.lf index 253de78c1a..20a66f2e1f 100644 --- a/test/Python/src/multiport/MultiportFromBankHierarchy.lf +++ b/test/Python/src/multiport/MultiportFromBankHierarchy.lf @@ -10,7 +10,9 @@ import Destination from "MultiportFromBank.lf" reactor Source(bank_index=0) { output out - reaction(startup) -> out {= out.set(self.bank_index) =} + reaction(startup) -> out {= + out.set(self.bank_index) + =} } reactor Container { diff --git a/test/Python/src/multiport/MultiportIn.lf b/test/Python/src/multiport/MultiportIn.lf index e72b037bab..3fd77500ff 100644 --- a/test/Python/src/multiport/MultiportIn.lf +++ b/test/Python/src/multiport/MultiportIn.lf @@ -20,7 +20,9 @@ reactor Computation { input _in output out - reaction(_in) -> out {= out.set(_in.value) =} + reaction(_in) -> out {= + out.set(_in.value) + =} } reactor Destination { diff --git a/test/Python/src/multiport/MultiportInParameterized.lf b/test/Python/src/multiport/MultiportInParameterized.lf index d9df047b5a..ece6b51b2a 100644 --- a/test/Python/src/multiport/MultiportInParameterized.lf +++ b/test/Python/src/multiport/MultiportInParameterized.lf @@ -20,7 +20,9 @@ reactor Computation { input _in output out - reaction(_in) -> out {= out.set(_in.value) =} + reaction(_in) -> out {= + out.set(_in.value) + =} } reactor Destination(width=1) { diff --git a/test/Python/src/multiport/MultiportOut.lf b/test/Python/src/multiport/MultiportOut.lf index b84f97989c..29a5816e90 100644 --- a/test/Python/src/multiport/MultiportOut.lf +++ b/test/Python/src/multiport/MultiportOut.lf @@ -21,7 +21,9 @@ reactor Computation { input _in output out - reaction(_in) -> out {= out.set(_in.value) =} + reaction(_in) -> out {= + out.set(_in.value) + =} } reactor Destination { diff --git a/test/Python/src/multiport/PipelineAfter.lf b/test/Python/src/multiport/PipelineAfter.lf index 307a4122cd..b16d20b7a4 100644 --- a/test/Python/src/multiport/PipelineAfter.lf +++ b/test/Python/src/multiport/PipelineAfter.lf @@ -3,14 +3,18 @@ target Python reactor Source { output out - reaction(startup) -> out {= out.set(40) =} + reaction(startup) -> out {= + out.set(40) + =} } reactor Compute { input inp output out - reaction(inp) -> out {= out.set(inp.value + 2) =} + reaction(inp) -> out {= + out.set(inp.value + 2) + =} } reactor Sink { diff --git a/test/Python/src/multiport/ReactionsToNested.lf b/test/Python/src/multiport/ReactionsToNested.lf index b298a85a95..f02fc91bc4 100644 --- a/test/Python/src/multiport/ReactionsToNested.lf +++ b/test/Python/src/multiport/ReactionsToNested.lf @@ -32,7 +32,11 @@ reactor D { main reactor { d = new D() - reaction(startup) -> d.y {= d.y[0].set(42) =} + reaction(startup) -> d.y {= + d.y[0].set(42) + =} - reaction(startup) -> d.y {= d.y[1].set(43) =} + reaction(startup) -> d.y {= + d.y[1].set(43) + =} } diff --git a/test/Python/src/target/AfterNoTypes.lf b/test/Python/src/target/AfterNoTypes.lf index c2be99ef2c..8a00ea94c7 100644 --- a/test/Python/src/target/AfterNoTypes.lf +++ b/test/Python/src/target/AfterNoTypes.lf @@ -9,7 +9,9 @@ reactor Foo { input x output y - reaction(x) -> y {= y.set(2*x.value); =} + reaction(x) -> y {= + y.set(2*x.value); + =} } reactor Print { @@ -46,5 +48,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= f.x.set(42) =} + reaction(t) -> f.x {= + f.x.set(42) + =} } diff --git a/test/Rust/src/ActionImplicitDelay.lf b/test/Rust/src/ActionImplicitDelay.lf index 5ae8557a57..ea33042ea1 100644 --- a/test/Rust/src/ActionImplicitDelay.lf +++ b/test/Rust/src/ActionImplicitDelay.lf @@ -5,7 +5,9 @@ main reactor ActionImplicitDelay { logical action act(40 msec) state count: u64 = 1 - reaction(startup) -> act {= ctx.schedule(act, Asap); =} + reaction(startup) -> act {= + ctx.schedule(act, Asap); + =} reaction(act) -> act {= assert_tag_is!(ctx, T0 + (40 * self.count) ms); diff --git a/test/Rust/src/ActionValuesCleanup.lf b/test/Rust/src/ActionValuesCleanup.lf index 1db2759ad6..407424b218 100644 --- a/test/Rust/src/ActionValuesCleanup.lf +++ b/test/Rust/src/ActionValuesCleanup.lf @@ -22,7 +22,9 @@ main reactor ActionValuesCleanup { logical action act: FooDrop state count: u32 = 0 - reaction(startup) -> act {= ctx.schedule_with_v(act, Some(FooDrop { }), Asap) =} + reaction(startup) -> act {= + ctx.schedule_with_v(act, Some(FooDrop { }), Asap) + =} reaction(act) -> act {= ctx.use_ref(act, |v| println!("{:?}", v)); diff --git a/test/Rust/src/CompositionInitializationOrder.lf b/test/Rust/src/CompositionInitializationOrder.lf index 5bb11f7d9c..1d1106dc58 100644 --- a/test/Rust/src/CompositionInitializationOrder.lf +++ b/test/Rust/src/CompositionInitializationOrder.lf @@ -5,13 +5,19 @@ main reactor CompositionInitializationOrder { c1 = new Component1() c2 = new Component2() - reaction(startup) {= println!("parent woke up"); =} + reaction(startup) {= + println!("parent woke up"); + =} } reactor Component2 { - reaction(startup) {= println!("c2 woke up"); =} + reaction(startup) {= + println!("c2 woke up"); + =} } reactor Component1 { - reaction(startup) {= println!("c1 woke up"); =} + reaction(startup) {= + println!("c1 woke up"); + =} } diff --git a/test/Rust/src/CompositionWithPorts.lf b/test/Rust/src/CompositionWithPorts.lf index 802f8cac21..17715fa5d9 100644 --- a/test/Rust/src/CompositionWithPorts.lf +++ b/test/Rust/src/CompositionWithPorts.lf @@ -3,7 +3,9 @@ target Rust reactor Source { output out: i32 - reaction(startup) -> out {= ctx.set(out, 76600) =} + reaction(startup) -> out {= + ctx.set(out, 76600) + =} } reactor Sink { diff --git a/test/Rust/src/DependencyOnChildPort.lf b/test/Rust/src/DependencyOnChildPort.lf index 2758af8604..0e6dbbda68 100644 --- a/test/Rust/src/DependencyOnChildPort.lf +++ b/test/Rust/src/DependencyOnChildPort.lf @@ -16,9 +16,13 @@ main reactor { box0.out -> box1.inp - reaction(startup) -> box0.inp {= ctx.set(box0__inp, 444); =} + reaction(startup) -> box0.inp {= + ctx.set(box0__inp, 444); + =} - reaction(box1.out) {= assert!(ctx.get_elapsed_logical_time().is_zero()); self.done = true; =} + reaction(box1.out) {= + assert!(ctx.get_elapsed_logical_time().is_zero()); self.done = true; + =} reaction(shutdown) {= assert!(self.done, "reaction was not executed"); diff --git a/test/Rust/src/DependencyThroughChildPort.lf b/test/Rust/src/DependencyThroughChildPort.lf index c8e8bf1592..48b6314363 100644 --- a/test/Rust/src/DependencyThroughChildPort.lf +++ b/test/Rust/src/DependencyThroughChildPort.lf @@ -40,5 +40,7 @@ main reactor { ctx.schedule(repeat, Asap); =} - reaction(repeat) -> d.y {= ctx.set(d__y, 1); =} + reaction(repeat) -> d.y {= + ctx.set(d__y, 1); + =} } diff --git a/test/Rust/src/DependencyUseAccessible.lf b/test/Rust/src/DependencyUseAccessible.lf index 0654d25f60..9a5866d6bf 100644 --- a/test/Rust/src/DependencyUseAccessible.lf +++ b/test/Rust/src/DependencyUseAccessible.lf @@ -8,11 +8,18 @@ reactor Source { timer t1(35 msec) timer t2(70 msec) - reaction(startup) -> clock {= ctx.set(clock, 0); =} + reaction(startup) -> clock {= + ctx.set(clock, 0); + =} - reaction(t1) -> clock, o1 {= ctx.set(clock, 1); ctx.set(o1, 10) =} + reaction(t1) -> clock, o1 {= + ctx.set(clock, 1); ctx.set(o1, 10) + =} - reaction(t2) -> clock, o2 {= ctx.set(clock, 2); =} // has a dependency but doesn't use it + // has a dependency but doesn't use it + reaction(t2) -> clock, o2 {= + ctx.set(clock, 2); + =} } reactor Sink { diff --git a/test/Rust/src/DependencyUseNonTrigger.lf b/test/Rust/src/DependencyUseNonTrigger.lf index 656ad1f768..11da73eb54 100644 --- a/test/Rust/src/DependencyUseNonTrigger.lf +++ b/test/Rust/src/DependencyUseNonTrigger.lf @@ -4,16 +4,22 @@ target Rust reactor Source { output clock: u32 - reaction(startup) -> clock {= ctx.set(clock, 0); =} + reaction(startup) -> clock {= + ctx.set(clock, 0); + =} } reactor Sink { input clock: u32 input bogus: u32 - reaction(bogus) clock {= panic!("Should not be executed") =} + reaction(bogus) clock {= + panic!("Should not be executed") + =} - reaction(shutdown) {= println!("Success") =} + reaction(shutdown) {= + println!("Success") + =} } main reactor { diff --git a/test/Rust/src/Import.lf b/test/Rust/src/Import.lf index c14618ba6e..f2c5549abc 100644 --- a/test/Rust/src/Import.lf +++ b/test/Rust/src/Import.lf @@ -7,5 +7,7 @@ main reactor Import { timer t a = new Imported() - reaction(t) -> a.x {= ctx.set(a__x, 42); =} + reaction(t) -> a.x {= + ctx.set(a__x, 42); + =} } diff --git a/test/Rust/src/ImportPreambleItem.lf b/test/Rust/src/ImportPreambleItem.lf index 922ea74b1a..dbbe1706e6 100644 --- a/test/Rust/src/ImportPreambleItem.lf +++ b/test/Rust/src/ImportPreambleItem.lf @@ -6,5 +6,7 @@ import SomethingWithAPreamble from "lib/SomethingWithAPreamble.lf" main reactor { r = new SomethingWithAPreamble() - reaction(startup) -> r.a {= ctx.set(r__a, super::something_with_a_preamble::some_fun()); =} + reaction(startup) -> r.a {= + ctx.set(r__a, super::something_with_a_preamble::some_fun()); + =} } diff --git a/test/Rust/src/MainReactorParam.lf b/test/Rust/src/MainReactorParam.lf index 2081466a37..90c10f4ea2 100644 --- a/test/Rust/src/MainReactorParam.lf +++ b/test/Rust/src/MainReactorParam.lf @@ -4,5 +4,7 @@ main reactor(one: u64 = 1152921504606846976, two: u64 = {= 1 << 60 =}) { state one = one state two = two - reaction(startup) {= assert_eq!(self.one, self.two); =} + reaction(startup) {= + assert_eq!(self.one, self.two); + =} } diff --git a/test/Rust/src/Minimal.lf b/test/Rust/src/Minimal.lf index 02fd0d3eb3..754d7bb1f8 100644 --- a/test/Rust/src/Minimal.lf +++ b/test/Rust/src/Minimal.lf @@ -2,5 +2,7 @@ target Rust main reactor Minimal { - reaction(startup) {= println!("Hello World."); =} + reaction(startup) {= + println!("Hello World."); + =} } diff --git a/test/Rust/src/MovingAverage.lf b/test/Rust/src/MovingAverage.lf index 22d10cabe0..0c5957b21c 100644 --- a/test/Rust/src/MovingAverage.lf +++ b/test/Rust/src/MovingAverage.lf @@ -17,7 +17,9 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {= [f64 ; 4] =} = {= [ 0.0 ; 4 ] =} + state delay_line: {= + [f64 ; 4] + =} = {= [ 0.0 ; 4 ] =} state index: usize = 0 input in_: f64 output out: f64 @@ -40,7 +42,9 @@ reactor Print { input in_: f64 state count: usize = 0 - preamble {= const EXPECTED: [ f64 ; 6 ] = [0.0, 0.25, 0.75, 1.5, 2.5, 3.5]; =} + preamble {= + const EXPECTED: [ f64 ; 6 ] = [0.0, 0.25, 0.75, 1.5, 2.5, 3.5]; + =} reaction(in_) {= let in_ = ctx.get(in_).unwrap(); diff --git a/test/Rust/src/NativeListsAndTimes.lf b/test/Rust/src/NativeListsAndTimes.lf index 5401d6d1b9..d96e0649ba 100644 --- a/test/Rust/src/NativeListsAndTimes.lf +++ b/test/Rust/src/NativeListsAndTimes.lf @@ -30,7 +30,10 @@ reactor Foo( // state baz(p); // Implicit type i32[] fixme this interplays badly with syntax for array init // Implicit type time state period = z - state times: Vec>(q, g) // a list of lists + // a list of lists + state times: Vec>(q, g) /** * reactor Foo (p: i32[](1, 2)) { state baz(p); // Implicit type i32[] state baz({=p=}); // diff --git a/test/Rust/src/PortConnectionInSelfOutSelf.lf b/test/Rust/src/PortConnectionInSelfOutSelf.lf index d398e89f0f..578255d43f 100644 --- a/test/Rust/src/PortConnectionInSelfOutSelf.lf +++ b/test/Rust/src/PortConnectionInSelfOutSelf.lf @@ -26,7 +26,9 @@ reactor Sink { self.done = true; =} - reaction(shutdown) {= assert!(self.done, "reaction was not executed") =} + reaction(shutdown) {= + assert!(self.done, "reaction was not executed") + =} } main reactor { diff --git a/test/Rust/src/PortConnectionOutChildOutSelf.lf b/test/Rust/src/PortConnectionOutChildOutSelf.lf index 6935eb4256..0aef3570f4 100644 --- a/test/Rust/src/PortConnectionOutChildOutSelf.lf +++ b/test/Rust/src/PortConnectionOutChildOutSelf.lf @@ -27,7 +27,9 @@ reactor Sink { self.done = true; =} - reaction(shutdown) {= assert!(self.done, "reaction was not executed") =} + reaction(shutdown) {= + assert!(self.done, "reaction was not executed") + =} } main reactor { @@ -41,5 +43,7 @@ main reactor { self.done = true; =} - reaction(shutdown) {= assert!(self.done, "reaction was not executed") =} + reaction(shutdown) {= + assert!(self.done, "reaction was not executed") + =} } diff --git a/test/Rust/src/PortValueCleanup.lf b/test/Rust/src/PortValueCleanup.lf index ea0c9f50a0..13c35ac80c 100644 --- a/test/Rust/src/PortValueCleanup.lf +++ b/test/Rust/src/PortValueCleanup.lf @@ -4,7 +4,9 @@ target Rust reactor Source { output out: u32 - reaction(startup) -> out {= ctx.set(out, 150); =} + reaction(startup) -> out {= + ctx.set(out, 150); + =} } reactor Sink { diff --git a/test/Rust/src/Preamble.lf b/test/Rust/src/Preamble.lf index 3f195808d7..01fc117db3 100644 --- a/test/Rust/src/Preamble.lf +++ b/test/Rust/src/Preamble.lf @@ -7,5 +7,7 @@ main reactor Preamble { } =} - reaction(startup) {= println!("42 plus 42 is {}.\n", add_42(42)); =} + reaction(startup) {= + println!("42 plus 42 is {}.\n", add_42(42)); + =} } diff --git a/test/Rust/src/ReactionLabels.lf b/test/Rust/src/ReactionLabels.lf index 41c7ec57dd..0b3937bf6a 100644 --- a/test/Rust/src/ReactionLabels.lf +++ b/test/Rust/src/ReactionLabels.lf @@ -5,5 +5,8 @@ target Rust main reactor { timer t(0) - reaction(t) {= println!("success"); =} // @label foo + // @label foo + reaction(t) {= + println!("success"); + =} } diff --git a/test/Rust/src/SingleFileGeneration.lf b/test/Rust/src/SingleFileGeneration.lf index c88a4bdcbd..1fb32780a4 100644 --- a/test/Rust/src/SingleFileGeneration.lf +++ b/test/Rust/src/SingleFileGeneration.lf @@ -6,7 +6,9 @@ target Rust { reactor Source { output out: i32 - reaction(startup) -> out {= ctx.set(out, 76600) =} + reaction(startup) -> out {= + ctx.set(out, 76600) + =} } reactor Sink { diff --git a/test/Rust/src/StopNoEvent.lf b/test/Rust/src/StopNoEvent.lf index 9dc96d3533..3c93d5d205 100644 --- a/test/Rust/src/StopNoEvent.lf +++ b/test/Rust/src/StopNoEvent.lf @@ -2,5 +2,7 @@ target Rust main reactor StopNoEvent { - reaction(shutdown) {= println!("success"); =} + reaction(shutdown) {= + println!("success"); + =} } diff --git a/test/Rust/src/StructAsType.lf b/test/Rust/src/StructAsType.lf index 867651e8de..893a1ed8a8 100644 --- a/test/Rust/src/StructAsType.lf +++ b/test/Rust/src/StructAsType.lf @@ -20,7 +20,9 @@ reactor Source { // expected parameter is for testing. reactor Print(expected: i32 = 42) { - input inp: {= super::source::Hello =} + input inp: {= + super::source::Hello + =} state expected: i32 = expected reaction(inp) {= diff --git a/test/Rust/src/TimeState.lf b/test/Rust/src/TimeState.lf index 3de9934e28..d6195c8d10 100644 --- a/test/Rust/src/TimeState.lf +++ b/test/Rust/src/TimeState.lf @@ -3,7 +3,9 @@ target Rust reactor Foo { state baz: time = 500 msec - reaction(startup) {= assert_eq!(500, self.baz.as_millis()); =} + reaction(startup) {= + assert_eq!(500, self.baz.as_millis()); + =} } main reactor TimeState { diff --git a/test/Rust/src/Timers.lf b/test/Rust/src/Timers.lf index 16b359966c..05ba51003c 100644 --- a/test/Rust/src/Timers.lf +++ b/test/Rust/src/Timers.lf @@ -8,9 +8,13 @@ main reactor Timers { timer t2(0, 2 sec) state counter: i32 = 0 - reaction(t2) {= self.counter += 2; =} + reaction(t2) {= + self.counter += 2; + =} - reaction(t) {= self.counter -= 1; =} + reaction(t) {= + self.counter -= 1; + =} reaction(shutdown) {= assert_eq!(1, self.counter); diff --git a/test/Rust/src/concurrent/AsyncCallback.lf b/test/Rust/src/concurrent/AsyncCallback.lf index c6e42c3909..33bc8b9254 100644 --- a/test/Rust/src/concurrent/AsyncCallback.lf +++ b/test/Rust/src/concurrent/AsyncCallback.lf @@ -5,7 +5,9 @@ target Rust { } main reactor AsyncCallback(period: time = 10 msec) { - preamble {= use std::thread; =} + preamble {= + use std::thread; + =} timer t(0, period) state thread: Option> diff --git a/test/Rust/src/generics/CtorParamGeneric.lf b/test/Rust/src/generics/CtorParamGeneric.lf index 2104da5f54..fe9d2a4d90 100644 --- a/test/Rust/src/generics/CtorParamGeneric.lf +++ b/test/Rust/src/generics/CtorParamGeneric.lf @@ -1,8 +1,9 @@ // tests that ctor parameters may refer to type parameters. target Rust -reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug =}>( - value: T = {= Default::default() =}) { +reactor Generic<{= + T: Default + Eq + Sync + std::fmt::Debug +=}>(value: T = {= Default::default() =}) { input in: T state v: T = value @@ -17,5 +18,7 @@ reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug =}>( main reactor { p = new Generic(value=23) - reaction(startup) -> p.in {= ctx.set(p__in, 23); =} + reaction(startup) -> p.in {= + ctx.set(p__in, 23); + =} } diff --git a/test/Rust/src/generics/CtorParamGenericInst.lf b/test/Rust/src/generics/CtorParamGenericInst.lf index 1471178a17..de02ca156e 100644 --- a/test/Rust/src/generics/CtorParamGenericInst.lf +++ b/test/Rust/src/generics/CtorParamGenericInst.lf @@ -2,8 +2,9 @@ // argument list of a further child instance. target Rust -reactor Generic2<{= T: Default + Eq + Sync + std::fmt::Debug + Send + 'static =}>( - value: T = {= Default::default() =}) { +reactor Generic2<{= + T: Default + Eq + Sync + std::fmt::Debug + Send + 'static +=}>(value: T = {= Default::default() =}) { input in: T state v: T = value @@ -15,8 +16,9 @@ reactor Generic2<{= T: Default + Eq + Sync + std::fmt::Debug + Send + 'static =} =} } -reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'static =}>( - value: T = {= Default::default() =}) { +reactor Generic<{= + T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'static +=}>(value: T = {= Default::default() =}) { input in: T inner = new Generic2(value=value) @@ -27,5 +29,7 @@ reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'sta main reactor { p = new Generic(value=23) - reaction(startup) -> p.in {= ctx.set(p__in, 23); =} + reaction(startup) -> p.in {= + ctx.set(p__in, 23); + =} } diff --git a/test/Rust/src/generics/GenericComplexType.lf b/test/Rust/src/generics/GenericComplexType.lf index d427f65b25..6e534117c3 100644 --- a/test/Rust/src/generics/GenericComplexType.lf +++ b/test/Rust/src/generics/GenericComplexType.lf @@ -18,5 +18,7 @@ reactor R { main reactor { p = new R() - reaction(startup) -> p.in {= ctx.set(p__in, vec![delay!(20 ms)]); =} + reaction(startup) -> p.in {= + ctx.set(p__in, vec![delay!(20 ms)]); + =} } diff --git a/test/Rust/src/generics/GenericReactor.lf b/test/Rust/src/generics/GenericReactor.lf index eaff12a4c9..251fefcc69 100644 --- a/test/Rust/src/generics/GenericReactor.lf +++ b/test/Rust/src/generics/GenericReactor.lf @@ -1,7 +1,9 @@ // Tests a port connection between (input of self -> input of child) target Rust -reactor Box<{= T: Sync =}> { +reactor Box<{= + T: Sync +=}> { input inp: T output out: T @@ -16,9 +18,13 @@ main reactor { box0.out -> box1.inp - reaction(startup) -> box0.inp {= ctx.set(box0__inp, 444); =} + reaction(startup) -> box0.inp {= + ctx.set(box0__inp, 444); + =} - reaction(box1.out) {= assert!(ctx.get_elapsed_logical_time().is_zero()); self.done = true; =} + reaction(box1.out) {= + assert!(ctx.get_elapsed_logical_time().is_zero()); self.done = true; + =} reaction(shutdown) {= assert!(self.done, "reaction was not executed"); diff --git a/test/Rust/src/lib/Imported.lf b/test/Rust/src/lib/Imported.lf index b72cfdf533..bf42bce770 100644 --- a/test/Rust/src/lib/Imported.lf +++ b/test/Rust/src/lib/Imported.lf @@ -8,5 +8,7 @@ reactor Imported { input x: u32 a = new ImportedAgain() - reaction(x) -> a.x {= ctx.set(a__x, ctx.get(x).unwrap()); =} + reaction(x) -> a.x {= + ctx.set(a__x, ctx.get(x).unwrap()); + =} } diff --git a/test/Rust/src/multiport/ConnectionToSelfBank.lf b/test/Rust/src/multiport/ConnectionToSelfBank.lf index c396bcb5e6..d4b883de8c 100644 --- a/test/Rust/src/multiport/ConnectionToSelfBank.lf +++ b/test/Rust/src/multiport/ConnectionToSelfBank.lf @@ -6,7 +6,9 @@ reactor Node(bank_index: usize = 0, num_nodes: usize = 4) { state bank_index = bank_index state num_nodes = num_nodes - reaction(startup) -> out {= ctx.set(out, self.bank_index); =} + reaction(startup) -> out {= + ctx.set(out, self.bank_index); + =} reaction(in) {= let count = r#in.iterate_set().count(); diff --git a/test/Rust/src/multiport/CycledLhs_SelfLoop.lf b/test/Rust/src/multiport/CycledLhs_SelfLoop.lf index efa3e13c4e..7d41b8ea3e 100644 --- a/test/Rust/src/multiport/CycledLhs_SelfLoop.lf +++ b/test/Rust/src/multiport/CycledLhs_SelfLoop.lf @@ -10,9 +10,13 @@ reactor Test { logical action act: u32 state last: u32 = 1 - reaction(startup) -> act {= ctx.schedule_with_v(act, Some(1), after!(1 us)); =} + reaction(startup) -> act {= + ctx.schedule_with_v(act, Some(1), after!(1 us)); + =} - reaction(act) -> out {= ctx.set_opt(out, ctx.get(act)); =} + reaction(act) -> out {= + ctx.set_opt(out, ctx.get(act)); + =} reaction(in) -> act {= let sum: u32 = r#in.iterate_values().sum(); diff --git a/test/Rust/src/multiport/CycledLhs_Single.lf b/test/Rust/src/multiport/CycledLhs_Single.lf index 32c406b692..4d8931e9d7 100644 --- a/test/Rust/src/multiport/CycledLhs_Single.lf +++ b/test/Rust/src/multiport/CycledLhs_Single.lf @@ -7,10 +7,14 @@ target Rust { reactor Test { output[2] out: u32 input[4] in: u32 - logical action act: {= (u32, u32) =} + logical action act: {= + (u32, u32) + =} state last: u32 = 1 - reaction(startup) -> act {= ctx.schedule_with_v(act, Some((0, 1)), after!(1 us)); =} + reaction(startup) -> act {= + ctx.schedule_with_v(act, Some((0, 1)), after!(1 us)); + =} reaction(act) -> out {= let (a, b) = ctx.get(act).unwrap(); diff --git a/test/Rust/src/multiport/FullyConnected.lf b/test/Rust/src/multiport/FullyConnected.lf index e83a0cac3d..50fea84f18 100644 --- a/test/Rust/src/multiport/FullyConnected.lf +++ b/test/Rust/src/multiport/FullyConnected.lf @@ -5,7 +5,9 @@ reactor Left(bank_index: usize = 0) { output out: usize state bank_index = bank_index - reaction(startup) -> out {= ctx.set(out, self.bank_index); =} + reaction(startup) -> out {= + ctx.set(out, self.bank_index); + =} } reactor Right(bank_index: usize = 0, num_nodes: usize = 4) { diff --git a/test/Rust/src/multiport/MultiportFromBank.lf b/test/Rust/src/multiport/MultiportFromBank.lf index cf66939562..3e0afdaedd 100644 --- a/test/Rust/src/multiport/MultiportFromBank.lf +++ b/test/Rust/src/multiport/MultiportFromBank.lf @@ -7,7 +7,9 @@ reactor Source(bank_index: usize = 0) { output out: usize state bank_index = bank_index - reaction(startup) -> out {= ctx.set(out, self.bank_index); =} + reaction(startup) -> out {= + ctx.set(out, self.bank_index); + =} } reactor Destination(port_width: usize = 2) { diff --git a/test/Rust/src/multiport/ReadOutputOfContainedBank.lf b/test/Rust/src/multiport/ReadOutputOfContainedBank.lf index 2d97ad74d7..4b47f97d3f 100644 --- a/test/Rust/src/multiport/ReadOutputOfContainedBank.lf +++ b/test/Rust/src/multiport/ReadOutputOfContainedBank.lf @@ -6,7 +6,9 @@ reactor Contained(bank_index: usize = 0) { output out: usize - reaction(startup) -> out {= ctx.set(out, 42 * self.bank_index); =} + reaction(startup) -> out {= + ctx.set(out, 42 * self.bank_index); + =} } main reactor { diff --git a/test/Rust/src/multiport/WidthWithParameter.lf b/test/Rust/src/multiport/WidthWithParameter.lf index 572da15222..4152e585fc 100644 --- a/test/Rust/src/multiport/WidthWithParameter.lf +++ b/test/Rust/src/multiport/WidthWithParameter.lf @@ -13,5 +13,7 @@ reactor Some(value: usize = 30) { main reactor { some = new Some(value=20) - reaction(some.finished) {= println!("success"); =} + reaction(some.finished) {= + println!("success"); + =} } diff --git a/test/Rust/src/multiport/WriteInputOfContainedBank.lf b/test/Rust/src/multiport/WriteInputOfContainedBank.lf index f44914bd5d..01a96e02bc 100644 --- a/test/Rust/src/multiport/WriteInputOfContainedBank.lf +++ b/test/Rust/src/multiport/WriteInputOfContainedBank.lf @@ -14,7 +14,9 @@ reactor Contained(bank_index: usize = 0) { self.count += 1; =} - reaction(shutdown) {= assert_eq!(self.count, 1, "One of the reactions failed to trigger"); =} + reaction(shutdown) {= + assert_eq!(self.count, 1, "One of the reactions failed to trigger"); + =} } main reactor { diff --git a/test/Rust/src/target/CargoDependencyOnRuntime.lf b/test/Rust/src/target/CargoDependencyOnRuntime.lf index 26aa2c5eb3..946ba7ab04 100644 --- a/test/Rust/src/target/CargoDependencyOnRuntime.lf +++ b/test/Rust/src/target/CargoDependencyOnRuntime.lf @@ -8,5 +8,7 @@ target Rust { } main reactor { - reaction(startup) {= println!("success") =} + reaction(startup) {= + println!("success") + =} } diff --git a/test/Rust/src/target/CliFeature.lf b/test/Rust/src/target/CliFeature.lf index a28f8d2e3d..d54f09c9cf 100644 --- a/test/Rust/src/target/CliFeature.lf +++ b/test/Rust/src/target/CliFeature.lf @@ -5,5 +5,7 @@ target Rust { // todo allow test framework to pass CLI arguments. main reactor CliFeature(size: u32 = 4, t: time = 4 sec) { - reaction(startup) {= println!("success"); =} + reaction(startup) {= + println!("success"); + =} } diff --git a/test/TypeScript/src/ActionDelay.lf b/test/TypeScript/src/ActionDelay.lf index 18949417d3..f2c723b601 100644 --- a/test/TypeScript/src/ActionDelay.lf +++ b/test/TypeScript/src/ActionDelay.lf @@ -12,13 +12,17 @@ reactor GeneratedDelay { actions.act.schedule(0, null); =} - reaction(act) -> y_out {= y_out = y_state; =} + reaction(act) -> y_out {= + y_out = y_state; + =} } reactor Source { output out: number - reaction(startup) -> out {= out = 1; =} + reaction(startup) -> out {= + out = 1; + =} } reactor Sink { diff --git a/test/TypeScript/src/ActionWithNoReaction.lf b/test/TypeScript/src/ActionWithNoReaction.lf index 14d6aa8801..c8055713db 100644 --- a/test/TypeScript/src/ActionWithNoReaction.lf +++ b/test/TypeScript/src/ActionWithNoReaction.lf @@ -32,5 +32,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= f.x = 42; =} + reaction(t) -> f.x {= + f.x = 42; + =} } diff --git a/test/TypeScript/src/After.lf b/test/TypeScript/src/After.lf index 30edbdb554..f65ab6bbb3 100644 --- a/test/TypeScript/src/After.lf +++ b/test/TypeScript/src/After.lf @@ -8,7 +8,9 @@ reactor Foo { input x: number output y: number - reaction(x) -> y {= y = 2 * (x as number); =} + reaction(x) -> y {= + y = 2 * (x as number); + =} } reactor Print { @@ -33,5 +35,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x after 10 msec - reaction(t) -> f.x {= f.x = 42; =} + reaction(t) -> f.x {= + f.x = 42; + =} } diff --git a/test/TypeScript/src/ArrayAsParameter.lf b/test/TypeScript/src/ArrayAsParameter.lf index ef9ba9f414..150213d47c 100644 --- a/test/TypeScript/src/ArrayAsParameter.lf +++ b/test/TypeScript/src/ArrayAsParameter.lf @@ -1,7 +1,9 @@ // Source has an array as a parameter, the elements of which it passes to Print. target TypeScript -reactor Source(sequence: {= Array =} = {= [0, 1, 2] =}) { +reactor Source(sequence: {= + Array +=} = {= [0, 1, 2] =}) { output out: number state count: number = 0 logical action next diff --git a/test/TypeScript/src/ArrayAsType.lf b/test/TypeScript/src/ArrayAsType.lf index c26e3fe02e..f40d6d91e0 100644 --- a/test/TypeScript/src/ArrayAsType.lf +++ b/test/TypeScript/src/ArrayAsType.lf @@ -3,7 +3,9 @@ target TypeScript reactor Source { - output out: {= Array =} + output out: {= + Array + =} reaction(startup) -> out {= let toSend = []; @@ -16,7 +18,9 @@ reactor Source { // The scale parameter is just for testing. reactor Print(scale: number = 1) { - input x: {= Array =} + input x: {= + Array + =} reaction(x) {= let count = 0; // For testing. diff --git a/test/TypeScript/src/ArrayPrint.lf b/test/TypeScript/src/ArrayPrint.lf index 3c94b00b34..7967efb290 100644 --- a/test/TypeScript/src/ArrayPrint.lf +++ b/test/TypeScript/src/ArrayPrint.lf @@ -3,7 +3,9 @@ target TypeScript reactor Source { - output out: {= Array =} + output out: {= + Array + =} reaction(startup) -> out {= let toSend = new Array(); @@ -16,7 +18,9 @@ reactor Source { // The scale parameter is just for testing. reactor Print(scale: number = 1) { - input x: {= Array =} + input x: {= + Array + =} reaction(x) {= let count = 0; // For testing. diff --git a/test/TypeScript/src/ArrayScale.lf b/test/TypeScript/src/ArrayScale.lf index 2ddfa951f3..45c982f493 100644 --- a/test/TypeScript/src/ArrayScale.lf +++ b/test/TypeScript/src/ArrayScale.lf @@ -6,8 +6,12 @@ target TypeScript import Source, Print from "ArrayPrint.lf" reactor Scale(scale: number = 2) { - mutable input x: {= Array =} - output out: {= Array =} + mutable input x: {= + Array + =} + output out: {= + Array + =} reaction(x) -> out {= x = x as Array; diff --git a/test/TypeScript/src/DanglingOutput.lf b/test/TypeScript/src/DanglingOutput.lf index 8c9f884dd0..a55312ca40 100644 --- a/test/TypeScript/src/DanglingOutput.lf +++ b/test/TypeScript/src/DanglingOutput.lf @@ -6,7 +6,9 @@ reactor Source { output out: number timer t - reaction(t) -> out {= out = 1; =} + reaction(t) -> out {= + out = 1; + =} } reactor Gain { diff --git a/test/TypeScript/src/DelayInt.lf b/test/TypeScript/src/DelayInt.lf index 4cf2b5a8cc..1ff1df7871 100644 --- a/test/TypeScript/src/DelayInt.lf +++ b/test/TypeScript/src/DelayInt.lf @@ -7,7 +7,9 @@ reactor Delay(delay: time = 100 msec) { output out: number logical action a: number - reaction(x) -> a {= actions.a.schedule( delay, x as number); =} + reaction(x) -> a {= + actions.a.schedule( delay, x as number); + =} reaction(a) -> out {= if (a !== null){ @@ -54,5 +56,7 @@ main reactor DelayInt { t = new Test() d.out -> t.x - reaction(startup) -> d.x {= d.x = 42; =} + reaction(startup) -> d.x {= + d.x = 42; + =} } diff --git a/test/TypeScript/src/DelayedAction.lf b/test/TypeScript/src/DelayedAction.lf index 1979003351..de433faf58 100644 --- a/test/TypeScript/src/DelayedAction.lf +++ b/test/TypeScript/src/DelayedAction.lf @@ -7,7 +7,9 @@ main reactor DelayedAction { logical action a state count: number = 0 - reaction(t) -> a {= actions.a.schedule(TimeValue.msec(100), null); =} + reaction(t) -> a {= + actions.a.schedule(TimeValue.msec(100), null); + =} reaction(a) {= let elapsedLogical = util.getElapsedLogicalTime(); diff --git a/test/TypeScript/src/DelayedReaction.lf b/test/TypeScript/src/DelayedReaction.lf index 66a721069b..9a1e31585e 100644 --- a/test/TypeScript/src/DelayedReaction.lf +++ b/test/TypeScript/src/DelayedReaction.lf @@ -5,7 +5,9 @@ reactor Source { output out: number timer t - reaction(t) -> out {= out = 1; =} + reaction(t) -> out {= + out = 1; + =} } reactor Sink { diff --git a/test/TypeScript/src/Determinism.lf b/test/TypeScript/src/Determinism.lf index 5b9d6de201..ed110b0334 100644 --- a/test/TypeScript/src/Determinism.lf +++ b/test/TypeScript/src/Determinism.lf @@ -4,7 +4,9 @@ reactor Source { output y: number timer t - reaction(t) -> y {= y = 1; =} + reaction(t) -> y {= + y = 1; + =} } reactor Destination { @@ -30,7 +32,9 @@ reactor Pass { input x: number output y: number - reaction(x) -> y {= y = x as number; =} + reaction(x) -> y {= + y = x as number; + =} } main reactor Determinism { diff --git a/test/TypeScript/src/Gain.lf b/test/TypeScript/src/Gain.lf index bcb17bd4eb..c7b77cd31e 100644 --- a/test/TypeScript/src/Gain.lf +++ b/test/TypeScript/src/Gain.lf @@ -5,7 +5,9 @@ reactor Scale(scale: number = 2) { input x: number output y: number - reaction(x) -> y {= y = (x as number) * scale; =} + reaction(x) -> y {= + y = (x as number) * scale; + =} } reactor Test { @@ -34,5 +36,7 @@ main reactor Gain { d = new Test() g.y -> d.x - reaction(startup) -> g.x {= g.x = 1; =} + reaction(startup) -> g.x {= + g.x = 1; + =} } diff --git a/test/TypeScript/src/HelloWorld.lf b/test/TypeScript/src/HelloWorld.lf index 2fe705929b..2862c01297 100644 --- a/test/TypeScript/src/HelloWorld.lf +++ b/test/TypeScript/src/HelloWorld.lf @@ -3,7 +3,9 @@ target TypeScript reactor HelloWorldInside { timer t - reaction(t) {= console.log("Hello World."); =} + reaction(t) {= + console.log("Hello World."); + =} } main reactor HelloWorld { diff --git a/test/TypeScript/src/Hierarchy2.lf b/test/TypeScript/src/Hierarchy2.lf index 017c507b73..b401baf186 100644 --- a/test/TypeScript/src/Hierarchy2.lf +++ b/test/TypeScript/src/Hierarchy2.lf @@ -8,7 +8,9 @@ reactor Source { output out: number timer t(0, 1 sec) - reaction(t) -> out {= out = 1; =} + reaction(t) -> out {= + out = 1; + =} } reactor Count { diff --git a/test/TypeScript/src/Import.lf b/test/TypeScript/src/Import.lf index aecf259f71..4fc1e28e93 100644 --- a/test/TypeScript/src/Import.lf +++ b/test/TypeScript/src/Import.lf @@ -9,5 +9,7 @@ main reactor Import { timer t a = new Imported() - reaction(t) -> a.x {= a.x = 42; =} + reaction(t) -> a.x {= + a.x = 42; + =} } diff --git a/test/TypeScript/src/Microsteps.lf b/test/TypeScript/src/Microsteps.lf index c5412a6b06..96ce4da40d 100644 --- a/test/TypeScript/src/Microsteps.lf +++ b/test/TypeScript/src/Microsteps.lf @@ -35,5 +35,7 @@ main reactor Microsteps { actions.repeat.schedule(0, null); =} - reaction(repeat) -> d.y {= d.y = 1; =} + reaction(repeat) -> d.y {= + d.y = 1; + =} } diff --git a/test/TypeScript/src/Minimal.lf b/test/TypeScript/src/Minimal.lf index 54a1aa7ae9..b0f75adccc 100644 --- a/test/TypeScript/src/Minimal.lf +++ b/test/TypeScript/src/Minimal.lf @@ -4,5 +4,7 @@ target TypeScript main reactor Minimal { timer t - reaction(t) {= console.log("Hello World."); =} + reaction(t) {= + console.log("Hello World."); + =} } diff --git a/test/TypeScript/src/MovingAverage.lf b/test/TypeScript/src/MovingAverage.lf index f99e436ab7..38ddde1504 100644 --- a/test/TypeScript/src/MovingAverage.lf +++ b/test/TypeScript/src/MovingAverage.lf @@ -17,7 +17,9 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {= Array =} = {= [0.0, 0.0, 0.0] =} + state delay_line: {= + Array + =} = {= [0.0, 0.0, 0.0] =} state index: number = 0 input x: number output out: number diff --git a/test/TypeScript/src/MultipleContained.lf b/test/TypeScript/src/MultipleContained.lf index a3ae63b2cf..cabacf59ea 100644 --- a/test/TypeScript/src/MultipleContained.lf +++ b/test/TypeScript/src/MultipleContained.lf @@ -6,7 +6,9 @@ reactor Contained { input in1: number input in2: number - reaction(startup) -> trigger {= trigger = 42; =} + reaction(startup) -> trigger {= + trigger = 42; + =} reaction(in1) {= in1 = in1 as number; diff --git a/test/TypeScript/src/ParameterizedState.lf b/test/TypeScript/src/ParameterizedState.lf index 2904b30106..f7ef0dd4d2 100644 --- a/test/TypeScript/src/ParameterizedState.lf +++ b/test/TypeScript/src/ParameterizedState.lf @@ -3,7 +3,9 @@ target TypeScript reactor Foo(bar: number = 42) { state baz = bar - reaction(startup) {= console.log("Baz: " + baz); =} + reaction(startup) {= + console.log("Baz: " + baz); + =} } main reactor { diff --git a/test/TypeScript/src/PhysicalConnection.lf b/test/TypeScript/src/PhysicalConnection.lf index 495d7bc0e0..8767075ce7 100644 --- a/test/TypeScript/src/PhysicalConnection.lf +++ b/test/TypeScript/src/PhysicalConnection.lf @@ -4,7 +4,9 @@ target TypeScript reactor Source { output y: number - reaction(startup) -> y {= y = 42 =} + reaction(startup) -> y {= + y = 42 + =} } reactor Destination { diff --git a/test/TypeScript/src/ReadOutputOfContainedReactor.lf b/test/TypeScript/src/ReadOutputOfContainedReactor.lf index 9009141181..11c8ebd2e4 100644 --- a/test/TypeScript/src/ReadOutputOfContainedReactor.lf +++ b/test/TypeScript/src/ReadOutputOfContainedReactor.lf @@ -4,7 +4,9 @@ target TypeScript reactor Contained { output out: number - reaction(startup) -> out {= out = 42; =} + reaction(startup) -> out {= + out = 42; + =} } main reactor ReadOutputOfContainedReactor { diff --git a/test/TypeScript/src/Schedule.lf b/test/TypeScript/src/Schedule.lf index a6b48a14fb..cd4f7e85e7 100644 --- a/test/TypeScript/src/Schedule.lf +++ b/test/TypeScript/src/Schedule.lf @@ -5,7 +5,9 @@ reactor ScheduleLogicalAction { input x: number logical action a - reaction(x) -> a {= actions.a.schedule(TimeValue.msec(200), null) =} + reaction(x) -> a {= + actions.a.schedule(TimeValue.msec(200), null) + =} reaction(a) {= let elapsedTime = util.getElapsedLogicalTime(); @@ -22,5 +24,7 @@ main reactor { a = new ScheduleLogicalAction() timer t - reaction(t) -> a.x {= a.x = 1; =} + reaction(t) -> a.x {= + a.x = 1; + =} } diff --git a/test/TypeScript/src/ScheduleLogicalAction.lf b/test/TypeScript/src/ScheduleLogicalAction.lf index b165588a1b..5340847280 100644 --- a/test/TypeScript/src/ScheduleLogicalAction.lf +++ b/test/TypeScript/src/ScheduleLogicalAction.lf @@ -17,7 +17,9 @@ reactor foo { actions.a.schedule(TimeValue.msec(500), null); =} - reaction(a) -> y {= y = -42; =} + reaction(a) -> y {= + y = -42; + =} } reactor print { @@ -42,5 +44,7 @@ main reactor { timer t(0, 1 sec) f.y -> p.x - reaction(t) -> f.x {= f.x = 42; =} + reaction(t) -> f.x {= + f.x = 42; + =} } diff --git a/test/TypeScript/src/SendingInside2.lf b/test/TypeScript/src/SendingInside2.lf index 0271112da6..e1e8f9dadc 100644 --- a/test/TypeScript/src/SendingInside2.lf +++ b/test/TypeScript/src/SendingInside2.lf @@ -15,5 +15,7 @@ main reactor SendingInside2 { timer t p = new Printer() - reaction(t) -> p.x {= p.x = 1; =} + reaction(t) -> p.x {= + p.x = 1; + =} } diff --git a/test/TypeScript/src/SendsPointerTest.lf b/test/TypeScript/src/SendsPointerTest.lf index 2808d2a87b..68cf14b4cd 100644 --- a/test/TypeScript/src/SendsPointerTest.lf +++ b/test/TypeScript/src/SendsPointerTest.lf @@ -3,7 +3,9 @@ target TypeScript reactor SendsPointer { - output out: {= {value: number} =} + output out: {= + {value: number} + =} reaction(startup) -> out {= let my_object = { value: 42 }; @@ -12,8 +14,12 @@ reactor SendsPointer { } // expected parameter is for testing. -reactor Print(expected: {= {value: number} =} = {= { value: 42 } =}) { - input x: {= {value: number} =} +reactor Print(expected: {= + {value: number} +=} = {= { value: 42 } =}) { + input x: {= + {value: number} + =} reaction(x) {= x = x as {value: number}; diff --git a/test/TypeScript/src/SlowingClock.lf b/test/TypeScript/src/SlowingClock.lf index 522778f2d7..0d0fb70a1e 100644 --- a/test/TypeScript/src/SlowingClock.lf +++ b/test/TypeScript/src/SlowingClock.lf @@ -8,7 +8,9 @@ main reactor SlowingClock { state interval: time = 100 msec state expected_time: time = 100 msec - reaction(startup) -> a {= actions.a.schedule(0, null); =} + reaction(startup) -> a {= + actions.a.schedule(0, null); + =} reaction(a) -> a {= let elapsed_logical_time : TimeValue = util.getElapsedLogicalTime(); diff --git a/test/TypeScript/src/Stride.lf b/test/TypeScript/src/Stride.lf index a8413a6aee..03b14b71e2 100644 --- a/test/TypeScript/src/Stride.lf +++ b/test/TypeScript/src/Stride.lf @@ -19,7 +19,9 @@ reactor Count(stride: number = 1) { reactor Display { input x: number - reaction(x) {= console.log("Received: " + x); =} + reaction(x) {= + console.log("Received: " + x); + =} } main reactor Stride { diff --git a/test/TypeScript/src/TimeLimit.lf b/test/TypeScript/src/TimeLimit.lf index 42ec3391ae..0b6985d985 100644 --- a/test/TypeScript/src/TimeLimit.lf +++ b/test/TypeScript/src/TimeLimit.lf @@ -37,5 +37,7 @@ main reactor TimeLimit(period: time = 1 msec) { d = new Destination() c.y -> d.x - reaction(stop) {= util.requestStop() =} + reaction(stop) {= + util.requestStop() + =} } diff --git a/test/TypeScript/src/TimeState.lf b/test/TypeScript/src/TimeState.lf index f71374fd59..1566c891bd 100644 --- a/test/TypeScript/src/TimeState.lf +++ b/test/TypeScript/src/TimeState.lf @@ -3,7 +3,9 @@ target TypeScript reactor Foo(bar: number = 42) { state baz: time = 500 msec - reaction(startup) {= console.log("Baz: " + baz); =} + reaction(startup) {= + console.log("Baz: " + baz); + =} } main reactor { diff --git a/test/TypeScript/src/Wcet.lf b/test/TypeScript/src/Wcet.lf index b715dfd9a4..6c517a9d78 100644 --- a/test/TypeScript/src/Wcet.lf +++ b/test/TypeScript/src/Wcet.lf @@ -31,7 +31,9 @@ reactor Work { reactor Print { input x: number - reaction(x) {= console.log("Received: " + x); =} + reaction(x) {= + console.log("Received: " + x); + =} } main reactor Wcet { diff --git a/test/TypeScript/src/federated/DistributedDoublePort.lf b/test/TypeScript/src/federated/DistributedDoublePort.lf index a6bde59ed5..90365e1c50 100644 --- a/test/TypeScript/src/federated/DistributedDoublePort.lf +++ b/test/TypeScript/src/federated/DistributedDoublePort.lf @@ -21,9 +21,13 @@ reactor CountMicrostep { logical action act: number timer t(0, 1 sec) - reaction(t) -> act {= actions.act.schedule(0, count++); =} + reaction(t) -> act {= + actions.act.schedule(0, count++); + =} - reaction(act) -> out {= out = act; =} + reaction(act) -> out {= + out = act; + =} } reactor Print { @@ -39,7 +43,9 @@ reactor Print { } =} - reaction(shutdown) {= console.log("SUCCESS: messages were at least one microstep apart."); =} + reaction(shutdown) {= + console.log("SUCCESS: messages were at least one microstep apart."); + =} } federated reactor DistributedDoublePort { diff --git a/test/TypeScript/src/federated/HelloDistributed.lf b/test/TypeScript/src/federated/HelloDistributed.lf index 4936cfae42..84b8b895b2 100644 --- a/test/TypeScript/src/federated/HelloDistributed.lf +++ b/test/TypeScript/src/federated/HelloDistributed.lf @@ -21,7 +21,9 @@ reactor Destination { input inp: string state received: boolean = false - reaction(startup) {= console.log("Destination started."); =} + reaction(startup) {= + console.log("Destination started."); + =} reaction(inp) {= console.log(`At logical time ${util.getElapsedLogicalTime()}, destination received: ` + inp); @@ -44,5 +46,7 @@ federated reactor HelloDistributed at localhost { d = new Destination() // Reactor d is in federate Destination s.out -> d.inp // This version preserves the timestamp. - reaction(startup) {= console.log("Printing something in top-level federated reactor."); =} + reaction(startup) {= + console.log("Printing something in top-level federated reactor."); + =} } diff --git a/test/TypeScript/src/federated/SpuriousDependency.lf b/test/TypeScript/src/federated/SpuriousDependency.lf index 39da8f0ea5..15e2b527c7 100644 --- a/test/TypeScript/src/federated/SpuriousDependency.lf +++ b/test/TypeScript/src/federated/SpuriousDependency.lf @@ -35,7 +35,9 @@ reactor Check { state count: number = 0 - reaction(inp) {= console.log("count is now " + ++count); =} + reaction(inp) {= + console.log("count is now " + ++count); + =} reaction(shutdown) {= console.log("******* Shutdown invoked."); @@ -55,5 +57,7 @@ federated reactor { t1.out0 -> check.inp - reaction(startup) -> t0.in1 {= t0.in1 = 0; =} + reaction(startup) -> t0.in1 {= + t0.in1 = 0; + =} } diff --git a/test/TypeScript/src/federated/StopAtShutdown.lf b/test/TypeScript/src/federated/StopAtShutdown.lf index 200e773e82..c8550147b6 100644 --- a/test/TypeScript/src/federated/StopAtShutdown.lf +++ b/test/TypeScript/src/federated/StopAtShutdown.lf @@ -10,20 +10,30 @@ target TypeScript { reactor A { input inp: number - reaction(startup) {= console.log("Hello World!"); =} + reaction(startup) {= + console.log("Hello World!"); + =} - reaction(inp) {= console.log("Got it"); =} + reaction(inp) {= + console.log("Got it"); + =} - reaction(shutdown) {= util.requestStop(); =} + reaction(shutdown) {= + util.requestStop(); + =} } reactor B { output out: number timer t(1 sec) - reaction(t) -> out {= out = 1; =} + reaction(t) -> out {= + out = 1; + =} - reaction(shutdown) {= util.requestStop(); =} + reaction(shutdown) {= + util.requestStop(); + =} } federated reactor { diff --git a/test/TypeScript/src/federated/TopLevelArtifacts.lf b/test/TypeScript/src/federated/TopLevelArtifacts.lf index b7d59ae4b4..df1edae247 100644 --- a/test/TypeScript/src/federated/TopLevelArtifacts.lf +++ b/test/TypeScript/src/federated/TopLevelArtifacts.lf @@ -23,14 +23,18 @@ federated reactor { tc = new TestCount() c.out -> tc.inp - reaction(startup) {= successes++; =} + reaction(startup) {= + successes++; + =} reaction(t) -> act {= successes++; actions.act.schedule(0, null); =} - reaction(act) {= successes++; =} + reaction(act) {= + successes++; + =} reaction(shutdown) {= if (successes != 3) { diff --git a/test/TypeScript/src/lib/Count.lf b/test/TypeScript/src/lib/Count.lf index 88326db3f1..de9cf6b98a 100644 --- a/test/TypeScript/src/lib/Count.lf +++ b/test/TypeScript/src/lib/Count.lf @@ -5,5 +5,7 @@ reactor Count(offset: time = 0, period: time = 1 sec) { timer t(offset, period) state count: number = 1 - reaction(t) -> out {= out = count++; =} + reaction(t) -> out {= + out = count++; + =} } diff --git a/test/TypeScript/src/lib/Imported.lf b/test/TypeScript/src/lib/Imported.lf index 9b8506f39b..cb6072a7c2 100644 --- a/test/TypeScript/src/lib/Imported.lf +++ b/test/TypeScript/src/lib/Imported.lf @@ -10,5 +10,7 @@ reactor Imported { input x: number a = new ImportedAgain() - reaction(x) -> a.x {= a.x = (x as number); =} + reaction(x) -> a.x {= + a.x = (x as number); + =} } diff --git a/test/TypeScript/src/lib/InternalDelay.lf b/test/TypeScript/src/lib/InternalDelay.lf index 7b734baf31..5ee717b2bc 100644 --- a/test/TypeScript/src/lib/InternalDelay.lf +++ b/test/TypeScript/src/lib/InternalDelay.lf @@ -6,7 +6,11 @@ reactor InternalDelay(delay: TimeValue = 10 msec) { output out: number logical action d: number - reaction(inp) -> d {= actions.d.schedule(delay, inp as number); =} + reaction(inp) -> d {= + actions.d.schedule(delay, inp as number); + =} - reaction(d) -> out {= out = d; =} + reaction(d) -> out {= + out = d; + =} } diff --git a/test/TypeScript/src/multiport/BankSelfBroadcast.lf b/test/TypeScript/src/multiport/BankSelfBroadcast.lf index 956de7d5a2..3e97b88952 100644 --- a/test/TypeScript/src/multiport/BankSelfBroadcast.lf +++ b/test/TypeScript/src/multiport/BankSelfBroadcast.lf @@ -14,7 +14,9 @@ reactor A { output out: number state received: boolean = false - reaction(startup) -> out {= out = this.getBankIndex(); =} + reaction(startup) -> out {= + out = this.getBankIndex(); + =} reaction(inp) {= for (let i = 0; i < inp.length; i++) { diff --git a/test/TypeScript/src/multiport/BankToMultiport.lf b/test/TypeScript/src/multiport/BankToMultiport.lf index b1ea107ca9..044c5b24b5 100644 --- a/test/TypeScript/src/multiport/BankToMultiport.lf +++ b/test/TypeScript/src/multiport/BankToMultiport.lf @@ -4,7 +4,9 @@ target TypeScript reactor Source { output out: number - reaction(startup) -> out {= out = this.getBankIndex(); =} + reaction(startup) -> out {= + out = this.getBankIndex(); + =} } reactor Sink { diff --git a/test/TypeScript/src/multiport/Broadcast.lf b/test/TypeScript/src/multiport/Broadcast.lf index 8ec6e21742..54f52694dd 100644 --- a/test/TypeScript/src/multiport/Broadcast.lf +++ b/test/TypeScript/src/multiport/Broadcast.lf @@ -3,7 +3,9 @@ target TypeScript reactor Source { output out: number - reaction(startup) -> out {= out = 42; =} + reaction(startup) -> out {= + out = 42; + =} } reactor Sink { diff --git a/test/TypeScript/src/multiport/BroadcastAfter.lf b/test/TypeScript/src/multiport/BroadcastAfter.lf index 5d8165b983..ac394fdf0d 100644 --- a/test/TypeScript/src/multiport/BroadcastAfter.lf +++ b/test/TypeScript/src/multiport/BroadcastAfter.lf @@ -5,7 +5,9 @@ target TypeScript { reactor Source { output out: number - reaction(startup) -> out {= out = 42; =} + reaction(startup) -> out {= + out = 42; + =} } reactor Destination { diff --git a/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf b/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf index cd9bcd726a..f3f1fc2270 100644 --- a/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf +++ b/test/TypeScript/src/multiport/BroadcastMultipleAfter.lf @@ -5,7 +5,9 @@ target TypeScript { reactor Source(value: number = 42) { output out: number - reaction(startup) -> out {= out = value; =} + reaction(startup) -> out {= + out = value; + =} } reactor Destination { diff --git a/test/TypeScript/src/multiport/MultiportFromBank.lf b/test/TypeScript/src/multiport/MultiportFromBank.lf index 63708bfb76..f1629755ee 100644 --- a/test/TypeScript/src/multiport/MultiportFromBank.lf +++ b/test/TypeScript/src/multiport/MultiportFromBank.lf @@ -7,7 +7,9 @@ target TypeScript { reactor Source { output out: number - reaction(startup) -> out {= out = this.getBankIndex(); =} + reaction(startup) -> out {= + out = this.getBankIndex(); + =} } reactor Destination(portWidth: number = 3) { diff --git a/test/TypeScript/src/multiport/MultiportIn.lf b/test/TypeScript/src/multiport/MultiportIn.lf index 8e786a4fdd..1ea4501a3a 100644 --- a/test/TypeScript/src/multiport/MultiportIn.lf +++ b/test/TypeScript/src/multiport/MultiportIn.lf @@ -9,14 +9,18 @@ reactor Source { output out: number state s: number = 0 - reaction(t) -> out {= out = s++; =} + reaction(t) -> out {= + out = s++; + =} } reactor Computation { input inp: number output out: number - reaction(inp) -> out {= out = inp; =} + reaction(inp) -> out {= + out = inp; + =} } reactor Destination { diff --git a/test/TypeScript/src/multiport/MultiportInParameterized.lf b/test/TypeScript/src/multiport/MultiportInParameterized.lf index 1f60d19bf0..31662b9de1 100644 --- a/test/TypeScript/src/multiport/MultiportInParameterized.lf +++ b/test/TypeScript/src/multiport/MultiportInParameterized.lf @@ -19,7 +19,9 @@ reactor Computation { input inp: number output out: number - reaction(inp) -> out {= out = inp; =} + reaction(inp) -> out {= + out = inp; + =} } reactor Destination(width: number = 1) { diff --git a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf index b097927288..440f939733 100644 --- a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf +++ b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf @@ -4,7 +4,9 @@ target TypeScript reactor Source { - output[2] out: {= Array =} + output[2] out: {= + Array + =} reaction(startup) -> out {= // Dynamically allocate an output array of length 3. @@ -27,7 +29,9 @@ reactor Source { // The scale parameter is just for testing. reactor Print(scale: number = 1) { - input[2] inp: {= Array =} + input[2] inp: {= + Array + =} reaction(inp) {= let count = 0; // For testing. @@ -56,8 +60,12 @@ reactor Print(scale: number = 1) { } reactor Scale(scale: number = 2) { - mutable input[2] inp: {= Array =} - output[2] out: {= Array =} + mutable input[2] inp: {= + Array + =} + output[2] out: {= + Array + =} reaction(inp) -> out {= for (let j = 0; j < inp.length; j++) { diff --git a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf index 018d8dd587..eb108317e6 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf @@ -5,7 +5,9 @@ target TypeScript { reactor Source { timer t(0, 200 msec) - output[2] out: {= Array =} + output[2] out: {= + Array + =} state s: number = 0 reaction(t) -> out {= @@ -24,7 +26,9 @@ reactor Source { reactor Destination { state s: number = 15 - input[2] inp: {= Array =} + input[2] inp: {= + Array + =} reaction(inp) {= let sum = 0; diff --git a/test/TypeScript/src/multiport/PipelineAfter.lf b/test/TypeScript/src/multiport/PipelineAfter.lf index 9db397c0e4..cf46072bb2 100644 --- a/test/TypeScript/src/multiport/PipelineAfter.lf +++ b/test/TypeScript/src/multiport/PipelineAfter.lf @@ -3,14 +3,18 @@ target TypeScript reactor Source { output out: number - reaction(startup) -> out {= out = 40; =} + reaction(startup) -> out {= + out = 40; + =} } reactor Compute { input inp: number output out: number - reaction(inp) -> out {= out = (inp as number) + 2; =} + reaction(inp) -> out {= + out = (inp as number) + 2; + =} } reactor Sink { diff --git a/test/TypeScript/src/multiport/ReactionsToNested.lf b/test/TypeScript/src/multiport/ReactionsToNested.lf index a6baf12135..c1ce7c104d 100644 --- a/test/TypeScript/src/multiport/ReactionsToNested.lf +++ b/test/TypeScript/src/multiport/ReactionsToNested.lf @@ -32,7 +32,11 @@ reactor D { main reactor { d = new D() - reaction(startup) -> d.y {= d.y[0] = 42; =} + reaction(startup) -> d.y {= + d.y[0] = 42; + =} - reaction(startup) -> d.y {= d.y[1] = 43; =} + reaction(startup) -> d.y {= + d.y[1] = 43; + =} } From f3a3c1eac8e1afc0da12369516189e62f35ea9cf Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 1 Sep 2023 21:18:56 -0700 Subject: [PATCH 050/141] Do not make ToLf a singleton. The comment about thread-safety in the previous commit message was incorrect because I forget that we were using the singleton pattern on ToLf. To my knowledge there was no good reason for us to do that. --- .../main/java/org/lflang/ast/FormattingUtil.java | 2 +- core/src/main/java/org/lflang/ast/ToLf.java | 8 -------- core/src/main/java/org/lflang/ast/ToText.java | 16 ++++++++-------- .../diagram/synthesis/LinguaFrancaSynthesis.java | 4 ++-- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/core/src/main/java/org/lflang/ast/FormattingUtil.java b/core/src/main/java/org/lflang/ast/FormattingUtil.java index 19754b5f10..232d05b190 100644 --- a/core/src/main/java/org/lflang/ast/FormattingUtil.java +++ b/core/src/main/java/org/lflang/ast/FormattingUtil.java @@ -56,7 +56,7 @@ public static Function renderer(Target target) { * with the assumption that the target language is {@code target}. */ public static String render(EObject object, int lineLength, Target target, boolean codeMapTags) { - MalleableString ms = ToLf.instance.doSwitch(object); + MalleableString ms = new ToLf().doSwitch(object); String singleLineCommentPrefix = target.getSingleLineCommentPrefix(); ms.findBestRepresentation( () -> ms.render(INDENTATION, singleLineCommentPrefix, codeMapTags, null), diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index 50ffb442ea..b70c6f735b 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -89,20 +89,12 @@ public class ToLf extends LfSwitch { private static final Pattern KEEP_FORMAT_COMMENT = Pattern.compile("\\s*(//|#)\\s*keep-format\\s*"); - /// public instance initialized when loading the class - public static final ToLf instance = new ToLf(); - /** * The eObjects in the syntax tree on the path from the root up to and including the current * eObject. */ private final ArrayDeque callStack = new ArrayDeque<>(); - // private constructor - private ToLf() { - super(); - } - @Override public MalleableString caseArraySpec(ArraySpec spec) { if (spec.isOfVariableLength()) return MalleableString.anyOf("[]"); diff --git a/core/src/main/java/org/lflang/ast/ToText.java b/core/src/main/java/org/lflang/ast/ToText.java index c677f0730b..6845fde4e7 100644 --- a/core/src/main/java/org/lflang/ast/ToText.java +++ b/core/src/main/java/org/lflang/ast/ToText.java @@ -34,7 +34,7 @@ private ToText() { @Override public String caseArraySpec(ArraySpec spec) { - return ToLf.instance.doSwitch(spec).toString(); + return new ToLf().doSwitch(spec).toString(); } @Override @@ -77,27 +77,27 @@ public String caseCode(Code code) { @Override public String caseBracedListExpression(BracedListExpression object) { - return ToLf.instance.caseBracedListExpression(object).toString(); + return new ToLf().caseBracedListExpression(object).toString(); } @Override public String caseHost(Host host) { - return ToLf.instance.caseHost(host).toString(); + return new ToLf().caseHost(host).toString(); } @Override public String caseLiteral(Literal l) { - return ToLf.instance.caseLiteral(l).toString(); + return new ToLf().caseLiteral(l).toString(); } @Override public String caseParameterReference(ParameterReference p) { - return ToLf.instance.caseParameterReference(p).toString(); + return new ToLf().caseParameterReference(p).toString(); } @Override public String caseTime(Time t) { - return ToLf.instance.caseTime(t).toString(); + return new ToLf().caseTime(t).toString(); } @Override @@ -105,13 +105,13 @@ public String caseType(Type type) { if (type.getCode() != null) { return caseCode(type.getCode()); } - return ToLf.instance.caseType(type).toString(); + return new ToLf().caseType(type).toString(); } @Override public String caseTypeParm(TypeParm t) { if (t.getCode() != null) return doSwitch(t.getCode()); - return ToLf.instance.caseTypeParm(t).toString(); + return new ToLf().caseTypeParm(t).toString(); } @Override diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index 6496bb5dcc..b51822c9a5 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -1492,7 +1492,7 @@ private String createParameterLabel(ParameterInstance param) { if (param.getOverride() != null) { b.append(" = "); var init = param.getActualValue(); - b.append(ToLf.instance.doSwitch(init)); + b.append(new ToLf().doSwitch(init)); } return b.toString(); } @@ -1523,7 +1523,7 @@ private String createStateVariableLabel(StateVar variable) { b.append(":").append(t.toOriginalText()); } if (variable.getInit() != null) { - b.append(ToLf.instance.doSwitch(variable.getInit())); + b.append(new ToLf().doSwitch(variable.getInit())); } return b.toString(); } From 69ebb0f188b60092bf7de579d0f4977faa81e47b Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 1 Sep 2023 22:40:28 -0700 Subject: [PATCH 051/141] Update formatter expect test. --- cli/lff/src/test/java/org/lflang/cli/LffCliTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java b/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java index 5f5f09d977..6b66c7107e 100644 --- a/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java +++ b/cli/lff/src/test/java/org/lflang/cli/LffCliTest.java @@ -83,7 +83,9 @@ public class LffCliTest { /** moo */ // this is a humbug reaction - reaction(a) -> humbug {= /* it reacts like this*/ react react =} + reaction(a) -> humbug {= + /* it reacts like this*/ react react + =} } """), List.of( From 3531fce531a579ecc04a75d5c2d5161170f7a6a1 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 2 Sep 2023 11:54:59 -0700 Subject: [PATCH 052/141] Delete preamble that does nothing. This preamble was not even appearing in the generated code, which causes LSP test to fail. --- test/Python/src/federated/DistributedStructParallel.lf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/Python/src/federated/DistributedStructParallel.lf b/test/Python/src/federated/DistributedStructParallel.lf index 9577231955..9a27ec6e8e 100644 --- a/test/Python/src/federated/DistributedStructParallel.lf +++ b/test/Python/src/federated/DistributedStructParallel.lf @@ -8,10 +8,6 @@ target Python { import Source from "../StructScale.lf" import Check, Print from "../StructParallel.lf" -preamble {= - import hello -=} - federated reactor { s = new Source() c1 = new Print() From 62af2e173ec829ac1189d0103430ba4f48f6359e Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 2 Sep 2023 12:09:29 -0700 Subject: [PATCH 053/141] Update condition for forcing code to be multiline. Reactions, preambles, and methods typically consist of multiple statements appearing on distinct lines, and if they consist of only a single statement, they commonly evolve into multiple statements. Therefore these three constructs should all use multiline code blocks. --- core/src/main/java/org/lflang/ast/ToLf.java | 2 +- test/C/src/verifier/ADASModel.lf | 24 +++++-------------- test/Cpp/src/Alignment.lf | 4 +--- test/Cpp/src/DelayInt.lf | 4 +--- test/Cpp/src/GetMicroStep.lf | 4 +--- test/Cpp/src/Hello.lf | 8 ++----- test/Cpp/src/NativeListsAndTimes.lf | 9 ++----- test/Cpp/src/StructPrint.lf | 4 +--- test/Cpp/src/concurrent/AsyncCallback.lf | 4 +--- test/Cpp/src/concurrent/DelayIntThreaded.lf | 4 +--- test/Cpp/src/concurrent/HelloThreaded.lf | 12 +++------- test/Cpp/src/enclave/EnclaveBankEach.lf | 8 ++----- test/Cpp/src/multiport/WidthGivenByCode.lf | 12 +++------- .../src/target/CliParserGenericArguments.lf | 20 ++++------------ test/Cpp/src/target/CombinedTypeNames.lf | 18 ++++---------- test/Rust/src/MovingAverage.lf | 4 +--- test/Rust/src/NativeListsAndTimes.lf | 5 +--- test/Rust/src/StructAsType.lf | 4 +--- test/Rust/src/generics/CtorParamGeneric.lf | 5 ++-- .../Rust/src/generics/CtorParamGenericInst.lf | 10 ++++---- test/Rust/src/generics/GenericReactor.lf | 4 +--- test/Rust/src/multiport/CycledLhs_Single.lf | 4 +--- test/TypeScript/src/ArrayAsParameter.lf | 4 +--- test/TypeScript/src/ArrayAsType.lf | 8 ++----- test/TypeScript/src/ArrayPrint.lf | 8 ++----- test/TypeScript/src/ArrayScale.lf | 8 ++----- test/TypeScript/src/MovingAverage.lf | 4 +--- test/TypeScript/src/SendsPointerTest.lf | 12 +++------- .../multiport/MultiportMutableInputArray.lf | 16 ++++--------- .../multiport/MultiportToMultiportArray.lf | 8 ++----- 30 files changed, 62 insertions(+), 179 deletions(-) diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index b70c6f735b..0ebc942b26 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -263,7 +263,7 @@ public MalleableString caseCode(Code code) { if (content.lines().count() > 1 || content.contains("#") || content.contains("//")) { return multilineRepresentation; } - if (callStack.stream().anyMatch(it -> it instanceof Code) && !content.isBlank()) { + if (callStack.stream().anyMatch(it -> it instanceof Reaction || it instanceof Preamble || it instanceof Method) && !content.isBlank()) { return MalleableString.anyOf(multilineRepresentation); } return MalleableString.anyOf(singleLineRepresentation, multilineRepresentation); diff --git a/test/C/src/verifier/ADASModel.lf b/test/C/src/verifier/ADASModel.lf index b127c1d1a8..e0e960a894 100644 --- a/test/C/src/verifier/ADASModel.lf +++ b/test/C/src/verifier/ADASModel.lf @@ -6,12 +6,8 @@ preamble {= =} reactor Camera { - output out: {= - c_frame_t - =} - state frame: {= - c_frame_t - =} + output out: {= c_frame_t =} + state frame: {= c_frame_t =} timer t(0, 17 msec) // 60 fps reaction(t) -> out {= @@ -22,12 +18,8 @@ reactor Camera { } reactor LiDAR { - output out: {= - l_frame_t - =} - state frame: {= - l_frame_t - =} + output out: {= l_frame_t =} + state frame: {= l_frame_t =} timer t(0, 34 msec) // 30 fps reaction(t) -> out {= @@ -58,12 +50,8 @@ reactor Brakes { } reactor ADASProcessor { - input in1: {= - l_frame_t - =} - input in2: {= - c_frame_t - =} + input in1: {= l_frame_t =} + input in2: {= c_frame_t =} output out1: int output out2: int logical action a(50 msec) diff --git a/test/Cpp/src/Alignment.lf b/test/Cpp/src/Alignment.lf index 7eaa596379..00f4ce0936 100644 --- a/test/Cpp/src/Alignment.lf +++ b/test/Cpp/src/Alignment.lf @@ -78,9 +78,7 @@ reactor Sieve { reactor Destination { input ok: bool input in: int - state last_invoked: {= - reactor::TimePoint - =} + state last_invoked: {= reactor::TimePoint =} reaction(ok, in) {= if (ok.is_present() && in.is_present()) { diff --git a/test/Cpp/src/DelayInt.lf b/test/Cpp/src/DelayInt.lf index 5111e26ee6..1b02dcba61 100644 --- a/test/Cpp/src/DelayInt.lf +++ b/test/Cpp/src/DelayInt.lf @@ -19,9 +19,7 @@ reactor Delay(delay: time = 100 msec) { reactor Test { input in: int - state start_time: {= - reactor::TimePoint - =} + state start_time: {= reactor::TimePoint =} timer start reaction(start) {= diff --git a/test/Cpp/src/GetMicroStep.lf b/test/Cpp/src/GetMicroStep.lf index bc541db26a..d09ebcdb32 100644 --- a/test/Cpp/src/GetMicroStep.lf +++ b/test/Cpp/src/GetMicroStep.lf @@ -2,9 +2,7 @@ target Cpp main reactor GetMicroStep { - state s: {= - reactor::mstep_t - =} = 1 + state s: {= reactor::mstep_t =} = 1 logical action l diff --git a/test/Cpp/src/Hello.lf b/test/Cpp/src/Hello.lf index 483d15b166..022b9a7383 100644 --- a/test/Cpp/src/Hello.lf +++ b/test/Cpp/src/Hello.lf @@ -7,13 +7,9 @@ target Cpp { fast: true } -reactor HelloCpp(period: time = 2 sec, message: {= - std::string -=} = "Hello C++") { +reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") { state count: int = 0 - state previous_time: {= - reactor::TimePoint - =} + state previous_time: {= reactor::TimePoint =} timer t(1 sec, period) logical action a: void diff --git a/test/Cpp/src/NativeListsAndTimes.lf b/test/Cpp/src/NativeListsAndTimes.lf index b786edc7a5..b6e8550c50 100644 --- a/test/Cpp/src/NativeListsAndTimes.lf +++ b/test/Cpp/src/NativeListsAndTimes.lf @@ -6,9 +6,7 @@ reactor Foo( y: time = 0, // Units are missing but not required z = 1 msec, // Type is missing but not required p: int[]{1, 2, 3, 4}, // List of integers - q: {= - std::vector - =}{1 msec, 2 msec, 3 msec}, + q: {= std::vector =}{1 msec, 2 msec, 3 msec}, g: time[]{1 msec, 2 msec}, // List of time values g2: int[] = {}) { state s: time = y // Reference to explicitly typed time parameter @@ -20,10 +18,7 @@ reactor Foo( timer toe(z) // Implicit type time state baz = p // Implicit type int[] state period = z // Implicit type time - // a list of lists - state times: std::vector>{q, g} + state times: std::vector>{q, g} // a list of lists state empty_list: int[] = {} reaction(tick) {= diff --git a/test/Cpp/src/StructPrint.lf b/test/Cpp/src/StructPrint.lf index 6e0fba1199..807dba8e85 100644 --- a/test/Cpp/src/StructPrint.lf +++ b/test/Cpp/src/StructPrint.lf @@ -18,9 +18,7 @@ reactor Source { =} } -reactor Print(expected_value: int = 42, expected_name: {= - std::string -=} = "Earth") { +reactor Print(expected_value: int = 42, expected_name: {= std::string =} = "Earth") { input in: Hello reaction(in) {= diff --git a/test/Cpp/src/concurrent/AsyncCallback.lf b/test/Cpp/src/concurrent/AsyncCallback.lf index 07eb85ca3a..b9d655ca75 100644 --- a/test/Cpp/src/concurrent/AsyncCallback.lf +++ b/test/Cpp/src/concurrent/AsyncCallback.lf @@ -10,9 +10,7 @@ main reactor AsyncCallback { =} timer t(0, 200 msec) - state thread: {= - std::thread - =} + state thread: {= std::thread =} state expected_time: time = 100 msec state toggle: bool = false diff --git a/test/Cpp/src/concurrent/DelayIntThreaded.lf b/test/Cpp/src/concurrent/DelayIntThreaded.lf index e090af0b89..5a181e6770 100644 --- a/test/Cpp/src/concurrent/DelayIntThreaded.lf +++ b/test/Cpp/src/concurrent/DelayIntThreaded.lf @@ -19,9 +19,7 @@ reactor Delay(delay: time = 100 msec) { reactor Test { input in: int - state start_time: {= - reactor::TimePoint - =} + state start_time: {= reactor::TimePoint =} timer start reaction(start) {= diff --git a/test/Cpp/src/concurrent/HelloThreaded.lf b/test/Cpp/src/concurrent/HelloThreaded.lf index ca08070d87..35e2261048 100644 --- a/test/Cpp/src/concurrent/HelloThreaded.lf +++ b/test/Cpp/src/concurrent/HelloThreaded.lf @@ -7,13 +7,9 @@ target Cpp { fast: true } -reactor HelloCpp(period: time = 2 sec, message: {= - std::string -=} = "Hello C++") { +reactor HelloCpp(period: time = 2 sec, message: {= std::string =} = "Hello C++") { state count: int = 0 - state previous_time: {= - reactor::TimePoint - =} + state previous_time: {= reactor::TimePoint =} timer t(1 sec, period) logical action a: void @@ -39,9 +35,7 @@ reactor HelloCpp(period: time = 2 sec, message: {= =} } -reactor Inside(period: time = 1 sec, message: {= - std::string -=} = "Composite default message.") { +reactor Inside(period: time = 1 sec, message: {= std::string =} = "Composite default message.") { third_instance = new HelloCpp(period=period, message=message) } diff --git a/test/Cpp/src/enclave/EnclaveBankEach.lf b/test/Cpp/src/enclave/EnclaveBankEach.lf index c220a082c5..d1b94748ba 100644 --- a/test/Cpp/src/enclave/EnclaveBankEach.lf +++ b/test/Cpp/src/enclave/EnclaveBankEach.lf @@ -6,12 +6,8 @@ target Cpp { reactor Node( bank_index: size_t = 0, id: std::string = {= "node" + std::to_string(bank_index) =}, - period: {= - reactor::Duration - =} = {= 100ms * (bank_index+1) =}, - duration: {= - reactor::Duration - =} = {= 50ms + 100ms * bank_index =}) { + period: {= reactor::Duration =} = {= 100ms * (bank_index+1) =}, + duration: {= reactor::Duration =} = {= 50ms + 100ms * bank_index =}) { logical action a: void reaction(startup, a) -> a {= diff --git a/test/Cpp/src/multiport/WidthGivenByCode.lf b/test/Cpp/src/multiport/WidthGivenByCode.lf index 3580a9696c..5e9ed80eb3 100644 --- a/test/Cpp/src/multiport/WidthGivenByCode.lf +++ b/test/Cpp/src/multiport/WidthGivenByCode.lf @@ -1,12 +1,8 @@ target Cpp reactor Foo(a: size_t = 8, b: size_t = 2) { - input[{= - a*b - =}] in: size_t - output[{= - a/b - =}] out: size_t + input[{= a*b =}] in: size_t + output[{= a/b =}] out: size_t reaction(startup) in -> out {= if (in.size() != a*b) { @@ -24,9 +20,7 @@ main reactor { foo1 = new Foo() foo2 = new Foo(a=10, b=3) foo3 = new Foo(a=9, b=9) - foo_bank = new[{= - 42 - =}] Foo() + foo_bank = new[{= 42 =}] Foo() reaction(startup) foo_bank.out {= if (foo_bank.size() != 42) { diff --git a/test/Cpp/src/target/CliParserGenericArguments.lf b/test/Cpp/src/target/CliParserGenericArguments.lf index 42c8bd6c2a..fc1862b411 100644 --- a/test/Cpp/src/target/CliParserGenericArguments.lf +++ b/test/Cpp/src/target/CliParserGenericArguments.lf @@ -47,26 +47,16 @@ main reactor CliParserGenericArguments( signed_value: signed = -10, unsigned_value: unsigned = 11, long_value: long = -100, - unsigned_long_value: {= - unsigned_long - =} = 42, - long_long_value: {= - long_long - =} = -42, - ull_value: {= - uns_long_long - =} = 42, + unsigned_long_value: {= unsigned_long =} = 42, + long_long_value: {= long_long =} = -42, + ull_value: {= uns_long_long =} = 42, bool_value: bool = false, char_value: char = 'T', double_value: double = 4.2, - long_double_value: {= - long_double - =} = 4.2, + long_double_value: {= long_double =} = 4.2, float_value: float = 10.5, string_value: string = "This is a testvalue", - custom_class_value: {= - CustomClass - =}("Peter")) { + custom_class_value: {= CustomClass =}("Peter")) { reaction(startup) {= std::cout << "Hello World!\n"; =} diff --git a/test/Cpp/src/target/CombinedTypeNames.lf b/test/Cpp/src/target/CombinedTypeNames.lf index 5caa22f70a..f64116eb4a 100644 --- a/test/Cpp/src/target/CombinedTypeNames.lf +++ b/test/Cpp/src/target/CombinedTypeNames.lf @@ -2,17 +2,9 @@ // int`) can be used correctly in LF code. target Cpp -reactor Foo(bar: {= - unsigned int -=} = 0, baz: {= - const unsigned int* -=} = {= nullptr =}) { - state s_bar: {= - unsigned int - =} = bar - state s_baz: {= - const unsigned int* - =} = baz +reactor Foo(bar: {= unsigned int =} = 0, baz: {= const unsigned int* =} = {= nullptr =}) { + state s_bar: {= unsigned int =} = bar + state s_baz: {= const unsigned int* =} = baz reaction(startup) {= if (bar != 42 || s_bar != 42 || *baz != 42 || *s_baz != 42) { @@ -22,8 +14,6 @@ reactor Foo(bar: {= =} } -main reactor(bar: {= - unsigned int -=} = 42) { +main reactor(bar: {= unsigned int =} = 42) { foo = new Foo(bar=bar, baz = {= &bar =}) } diff --git a/test/Rust/src/MovingAverage.lf b/test/Rust/src/MovingAverage.lf index 0c5957b21c..69f973cede 100644 --- a/test/Rust/src/MovingAverage.lf +++ b/test/Rust/src/MovingAverage.lf @@ -17,9 +17,7 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {= - [f64 ; 4] - =} = {= [ 0.0 ; 4 ] =} + state delay_line: {= [f64 ; 4] =} = {= [ 0.0 ; 4 ] =} state index: usize = 0 input in_: f64 output out: f64 diff --git a/test/Rust/src/NativeListsAndTimes.lf b/test/Rust/src/NativeListsAndTimes.lf index d96e0649ba..5401d6d1b9 100644 --- a/test/Rust/src/NativeListsAndTimes.lf +++ b/test/Rust/src/NativeListsAndTimes.lf @@ -30,10 +30,7 @@ reactor Foo( // state baz(p); // Implicit type i32[] fixme this interplays badly with syntax for array init // Implicit type time state period = z - // a list of lists - state times: Vec>(q, g) + state times: Vec>(q, g) // a list of lists /** * reactor Foo (p: i32[](1, 2)) { state baz(p); // Implicit type i32[] state baz({=p=}); // diff --git a/test/Rust/src/StructAsType.lf b/test/Rust/src/StructAsType.lf index 893a1ed8a8..867651e8de 100644 --- a/test/Rust/src/StructAsType.lf +++ b/test/Rust/src/StructAsType.lf @@ -20,9 +20,7 @@ reactor Source { // expected parameter is for testing. reactor Print(expected: i32 = 42) { - input inp: {= - super::source::Hello - =} + input inp: {= super::source::Hello =} state expected: i32 = expected reaction(inp) {= diff --git a/test/Rust/src/generics/CtorParamGeneric.lf b/test/Rust/src/generics/CtorParamGeneric.lf index fe9d2a4d90..e5a6db3f0e 100644 --- a/test/Rust/src/generics/CtorParamGeneric.lf +++ b/test/Rust/src/generics/CtorParamGeneric.lf @@ -1,9 +1,8 @@ // tests that ctor parameters may refer to type parameters. target Rust -reactor Generic<{= - T: Default + Eq + Sync + std::fmt::Debug -=}>(value: T = {= Default::default() =}) { +reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug =}>( + value: T = {= Default::default() =}) { input in: T state v: T = value diff --git a/test/Rust/src/generics/CtorParamGenericInst.lf b/test/Rust/src/generics/CtorParamGenericInst.lf index de02ca156e..c76e0e1dcb 100644 --- a/test/Rust/src/generics/CtorParamGenericInst.lf +++ b/test/Rust/src/generics/CtorParamGenericInst.lf @@ -2,9 +2,8 @@ // argument list of a further child instance. target Rust -reactor Generic2<{= - T: Default + Eq + Sync + std::fmt::Debug + Send + 'static -=}>(value: T = {= Default::default() =}) { +reactor Generic2<{= T: Default + Eq + Sync + std::fmt::Debug + Send + 'static =}>( + value: T = {= Default::default() =}) { input in: T state v: T = value @@ -16,9 +15,8 @@ reactor Generic2<{= =} } -reactor Generic<{= - T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'static -=}>(value: T = {= Default::default() =}) { +reactor Generic<{= T: Default + Eq + Sync + std::fmt::Debug + Copy + Send + 'static =}>( + value: T = {= Default::default() =}) { input in: T inner = new Generic2(value=value) diff --git a/test/Rust/src/generics/GenericReactor.lf b/test/Rust/src/generics/GenericReactor.lf index 251fefcc69..b87119bb86 100644 --- a/test/Rust/src/generics/GenericReactor.lf +++ b/test/Rust/src/generics/GenericReactor.lf @@ -1,9 +1,7 @@ // Tests a port connection between (input of self -> input of child) target Rust -reactor Box<{= - T: Sync -=}> { +reactor Box<{= T: Sync =}> { input inp: T output out: T diff --git a/test/Rust/src/multiport/CycledLhs_Single.lf b/test/Rust/src/multiport/CycledLhs_Single.lf index 4d8931e9d7..2ab73f49ad 100644 --- a/test/Rust/src/multiport/CycledLhs_Single.lf +++ b/test/Rust/src/multiport/CycledLhs_Single.lf @@ -7,9 +7,7 @@ target Rust { reactor Test { output[2] out: u32 input[4] in: u32 - logical action act: {= - (u32, u32) - =} + logical action act: {= (u32, u32) =} state last: u32 = 1 reaction(startup) -> act {= diff --git a/test/TypeScript/src/ArrayAsParameter.lf b/test/TypeScript/src/ArrayAsParameter.lf index 150213d47c..ef9ba9f414 100644 --- a/test/TypeScript/src/ArrayAsParameter.lf +++ b/test/TypeScript/src/ArrayAsParameter.lf @@ -1,9 +1,7 @@ // Source has an array as a parameter, the elements of which it passes to Print. target TypeScript -reactor Source(sequence: {= - Array -=} = {= [0, 1, 2] =}) { +reactor Source(sequence: {= Array =} = {= [0, 1, 2] =}) { output out: number state count: number = 0 logical action next diff --git a/test/TypeScript/src/ArrayAsType.lf b/test/TypeScript/src/ArrayAsType.lf index f40d6d91e0..c26e3fe02e 100644 --- a/test/TypeScript/src/ArrayAsType.lf +++ b/test/TypeScript/src/ArrayAsType.lf @@ -3,9 +3,7 @@ target TypeScript reactor Source { - output out: {= - Array - =} + output out: {= Array =} reaction(startup) -> out {= let toSend = []; @@ -18,9 +16,7 @@ reactor Source { // The scale parameter is just for testing. reactor Print(scale: number = 1) { - input x: {= - Array - =} + input x: {= Array =} reaction(x) {= let count = 0; // For testing. diff --git a/test/TypeScript/src/ArrayPrint.lf b/test/TypeScript/src/ArrayPrint.lf index 7967efb290..3c94b00b34 100644 --- a/test/TypeScript/src/ArrayPrint.lf +++ b/test/TypeScript/src/ArrayPrint.lf @@ -3,9 +3,7 @@ target TypeScript reactor Source { - output out: {= - Array - =} + output out: {= Array =} reaction(startup) -> out {= let toSend = new Array(); @@ -18,9 +16,7 @@ reactor Source { // The scale parameter is just for testing. reactor Print(scale: number = 1) { - input x: {= - Array - =} + input x: {= Array =} reaction(x) {= let count = 0; // For testing. diff --git a/test/TypeScript/src/ArrayScale.lf b/test/TypeScript/src/ArrayScale.lf index 45c982f493..2ddfa951f3 100644 --- a/test/TypeScript/src/ArrayScale.lf +++ b/test/TypeScript/src/ArrayScale.lf @@ -6,12 +6,8 @@ target TypeScript import Source, Print from "ArrayPrint.lf" reactor Scale(scale: number = 2) { - mutable input x: {= - Array - =} - output out: {= - Array - =} + mutable input x: {= Array =} + output out: {= Array =} reaction(x) -> out {= x = x as Array; diff --git a/test/TypeScript/src/MovingAverage.lf b/test/TypeScript/src/MovingAverage.lf index 38ddde1504..f99e436ab7 100644 --- a/test/TypeScript/src/MovingAverage.lf +++ b/test/TypeScript/src/MovingAverage.lf @@ -17,9 +17,7 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {= - Array - =} = {= [0.0, 0.0, 0.0] =} + state delay_line: {= Array =} = {= [0.0, 0.0, 0.0] =} state index: number = 0 input x: number output out: number diff --git a/test/TypeScript/src/SendsPointerTest.lf b/test/TypeScript/src/SendsPointerTest.lf index 68cf14b4cd..2808d2a87b 100644 --- a/test/TypeScript/src/SendsPointerTest.lf +++ b/test/TypeScript/src/SendsPointerTest.lf @@ -3,9 +3,7 @@ target TypeScript reactor SendsPointer { - output out: {= - {value: number} - =} + output out: {= {value: number} =} reaction(startup) -> out {= let my_object = { value: 42 }; @@ -14,12 +12,8 @@ reactor SendsPointer { } // expected parameter is for testing. -reactor Print(expected: {= - {value: number} -=} = {= { value: 42 } =}) { - input x: {= - {value: number} - =} +reactor Print(expected: {= {value: number} =} = {= { value: 42 } =}) { + input x: {= {value: number} =} reaction(x) {= x = x as {value: number}; diff --git a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf index 440f939733..b097927288 100644 --- a/test/TypeScript/src/multiport/MultiportMutableInputArray.lf +++ b/test/TypeScript/src/multiport/MultiportMutableInputArray.lf @@ -4,9 +4,7 @@ target TypeScript reactor Source { - output[2] out: {= - Array - =} + output[2] out: {= Array =} reaction(startup) -> out {= // Dynamically allocate an output array of length 3. @@ -29,9 +27,7 @@ reactor Source { // The scale parameter is just for testing. reactor Print(scale: number = 1) { - input[2] inp: {= - Array - =} + input[2] inp: {= Array =} reaction(inp) {= let count = 0; // For testing. @@ -60,12 +56,8 @@ reactor Print(scale: number = 1) { } reactor Scale(scale: number = 2) { - mutable input[2] inp: {= - Array - =} - output[2] out: {= - Array - =} + mutable input[2] inp: {= Array =} + output[2] out: {= Array =} reaction(inp) -> out {= for (let j = 0; j < inp.length; j++) { diff --git a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf index eb108317e6..018d8dd587 100644 --- a/test/TypeScript/src/multiport/MultiportToMultiportArray.lf +++ b/test/TypeScript/src/multiport/MultiportToMultiportArray.lf @@ -5,9 +5,7 @@ target TypeScript { reactor Source { timer t(0, 200 msec) - output[2] out: {= - Array - =} + output[2] out: {= Array =} state s: number = 0 reaction(t) -> out {= @@ -26,9 +24,7 @@ reactor Source { reactor Destination { state s: number = 15 - input[2] inp: {= - Array - =} + input[2] inp: {= Array =} reaction(inp) {= let sum = 0; From 1cf93687e1a92f5a220345d20e7ff06da5b884f1 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 2 Sep 2023 22:27:26 -0700 Subject: [PATCH 054/141] Format. --- core/src/main/java/org/lflang/ast/ToLf.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index 0ebc942b26..740dcb074d 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -263,7 +263,10 @@ public MalleableString caseCode(Code code) { if (content.lines().count() > 1 || content.contains("#") || content.contains("//")) { return multilineRepresentation; } - if (callStack.stream().anyMatch(it -> it instanceof Reaction || it instanceof Preamble || it instanceof Method) && !content.isBlank()) { + if (callStack.stream() + .anyMatch( + it -> it instanceof Reaction || it instanceof Preamble || it instanceof Method) + && !content.isBlank()) { return MalleableString.anyOf(multilineRepresentation); } return MalleableString.anyOf(singleLineRepresentation, multilineRepresentation); From 4b92a340c5b8f647926e607d8cd7e388be598100 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 2 Sep 2023 22:45:09 -0700 Subject: [PATCH 055/141] Delete another unused preamble. --- test/Python/src/federated/DistributedStructAsType.lf | 4 ---- test/Python/src/federated/DistributedStructAsTypeDirect.lf | 4 ---- test/Python/src/federated/DistributedStructPrint.lf | 4 ---- test/Python/src/federated/DistributedStructScale.lf | 4 ---- 4 files changed, 16 deletions(-) diff --git a/test/Python/src/federated/DistributedStructAsType.lf b/test/Python/src/federated/DistributedStructAsType.lf index b3a83cc600..8179a295a7 100644 --- a/test/Python/src/federated/DistributedStructAsType.lf +++ b/test/Python/src/federated/DistributedStructAsType.lf @@ -5,10 +5,6 @@ target Python { import Source, Print from "../StructAsType.lf" -preamble {= - import hello -=} - federated reactor { s = new Source() p = new Print() diff --git a/test/Python/src/federated/DistributedStructAsTypeDirect.lf b/test/Python/src/federated/DistributedStructAsTypeDirect.lf index 7463672366..80eac47772 100644 --- a/test/Python/src/federated/DistributedStructAsTypeDirect.lf +++ b/test/Python/src/federated/DistributedStructAsTypeDirect.lf @@ -5,10 +5,6 @@ target Python { import Source, Print from "../StructAsTypeDirect.lf" -preamble {= - import hello -=} - federated reactor { s = new Source() p = new Print() diff --git a/test/Python/src/federated/DistributedStructPrint.lf b/test/Python/src/federated/DistributedStructPrint.lf index d3dbfe398b..b447fc61cd 100644 --- a/test/Python/src/federated/DistributedStructPrint.lf +++ b/test/Python/src/federated/DistributedStructPrint.lf @@ -7,10 +7,6 @@ target Python { import Print, Check from "../StructPrint.lf" -preamble {= - import hello -=} - federated reactor { s = new Print() p = new Check() diff --git a/test/Python/src/federated/DistributedStructScale.lf b/test/Python/src/federated/DistributedStructScale.lf index 34a4977d05..0e7d614448 100644 --- a/test/Python/src/federated/DistributedStructScale.lf +++ b/test/Python/src/federated/DistributedStructScale.lf @@ -7,10 +7,6 @@ target Python { import Source, TestInput, Print from "../StructScale.lf" -preamble {= - import hello -=} - federated reactor { s = new Source() c = new Print() From ba2fa9c5b5d3366022b6dfb3f66e406c27ff0d5b Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sun, 3 Sep 2023 10:52:08 -0700 Subject: [PATCH 056/141] Format. --- test/C/src/PersistentInputs.lf | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/C/src/PersistentInputs.lf b/test/C/src/PersistentInputs.lf index 8ff14e41b2..822810fd90 100644 --- a/test/C/src/PersistentInputs.lf +++ b/test/C/src/PersistentInputs.lf @@ -8,7 +8,9 @@ reactor Source { timer t(100 ms, 200 ms) state count: int = 1 - reaction(t) -> out {= lf_set(out, self->count++); =} + reaction(t) -> out {= + lf_set(out, self->count++); + =} } reactor Sink { @@ -17,7 +19,9 @@ reactor Sink { state count: int = 0 // For testing, emulate the count variable of Source. timer t2(100 ms, 200 ms) - reaction(t2) {= self->count++; =} + reaction(t2) {= + self->count++; + =} reaction(t) in {= printf("Value of the input is %d at time %lld\n", in->value, lf_time_logical_elapsed()); From 14fac8c050168f8c9e175024e602f1e67aad52b7 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 1 Sep 2023 22:31:46 -0700 Subject: [PATCH 057/141] Set the bank index of top-level federates. Fixes #1962. --- .../java/org/lflang/ast/FormattingUtil.java | 4 ++- core/src/main/java/org/lflang/ast/ToLf.java | 21 +++++++++++-- .../federated/generator/FedMainEmitter.java | 13 ++++++++ .../generator/c/CParameterGenerator.java | 2 +- test/C/src/federated/BankIndex.lf | 30 +++++++++++++++++++ 5 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 test/C/src/federated/BankIndex.lf diff --git a/core/src/main/java/org/lflang/ast/FormattingUtil.java b/core/src/main/java/org/lflang/ast/FormattingUtil.java index 232d05b190..113bcb27c8 100644 --- a/core/src/main/java/org/lflang/ast/FormattingUtil.java +++ b/core/src/main/java/org/lflang/ast/FormattingUtil.java @@ -56,7 +56,9 @@ public static Function renderer(Target target) { * with the assumption that the target language is {@code target}. */ public static String render(EObject object, int lineLength, Target target, boolean codeMapTags) { - MalleableString ms = new ToLf().doSwitch(object); + var toLf = new ToLf(); + toLf.setTarget(target); + MalleableString ms = toLf.doSwitch(object); String singleLineCommentPrefix = target.getSingleLineCommentPrefix(); ms.findBestRepresentation( () -> ms.render(INDENTATION, singleLineCommentPrefix, codeMapTags, null), diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index 740dcb074d..b91ea5499c 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -95,6 +95,23 @@ public class ToLf extends LfSwitch { */ private final ArrayDeque callStack = new ArrayDeque<>(); + /** The target language. This is only needed when the complete program is not available. */ + private Target optionalTarget; + + /** Return the target language of the LF being generated. */ + private Target getTarget() { + if (callStack.getFirst() instanceof Model model) return ASTUtils.getTarget(model); + else return optionalTarget; + } + + /** + * Set the target language of the LF being generated. This has no effect unless the target spec is + * unavailable. + */ + public void setTarget(Target target) { + optionalTarget = target; + } + @Override public MalleableString caseArraySpec(ArraySpec spec) { if (spec.isOfVariableLength()) return MalleableString.anyOf("[]"); @@ -931,7 +948,7 @@ public MalleableString caseAssignment(Assignment object) { */ private boolean shouldOutputAsAssignment(Initializer init) { return init.isAssign() - || init.getExprs().size() == 1 && ASTUtils.getTarget(init).mandatesEqualsInitializers(); + || init.getExprs().size() == 1 && getTarget().mandatesEqualsInitializers(); } @Override @@ -945,7 +962,7 @@ public MalleableString caseInitializer(Initializer init) { Objects.requireNonNull(expr); return builder.append(doSwitch(expr)).get(); } - if (ASTUtils.getTarget(init) == Target.C) { + if (getTarget() == Target.C) { // This turns C array initializers into a braced expression. // C++ variants are not converted. return builder.append(bracedListExpression(init.getExprs())).get(); diff --git a/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java b/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java index f6e8f6e9c8..9d4817c20d 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java +++ b/core/src/main/java/org/lflang/federated/generator/FedMainEmitter.java @@ -7,6 +7,7 @@ import org.lflang.MessageReporter; import org.lflang.ast.ASTUtils; import org.lflang.ast.FormattingUtil; +import org.lflang.lf.LfFactory; import org.lflang.lf.Reactor; /** Helper class to generate a main reactor */ @@ -30,6 +31,18 @@ String generateMainReactor( var renderer = FormattingUtil.renderer(federate.targetConfig.target); var instantiation = EcoreUtil.copy(federate.instantiation); instantiation.setWidthSpec(null); + if (federate.bankWidth > 1) { + var assignment = LfFactory.eINSTANCE.createAssignment(); + var parameter = LfFactory.eINSTANCE.createParameter(); + parameter.setName("bank_index"); + assignment.setLhs(parameter); + var initializer = LfFactory.eINSTANCE.createInitializer(); + var expression = LfFactory.eINSTANCE.createLiteral(); + expression.setLiteral(String.valueOf(federate.bankIndex)); + initializer.getExprs().add(expression); + assignment.setRhs(initializer); + instantiation.getParameters().add(assignment); + } return String.join( "\n", diff --git a/core/src/main/java/org/lflang/generator/c/CParameterGenerator.java b/core/src/main/java/org/lflang/generator/c/CParameterGenerator.java index caaa375056..21a4803a5f 100644 --- a/core/src/main/java/org/lflang/generator/c/CParameterGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CParameterGenerator.java @@ -21,7 +21,7 @@ public class CParameterGenerator { */ public static String getInitializer(ParameterInstance p) { // Handle the bank_index parameter. - if (p.getName().equals("bank_index")) { + if (p.getName().equals("bank_index") && p.getOverride() == null) { return CUtil.bankIndex(p.getParent()); } diff --git a/test/C/src/federated/BankIndex.lf b/test/C/src/federated/BankIndex.lf new file mode 100644 index 0000000000..ff7341608f --- /dev/null +++ b/test/C/src/federated/BankIndex.lf @@ -0,0 +1,30 @@ +target C + +reactor Node(bank_index: int = 0, num_nodes: int = 3) { + input[num_nodes] in: int + output out: int + + reaction(startup) -> out {= + lf_set(out, self->bank_index); + =} +} + +reactor Check(num_nodes: int = 3) { + input[num_nodes] in: int + + reaction(in) {= + for (int i = 0; i < self->num_nodes; i++) { + if (in[i]->value != i) { + lf_print_error_and_exit("Expected %d, not %d.", i, in[i]->value); + } + } + lf_print("Success."); + lf_request_stop(); + =} +} + +federated reactor { + b = new[4] Node(num_nodes=4) + c = new Check(num_nodes=4) + b.out -> c.in +} From 7e8d3f3022871dabfc99a0b9b1b62000afc39f1f Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 2 Sep 2023 22:22:44 -0700 Subject: [PATCH 058/141] Remove check that bank index is zero. --- test/C/src/federated/DistributedBank.lf | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/C/src/federated/DistributedBank.lf b/test/C/src/federated/DistributedBank.lf index f934bd7361..65a6f871c2 100644 --- a/test/C/src/federated/DistributedBank.lf +++ b/test/C/src/federated/DistributedBank.lf @@ -13,9 +13,6 @@ reactor Node(bank_index: int = 0) { =} reaction(shutdown) {= - if (self->bank_index) { - lf_print_error_and_exit("The only bank index should be zero because there should be only one bank member per federate."); - } if (self->count == 0) { lf_print_error_and_exit("Timer reactions did not execute."); } From 02a8557b41ac5539303bfad6f2078616eb7428ed Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Tue, 5 Sep 2023 19:50:12 -0700 Subject: [PATCH 059/141] Optimise gradle per @lhstrh suggestions, add --quiet flag --- util/scripts/launch.ps1 | 2 +- util/scripts/launch.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 index bb14204f5c..40cd25ba55 100644 --- a/util/scripts/launch.ps1 +++ b/util/scripts/launch.ps1 @@ -29,5 +29,5 @@ $base="$PSScriptRoot\..\..\" $gradlew="${base}/gradlew.bat" # invoke script -& "${gradlew}" assemble +& "${gradlew}" --quiet assemble ":cli:${tool}:assemble" & "${base}/build/install/lf-cli/bin/${tool}" @args \ No newline at end of file diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 22a272f81f..5233cb55fb 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -18,6 +18,8 @@ # This solution, adapted from an example written by Geoff Nixon, is POSIX- # compliant and robust to symbolic links. If a chain of more than 1000 links # is encountered, we return. +set -euo pipefail + find_dir() ( start_dir=$PWD cd "$(dirname "$1")" @@ -72,5 +74,5 @@ fi gradlew="${base}/gradlew" # Launch the tool. -"${gradlew}" assemble +"${gradlew}" --quiet assemble ":cli:${tool}:assemble" "${base}/build/install/lf-cli/bin/${tool}" "$@" \ No newline at end of file From 4012718f9bfa137186ee05a5ec036e9fb57f4848 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 17:02:54 -0700 Subject: [PATCH 060/141] Update latest-release workflow --- .github/actions/latest-release/action.yml | 26 +++++++++++++++++ .github/workflows/latest-release.yml | 34 ++++++----------------- 2 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 .github/actions/latest-release/action.yml diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml new file mode 100644 index 0000000000..e283e8ed01 --- /dev/null +++ b/.github/actions/latest-release/action.yml @@ -0,0 +1,26 @@ +name: Latest release +description: Report the latest release of the current repo +runs: + using: "composite" + steps: + - name: Install semver-tool + run: | + wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver + chmod +x /usr/local/bin/semver + semver --version + - name: Fetch all tags + run: git fetch --all --tags + - name: Fetch latest-release script + run: | + wget https://raw.githubusercontent.com/lf-lang/lingua-franca/master/.github/scripts/latest-release.sh + chmod +x latest-release.sh + - name: Find the latest release + id: find + run: | + export tag=$(./latest-release.sh) + echo "ref=${tag}" >> $GITHUB_OUTPUT + shopt -s extglob + export ver="${tag##v}" + echo "ver=${ver}" >> $GITHUB_OUTPUT + echo "Latest release tag: ${tag}" + echo "Without a leading 'v': ${ver}" diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index d327f8f722..900df0f843 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -10,10 +10,10 @@ on: outputs: ref: description: "The tag of the latest release" - value: ${{ jobs.run.outputs.ref }} + value: ${{ jobs.get-latest-release.outputs.ref }} ver: description: "The semver of the latest release (without a leading 'v')" - value: ${{ jobs.run.outputs.ver }} + value: ${{ jobs.get-latest-release.outputs.ver }} # Also allow trigging the workflow manually. workflow_dispatch: @@ -21,31 +21,13 @@ jobs: get-latest-release: runs-on: ubuntu-latest outputs: - ref: ${{ steps.find.outputs.ref }} - ver: ${{ steps.find.outputs.ver }} + ref: ${{ steps.semver.outputs.ref }} + ver: ${{ steps.semver.outputs.ver }} steps: - name: Check out repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: lf-lang/${{ inputs.repo }} - - name: Install semver-tool - run: | - wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver - chmod +x /usr/local/bin/semver - semver --version - - name: Fetch all tags - run: git fetch --all --tags - - name: Fetch latest-release script - run: | - wget https://raw.githubusercontent.com/lf-lang/lingua-franca/master/.github/scripts/latest-release.sh - chmod +x latest-release.sh - - name: Find the latest release - id: find - run: | - export tag=$(./latest-release.sh) - echo "{ref}={${tag}}" >> $GITHUB_OUTPUT - shopt -s extglob - export ver="${tag##v}" - echo "{ver}={${ver}}" >> $GITHUB_OUTPUT - echo "Latest release tag: ${tag}" - echo "Without a leading 'v': ${ver}" + - id: semver + uses: ./.github/actions/latest-release@master + \ No newline at end of file From fa9e2e5e13e85d2d74072a25665a8d689deab153 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 17:05:13 -0700 Subject: [PATCH 061/141] Get input from user with invoked manually --- .github/workflows/latest-release.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index 900df0f843..7882968990 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -16,6 +16,11 @@ on: value: ${{ jobs.get-latest-release.outputs.ver }} # Also allow trigging the workflow manually. workflow_dispatch: + inputs: + repo: + type: string + description: Repo to find the latest release of + default: lingua-franca jobs: get-latest-release: @@ -27,7 +32,7 @@ jobs: - name: Check out repository uses: actions/checkout@v3 with: - repository: lf-lang/${{ inputs.repo }} + repository: lf-lang/${{ github.event.inputs.repo || inputs.repo }} - id: semver uses: ./.github/actions/latest-release@master \ No newline at end of file From 35f74a6297ac4b966633137f54e8061b2fb851a3 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 17:36:16 -0700 Subject: [PATCH 062/141] Add option to specify different repo owner --- .github/actions/latest-release/action.yml | 4 ++++ .github/workflows/latest-release.yml | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml index e283e8ed01..98c51bb900 100644 --- a/.github/actions/latest-release/action.yml +++ b/.github/actions/latest-release/action.yml @@ -8,12 +8,15 @@ runs: wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver chmod +x /usr/local/bin/semver semver --version + shell: bash - name: Fetch all tags run: git fetch --all --tags + shell: bash - name: Fetch latest-release script run: | wget https://raw.githubusercontent.com/lf-lang/lingua-franca/master/.github/scripts/latest-release.sh chmod +x latest-release.sh + shell: bash - name: Find the latest release id: find run: | @@ -24,3 +27,4 @@ runs: echo "ver=${ver}" >> $GITHUB_OUTPUT echo "Latest release tag: ${tag}" echo "Without a leading 'v': ${ver}" + shell: bash diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index 7882968990..cdd65f59f1 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -3,6 +3,10 @@ name: Latest release on: workflow_call: inputs: + owner: + type: string + description: Owner of the repo + default: lf-lang repo: type: string description: Repo to find the latest release of @@ -14,9 +18,13 @@ on: ver: description: "The semver of the latest release (without a leading 'v')" value: ${{ jobs.get-latest-release.outputs.ver }} - # Also allow trigging the workflow manually. + workflow_dispatch: inputs: + owner: + type: string + description: Owner of the repo + default: lf-lang repo: type: string description: Repo to find the latest release of @@ -32,7 +40,6 @@ jobs: - name: Check out repository uses: actions/checkout@v3 with: - repository: lf-lang/${{ github.event.inputs.repo || inputs.repo }} + repository: ${{ github.event.inputs.owner || inputs.owner }}/${{ github.event.inputs.repo || inputs.repo }} - id: semver - uses: ./.github/actions/latest-release@master - \ No newline at end of file + uses: lf-lang/lingua-franca/.github/actions/latest-release@ci-stuff From 963baefc4876fdcd3c906fa13fe1402947826ac8 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 18:05:14 -0700 Subject: [PATCH 063/141] Rename executables in bin --- bin/{lfc => lfc-dev} | 0 bin/{lfc.ps1 => lfc-dev.ps1} | 0 bin/{lfd => lfd-dev} | 0 bin/{lfd.ps1 => lfd-dev.ps1} | 0 bin/{lff => lff-dev} | 0 bin/{lff.ps1 => lff-dev.ps1} | 0 util/scripts/launch.sh | 7 +++---- 7 files changed, 3 insertions(+), 4 deletions(-) rename bin/{lfc => lfc-dev} (100%) rename bin/{lfc.ps1 => lfc-dev.ps1} (100%) rename bin/{lfd => lfd-dev} (100%) rename bin/{lfd.ps1 => lfd-dev.ps1} (100%) rename bin/{lff => lff-dev} (100%) rename bin/{lff.ps1 => lff-dev.ps1} (100%) diff --git a/bin/lfc b/bin/lfc-dev similarity index 100% rename from bin/lfc rename to bin/lfc-dev diff --git a/bin/lfc.ps1 b/bin/lfc-dev.ps1 similarity index 100% rename from bin/lfc.ps1 rename to bin/lfc-dev.ps1 diff --git a/bin/lfd b/bin/lfd-dev similarity index 100% rename from bin/lfd rename to bin/lfd-dev diff --git a/bin/lfd.ps1 b/bin/lfd-dev.ps1 similarity index 100% rename from bin/lfd.ps1 rename to bin/lfd-dev.ps1 diff --git a/bin/lff b/bin/lff-dev similarity index 100% rename from bin/lff rename to bin/lff-dev diff --git a/bin/lff.ps1 b/bin/lff-dev.ps1 similarity index 100% rename from bin/lff.ps1 rename to bin/lff-dev.ps1 diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index 5233cb55fb..b5e0f8c03e 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -54,12 +54,11 @@ else fi #============================================================================ - -if [[ "$0" == *lfc ]]; then +if [[ "${0%%-dev}" == *lfc ]]; then tool="lfc" -elif [[ "$0" == *lff ]]; then +elif [[ "${0%%-dev}" == *lff ]]; then tool="lff" -elif [[ "$0" == *lfd ]]; then +elif [[ "${0%%-dev}" == *lfd ]]; then tool="lfd" else known_commands="[lfc, lff, lfd]" From 805c149cf8b1d531a885b7e80c024fa13d37223b Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 18:15:17 -0700 Subject: [PATCH 064/141] Add trailing newline --- util/scripts/launch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh index b5e0f8c03e..5e52051c60 100755 --- a/util/scripts/launch.sh +++ b/util/scripts/launch.sh @@ -74,4 +74,4 @@ gradlew="${base}/gradlew" # Launch the tool. "${gradlew}" --quiet assemble ":cli:${tool}:assemble" -"${base}/build/install/lf-cli/bin/${tool}" "$@" \ No newline at end of file +"${base}/build/install/lf-cli/bin/${tool}" "$@" From 313db97f79e18edced156060f968cb48f87014fd Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 18:35:55 -0700 Subject: [PATCH 065/141] Update CLI tests --- .github/scripts/test-lfc.sh | 6 +++--- .github/scripts/test-lfd.sh | 6 +++--- .github/scripts/test-lff.sh | 16 ++++++++-------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/scripts/test-lfc.sh b/.github/scripts/test-lfc.sh index fe9b6e3757..bc43342e44 100755 --- a/.github/scripts/test-lfc.sh +++ b/.github/scripts/test-lfc.sh @@ -14,7 +14,7 @@ function test_with_links() { foo/bar/baz/link-${1} --help } -bin/lfc test/C/src/Minimal.lf +bin/lfc-dev test/C/src/Minimal.lf -# Ensure that lfc is robust to symbolic links. -test_with_links "lfc" +# Ensure that lfc can be invoked via symbolic links. +test_with_links "lfc-dev" diff --git a/.github/scripts/test-lfd.sh b/.github/scripts/test-lfd.sh index 041daf7029..0f04fcc5b1 100755 --- a/.github/scripts/test-lfd.sh +++ b/.github/scripts/test-lfd.sh @@ -14,7 +14,7 @@ function test_with_links() { foo/bar/baz/link-${1} --help } -bin/lfd test/C/src/Minimal.lf +bin/lfd-dev test/C/src/Minimal.lf -# Ensure that lfd is robust to symbolic links. -test_with_links "lfd" +# Ensure that lfd can be invoked via symbolic links. +test_with_links "lfd-dev" diff --git a/.github/scripts/test-lff.sh b/.github/scripts/test-lff.sh index d98578a39b..273c26b429 100755 --- a/.github/scripts/test-lff.sh +++ b/.github/scripts/test-lff.sh @@ -15,14 +15,14 @@ function test_with_links() { } # just a couple of smoke tests -bin/lff --help -bin/lff --version +bin/lff-dev --help +bin/lff-dev --version -bin/lff -d test/C/src/Minimal.lf -bin/lff --dry-run test/Cpp/src/Minimal.lf +bin/lff-dev -d test/C/src/Minimal.lf +bin/lff-dev --dry-run test/Cpp/src/Minimal.lf -bin/lff -d test/C/src/Minimal.lf -bin/lff --dry-run test/Cpp/src/Minimal.lf +bin/lff-dev -d test/C/src/Minimal.lf +bin/lff-dev --dry-run test/Cpp/src/Minimal.lf -# Ensure that lff is robust to symbolic links. -test_with_links "lff" +# Ensure that lff can be invoked via symbolic links. +test_with_links "lff-dev" From 6b49fa464a44f4cbc7a7edfd6764a525df40452e Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 20:09:56 -0700 Subject: [PATCH 066/141] Fix more filenames --- .github/workflows/cli-tests.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cli-tests.yml b/.github/workflows/cli-tests.yml index 2b718a774d..5312aef33c 100644 --- a/.github/workflows/cli-tests.yml +++ b/.github/workflows/cli-tests.yml @@ -44,24 +44,24 @@ jobs: if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} - name: Test lfc PowerShell script (Windows only) run: | - bin/lfc.ps1 --version - bin/lfc.ps1 test/C/src/Minimal.lf + bin/lfc-dev.ps1 --version + bin/lfc-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lfc.bat --version ./build/install/lf-cli/bin/lfc.bat test/C/src/Minimal.lf if: ${{ runner.os == 'Windows' }} - name: Test lff PowerShell script (Windows only) run: | - bin/lff.ps1 --version - bin/lff.ps1 test/C/src/Minimal.lf + bin/lff-dev-dev.ps1 --version + bin/lff-dev-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lff.bat --version ./build/install/lf-cli/bin/lff.bat test/C/src/Minimal.lf if: ${{ runner.os == 'Windows' }} - name: Test lfd PowerShell script (Windows only) run: | - bin/lfd.ps1 --version - bin/lfd.ps1 test/C/src/Minimal.lf + bin/lfd-dev.ps1 --version + bin/lfd-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lfd.bat --version ./build/install/lf-cli/bin/lfd.bat test/C/src/Minimal.lf From d310df13bdd7fb7da9d18712669a5a083139dec4 Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Wed, 6 Sep 2023 20:42:00 -0700 Subject: [PATCH 067/141] Strip out '-dev', and add trailing space --- util/scripts/launch.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 index 40cd25ba55..9100c75434 100644 --- a/util/scripts/launch.ps1 +++ b/util/scripts/launch.ps1 @@ -13,7 +13,8 @@ $invokerName = [System.IO.Path]::GetFileNameWithoutExtension("$(Split-Path -Path $mainClassTable = @{"lfc" = "org.lflang.cli.Lfc"; "lff" = "org.lflang.cli.Lff"; "lfd" = "org.lflang.cli.Lfd"} $tool = $null foreach ($k in $mainClassTable.Keys) { - if ($invokerName.EndsWith($k)) { + # This replacement is not ideal, but it is kinda analogous to its counterpart in launch.sh. + if ($invokerName.Contains(($k -replace "-dev", ""))) { $tool = $k break } @@ -30,4 +31,4 @@ $gradlew="${base}/gradlew.bat" # invoke script & "${gradlew}" --quiet assemble ":cli:${tool}:assemble" -& "${base}/build/install/lf-cli/bin/${tool}" @args \ No newline at end of file +& "${base}/build/install/lf-cli/bin/${tool}" @args From 3f42c83a51b037abaabc49c91d568dd50c39040b Mon Sep 17 00:00:00 2001 From: i love smoked beef brisket Date: Wed, 6 Sep 2023 20:53:18 -0700 Subject: [PATCH 068/141] Fix broken script names --- .github/workflows/cli-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli-tests.yml b/.github/workflows/cli-tests.yml index 5312aef33c..edcc31b6f8 100644 --- a/.github/workflows/cli-tests.yml +++ b/.github/workflows/cli-tests.yml @@ -52,8 +52,8 @@ jobs: if: ${{ runner.os == 'Windows' }} - name: Test lff PowerShell script (Windows only) run: | - bin/lff-dev-dev.ps1 --version - bin/lff-dev-dev.ps1 test/C/src/Minimal.lf + bin/lff-dev.ps1 --version + bin/lff-dev.ps1 test/C/src/Minimal.lf ./gradlew assemble ./build/install/lf-cli/bin/lff.bat --version ./build/install/lf-cli/bin/lff.bat test/C/src/Minimal.lf From cfa80a298adaa50fe4ab9b49b76ca8d428d1c6dc Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 22:02:48 -0700 Subject: [PATCH 069/141] Set outputs accordingly --- .github/actions/latest-release/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml index 98c51bb900..8d78884008 100644 --- a/.github/actions/latest-release/action.yml +++ b/.github/actions/latest-release/action.yml @@ -1,5 +1,14 @@ name: Latest release description: Report the latest release of the current repo +outputs: + outputs: + ref: + value: ${{ steps.find.outputs.ref }} + description: The latest semver tag + ver: + value: ${{ steps.find.outputs.ver }} + description: The semver corresponding to the latest semver tag + runs: using: "composite" steps: From c99a0f9a88bb21828eb3b1264be79756d9d9baaa Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Wed, 6 Sep 2023 22:14:27 -0700 Subject: [PATCH 070/141] Yaml is not a programming language --- .github/actions/latest-release/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/latest-release/action.yml b/.github/actions/latest-release/action.yml index 8d78884008..910da91c03 100644 --- a/.github/actions/latest-release/action.yml +++ b/.github/actions/latest-release/action.yml @@ -1,7 +1,6 @@ name: Latest release description: Report the latest release of the current repo outputs: - outputs: ref: value: ${{ steps.find.outputs.ref }} description: The latest semver tag From b14e8378e4b9ea42c0d5093e9e3b94aa42aca977 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Thu, 7 Sep 2023 20:49:26 +0900 Subject: [PATCH 071/141] Use "rti" as the hostname of the RTI when it comes to a dockerized federation --- .../java/org/lflang/federated/generator/FedGenerator.java | 8 ++++++++ .../src/docker/federated/DistributedCountContainerized.lf | 2 +- .../federated/DistributedDoublePortContainerized.lf | 2 +- .../docker/federated/DistributedMultiportContainerized.lf | 2 +- .../DistributedStopDecentralizedContainerized.lf | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java index f885daabdf..8c7f190e4a 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java +++ b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java @@ -416,6 +416,14 @@ private void analyzeFederates(Reactor federation, LFGeneratorContext context) { && !federation.getHost().getAddr().equals("localhost")) { rtiConfig.setHost(federation.getHost().getAddr()); } + // If the federation is dockerized, use "rti" as the hostname. + // FIXME: Do we have to check the condition rtiConfig.getHost().equals("localhost")? + // In other words, do we have to preserve the user-specified IP address of the RTI + // when the program is dockerized? + if (rtiConfig.getHost().equals("localhost") + && targetConfig.dockerOptions != null) { + rtiConfig.setHost("rti"); + } // Since federates are always within the main (federated) reactor, // create a list containing just that one containing instantiation. diff --git a/test/C/src/docker/federated/DistributedCountContainerized.lf b/test/C/src/docker/federated/DistributedCountContainerized.lf index d7f5fc2cdb..0c9ae24594 100644 --- a/test/C/src/docker/federated/DistributedCountContainerized.lf +++ b/test/C/src/docker/federated/DistributedCountContainerized.lf @@ -14,7 +14,7 @@ target C { import Count from "../../lib/Count.lf" import Print from "../../federated/DistributedCount.lf" -federated reactor DistributedCountContainerized(offset: time = 200 msec) at rti { +federated reactor DistributedCountContainerized(offset: time = 200 msec) { c = new Count() p = new Print() c.out -> p.in after offset diff --git a/test/C/src/docker/federated/DistributedDoublePortContainerized.lf b/test/C/src/docker/federated/DistributedDoublePortContainerized.lf index c9273862c5..adad1f72b1 100644 --- a/test/C/src/docker/federated/DistributedDoublePortContainerized.lf +++ b/test/C/src/docker/federated/DistributedDoublePortContainerized.lf @@ -15,7 +15,7 @@ import Count from "../../lib/Count.lf" import CountMicrostep from "../../federated/DistributedDoublePort.lf" import Print from "../../federated/DistributedDoublePort.lf" -federated reactor DistributedDoublePortContainerized at rti { +federated reactor DistributedDoublePortContainerized { c = new Count() cm = new CountMicrostep() p = new Print() diff --git a/test/C/src/docker/federated/DistributedMultiportContainerized.lf b/test/C/src/docker/federated/DistributedMultiportContainerized.lf index 6250c105c4..026b6f4f17 100644 --- a/test/C/src/docker/federated/DistributedMultiportContainerized.lf +++ b/test/C/src/docker/federated/DistributedMultiportContainerized.lf @@ -7,7 +7,7 @@ target C { import Source, Destination from "../../federated/DistributedMultiport.lf" -federated reactor DistributedMultiportContainerized at rti { +federated reactor DistributedMultiportContainerized { s = new Source(width=4) d = new Destination(width=4) s.out -> d.in diff --git a/test/C/src/docker/federated/DistributedStopDecentralizedContainerized.lf b/test/C/src/docker/federated/DistributedStopDecentralizedContainerized.lf index 5480a6f06c..0c29c1aec9 100644 --- a/test/C/src/docker/federated/DistributedStopDecentralizedContainerized.lf +++ b/test/C/src/docker/federated/DistributedStopDecentralizedContainerized.lf @@ -10,7 +10,7 @@ target C { import Sender, Receiver from "../../federated/DistributedStop.lf" -federated reactor DistributedStopDecentralizedContainerized at rti { +federated reactor DistributedStopDecentralizedContainerized { sender = new Sender() receiver = new Receiver() sender.out -> receiver.in From 73e660cfc54ed06274e916ebaa1b61a19f438301 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun Date: Thu, 7 Sep 2023 21:00:03 +0900 Subject: [PATCH 072/141] Formatting comments --- .../org/lflang/federated/generator/FedGenerator.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java index 8c7f190e4a..ed9969202c 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java +++ b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java @@ -417,11 +417,10 @@ private void analyzeFederates(Reactor federation, LFGeneratorContext context) { rtiConfig.setHost(federation.getHost().getAddr()); } // If the federation is dockerized, use "rti" as the hostname. - // FIXME: Do we have to check the condition rtiConfig.getHost().equals("localhost")? - // In other words, do we have to preserve the user-specified IP address of the RTI - // when the program is dockerized? - if (rtiConfig.getHost().equals("localhost") - && targetConfig.dockerOptions != null) { + // FIXME: Do we have to check the condition rtiConfig.getHost().equals("localhost")? + // In other words, do we have to preserve the user-specified IP address of the RTI + // when the program is dockerized? + if (rtiConfig.getHost().equals("localhost") && targetConfig.dockerOptions != null) { rtiConfig.setHost("rti"); } From af12fb4c8b4b55b5cfcd7c53cd9684f6ec3be2a4 Mon Sep 17 00:00:00 2001 From: Byeong-gil Jun <78055940+byeong-gil@users.noreply.github.com> Date: Fri, 8 Sep 2023 08:26:44 +0900 Subject: [PATCH 073/141] Update FedGenerator.java --- .../main/java/org/lflang/federated/generator/FedGenerator.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java index ed9969202c..8aca1fec8f 100644 --- a/core/src/main/java/org/lflang/federated/generator/FedGenerator.java +++ b/core/src/main/java/org/lflang/federated/generator/FedGenerator.java @@ -417,9 +417,6 @@ private void analyzeFederates(Reactor federation, LFGeneratorContext context) { rtiConfig.setHost(federation.getHost().getAddr()); } // If the federation is dockerized, use "rti" as the hostname. - // FIXME: Do we have to check the condition rtiConfig.getHost().equals("localhost")? - // In other words, do we have to preserve the user-specified IP address of the RTI - // when the program is dockerized? if (rtiConfig.getHost().equals("localhost") && targetConfig.dockerOptions != null) { rtiConfig.setHost("rti"); } From c3e2d1c9ce656546d262085175da9b4e70a26df0 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Fri, 8 Sep 2023 00:06:07 -0700 Subject: [PATCH 074/141] Update latest-release.yml --- .github/workflows/latest-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/latest-release.yml b/.github/workflows/latest-release.yml index cdd65f59f1..1169ff30ee 100644 --- a/.github/workflows/latest-release.yml +++ b/.github/workflows/latest-release.yml @@ -42,4 +42,4 @@ jobs: with: repository: ${{ github.event.inputs.owner || inputs.owner }}/${{ github.event.inputs.repo || inputs.repo }} - id: semver - uses: lf-lang/lingua-franca/.github/actions/latest-release@ci-stuff + uses: lf-lang/lingua-franca/.github/actions/latest-release@master From 98ece714c8854a4fd64dd3d2aa24fc99e4bcea34 Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Thu, 17 Aug 2023 18:15:57 +0500 Subject: [PATCH 075/141] unconnected multi-port, and bank reactor bug --- .../org/lflang/generator/c/CTriggerObjectsGenerator.java | 7 +++++++ core/src/main/resources/lib/c/reactor-c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java b/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java index 77e7eee22e..8072e514c7 100644 --- a/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java @@ -783,6 +783,9 @@ private static String deferredOutputNumDestinations(ReactorInstance reactor) { } if (output.eventualDestinations().size() == 0) { + // Iteration for unconnected case when + // output port is a multiport + code.startChannelIteration(output); // Dangling output. Still set the source reactor code.pr( "for (int index486184027c8990b = 0; index486184027c8990b < " @@ -814,6 +817,9 @@ private static String deferredInitializeNonNested( CTypes types) { var code = new CodeBuilder(); code.pr("// **** Start non-nested deferred initialize for " + reactor.getFullName()); + // Initialization within a for loop iterating + // over bank members of reactor + code.startScopedBlock(reactor); // Initialize the num_destinations fields of port structs on the self struct. // This needs to be outside the above scoped block because it performs // its own iteration over ranges. @@ -830,6 +836,7 @@ private static String deferredInitializeNonNested( for (ReactorInstance child : reactor.children) { code.pr(deferredInitializeNonNested(child, main, child.reactions, types)); } + code.endScopedBlock(); code.pr("// **** End of non-nested deferred initialize for " + reactor.getFullName()); return code.toString(); } diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 09b75edfdb..809c454db0 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 09b75edfdbfcd0206a89199fcb65b1678398a0c7 +Subproject commit 809c454db07c1b5e03a789a4863137107b817da6 From 8057121c751344a0ab446346a2c78627740005e8 Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Fri, 18 Aug 2023 01:52:39 +0500 Subject: [PATCH 076/141] test file to test multi-port, multi-bank bug --- test/C/src/MultiPort_MultiBankTest.lf | 113 ++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 test/C/src/MultiPort_MultiBankTest.lf diff --git a/test/C/src/MultiPort_MultiBankTest.lf b/test/C/src/MultiPort_MultiBankTest.lf new file mode 100644 index 0000000000..39f5aa3031 --- /dev/null +++ b/test/C/src/MultiPort_MultiBankTest.lf @@ -0,0 +1,113 @@ +target C { + keepalive: true, + workers: 1 +}; + +preamble {= + #define P_FILE FILE * +=} + +reactor adder (bank_index:int(0), n_ports:int(1), log_file:FILE*({=stderr=})) { + input[n_ports] add_request:entry_T; + output[n_ports] add_response:entry_T; + + input[n_ports] result_request:entry_T; + output[n_ports] result_response:entry_T; + + state sum:entry_T(0); + + reaction (startup) {= + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "adder_%d ports:%d " + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->n_ports + ); + =} + + reaction (add_request) -> add_response {= + for (int i = 0; i < add_request_width; ++i) { + if (add_request[i]->is_present) { + int req = add_request[i]->value; + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "adder_%d port:%d " + "received add request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, i, req + ); + self->sum += req; + lf_set (add_response[i], self->sum); + } + } + =} + + reaction (result_request) -> result_response {= + for (int i = 0; i < result_request_width; ++i) { + if (result_request[i]->is_present) { + int req = result_request[i]->value; + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "adder_%d port:%d " + "received query request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, i, req + ); + self->sum += req; + lf_set (result_response[i], self->sum); + } + } + =} +} + +reactor testing_adder (bank_index:int(0), iterations:uint32_t(20), log_file:FILE*({=stderr=})) { + output add_req:int; + output result_req:int; + + input add_resp:int; + input result_resp:int; + + state seed:uint32_t(0); + state request_counter:uint32_t(0); + state response_counter:uint32_t(0); + + timer t(0, 2 sec); + + reaction (startup) {= + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_adder_%d startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index + ); + =} + + reaction (t) -> add_req {= + int number = rand_r(&self->seed) % 100; + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_adder_%d sending add request[%u] number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->request_counter, number + ); + lf_set (add_req, number); + ++self->request_counter; + =} + + reaction (add_resp) {= + int rsp = add_resp->value; + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_adder_%d response[%u] sum:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->response_counter, rsp); + + ++self->response_counter; + if (self->response_counter == self->iterations) { + lf_request_stop(); + } + =} +} + +main reactor MultiPort_MultiBankTest { + test = new [2] testing_adder(iterations = 20); + a = new [2] adder (); + + test.add_req -> a.add_request; + a.add_response -> test.add_resp; +} \ No newline at end of file From 04b9fc3d4e06a7a8687ca493e35ce159596af6f1 Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Fri, 18 Aug 2023 01:58:55 +0500 Subject: [PATCH 077/141] removed unnecessary preamble --- test/C/src/MultiPort_MultiBankTest.lf | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/C/src/MultiPort_MultiBankTest.lf b/test/C/src/MultiPort_MultiBankTest.lf index 39f5aa3031..558d3ae1da 100644 --- a/test/C/src/MultiPort_MultiBankTest.lf +++ b/test/C/src/MultiPort_MultiBankTest.lf @@ -3,10 +3,6 @@ target C { workers: 1 }; -preamble {= - #define P_FILE FILE * -=} - reactor adder (bank_index:int(0), n_ports:int(1), log_file:FILE*({=stderr=})) { input[n_ports] add_request:entry_T; output[n_ports] add_response:entry_T; From 8b4c5ce609d2dcfdd2b645455b033d73511dfb0e Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Wed, 23 Aug 2023 23:43:39 +0500 Subject: [PATCH 078/141] added multi-port and multi-bank tests for unconnected output port --- ...iBankToMultiPort_UnconnectedOutput_Test.lf | 86 ++++++++++++++++++ .../C/src/MultiBank_UnconnectedOutput_Test.lf | 82 +++++++++++++++++ ...t_MultiBankTest_UnconnectedOutput_Test.lf} | 2 +- .../C/src/MultiPort_UnconnectedOutput_Test.lf | 91 +++++++++++++++++++ 4 files changed, 260 insertions(+), 1 deletion(-) create mode 100644 test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf create mode 100644 test/C/src/MultiBank_UnconnectedOutput_Test.lf rename test/C/src/{MultiPort_MultiBankTest.lf => MultiPort_MultiBankTest_UnconnectedOutput_Test.lf} (98%) create mode 100644 test/C/src/MultiPort_UnconnectedOutput_Test.lf diff --git a/test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf b/test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf new file mode 100644 index 0000000000..b3c9ccf679 --- /dev/null +++ b/test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf @@ -0,0 +1,86 @@ +target C { + keepalive: true, + workers: 1 +}; + +reactor echo (n_ports:int(1)) { + input[n_ports] request:entry_T; + output[n_ports] response:entry_T; + + output[n_ports] unconnected:entry_T; + + reaction (startup) {= + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo ports:%d" + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->n_ports + ); + =} + + reaction (request) -> response {= + for (int i = 0; i < request_width; ++i) { + if (request[i]->is_present) { + int req = request[i]->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo port:%d " + "received echo request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + i, req + ); + lf_set (response[i], req + i); + } + } + =} +} + +reactor testing_echo (bank_index:int(0), iterations:uint32_t(20), log_file:FILE*({=stderr=})) { + output req:int; + input resp:int; + + state seed:uint32_t(0); + state request_counter:uint32_t(0); + state response_counter:uint32_t(0); + + timer t(0, 2 sec); + + reaction (startup) {= + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_echo_%d startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index + ); + =} + + reaction (t) -> req {= + int number = rand_r(&self->seed); + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_echo_%d sending echo request[%u] number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->request_counter, number + ); + lf_set (req, number + self->bank_index); + ++self->request_counter; + =} + + reaction (resp) {= + int rsp = resp->value; + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_echo_%d echo response[%u] number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->response_counter, rsp); + + ++self->response_counter; + if (self->response_counter == self->iterations) { + lf_request_stop(); + } + =} +} + +main reactor MultiBankToMultiPort_UnconnectedOutput_Test { + test = new [2] testing_echo(iterations = 20); + e = new echo (n_ports = 2); + + test.req -> e.request; + e.response -> test.resp; +} \ No newline at end of file diff --git a/test/C/src/MultiBank_UnconnectedOutput_Test.lf b/test/C/src/MultiBank_UnconnectedOutput_Test.lf new file mode 100644 index 0000000000..6170299514 --- /dev/null +++ b/test/C/src/MultiBank_UnconnectedOutput_Test.lf @@ -0,0 +1,82 @@ +target C { + keepalive: true, + workers: 1 +}; + +reactor echo (bank_index:int(0)) { + input request:entry_T; + output response:entry_T; + + output unconnected:entry_T; + + reaction (startup) {= + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo_%d " + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index + ); + =} + + reaction (request) -> response {= + int req = request->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo_%d " + "received echo request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, req + ); + lf_set (response, req + self->bank_index); + =} +} + +reactor testing_echo (bank_index:int(0), iterations:uint32_t(20)) { + output req:int; + input resp:int; + + state seed:uint32_t(0); + state request_counter:uint32_t(0); + state response_counter:uint32_t(0); + + timer t(0, 2 sec); + + reaction (startup) {= + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_echo_%d startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index + ); + =} + + reaction (t) -> req {= + int number = rand_r(&self->seed); + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_echo_%d sending echo request[%u] number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->request_counter, number + ); + lf_set (req, number + self->bank_index); + ++self->request_counter; + =} + + reaction (resp) {= + int rsp = resp->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_echo_%d echo response[%u] number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->response_counter, rsp); + + ++self->response_counter; + if (self->response_counter == self->iterations) { + lf_request_stop(); + } + =} +} + +main reactor MultiBank_UnconnectedOutput_Test { + test = new [2] testing_echo(iterations = 20); + e = new [2] echo (); + + test.req -> e.request; + e.response -> test.resp; +} \ No newline at end of file diff --git a/test/C/src/MultiPort_MultiBankTest.lf b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf similarity index 98% rename from test/C/src/MultiPort_MultiBankTest.lf rename to test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf index 558d3ae1da..74813d23af 100644 --- a/test/C/src/MultiPort_MultiBankTest.lf +++ b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf @@ -100,7 +100,7 @@ reactor testing_adder (bank_index:int(0), iterations:uint32_t(20), log_file:FILE =} } -main reactor MultiPort_MultiBankTest { +main reactor MultiPort_MultiBankTest_UnconnectedOutput_Test { test = new [2] testing_adder(iterations = 20); a = new [2] adder (); diff --git a/test/C/src/MultiPort_UnconnectedOutput_Test.lf b/test/C/src/MultiPort_UnconnectedOutput_Test.lf new file mode 100644 index 0000000000..a189ba29a8 --- /dev/null +++ b/test/C/src/MultiPort_UnconnectedOutput_Test.lf @@ -0,0 +1,91 @@ +target C { + keepalive: true, + workers: 1 +}; + +reactor echo (n_ports:int(1)) { + input[n_ports] request:entry_T; + output[n_ports] response:entry_T; + + output[n_ports] unconnected:entry_T; + + reaction (startup) {= + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo ports:%d" + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->n_ports + ); + =} + + reaction (request) -> response {= + for (int i = 0; i < request_width; ++i) { + if (request[i]->is_present) { + int req = request[i]->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo port:%d " + "received echo request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + i, req + ); + lf_set (response[i], req + i); + } + } + =} +} + +reactor testing_echo (n_ports:int(1), iterations:uint32_t(20), log_file:FILE*({=stderr=})) { + output[n_ports] req:int; + input[n_ports] resp:int; + + state seed:uint32_t(0); + state request_counter:uint32_t(0); + state response_counter:uint32_t(0); + + timer t(0, 2 sec); + + reaction (startup) {= + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_echo ports:%d startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->n_ports + ); + =} + + reaction (t) -> req {= + int number = rand_r(&self->seed); + for (int i = 0; i < req_width; ++i) { + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_echo port:%d sending echo request[%u] number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + i, self->request_counter, number + i + ); + lf_set (req[i], number + i); + } + ++self->request_counter; + if (self->request_counter == self->iterations) { + lf_request_stop(); + } + =} + + reaction (resp) {= + for (int i = 0; i < resp_width; ++i) { + if (resp[i]->is_present) { + int rsp = resp[i]->value; + fprintf (self->log_file, "(%lld, %u) physical_time:%lld " + "testing_echo port:%d echo response[%u] new_number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + i, self->response_counter, rsp); + } + } + ++self->response_counter; + =} +} + +main reactor MultiPort_UnconnectedOutput_Test { + test = new testing_echo(n_ports = 2, iterations = 20); + e = new echo (n_ports = 2); + + test.req -> e.request; + e.response -> test.resp; +} \ No newline at end of file From 5e6b7234f93d5073d76268e9f80365fb4ac43dfb Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Thu, 7 Sep 2023 21:01:20 +0500 Subject: [PATCH 079/141] keep the master changes for this multi-port fix --- .../java/org/lflang/generator/c/CTriggerObjectsGenerator.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java b/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java index 8072e514c7..98aec56d80 100644 --- a/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CTriggerObjectsGenerator.java @@ -783,9 +783,6 @@ private static String deferredOutputNumDestinations(ReactorInstance reactor) { } if (output.eventualDestinations().size() == 0) { - // Iteration for unconnected case when - // output port is a multiport - code.startChannelIteration(output); // Dangling output. Still set the source reactor code.pr( "for (int index486184027c8990b = 0; index486184027c8990b < " From 9b9d734cdbcc1ca41af12db1c6c5e5a97f9b719f Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Thu, 7 Sep 2023 21:58:01 +0500 Subject: [PATCH 080/141] test case fixes for PR to go into master --- ...iBankToMultiPort_UnconnectedOutput_Test.lf | 86 ------------------ .../C/src/MultiBank_UnconnectedOutput_Test.lf | 33 ++----- ...rt_MultiBankTest_UnconnectedOutput_Test.lf | 82 +++++------------ .../C/src/MultiPort_UnconnectedOutput_Test.lf | 91 ------------------- 4 files changed, 32 insertions(+), 260 deletions(-) delete mode 100644 test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf delete mode 100644 test/C/src/MultiPort_UnconnectedOutput_Test.lf diff --git a/test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf b/test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf deleted file mode 100644 index b3c9ccf679..0000000000 --- a/test/C/src/MultiBankToMultiPort_UnconnectedOutput_Test.lf +++ /dev/null @@ -1,86 +0,0 @@ -target C { - keepalive: true, - workers: 1 -}; - -reactor echo (n_ports:int(1)) { - input[n_ports] request:entry_T; - output[n_ports] response:entry_T; - - output[n_ports] unconnected:entry_T; - - reaction (startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo ports:%d" - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->n_ports - ); - =} - - reaction (request) -> response {= - for (int i = 0; i < request_width; ++i) { - if (request[i]->is_present) { - int req = request[i]->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo port:%d " - "received echo request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - i, req - ); - lf_set (response[i], req + i); - } - } - =} -} - -reactor testing_echo (bank_index:int(0), iterations:uint32_t(20), log_file:FILE*({=stderr=})) { - output req:int; - input resp:int; - - state seed:uint32_t(0); - state request_counter:uint32_t(0); - state response_counter:uint32_t(0); - - timer t(0, 2 sec); - - reaction (startup) {= - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_echo_%d startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index - ); - =} - - reaction (t) -> req {= - int number = rand_r(&self->seed); - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_echo_%d sending echo request[%u] number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->request_counter, number - ); - lf_set (req, number + self->bank_index); - ++self->request_counter; - =} - - reaction (resp) {= - int rsp = resp->value; - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_echo_%d echo response[%u] number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->response_counter, rsp); - - ++self->response_counter; - if (self->response_counter == self->iterations) { - lf_request_stop(); - } - =} -} - -main reactor MultiBankToMultiPort_UnconnectedOutput_Test { - test = new [2] testing_echo(iterations = 20); - e = new echo (n_ports = 2); - - test.req -> e.request; - e.response -> test.resp; -} \ No newline at end of file diff --git a/test/C/src/MultiBank_UnconnectedOutput_Test.lf b/test/C/src/MultiBank_UnconnectedOutput_Test.lf index 6170299514..e10d4fe3c9 100644 --- a/test/C/src/MultiBank_UnconnectedOutput_Test.lf +++ b/test/C/src/MultiBank_UnconnectedOutput_Test.lf @@ -1,5 +1,4 @@ target C { - keepalive: true, workers: 1 }; @@ -30,51 +29,35 @@ reactor echo (bank_index:int(0)) { =} } -reactor testing_echo (bank_index:int(0), iterations:uint32_t(20)) { +reactor testing_echo (bank_index:int(0)) { output req:int; input resp:int; state seed:uint32_t(0); - state request_counter:uint32_t(0); - state response_counter:uint32_t(0); - timer t(0, 2 sec); - - reaction (startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index - ); - =} - - reaction (t) -> req {= + reaction (startup) -> req {= int number = rand_r(&self->seed); fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d sending echo request[%u] number:%d\n", + "testing_echo_%d sending echo request number:%d\n", lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->request_counter, number + self->bank_index, number ); lf_set (req, number + self->bank_index); - ++self->request_counter; =} reaction (resp) {= int rsp = resp->value; fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d echo response[%u] number:%d\n", + "testing_echo_%d echo response number:%d\n", lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->response_counter, rsp); + self->bank_index, rsp); - ++self->response_counter; - if (self->response_counter == self->iterations) { - lf_request_stop(); - } + lf_request_stop(); =} } main reactor MultiBank_UnconnectedOutput_Test { - test = new [2] testing_echo(iterations = 20); + test = new [2] testing_echo(); e = new [2] echo (); test.req -> e.request; diff --git a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf index 74813d23af..8ebb1da8ce 100644 --- a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf +++ b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf @@ -1,23 +1,21 @@ target C { - keepalive: true, workers: 1 }; -reactor adder (bank_index:int(0), n_ports:int(1), log_file:FILE*({=stderr=})) { +reactor adder (bank_index:int(0), n_ports:int(1)) { input[n_ports] add_request:entry_T; output[n_ports] add_response:entry_T; - input[n_ports] result_request:entry_T; - output[n_ports] result_response:entry_T; + output[n_ports] unconnected:entry_T; state sum:entry_T(0); reaction (startup) {= - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "adder_%d ports:%d " - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->n_ports + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "adder_%d ports:%d " + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->n_ports ); =} @@ -25,36 +23,20 @@ reactor adder (bank_index:int(0), n_ports:int(1), log_file:FILE*({=stde for (int i = 0; i < add_request_width; ++i) { if (add_request[i]->is_present) { int req = add_request[i]->value; - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "adder_%d port:%d " - "received add request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, i, req + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "adder_%d port:%d " + "received add request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, i, req ); self->sum += req; lf_set (add_response[i], self->sum); } } =} - - reaction (result_request) -> result_response {= - for (int i = 0; i < result_request_width; ++i) { - if (result_request[i]->is_present) { - int req = result_request[i]->value; - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "adder_%d port:%d " - "received query request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, i, req - ); - self->sum += req; - lf_set (result_response[i], self->sum); - } - } - =} } -reactor testing_adder (bank_index:int(0), iterations:uint32_t(20), log_file:FILE*({=stderr=})) { +reactor testing_adder (bank_index:int(0)) { output add_req:int; output result_req:int; @@ -62,46 +44,30 @@ reactor testing_adder (bank_index:int(0), iterations:uint32_t(20), log_file:FILE input result_resp:int; state seed:uint32_t(0); - state request_counter:uint32_t(0); - state response_counter:uint32_t(0); - - timer t(0, 2 sec); - reaction (startup) {= - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_adder_%d startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index - ); - =} - - reaction (t) -> add_req {= + reaction (startup) -> add_req {= int number = rand_r(&self->seed) % 100; - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_adder_%d sending add request[%u] number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->request_counter, number + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_adder_%d sending add request number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, number ); lf_set (add_req, number); - ++self->request_counter; =} reaction (add_resp) {= int rsp = add_resp->value; - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_adder_%d response[%u] sum:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->response_counter, rsp); + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_adder_%d response sum:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, rsp); - ++self->response_counter; - if (self->response_counter == self->iterations) { - lf_request_stop(); - } + lf_request_stop(); =} } main reactor MultiPort_MultiBankTest_UnconnectedOutput_Test { - test = new [2] testing_adder(iterations = 20); + test = new [2] testing_adder(); a = new [2] adder (); test.add_req -> a.add_request; diff --git a/test/C/src/MultiPort_UnconnectedOutput_Test.lf b/test/C/src/MultiPort_UnconnectedOutput_Test.lf deleted file mode 100644 index a189ba29a8..0000000000 --- a/test/C/src/MultiPort_UnconnectedOutput_Test.lf +++ /dev/null @@ -1,91 +0,0 @@ -target C { - keepalive: true, - workers: 1 -}; - -reactor echo (n_ports:int(1)) { - input[n_ports] request:entry_T; - output[n_ports] response:entry_T; - - output[n_ports] unconnected:entry_T; - - reaction (startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo ports:%d" - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->n_ports - ); - =} - - reaction (request) -> response {= - for (int i = 0; i < request_width; ++i) { - if (request[i]->is_present) { - int req = request[i]->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo port:%d " - "received echo request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - i, req - ); - lf_set (response[i], req + i); - } - } - =} -} - -reactor testing_echo (n_ports:int(1), iterations:uint32_t(20), log_file:FILE*({=stderr=})) { - output[n_ports] req:int; - input[n_ports] resp:int; - - state seed:uint32_t(0); - state request_counter:uint32_t(0); - state response_counter:uint32_t(0); - - timer t(0, 2 sec); - - reaction (startup) {= - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_echo ports:%d startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->n_ports - ); - =} - - reaction (t) -> req {= - int number = rand_r(&self->seed); - for (int i = 0; i < req_width; ++i) { - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_echo port:%d sending echo request[%u] number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - i, self->request_counter, number + i - ); - lf_set (req[i], number + i); - } - ++self->request_counter; - if (self->request_counter == self->iterations) { - lf_request_stop(); - } - =} - - reaction (resp) {= - for (int i = 0; i < resp_width; ++i) { - if (resp[i]->is_present) { - int rsp = resp[i]->value; - fprintf (self->log_file, "(%lld, %u) physical_time:%lld " - "testing_echo port:%d echo response[%u] new_number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - i, self->response_counter, rsp); - } - } - ++self->response_counter; - =} -} - -main reactor MultiPort_UnconnectedOutput_Test { - test = new testing_echo(n_ports = 2, iterations = 20); - e = new echo (n_ports = 2); - - test.req -> e.request; - e.response -> test.resp; -} \ No newline at end of file From c839b28829be3b025d16a6fc34433eb22648da80 Mon Sep 17 00:00:00 2001 From: Omer Majeed Date: Fri, 8 Sep 2023 15:17:47 +0500 Subject: [PATCH 081/141] merge master branch run time changes --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 809c454db0..09b75edfdb 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 809c454db07c1b5e03a789a4863137107b817da6 +Subproject commit 09b75edfdbfcd0206a89199fcb65b1678398a0c7 From 84db8f28ea627fb1fdf8b46170299dc4ec3d277e Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 8 Sep 2023 12:30:18 +0200 Subject: [PATCH 082/141] Removed util directory and dev scripts can be executed from anywhere --- bin/lfc-dev | 62 ++++++++++++++++++++++++++++++++- bin/lfc-dev.ps1 | 20 +++++++---- bin/lfd-dev | 62 ++++++++++++++++++++++++++++++++- bin/lfd-dev.ps1 | 20 +++++++---- bin/lff-dev | 62 ++++++++++++++++++++++++++++++++- bin/lff-dev.ps1 | 20 +++++++---- util/README.md | 4 --- util/scripts/launch.ps1 | 34 ------------------ util/scripts/launch.sh | 77 ----------------------------------------- 9 files changed, 222 insertions(+), 139 deletions(-) mode change 120000 => 100755 bin/lfc-dev mode change 120000 => 100755 bin/lfd-dev mode change 120000 => 100755 bin/lff-dev delete mode 100644 util/README.md delete mode 100644 util/scripts/launch.ps1 delete mode 100755 util/scripts/launch.sh diff --git a/bin/lfc-dev b/bin/lfc-dev deleted file mode 120000 index 1a3eb8bc0d..0000000000 --- a/bin/lfc-dev +++ /dev/null @@ -1 +0,0 @@ -../util/scripts/launch.sh \ No newline at end of file diff --git a/bin/lfc-dev b/bin/lfc-dev new file mode 100755 index 0000000000..76a9642549 --- /dev/null +++ b/bin/lfc-dev @@ -0,0 +1,61 @@ +#!/bin/bash + +#============================================================================ +# Description: Build and run the Lingua Franca compiler (lfc). +# Authors: Marten Lohstroh +# Christian Menard +# Usage: Usage: lfc-dev [options] files... +#============================================================================ + +#============================================================================ +# Preamble +#============================================================================ + +# Find the directory in which this script resides in a way that is compatible +# with MacOS, which has a `readlink` implementation that does not support the +# necessary `-f` flag to canonicalize by following every symlink in every +# component of the given name recursively. +# This solution, adapted from an example written by Geoff Nixon, is POSIX- +# compliant and robust to symbolic links. If a chain of more than 1000 links +# is encountered, we return. +set -euo pipefail + +find_dir() ( + start_dir=$PWD + cd "$(dirname "$1")" + link=$(readlink "$(basename "$1")") + count=0 + while [ "${link}" ]; do + if [[ "${count}" -lt 1000 ]]; then + cd "$(dirname "${link}")" + link=$(readlink "$(basename "$1")") + ((count++)) + else + return + fi + done + real_path="$PWD/$(basename "$1")" + cd "${start_dir}" + echo `dirname "${real_path}"` +) + +# Report fatal error and exit. +function fatal_error() { + 1>&2 echo -e "\e[31mfatal error: \e[0m$1" + exit 1 +} + +abs_path="$(find_dir "$0")" + +if [[ "${abs_path}" ]]; then + base=`dirname ${abs_path}` +else + fatal_error "Unable to determine absolute path to $0." +fi +#============================================================================ + +gradlew="${base}/gradlew" + +# Launch the tool. +"${gradlew}" --quiet -p "${base}" assemble ":cli:lfc:assemble" +"${base}/build/install/lf-cli/bin/lfc" "$@" diff --git a/bin/lfc-dev.ps1 b/bin/lfc-dev.ps1 index 90e6f9876a..56ecf3ac62 100644 --- a/bin/lfc-dev.ps1 +++ b/bin/lfc-dev.ps1 @@ -1,9 +1,15 @@ -#========================================================== -# Description: Run the lfc compiler. +#============================================================================ +# Description: Build and run the Lingua Franca compiler (lfc). # Authors: Ruomu Xu -# Usage: Usage: lfc [options] files... -#========================================================== +# Christian Menard +# Usage: Usage: lfc-dev [options] files... +#============================================================================ -$launchScript="$PSScriptRoot\..\util\scripts\launch.ps1" -# PS requires spattling: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Splatting?view=powershell-7.2 -. $launchScript @args + +# This script is in $base\bin +$base="$PSScriptRoot\..\" +$gradlew="${base}/gradlew.bat" + +# invoke script +& "${gradlew}" --quiet -p "${base}" assemble ":cli:lfc:assemble" +& "${base}/build/install/lf-cli/bin/lfc" @args diff --git a/bin/lfd-dev b/bin/lfd-dev deleted file mode 120000 index 1a3eb8bc0d..0000000000 --- a/bin/lfd-dev +++ /dev/null @@ -1 +0,0 @@ -../util/scripts/launch.sh \ No newline at end of file diff --git a/bin/lfd-dev b/bin/lfd-dev new file mode 100755 index 0000000000..c154379ac4 --- /dev/null +++ b/bin/lfd-dev @@ -0,0 +1,61 @@ +#!/bin/bash + +#============================================================================ +# Description: Build and run the Lingua Franca diagram generator (lfd). +# Authors: Marten Lohstroh +# Christian Menard +# Usage: Usage: lfd-dev [options] files... +#============================================================================ + +#============================================================================ +# Preamble +#============================================================================ + +# Find the directory in which this script resides in a way that is compatible +# with MacOS, which has a `readlink` implementation that does not support the +# necessary `-f` flag to canonicalize by following every symlink in every +# component of the given name recursively. +# This solution, adapted from an example written by Geoff Nixon, is POSIX- +# compliant and robust to symbolic links. If a chain of more than 1000 links +# is encountered, we return. +set -euo pipefail + +find_dir() ( + start_dir=$PWD + cd "$(dirname "$1")" + link=$(readlink "$(basename "$1")") + count=0 + while [ "${link}" ]; do + if [[ "${count}" -lt 1000 ]]; then + cd "$(dirname "${link}")" + link=$(readlink "$(basename "$1")") + ((count++)) + else + return + fi + done + real_path="$PWD/$(basename "$1")" + cd "${start_dir}" + echo `dirname "${real_path}"` +) + +# Report fatal error and exit. +function fatal_error() { + 1>&2 echo -e "\e[31mfatal error: \e[0m$1" + exit 1 +} + +abs_path="$(find_dir "$0")" + +if [[ "${abs_path}" ]]; then + base=`dirname ${abs_path}` +else + fatal_error "Unable to determine absolute path to $0." +fi +#============================================================================ + +gradlew="${base}/gradlew" + +# Launch the tool. +"${gradlew}" --quiet -p "${base}" assemble ":cli:lfd:assemble" +"${base}/build/install/lf-cli/bin/lfd" "$@" diff --git a/bin/lfd-dev.ps1 b/bin/lfd-dev.ps1 index 54ce9397f4..47d53f0731 100644 --- a/bin/lfd-dev.ps1 +++ b/bin/lfd-dev.ps1 @@ -1,9 +1,15 @@ -#========================================================== -# Description: Run the lff compiler. +#============================================================================ +# Description: Build and run the Lingua Franca diagram generator (lfd). # Authors: Ruomu Xu -# Usage: Usage: lff [options] files... -#========================================================== +# Christian Menard +# Usage: Usage: lfd-dev [options] files... +#============================================================================ -$launchScript="$PSScriptRoot\..\util\scripts\launch.ps1" -# PS requires spattling: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Splatting?view=powershell-7.2 -. $launchScript @args + +# This script is in $base\bin +$base="$PSScriptRoot\..\" +$gradlew="${base}/gradlew.bat" + +# invoke script +& "${gradlew}" --quiet -p "${base}" assemble ":cli:lfd:assemble" +& "${base}/build/install/lf-cli/bin/lfd" @args diff --git a/bin/lff-dev b/bin/lff-dev deleted file mode 120000 index 1a3eb8bc0d..0000000000 --- a/bin/lff-dev +++ /dev/null @@ -1 +0,0 @@ -../util/scripts/launch.sh \ No newline at end of file diff --git a/bin/lff-dev b/bin/lff-dev new file mode 100755 index 0000000000..3a656a8a96 --- /dev/null +++ b/bin/lff-dev @@ -0,0 +1,61 @@ +#!/bin/bash + +#============================================================================ +# Description: Build and run the Lingua Franca code formatter (lff). +# Authors: Marten Lohstroh +# Christian Menard +# Usage: Usage: lff-dev [options] files... +#============================================================================ + +#============================================================================ +# Preamble +#============================================================================ + +# Find the directory in which this script resides in a way that is compatible +# with MacOS, which has a `readlink` implementation that does not support the +# necessary `-f` flag to canonicalize by following every symlink in every +# component of the given name recursively. +# This solution, adapted from an example written by Geoff Nixon, is POSIX- +# compliant and robust to symbolic links. If a chain of more than 1000 links +# is encountered, we return. +set -euo pipefail + +find_dir() ( + start_dir=$PWD + cd "$(dirname "$1")" + link=$(readlink "$(basename "$1")") + count=0 + while [ "${link}" ]; do + if [[ "${count}" -lt 1000 ]]; then + cd "$(dirname "${link}")" + link=$(readlink "$(basename "$1")") + ((count++)) + else + return + fi + done + real_path="$PWD/$(basename "$1")" + cd "${start_dir}" + echo `dirname "${real_path}"` +) + +# Report fatal error and exit. +function fatal_error() { + 1>&2 echo -e "\e[31mfatal error: \e[0m$1" + exit 1 +} + +abs_path="$(find_dir "$0")" + +if [[ "${abs_path}" ]]; then + base=`dirname ${abs_path}` +else + fatal_error "Unable to determine absolute path to $0." +fi +#============================================================================ + +gradlew="${base}/gradlew" + +# Launch the tool. +"${gradlew}" --quiet -p "${base}" assemble ":cli:lff:assemble" +"${base}/build/install/lf-cli/bin/lff" "$@" diff --git a/bin/lff-dev.ps1 b/bin/lff-dev.ps1 index 54ce9397f4..32b7b2171f 100644 --- a/bin/lff-dev.ps1 +++ b/bin/lff-dev.ps1 @@ -1,9 +1,15 @@ -#========================================================== -# Description: Run the lff compiler. +#============================================================================ +# Description: Build and run the Lingua Franca code formatter (lff). # Authors: Ruomu Xu -# Usage: Usage: lff [options] files... -#========================================================== +# Christian Menard +# Usage: Usage: lff-dev [options] files... +#============================================================================ -$launchScript="$PSScriptRoot\..\util\scripts\launch.ps1" -# PS requires spattling: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_Splatting?view=powershell-7.2 -. $launchScript @args + +# This script is in $base\bin +$base="$PSScriptRoot\..\" +$gradlew="${base}/gradlew.bat" + +# invoke script +& "${gradlew}" --quiet -p "${base}" assemble ":cli:lff:assemble" +& "${base}/build/install/lf-cli/bin/lff" @args diff --git a/util/README.md b/util/README.md deleted file mode 100644 index fd95c322f0..0000000000 --- a/util/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## util - -This directory is intended for collecting utility programs associated with Lingua Franca -but that run and install independently of the main tool chain. diff --git a/util/scripts/launch.ps1 b/util/scripts/launch.ps1 deleted file mode 100644 index 9100c75434..0000000000 --- a/util/scripts/launch.ps1 +++ /dev/null @@ -1,34 +0,0 @@ -#========================================================== -# Description: Launch lfc or lff depending on the invoking script. -# Authors: Christian Menard, Peter Donovan, Ruomu Xu -# Usage: Usage: launch args... -# with invoker with name same as the programme to be invoked. -#========================================================== - -# If the invoker is Z:\nkamihara\lf\bin\lfc.ps1, $invokerName will strip out "lfc.ps1" and then get "lfc". -# See https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_automatic_variables?view=powershell-7.2#myinvocation -$invokerPath = $MyInvocation.PSCommandPath -$invokerName = [System.IO.Path]::GetFileNameWithoutExtension("$(Split-Path -Path $invokerPath -Leaf -Resolve)") - -$mainClassTable = @{"lfc" = "org.lflang.cli.Lfc"; "lff" = "org.lflang.cli.Lff"; "lfd" = "org.lflang.cli.Lfd"} -$tool = $null -foreach ($k in $mainClassTable.Keys) { - # This replacement is not ideal, but it is kinda analogous to its counterpart in launch.sh. - if ($invokerName.Contains(($k -replace "-dev", ""))) { - $tool = $k - break - } -} -if ($null -eq $tool) { - throw ("$invokerName is not a known lf command. Known commands are [$($mainClassTable.Keys)]. " + - "In case you use a symbolic or hard link to one of the Lingua Franca " + - "command line tools, make sure that the link's name ends with one of [$($mainClassTable.Keys)]") -} - -# This script is in $base\util\scripts -$base="$PSScriptRoot\..\..\" -$gradlew="${base}/gradlew.bat" - -# invoke script -& "${gradlew}" --quiet assemble ":cli:${tool}:assemble" -& "${base}/build/install/lf-cli/bin/${tool}" @args diff --git a/util/scripts/launch.sh b/util/scripts/launch.sh deleted file mode 100755 index 5e52051c60..0000000000 --- a/util/scripts/launch.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash - -#============================================================================ -# Description: Run the Lingua Franca compiler. -# Authors: Marten Lohstroh -# Christian Menard -# Usage: Usage: lfc [options] files... -#============================================================================ - -#============================================================================ -# Preamble -#============================================================================ - -# Find the directory in which this script resides in a way that is compatible -# with MacOS, which has a `readlink` implementation that does not support the -# necessary `-f` flag to canonicalize by following every symlink in every -# component of the given name recursively. -# This solution, adapted from an example written by Geoff Nixon, is POSIX- -# compliant and robust to symbolic links. If a chain of more than 1000 links -# is encountered, we return. -set -euo pipefail - -find_dir() ( - start_dir=$PWD - cd "$(dirname "$1")" - link=$(readlink "$(basename "$1")") - count=0 - while [ "${link}" ]; do - if [[ "${count}" -lt 1000 ]]; then - cd "$(dirname "${link}")" - link=$(readlink "$(basename "$1")") - ((count++)) - else - return - fi - done - real_path="$PWD/$(basename "$1")" - cd "${start_dir}" - echo `dirname "${real_path}"` -) - -# Report fatal error and exit. -function fatal_error() { - 1>&2 echo -e "\e[1mlfc: \e[31mfatal error: \e[0m$1" - exit 1 -} - -abs_path="$(find_dir "$0")" - -if [[ "${abs_path}" ]]; then - base=`dirname $(dirname ${abs_path})` -else - fatal_error "Unable to determine absolute path to $0." -fi -#============================================================================ - -if [[ "${0%%-dev}" == *lfc ]]; then - tool="lfc" -elif [[ "${0%%-dev}" == *lff ]]; then - tool="lff" -elif [[ "${0%%-dev}" == *lfd ]]; then - tool="lfd" -else - known_commands="[lfc, lff, lfd]" - echo \ - "ERROR: $0 is not a known lf command! Known commands are ${known_commands}. - In case you use a symbolic or hard link to one of the Lingua Franca - command line tools, make sure that the link's name ends with one of - ${known_commands}." - exit 2 -fi - -gradlew="${base}/gradlew" - -# Launch the tool. -"${gradlew}" --quiet assemble ":cli:${tool}:assemble" -"${base}/build/install/lf-cli/bin/${tool}" "$@" From 1b3f505d480762b19d7a80c73d8eb5099630669f Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 8 Sep 2023 13:30:30 +0200 Subject: [PATCH 083/141] fix bug in readlink logic --- bin/lfc-dev | 16 +++++++--------- bin/lfd-dev | 16 +++++++--------- bin/lff-dev | 16 +++++++--------- 3 files changed, 21 insertions(+), 27 deletions(-) diff --git a/bin/lfc-dev b/bin/lfc-dev index 76a9642549..2664248947 100755 --- a/bin/lfc-dev +++ b/bin/lfc-dev @@ -20,7 +20,7 @@ # is encountered, we return. set -euo pipefail -find_dir() ( +find_base_dir() ( start_dir=$PWD cd "$(dirname "$1")" link=$(readlink "$(basename "$1")") @@ -28,15 +28,15 @@ find_dir() ( while [ "${link}" ]; do if [[ "${count}" -lt 1000 ]]; then cd "$(dirname "${link}")" - link=$(readlink "$(basename "$1")") + link=$(readlink "$(basename "${link}")") ((count++)) else return fi done - real_path="$PWD/$(basename "$1")" + real_path="${PWD}" cd "${start_dir}" - echo `dirname "${real_path}"` + echo "$(dirname "${real_path}")" ) # Report fatal error and exit. @@ -45,12 +45,10 @@ function fatal_error() { exit 1 } -abs_path="$(find_dir "$0")" +base="$(find_base_dir "$0")" -if [[ "${abs_path}" ]]; then - base=`dirname ${abs_path}` -else - fatal_error "Unable to determine absolute path to $0." +if [[ -z "${base}" ]]; then + fatal_error "Unable to determine base path of $0." fi #============================================================================ diff --git a/bin/lfd-dev b/bin/lfd-dev index c154379ac4..ddb1e0e69c 100755 --- a/bin/lfd-dev +++ b/bin/lfd-dev @@ -20,7 +20,7 @@ # is encountered, we return. set -euo pipefail -find_dir() ( +find_base_dir() ( start_dir=$PWD cd "$(dirname "$1")" link=$(readlink "$(basename "$1")") @@ -28,15 +28,15 @@ find_dir() ( while [ "${link}" ]; do if [[ "${count}" -lt 1000 ]]; then cd "$(dirname "${link}")" - link=$(readlink "$(basename "$1")") + link=$(readlink "$(basename "${link}")") ((count++)) else return fi done - real_path="$PWD/$(basename "$1")" + real_path="${PWD}" cd "${start_dir}" - echo `dirname "${real_path}"` + echo "$(dirname "${real_path}")" ) # Report fatal error and exit. @@ -45,12 +45,10 @@ function fatal_error() { exit 1 } -abs_path="$(find_dir "$0")" +base="$(find_base_dir "$0")" -if [[ "${abs_path}" ]]; then - base=`dirname ${abs_path}` -else - fatal_error "Unable to determine absolute path to $0." +if [[ -z "${base}" ]]; then + fatal_error "Unable to determine base path of $0." fi #============================================================================ diff --git a/bin/lff-dev b/bin/lff-dev index 3a656a8a96..c0dc83c647 100755 --- a/bin/lff-dev +++ b/bin/lff-dev @@ -20,7 +20,7 @@ # is encountered, we return. set -euo pipefail -find_dir() ( +find_base_dir() ( start_dir=$PWD cd "$(dirname "$1")" link=$(readlink "$(basename "$1")") @@ -28,15 +28,15 @@ find_dir() ( while [ "${link}" ]; do if [[ "${count}" -lt 1000 ]]; then cd "$(dirname "${link}")" - link=$(readlink "$(basename "$1")") + link=$(readlink "$(basename "${link}")") ((count++)) else return fi done - real_path="$PWD/$(basename "$1")" + real_path="${PWD}" cd "${start_dir}" - echo `dirname "${real_path}"` + echo "$(dirname "${real_path}")" ) # Report fatal error and exit. @@ -45,12 +45,10 @@ function fatal_error() { exit 1 } -abs_path="$(find_dir "$0")" +base="$(find_base_dir "$0")" -if [[ "${abs_path}" ]]; then - base=`dirname ${abs_path}` -else - fatal_error "Unable to determine absolute path to $0." +if [[ -z "${base}" ]]; then + fatal_error "Unable to determine base path of $0." fi #============================================================================ From d234236fe238e4f5d5e81175f11d18fd08d214c3 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 8 Sep 2023 14:58:47 +0200 Subject: [PATCH 084/141] test invocation of lf*-dev scripts from another directory --- .github/scripts/test-lfc.sh | 5 +++++ .github/scripts/test-lfd.sh | 5 +++++ .github/scripts/test-lff.sh | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/.github/scripts/test-lfc.sh b/.github/scripts/test-lfc.sh index bc43342e44..27f4807da3 100755 --- a/.github/scripts/test-lfc.sh +++ b/.github/scripts/test-lfc.sh @@ -18,3 +18,8 @@ bin/lfc-dev test/C/src/Minimal.lf # Ensure that lfc can be invoked via symbolic links. test_with_links "lfc-dev" + +# Ensure that lfc can be invoked from outside the root directory. +cd bin +./lfc-dev --help +cd .. diff --git a/.github/scripts/test-lfd.sh b/.github/scripts/test-lfd.sh index 0f04fcc5b1..2ad7ce1108 100755 --- a/.github/scripts/test-lfd.sh +++ b/.github/scripts/test-lfd.sh @@ -18,3 +18,8 @@ bin/lfd-dev test/C/src/Minimal.lf # Ensure that lfd can be invoked via symbolic links. test_with_links "lfd-dev" + +# Ensure that lfd can be invoked from outside the root directory. +cd bin +./lfd-dev --help +cd .. diff --git a/.github/scripts/test-lff.sh b/.github/scripts/test-lff.sh index 273c26b429..11a3d36ceb 100755 --- a/.github/scripts/test-lff.sh +++ b/.github/scripts/test-lff.sh @@ -26,3 +26,8 @@ bin/lff-dev --dry-run test/Cpp/src/Minimal.lf # Ensure that lff can be invoked via symbolic links. test_with_links "lff-dev" + +# Ensure that lfc can be invoked from outside the root directory. +cd bin +./lff-dev --help +cd .. From 90405223e4c1d21cf693eb702dafaaf0ffc73325 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Sun, 10 Sep 2023 23:11:37 -0700 Subject: [PATCH 085/141] Apply formatter --- .../C/src/MultiBank_UnconnectedOutput_Test.lf | 100 +++++++-------- ...rt_MultiBankTest_UnconnectedOutput_Test.lf | 116 +++++++++--------- 2 files changed, 108 insertions(+), 108 deletions(-) diff --git a/test/C/src/MultiBank_UnconnectedOutput_Test.lf b/test/C/src/MultiBank_UnconnectedOutput_Test.lf index e10d4fe3c9..2aedcd2a3c 100644 --- a/test/C/src/MultiBank_UnconnectedOutput_Test.lf +++ b/test/C/src/MultiBank_UnconnectedOutput_Test.lf @@ -1,65 +1,65 @@ target C { - workers: 1 -}; + workers: 1 +} -reactor echo (bank_index:int(0)) { - input request:entry_T; - output response:entry_T; +reactor echo(bank_index: int = 0) { + input request: entry_T + output response: entry_T - output unconnected:entry_T; + output unconnected: entry_T - reaction (startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo_%d " - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index - ); - =} + reaction(startup) {= + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo_%d " + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index + ); + =} - reaction (request) -> response {= - int req = request->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo_%d " - "received echo request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, req - ); - lf_set (response, req + self->bank_index); - =} + reaction(request) -> response {= + int req = request->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "echo_%d " + "received echo request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, req + ); + lf_set (response, req + self->bank_index); + =} } -reactor testing_echo (bank_index:int(0)) { - output req:int; - input resp:int; +reactor testing_echo(bank_index: int = 0) { + output req: int + input resp: int - state seed:uint32_t(0); + state seed: uint32_t = 0 - reaction (startup) -> req {= - int number = rand_r(&self->seed); - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d sending echo request number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, number - ); - lf_set (req, number + self->bank_index); - =} + reaction(startup) -> req {= + int number = rand_r(&self->seed); + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_echo_%d sending echo request number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, number + ); + lf_set (req, number + self->bank_index); + =} - reaction (resp) {= - int rsp = resp->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d echo response number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, rsp); + reaction(resp) {= + int rsp = resp->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_echo_%d echo response number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, rsp); - lf_request_stop(); - =} + lf_request_stop(); + =} } main reactor MultiBank_UnconnectedOutput_Test { - test = new [2] testing_echo(); - e = new [2] echo (); + test = new[2] testing_echo() + e = new[2] echo() - test.req -> e.request; - e.response -> test.resp; -} \ No newline at end of file + test.req -> e.request + e.response -> test.resp +} diff --git a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf index 8ebb1da8ce..23936ec16e 100644 --- a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf +++ b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf @@ -1,75 +1,75 @@ target C { - workers: 1 -}; + workers: 1 +} -reactor adder (bank_index:int(0), n_ports:int(1)) { - input[n_ports] add_request:entry_T; - output[n_ports] add_response:entry_T; +reactor adder(bank_index: int = 0, n_ports: int = 1) { + input[n_ports] add_request: entry_T + output[n_ports] add_response: entry_T - output[n_ports] unconnected:entry_T; + output[n_ports] unconnected: entry_T - state sum:entry_T(0); + state sum: entry_T = 0 - reaction (startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "adder_%d ports:%d " - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->n_ports - ); - =} + reaction(startup) {= + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "adder_%d ports:%d " + "startup\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, self->n_ports + ); + =} - reaction (add_request) -> add_response {= - for (int i = 0; i < add_request_width; ++i) { - if (add_request[i]->is_present) { - int req = add_request[i]->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "adder_%d port:%d " - "received add request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, i, req - ); - self->sum += req; - lf_set (add_response[i], self->sum); - } + reaction(add_request) -> add_response {= + for (int i = 0; i < add_request_width; ++i) { + if (add_request[i]->is_present) { + int req = add_request[i]->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "adder_%d port:%d " + "received add request:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, i, req + ); + self->sum += req; + lf_set (add_response[i], self->sum); } - =} + } + =} } -reactor testing_adder (bank_index:int(0)) { - output add_req:int; - output result_req:int; - - input add_resp:int; - input result_resp:int; +reactor testing_adder(bank_index: int = 0) { + output add_req: int + output result_req: int + + input add_resp: int + input result_resp: int - state seed:uint32_t(0); + state seed: uint32_t = 0 - reaction (startup) -> add_req {= - int number = rand_r(&self->seed) % 100; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_adder_%d sending add request number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, number - ); - lf_set (add_req, number); - =} + reaction(startup) -> add_req {= + int number = rand_r(&self->seed) % 100; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_adder_%d sending add request number:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, number + ); + lf_set (add_req, number); + =} - reaction (add_resp) {= - int rsp = add_resp->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_adder_%d response sum:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, rsp); + reaction(add_resp) {= + int rsp = add_resp->value; + fprintf (stderr, "(%lld, %u) physical_time:%lld " + "testing_adder_%d response sum:%d\n", + lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), + self->bank_index, rsp); - lf_request_stop(); - =} + lf_request_stop(); + =} } main reactor MultiPort_MultiBankTest_UnconnectedOutput_Test { - test = new [2] testing_adder(); - a = new [2] adder (); + test = new[2] testing_adder() + a = new[2] adder() - test.add_req -> a.add_request; - a.add_response -> test.add_resp; -} \ No newline at end of file + test.add_req -> a.add_request + a.add_response -> test.add_resp +} From 331a242537cdc4eb06aa2874fec6bbb25ee17426 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 11 Sep 2023 13:28:56 -0700 Subject: [PATCH 086/141] Simplify unconnected output test --- ...rt_MultiBankTest_UnconnectedOutput_Test.lf | 59 ++++++------------- 1 file changed, 18 insertions(+), 41 deletions(-) diff --git a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf index 23936ec16e..ed1864b906 100644 --- a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf +++ b/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf @@ -2,74 +2,51 @@ target C { workers: 1 } -reactor adder(bank_index: int = 0, n_ports: int = 1) { +reactor adder(n_ports: int = 1) { input[n_ports] add_request: entry_T - output[n_ports] add_response: entry_T + output add_response: entry_T output[n_ports] unconnected: entry_T state sum: entry_T = 0 - reaction(startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "adder_%d ports:%d " - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, self->n_ports - ); - =} - reaction(add_request) -> add_response {= for (int i = 0; i < add_request_width; ++i) { if (add_request[i]->is_present) { - int req = add_request[i]->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "adder_%d port:%d " - "received add request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, i, req - ); - self->sum += req; - lf_set (add_response[i], self->sum); + self->sum += add_request[i]->value; } } + lf_set (add_response, self->sum); + self->sum = 0; =} } -reactor testing_adder(bank_index: int = 0) { +reactor testing_adder(bank_index: int = 0, bank_width: int = 1) { output add_req: int output result_req: int input add_resp: int - input result_resp: int - - state seed: uint32_t = 0 + input unconnected: int reaction(startup) -> add_req {= - int number = rand_r(&self->seed) % 100; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_adder_%d sending add request number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, number - ); - lf_set (add_req, number); + lf_set (add_req, 42); =} reaction(add_resp) {= - int rsp = add_resp->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_adder_%d response sum:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, rsp); - - lf_request_stop(); + int sum = self->bank_width * 42; + int received = add_resp->value; + printf("Bank index: %d, received: %d\n", self->bank_index, received); + if (received != sum) { + printf("Wrong value. Should have been %d.\n", sum); + exit(1); + } =} } main reactor MultiPort_MultiBankTest_UnconnectedOutput_Test { - test = new[2] testing_adder() - a = new[2] adder() + test = new[2] testing_adder(bank_width=2) + a = new adder(n_ports=2) test.add_req -> a.add_request - a.add_response -> test.add_resp + (a.add_response)+ -> test.add_resp } From ee0be68e2a033fa236045ed651b5714db0555f26 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 11 Sep 2023 13:35:31 -0700 Subject: [PATCH 087/141] Move test into multiport directory --- .../MultiPort_MultiBankTest_UnconnectedOutput_Test.lf | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/C/src/{ => multiport}/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf (100%) diff --git a/test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf b/test/C/src/multiport/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf similarity index 100% rename from test/C/src/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf rename to test/C/src/multiport/MultiPort_MultiBankTest_UnconnectedOutput_Test.lf From 0c9d040a1ade5cd6838cde8970f96cc3ddccac5c Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Mon, 11 Sep 2023 13:56:20 -0700 Subject: [PATCH 088/141] Simplify and move second example --- .../C/src/MultiBank_UnconnectedOutput_Test.lf | 65 ------------------- .../MultiBank_UnconnectedOutput_Test.lf | 44 +++++++++++++ 2 files changed, 44 insertions(+), 65 deletions(-) delete mode 100644 test/C/src/MultiBank_UnconnectedOutput_Test.lf create mode 100644 test/C/src/multiport/MultiBank_UnconnectedOutput_Test.lf diff --git a/test/C/src/MultiBank_UnconnectedOutput_Test.lf b/test/C/src/MultiBank_UnconnectedOutput_Test.lf deleted file mode 100644 index 2aedcd2a3c..0000000000 --- a/test/C/src/MultiBank_UnconnectedOutput_Test.lf +++ /dev/null @@ -1,65 +0,0 @@ -target C { - workers: 1 -} - -reactor echo(bank_index: int = 0) { - input request: entry_T - output response: entry_T - - output unconnected: entry_T - - reaction(startup) {= - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo_%d " - "startup\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index - ); - =} - - reaction(request) -> response {= - int req = request->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "echo_%d " - "received echo request:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, req - ); - lf_set (response, req + self->bank_index); - =} -} - -reactor testing_echo(bank_index: int = 0) { - output req: int - input resp: int - - state seed: uint32_t = 0 - - reaction(startup) -> req {= - int number = rand_r(&self->seed); - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d sending echo request number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, number - ); - lf_set (req, number + self->bank_index); - =} - - reaction(resp) {= - int rsp = resp->value; - fprintf (stderr, "(%lld, %u) physical_time:%lld " - "testing_echo_%d echo response number:%d\n", - lf_time_logical_elapsed(), lf_tag().microstep, lf_time_physical_elapsed(), - self->bank_index, rsp); - - lf_request_stop(); - =} -} - -main reactor MultiBank_UnconnectedOutput_Test { - test = new[2] testing_echo() - e = new[2] echo() - - test.req -> e.request - e.response -> test.resp -} diff --git a/test/C/src/multiport/MultiBank_UnconnectedOutput_Test.lf b/test/C/src/multiport/MultiBank_UnconnectedOutput_Test.lf new file mode 100644 index 0000000000..20e79de508 --- /dev/null +++ b/test/C/src/multiport/MultiBank_UnconnectedOutput_Test.lf @@ -0,0 +1,44 @@ +target C { + workers: 1 +} + +reactor echo(bank_index: int = 0) { + input request: entry_T + output response: entry_T + + output unconnected: entry_T + + reaction(request) -> response {= + int req = request->value; + lf_set (response, request->value); + =} +} + +reactor testing_echo(bank_index: int = 0) { + output req: int + input resp: int + + state seed: uint32_t = 0 + + reaction(startup) -> req {= + lf_set (req, 42 + self->bank_index); + =} + + reaction(resp) {= + int sum = self->bank_index + 42; + int received = resp->value; + printf("Bank index: %d, received: %d\n", self->bank_index, received); + if (received != sum) { + printf("Wrong value. Should have been %d.\n", sum); + exit(1); + } + =} +} + +main reactor MultiBank_UnconnectedOutput_Test { + test = new[2] testing_echo() + e = new[2] echo() + + test.req -> e.request + e.response -> test.resp +} From f6d845e1900cb6f957919370db018b194293185b Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:35:44 -0700 Subject: [PATCH 089/141] Update CHANGELOG.md --- CHANGELOG.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dd1e426ca..9c14254321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,47 @@ # Changelog + +## [v0.5.1](https://github.com/lf-lang/lingua-franca/tree/v0.5.1) (2023-09-12) + +**Highlights** + +This release addresses several issues in the C code generator and fixes Docker support for federations. + +**✨ Enhancements** + +- Avoid squeezing reaction, method, or preamble bodies onto a single line [\#1984](https://github.com/lf-lang/lingua-franca/pull/1984) (@petervdonovan) + +**🔧 Fixes** + +- Fix for setting federates' bank index [\#1989](https://github.com/lf-lang/lingua-franca/pull/1989) (@petervdonovan) +- Default hostname for RTI in dockerized federation changed from "localhost" to "rti" [\#1993](https://github.com/lf-lang/lingua-franca/pull/1993) (@byeong-gil) +- Fix for unconnected multiport and bank reactor bug [\#1953](https://github.com/lf-lang/lingua-franca/pull/1953) (@OmerMajNition) + +**🚧 Maintenance and Refactoring** + +- Gradlew not longer used to run dev version of lf cli tools [\#1988](https://github.com/lf-lang/lingua-franca/pull/1988) (@axmmisaka) +- More robust dev scripts and removed util directory [\#1995](https://github.com/lf-lang/lingua-franca/pull/1995) (@cmnrd) + +**🧪 Tests** + +- Tests for `lf_set_array` and persistent inputs [\#1987](https://github.com/lf-lang/lingua-franca/pull/1987) (@edwardalee) +- Minor fixes for C++ tests [\#1979](https://github.com/lf-lang/lingua-franca/pull/1979) (@revol-xut) + + +### Submodule [lf-lang/reactor-c](http://github.com/lf-lang/reactor-c) + +- No Changes + + +### Submodule [lf-lang/reactor-cpp](http://github.com/lf-lang/reactor-cpp) + +- No Changes + + +### Submodule [lf-lang/reactor-rs](http://github.com/lf-lang/reactor-rs) + +- No Changes + + ## [v0.5.0](https://github.com/lf-lang/lingua-franca/tree/v0.5.0) (2023-08-30) From 2f47d64b8ee29a0b0463b918bf31e9624435934f Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:38:06 -0700 Subject: [PATCH 090/141] Bump version to 0.5.1 --- CHANGELOG.md | 2 +- core/src/main/resources/org/lflang/StringsBundle.properties | 2 +- gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c14254321..2a0b9d9b58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog - + ## [v0.5.1](https://github.com/lf-lang/lingua-franca/tree/v0.5.1) (2023-09-12) **Highlights** diff --git a/core/src/main/resources/org/lflang/StringsBundle.properties b/core/src/main/resources/org/lflang/StringsBundle.properties index dc4f99684f..75eb042e79 100644 --- a/core/src/main/resources/org/lflang/StringsBundle.properties +++ b/core/src/main/resources/org/lflang/StringsBundle.properties @@ -1 +1 @@ -VERSION = 0.5.1-SNAPSHOT +VERSION = 0.5.1 diff --git a/gradle.properties b/gradle.properties index 245b5cb0ba..4b08da69cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ [header] group=org.lflang -version=0.5.1-SNAPSHOT +version=0.5.1 [versions] antlrVersion=4.7.2 From d1d1e03cb8db5de7eb399ba6a3353dce0f62d4cb Mon Sep 17 00:00:00 2001 From: "lingua-franca[bot]" <97201490+francabot@users.noreply.github.com> Date: Tue, 12 Sep 2023 21:43:44 -0700 Subject: [PATCH 091/141] Bump version to 0.5.2-SNAPSHOT --- core/src/main/resources/org/lflang/StringsBundle.properties | 2 +- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/resources/org/lflang/StringsBundle.properties b/core/src/main/resources/org/lflang/StringsBundle.properties index 75eb042e79..a84b5b44f1 100644 --- a/core/src/main/resources/org/lflang/StringsBundle.properties +++ b/core/src/main/resources/org/lflang/StringsBundle.properties @@ -1 +1 @@ -VERSION = 0.5.1 +VERSION = 0.5.2-SNAPSHOT diff --git a/gradle.properties b/gradle.properties index 4b08da69cb..4b062644e0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ [header] group=org.lflang -version=0.5.1 +version=0.5.2-SNAPSHOT [versions] antlrVersion=4.7.2 From ddf67f33ad09ae1813b108d4ce00003239e5ffd7 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Tue, 12 Sep 2023 23:14:52 -0700 Subject: [PATCH 092/141] Updated reactor-c submodule --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 09b75edfdb..9760f233d4 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 09b75edfdbfcd0206a89199fcb65b1678398a0c7 +Subproject commit 9760f233d4b1d2653e61c7feb7e3e1379d6e8344 From c68a5b2fd7cffe17d2a896513a5dd266880e226c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 13 Sep 2023 15:44:10 +0200 Subject: [PATCH 093/141] Add bracket list expression --- .../main/java/org/lflang/LinguaFranca.xtext | 8 ++++++++ core/src/main/java/org/lflang/Target.java | 5 +++++ .../src/main/java/org/lflang/ast/IsEqual.java | 8 ++++++++ core/src/main/java/org/lflang/ast/ToLf.java | 10 ++++++++++ core/src/main/java/org/lflang/ast/ToText.java | 6 ++++++ .../lflang/generator/LfExpressionVisitor.java | 19 +++++++++++++++++++ .../org/lflang/generator/TargetTypes.java | 11 +++++++++++ .../org/lflang/validation/LFValidator.java | 10 ++++++++++ 8 files changed, 77 insertions(+) diff --git a/core/src/main/java/org/lflang/LinguaFranca.xtext b/core/src/main/java/org/lflang/LinguaFranca.xtext index b00456ce07..593b06317e 100644 --- a/core/src/main/java/org/lflang/LinguaFranca.xtext +++ b/core/src/main/java/org/lflang/LinguaFranca.xtext @@ -320,6 +320,7 @@ Expression: | ParameterReference | {CodeExpr} code=Code | BracedListExpression + | BracketListExpression ; // A list of expressions within braces. @@ -328,6 +329,13 @@ BracedListExpression: '{' {BracedListExpression} (items+=Expression (',' items+=Expression)*)? ','? '}' ; +// A list of expressions within square brackets. +// In Python and TS, this is a list literal. In Rust this could be an array but Rust +// array expressions are relatively rare so probably not worth supporting. +BracketListExpression: + '[' {BracketListExpression} (items+=Expression (',' items+=Expression)*)? ','? ']' +; + ParameterReference: parameter=[Parameter] ; diff --git a/core/src/main/java/org/lflang/Target.java b/core/src/main/java/org/lflang/Target.java index 096788484e..8dc820f826 100644 --- a/core/src/main/java/org/lflang/Target.java +++ b/core/src/main/java/org/lflang/Target.java @@ -524,6 +524,11 @@ public boolean allowsBracedListExpressions() { return this == C || this == CCPP || this == CPP; } + /** Allow expressions of the form {@code [a, b, c]}. */ + public boolean allowsBracketListExpressions() { + return this == Python || this == TS || this == Rust; + } + /** Return a string that demarcates the beginning of a single-line comment. */ public String getSingleLineCommentPrefix() { return this.equals(Target.Python) ? "#" : "//"; diff --git a/core/src/main/java/org/lflang/ast/IsEqual.java b/core/src/main/java/org/lflang/ast/IsEqual.java index af06923d35..9ac2a0a389 100644 --- a/core/src/main/java/org/lflang/ast/IsEqual.java +++ b/core/src/main/java/org/lflang/ast/IsEqual.java @@ -16,6 +16,7 @@ import org.lflang.lf.AttrParm; import org.lflang.lf.Attribute; import org.lflang.lf.BracedListExpression; +import org.lflang.lf.BracketListExpression; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; @@ -465,6 +466,13 @@ public Boolean caseBracedListExpression(BracedListExpression object) { .conclusion; } + @Override + public Boolean caseBracketListExpression(BracketListExpression object) { + return new ComparisonMachine<>(object, BracketListExpression.class) + .listsEquivalent(BracketListExpression::getItems) + .conclusion; + } + @Override public Boolean caseParameterReference(ParameterReference object) { return new ComparisonMachine<>(object, ParameterReference.class) diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index b91ea5499c..149b9211a3 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -30,6 +30,7 @@ import org.lflang.lf.AttrParm; import org.lflang.lf.Attribute; import org.lflang.lf.BracedListExpression; +import org.lflang.lf.BracketListExpression; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; @@ -873,6 +874,15 @@ public MalleableString caseBracedListExpression(BracedListExpression object) { return bracedListExpression(object.getItems()); } + + @Override + public MalleableString caseBracketListExpression(BracketListExpression object) { + if (object.getItems().isEmpty()) { + return MalleableString.anyOf("[]"); + } + return list(", ", "[", "]", false, false, true, object.getItems()); + } + /** * Represent a braced list expression. Do not invoke on expressions that may have comments * attached. diff --git a/core/src/main/java/org/lflang/ast/ToText.java b/core/src/main/java/org/lflang/ast/ToText.java index 6845fde4e7..515eb29fe5 100644 --- a/core/src/main/java/org/lflang/ast/ToText.java +++ b/core/src/main/java/org/lflang/ast/ToText.java @@ -6,6 +6,7 @@ import org.eclipse.xtext.nodemodel.util.NodeModelUtils; import org.lflang.lf.ArraySpec; import org.lflang.lf.BracedListExpression; +import org.lflang.lf.BracketListExpression; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; import org.lflang.lf.Host; @@ -80,6 +81,11 @@ public String caseBracedListExpression(BracedListExpression object) { return new ToLf().caseBracedListExpression(object).toString(); } + @Override + public String caseBracketListExpression(BracketListExpression object) { + return new ToLf().caseBracketListExpression(object).toString(); + } + @Override public String caseHost(Host host) { return new ToLf().caseHost(host).toString(); diff --git a/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java b/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java index 15f0e8ddad..e5b669b6f2 100644 --- a/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java +++ b/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java @@ -25,6 +25,7 @@ package org.lflang.generator; import org.lflang.lf.BracedListExpression; +import org.lflang.lf.BracketListExpression; import org.lflang.lf.Code; import org.lflang.lf.CodeExpr; import org.lflang.lf.Expression; @@ -43,6 +44,7 @@ public interface LfExpressionVisitor { R visitLiteral(Literal expr, P param); R visitBracedListExpr(BracedListExpression expr, P param); + R visitBracketListExpr(BracketListExpression expr, P param); R visitTimeLiteral(Time expr, P param); @@ -66,6 +68,8 @@ static R dispatch( return visitor.visitLiteral((Literal) e, arg); } else if (e instanceof BracedListExpression) { return visitor.visitBracedListExpr((BracedListExpression) e, arg); + } else if (e instanceof BracketListExpression) { + return visitor.visitBracketListExpr((BracketListExpression) e, arg); } else if (e instanceof Time) { return visitor.visitTimeLiteral((Time) e, arg); } else if (e instanceof CodeExpr) { @@ -106,6 +110,11 @@ public R visitCodeExpr(CodeExpr expr, P param) { public R visitParameterRef(ParameterReference expr, P param) { return visitExpression(expr, param); } + + @Override + public R visitBracketListExpr(BracketListExpression expr, P param) { + return visitExpression(expr, param); + } } /** @@ -147,6 +156,16 @@ public Expression visitParameterRef(ParameterReference expr, P param) { return clone; } + @Override + public Expression visitBracketListExpr(BracketListExpression expr, P param) { + BracketListExpression clone = LfFactory.eINSTANCE.createBracketListExpression(); + for (Expression item : expr.getItems()) { + clone.getItems().add(dispatch(item, param, this)); + } + return clone; + + } + @Override public Expression visitCodeExpr(CodeExpr expr, P param) { CodeExpr codeExpr = LfFactory.eINSTANCE.createCodeExpr(); diff --git a/core/src/main/java/org/lflang/generator/TargetTypes.java b/core/src/main/java/org/lflang/generator/TargetTypes.java index 968a641ed3..65552edc59 100644 --- a/core/src/main/java/org/lflang/generator/TargetTypes.java +++ b/core/src/main/java/org/lflang/generator/TargetTypes.java @@ -8,6 +8,7 @@ import org.lflang.ast.ASTUtils; import org.lflang.lf.Action; import org.lflang.lf.BracedListExpression; +import org.lflang.lf.BracketListExpression; import org.lflang.lf.CodeExpr; import org.lflang.lf.Expression; import org.lflang.lf.Initializer; @@ -60,6 +61,14 @@ default String getTargetBracedListExpr(BracedListExpression expr, InferredType t .collect(Collectors.joining(",", "{", "}")); } + /** Translate the bracket list expression into target language syntax. */ + default String getTargetBracketListExpr(BracketListExpression expr, InferredType typeOrNull) { + InferredType t = typeOrNull == null ? InferredType.undefined() : typeOrNull; + return expr.getItems().stream() + .map(e -> getTargetExpr(e, t)) + .collect(Collectors.joining(", ", "[", "]")); + } + /** Return an "unknown" type which is used as a default when a type cannot be inferred. */ String getTargetUndefinedType(); @@ -224,6 +233,8 @@ default String getTargetExpr(Expression expr, InferredType type) { return ASTUtils.toText(((CodeExpr) expr).getCode()); } else if (expr instanceof BracedListExpression) { return getTargetBracedListExpr((BracedListExpression) expr, type); + } else if (expr instanceof BracketListExpression) { + return getTargetBracketListExpr((BracketListExpression) expr, type); } else { throw new IllegalStateException("Invalid value " + expr); } diff --git a/core/src/main/java/org/lflang/validation/LFValidator.java b/core/src/main/java/org/lflang/validation/LFValidator.java index 7dcf00d107..755d28a42b 100644 --- a/core/src/main/java/org/lflang/validation/LFValidator.java +++ b/core/src/main/java/org/lflang/validation/LFValidator.java @@ -72,6 +72,7 @@ import org.lflang.lf.Assignment; import org.lflang.lf.Attribute; import org.lflang.lf.BracedListExpression; +import org.lflang.lf.BracketListExpression; import org.lflang.lf.BuiltinTrigger; import org.lflang.lf.BuiltinTriggerRef; import org.lflang.lf.Connection; @@ -193,6 +194,15 @@ public void checkBracedExpression(BracedListExpression expr) { } } + @Check(CheckType.FAST) + public void checkBracketExpression(BracketListExpression expr) { + if (!target.allowsBracketListExpressions()) { + var message = + "Bracketed expression lists are not a valid expression for the " + target + " target."; + error(message, Literals.BRACKET_LIST_EXPRESSION.eContainmentFeature()); + } + } + @Check(CheckType.FAST) public void checkAssignment(Assignment assignment) { From 2bb8212be4411485d2c0891636ff71acdf898a2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 13 Sep 2023 15:46:41 +0200 Subject: [PATCH 094/141] Update tests --- .../src/modal_models/util/TraceTesting.lf | 4 +-- test/Rust/src/ArrayAsParameter.lf | 36 +++++++++++++++++++ test/TypeScript/src/ArrayAsParameter.lf | 4 +-- test/TypeScript/src/MovingAverage.lf | 2 +- 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 test/Rust/src/ArrayAsParameter.lf diff --git a/test/Python/src/modal_models/util/TraceTesting.lf b/test/Python/src/modal_models/util/TraceTesting.lf index 0d5053b844..4bad50cd26 100644 --- a/test/Python/src/modal_models/util/TraceTesting.lf +++ b/test/Python/src/modal_models/util/TraceTesting.lf @@ -1,12 +1,12 @@ /** Utility reactor to record and test execution traces. */ target Python -reactor TraceTesting(events_size=0, trace = {= [] =}, training=False) { +reactor TraceTesting(events_size=0, trace = [], training=False) { input[events_size] events state last_reaction_time = 0 state trace_idx = 0 - state recorded_events = {= [] =} + state recorded_events = [] state recorded_events_next = 0 reaction(startup) {= diff --git a/test/Rust/src/ArrayAsParameter.lf b/test/Rust/src/ArrayAsParameter.lf new file mode 100644 index 0000000000..2692512273 --- /dev/null +++ b/test/Rust/src/ArrayAsParameter.lf @@ -0,0 +1,36 @@ +// Source has an array as a parameter, the elements of which it passes to Print. +target Rust + +reactor Source(sequence: {= [i32; 3] =} = [0, 1, 2]) { + output out: i32 + state count: usize = 0 + state seq = sequence + logical action next + + reaction(startup, next) -> out, next {= + ctx.set(out, self.seq[self.count]); + self.count += 1; + if self.count < self.seq.len() { + ctx.schedule(next, Asap); + } + =} +} + +reactor Print { + input x: i32 + state count: usize = 0 + + reaction(x) {= + let expected = [2, 3, 4]; + let x = ctx.get(x).unwrap(); + println!("Received: {}.", x); + assert_eq!(x, expected[self.count]); + self.count += 1; + =} +} + +main reactor ArrayAsParameter { + s = new Source(sequence = [2, 3, 4]) + p = new Print() + s.out -> p.x +} diff --git a/test/TypeScript/src/ArrayAsParameter.lf b/test/TypeScript/src/ArrayAsParameter.lf index ef9ba9f414..10ef7a5c32 100644 --- a/test/TypeScript/src/ArrayAsParameter.lf +++ b/test/TypeScript/src/ArrayAsParameter.lf @@ -1,7 +1,7 @@ // Source has an array as a parameter, the elements of which it passes to Print. target TypeScript -reactor Source(sequence: {= Array =} = {= [0, 1, 2] =}) { +reactor Source(sequence: Array = [0, 1, 2]) { output out: number state count: number = 0 logical action next @@ -29,7 +29,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence = {= [1, 2, 3, 4] =}) + s = new Source(sequence = [1, 2, 3, 4]) p = new Print() s.out -> p.x } diff --git a/test/TypeScript/src/MovingAverage.lf b/test/TypeScript/src/MovingAverage.lf index f99e436ab7..dfe550f612 100644 --- a/test/TypeScript/src/MovingAverage.lf +++ b/test/TypeScript/src/MovingAverage.lf @@ -17,7 +17,7 @@ reactor Source { } reactor MovingAverageImpl { - state delay_line: {= Array =} = {= [0.0, 0.0, 0.0] =} + state delay_line: Array = [0.0, 0.0, 0.0] state index: number = 0 input x: number output out: number From aac3c487e6bd335c5de97dd0fd51946bf4479871 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 13 Sep 2023 15:58:16 +0200 Subject: [PATCH 095/141] Enable the spotbugs plugin --- buildSrc/build.gradle | 2 ++ buildSrc/gradle.properties | 3 ++- .../groovy/org.lflang.java-conventions.gradle | 9 +++++++++ config/spotbugs/exclude.xml | 20 +++++++++++++++++++ gradle.properties | 1 + 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 config/spotbugs/exclude.xml diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index db34ac5c23..7c2d942ef8 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -13,6 +13,8 @@ dependencies { // https://mvnrepository.com/artifact/com.diffplug.spotless/spotless-lib-extra implementation group: 'com.diffplug.spotless', name: 'spotless-lib-extra', version: spotlessLibVersion + implementation group: 'com.github.spotbugs.snom', name: 'spotbugs-gradle-plugin', version: spotbugsPluginVersion + implementation "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" implementation "com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion" diff --git a/buildSrc/gradle.properties b/buildSrc/gradle.properties index 217c42b57c..a8cd2581d4 100644 --- a/buildSrc/gradle.properties +++ b/buildSrc/gradle.properties @@ -2,4 +2,5 @@ spotlessVersion=6.11.0 spotlessLibVersion=2.30.0 kotlinVersion=1.6.21 -shadowJarVersion=7.1.2 \ No newline at end of file +shadowJarVersion=7.1.2 +spotbugsPluginVersion=5.1.3 \ No newline at end of file diff --git a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle index 9fc4fa50f9..d5697d312c 100644 --- a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle +++ b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle @@ -2,6 +2,7 @@ plugins { id 'java' id 'com.diffplug.spotless' id 'org.lflang.platform' + id 'com.github.spotbugs' } repositories { @@ -19,6 +20,14 @@ spotless { } } +spotbugs { + toolVersion = spotbugsToolVersion + excludeFilter.set( + rootProject.file('config/spotbugs/exclude.xml') + ) +} + + configurations.all { resolutionStrategy { dependencySubstitution { diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml new file mode 100644 index 0000000000..fdd333f455 --- /dev/null +++ b/config/spotbugs/exclude.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/gradle.properties b/gradle.properties index 4b062644e0..636741363c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,7 @@ xtextVersion=2.31.0 klighdVersion=2.3.0.v20230606 freehepVersion=2.4 swtVersion=3.124.0 +spotbugsToolVersion=4.7.3 [manifestPropertyNames] org.eclipse.xtext=xtextVersion From 82dd4d64fd50038f0a414a333e3e8632dd4de8c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Wed, 13 Sep 2023 16:32:57 +0200 Subject: [PATCH 096/141] Format --- test/Python/src/modal_models/util/TraceTesting.lf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Python/src/modal_models/util/TraceTesting.lf b/test/Python/src/modal_models/util/TraceTesting.lf index 4bad50cd26..027b1ccb19 100644 --- a/test/Python/src/modal_models/util/TraceTesting.lf +++ b/test/Python/src/modal_models/util/TraceTesting.lf @@ -1,7 +1,7 @@ /** Utility reactor to record and test execution traces. */ target Python -reactor TraceTesting(events_size=0, trace = [], training=False) { +reactor TraceTesting(events_size=0, trace=[], training=False) { input[events_size] events state last_reaction_time = 0 From 9ea0a85beaf7446319133560fd02b088b1bc0d91 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 14:56:32 +0200 Subject: [PATCH 097/141] treat spotbugs issues as warnings, not errors --- buildSrc/src/main/groovy/org.lflang.java-conventions.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle index d5697d312c..8730fcf7b7 100644 --- a/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle +++ b/buildSrc/src/main/groovy/org.lflang.java-conventions.gradle @@ -25,6 +25,7 @@ spotbugs { excludeFilter.set( rootProject.file('config/spotbugs/exclude.xml') ) + ignoreFailures = true } From 1662f32c72a4c3869fda52493bf08003ca890ad4 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 09:54:51 +0200 Subject: [PATCH 098/141] fix spotbugs warnings in integration tests --- .../org/lflang/tests/lsp/ErrorInserter.java | 23 ++++++++++++------- .../java/org/lflang/tests/lsp/LspTests.java | 2 +- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/core/src/integrationTest/java/org/lflang/tests/lsp/ErrorInserter.java b/core/src/integrationTest/java/org/lflang/tests/lsp/ErrorInserter.java index a1948821eb..13b10156e2 100644 --- a/core/src/integrationTest/java/org/lflang/tests/lsp/ErrorInserter.java +++ b/core/src/integrationTest/java/org/lflang/tests/lsp/ErrorInserter.java @@ -4,14 +4,11 @@ import java.io.Closeable; import java.io.IOException; import java.io.PrintWriter; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.Random; +import java.nio.file.Paths; +import java.util.*; import java.util.function.BiFunction; import java.util.function.BiPredicate; import java.util.function.Function; @@ -125,7 +122,7 @@ public void write() throws IOException { if (!src.toFile().renameTo(swapFile(src).toFile())) { throw new IOException("Failed to create a swap file."); } - try (PrintWriter writer = new PrintWriter(src.toFile())) { + try (PrintWriter writer = new PrintWriter(src.toFile(), StandardCharsets.UTF_8)) { lines.forEach(writer::println); } } @@ -233,7 +230,13 @@ private void alter(BiFunction, String, Boolean> alterer) { /** Return the swap file associated with {@code f}. */ private static Path swapFile(Path p) { - return p.getParent().resolve("." + p.getFileName() + ".swp"); + final var parent = p.getParent(); + final var swpName = "." + p.getFileName() + ".swp"; + if (parent == null) { + return Paths.get(swpName); + } else { + return parent.resolve(swpName); + } } } @@ -265,6 +268,10 @@ public boolean hasNext() { @Override public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + T ret = current.item; current = current.previous; return ret; diff --git a/core/src/integrationTest/java/org/lflang/tests/lsp/LspTests.java b/core/src/integrationTest/java/org/lflang/tests/lsp/LspTests.java index 9270d9ea82..964963bd0e 100644 --- a/core/src/integrationTest/java/org/lflang/tests/lsp/LspTests.java +++ b/core/src/integrationTest/java/org/lflang/tests/lsp/LspTests.java @@ -91,7 +91,7 @@ void typescriptValidationTest() throws IOException { */ private void targetLanguageValidationTest(Target target, ErrorInserter.Builder builder) throws IOException { - long seed = new Random().nextLong(); + long seed = System.nanoTime(); System.out.printf( "Running validation tests for %s with random seed %d.%n", target.getDisplayName(), seed); Random random = new Random(seed); From 083f288fec12c08395439d5b8c3bab2fdce1e777 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 10:45:06 +0200 Subject: [PATCH 099/141] make TestError immutable --- .../java/org/lflang/tests/LFTest.java | 4 ++-- .../java/org/lflang/tests/TestError.java | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/core/src/testFixtures/java/org/lflang/tests/LFTest.java b/core/src/testFixtures/java/org/lflang/tests/LFTest.java index ee67dcbb96..702f8cf4af 100644 --- a/core/src/testFixtures/java/org/lflang/tests/LFTest.java +++ b/core/src/testFixtures/java/org/lflang/tests/LFTest.java @@ -165,9 +165,9 @@ public void handleTestError(TestError e) { if (e.getMessage() != null) { issues.append(e.getMessage()); } - if (e.getException() != null) { + if (e.causeIsException()) { issues.append(System.lineSeparator()); - issues.append(TestBase.stackTraceToString(e.getException())); + issues.append(e.getOriginalStackTrace()); } } diff --git a/core/src/testFixtures/java/org/lflang/tests/TestError.java b/core/src/testFixtures/java/org/lflang/tests/TestError.java index efb7d50048..fa22da447e 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestError.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestError.java @@ -5,12 +5,14 @@ /// Indicates an error during test execution public class TestError extends Exception { - private Throwable exception; - private Result result; + private final String stackTrace; + private final Result result; public TestError(String errorMessage, Result result, Throwable exception) { super(errorMessage); - this.exception = exception; + assert result != null; + + this.stackTrace = exception == null ? null : TestBase.stackTraceToString(exception); this.result = result; } @@ -26,7 +28,13 @@ public Result getResult() { return result; } - public Throwable getException() { - return exception; + /// Return true, if the TestError instance was created based on an exception. + public boolean causeIsException() { + return stackTrace != null; + } + + /// Retrieve the stack trace of the exception that caused the test error. + public String getOriginalStackTrace() { + return stackTrace; } } From 9ce13531e7bee266fa499e80f8cb8c0f6877c814 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 10:55:13 +0200 Subject: [PATCH 100/141] fix spotbugs warnings in cli test fixtures --- .../java/org/lflang/cli/CliToolTestFixture.java | 15 ++++++++++----- .../java/org/lflang/cli/TestUtils.java | 5 ++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cli/base/src/testFixtures/java/org/lflang/cli/CliToolTestFixture.java b/cli/base/src/testFixtures/java/org/lflang/cli/CliToolTestFixture.java index eab8f1aa9c..0950ad0098 100644 --- a/cli/base/src/testFixtures/java/org/lflang/cli/CliToolTestFixture.java +++ b/cli/base/src/testFixtures/java/org/lflang/cli/CliToolTestFixture.java @@ -31,6 +31,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import org.hamcrest.Matcher; import org.opentest4j.AssertionFailedError; @@ -66,7 +67,11 @@ public ExecutionResult run(Path wd, String... args) { ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream err = new ByteArrayOutputStream(); - Io testIo = new Io(new PrintStream(err), new PrintStream(out), wd); + Io testIo = + new Io( + new PrintStream(err, false, StandardCharsets.UTF_8), + new PrintStream(out, false, StandardCharsets.UTF_8), + wd); int exitCode = testIo.fakeSystemExit(io -> runCliProgram(io, args)); return new ExecutionResult(out, err, exitCode); @@ -82,11 +87,11 @@ public ExecutionResult run(Path wd, String... args) { record ExecutionResult(ByteArrayOutputStream out, ByteArrayOutputStream err, int exitCode) { public String getOut() { - return out.toString(); + return out.toString(StandardCharsets.UTF_8); } public String getErr() { - return err.toString(); + return err.toString(StandardCharsets.UTF_8); } public void checkOk() { @@ -117,9 +122,9 @@ public void verify(ThrowingConsumer actions) { System.out.println("TEST FAILED"); System.out.println("> Return code: " + exitCode); System.out.println("> Standard output -------------------------"); - System.err.println(out.toString()); + System.err.println(out.toString(StandardCharsets.UTF_8)); System.out.println("> Standard error --------------------------"); - System.err.println(err.toString()); + System.err.println(err.toString(StandardCharsets.UTF_8)); System.out.println("> -----------------------------------------"); if (e instanceof Exception) { diff --git a/cli/base/src/testFixtures/java/org/lflang/cli/TestUtils.java b/cli/base/src/testFixtures/java/org/lflang/cli/TestUtils.java index 442742768f..aa471a9ca8 100644 --- a/cli/base/src/testFixtures/java/org/lflang/cli/TestUtils.java +++ b/cli/base/src/testFixtures/java/org/lflang/cli/TestUtils.java @@ -111,7 +111,10 @@ public TempDirBuilder file(String relativePath, String contents) throws IOExcept throw new IllegalArgumentException("Should be a relative path: " + relativePath); } Path filePath = curDir.resolve(relPath); - Files.createDirectories(filePath.getParent()); + final var parent = filePath.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } Files.writeString(filePath, contents); return this; } From 468a4a5a1c17917661e45b5f4376ed0dfd0c11d0 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 13:49:48 +0200 Subject: [PATCH 101/141] simplifications --- core/src/main/java/org/lflang/Target.java | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/core/src/main/java/org/lflang/Target.java b/core/src/main/java/org/lflang/Target.java index 096788484e..8ab6af2891 100644 --- a/core/src/main/java/org/lflang/Target.java +++ b/core/src/main/java/org/lflang/Target.java @@ -469,16 +469,10 @@ public boolean supportsInheritance() { /** Return true if the target supports multiports and banks of reactors. */ public boolean supportsMultiports() { - switch (this) { - case C: - case CCPP: - case CPP: - case Python: - case Rust: - case TS: - return true; - } - return false; + return switch (this) { + case C, CCPP, CPP, Python, Rust, TS -> true; + default -> false; + }; } /** @@ -494,14 +488,11 @@ public boolean supportsParameterizedWidths() { * this target. */ public boolean supportsReactionDeclarations() { - if (this.equals(Target.C) || this.equals(Target.CPP)) return true; - else return false; + return this.equals(Target.C) || this.equals(Target.CPP); } /** * Return true if this code for this target should be built using Docker if Docker is used. - * - * @return */ public boolean buildsUsingDocker() { return switch (this) { From 352925e2b479db7e83bf217eb26b37c4fbc6dd11 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 14:23:57 +0200 Subject: [PATCH 102/141] clean up Target.java --- core/src/main/java/org/lflang/Target.java | 42 ++++------------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/core/src/main/java/org/lflang/Target.java b/core/src/main/java/org/lflang/Target.java index 8ab6af2891..c7aadda74f 100644 --- a/core/src/main/java/org/lflang/Target.java +++ b/core/src/main/java/org/lflang/Target.java @@ -24,17 +24,15 @@ import java.util.List; import java.util.Optional; import java.util.Set; +import javax.annotation.concurrent.Immutable; import org.lflang.lf.TargetDecl; /** - * Enumeration of targets and their associated properties. These classes are written in Java, not - * Xtend, because the enum implementation in Xtend more primitive. It is safer to use enums rather - * than string values since it allows faulty references to be caught at compile time. Switch - * statements that take as input an enum but do not have cases for all members of the enum are also - * reported by Xtend with a warning message. + * Enumeration of targets and their associated properties. * * @author Marten Lohstroh */ +@Immutable public enum Target { C( "C", @@ -90,8 +88,6 @@ public enum Target { CPP( "Cpp", true, - "cpp", - "Cpp", Arrays.asList( // List via: https://en.cppreference.com/w/cpp/keyword "alignas", // (since C++11) @@ -194,8 +190,6 @@ public enum Target { TS( "TypeScript", false, - "ts", - "TS", Arrays.asList( // List via: https://github.com/Microsoft/TypeScript/issues/2536 // Reserved words @@ -352,8 +346,6 @@ public enum Target { Rust( "Rust", true, - "rust", - "Rust", // In our Rust implementation, the only reserved keywords // are those that are a valid expression. Others may be escaped // with the syntax r#keyword. @@ -362,17 +354,11 @@ public enum Target { /** String representation of this target. */ private final String displayName; - /** Name of package containing Kotlin classes for the target language. */ - public final String packageName; - - /** Prefix of names of Kotlin classes for the target language. */ - public final String classNamePrefix; - /** Whether or not this target requires types. */ public final boolean requiresTypes; /** Reserved words in the target language. */ - public final Set keywords; + private final Set keywords; /** An unmodifiable list of all known targets. */ public static final List ALL = List.of(Target.values()); @@ -382,26 +368,12 @@ public enum Target { * * @param displayName String representation of this target. * @param requiresTypes Types Whether this target requires type annotations or not. - * @param packageName Name of package containing Kotlin classes for the target language. - * @param classNamePrefix Prefix of names of Kotlin classes for the target language. * @param keywords List of reserved strings in the target language. */ - Target( - String displayName, - boolean requiresTypes, - String packageName, - String classNamePrefix, - Collection keywords) { + Target(String displayName, boolean requiresTypes, Collection keywords) { this.displayName = displayName; this.requiresTypes = requiresTypes; this.keywords = Collections.unmodifiableSet(new LinkedHashSet<>(keywords)); - this.packageName = packageName; - this.classNamePrefix = classNamePrefix; - } - - /** Private constructor for targets without packageName and classNamePrefix. */ - Target(String displayName, boolean requiresTypes, Collection keywords) { - this(displayName, requiresTypes, "N/A", "N/A", keywords); // FIXME: prefix } /** @@ -491,9 +463,7 @@ public boolean supportsReactionDeclarations() { return this.equals(Target.C) || this.equals(Target.CPP); } - /** - * Return true if this code for this target should be built using Docker if Docker is used. - */ + /** Return true if this code for this target should be built using Docker if Docker is used. */ public boolean buildsUsingDocker() { return switch (this) { case TS -> false; From 2616fa05647d57f405dd4465b20df20cbdec11c8 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 14:29:30 +0200 Subject: [PATCH 103/141] fix spotbugs warnings in TestBase --- .../java/org/lflang/tests/LFTest.java | 38 ++++++++++--------- .../java/org/lflang/tests/TestBase.java | 29 +------------- 2 files changed, 23 insertions(+), 44 deletions(-) diff --git a/core/src/testFixtures/java/org/lflang/tests/LFTest.java b/core/src/testFixtures/java/org/lflang/tests/LFTest.java index 702f8cf4af..fb2198d8be 100644 --- a/core/src/testFixtures/java/org/lflang/tests/LFTest.java +++ b/core/src/testFixtures/java/org/lflang/tests/LFTest.java @@ -1,11 +1,7 @@ package org.lflang.tests; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.Reader; +import java.io.*; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.nio.file.Paths; import org.eclipse.xtext.util.RuntimeIOException; @@ -67,11 +63,6 @@ public LFTest(LFTest test) { this(test.target, test.srcPath); } - /** Stream object for capturing standard and error output. */ - public OutputStream getOutputStream() { - return compilationLog; - } - public FileConfig getFileConfig() { return context.getFileConfig(); } @@ -84,6 +75,20 @@ public Path getSrcPath() { return srcPath; } + /** Redirect outputs for recording. */ + public void redirectOutputs() { + System.setOut(new PrintStream(compilationLog, false, StandardCharsets.UTF_8)); + System.setErr(new PrintStream(compilationLog, false, StandardCharsets.UTF_8)); + } + + /** End output redirection. */ + public void restoreOutputs() { + System.out.flush(); + System.err.flush(); + System.setOut(System.out); + System.setErr(System.err); + } + /** * Comparison implementation to allow for tests to be sorted (e.g., when added to a tree set) * based on their path (relative to the root of the test directory). @@ -148,12 +153,12 @@ public void reportErrors() { System.out.println( "Failed: " + this - + String.format(" in %.2f seconds\n", getExecutionTimeNanoseconds() / 1.0e9)); + + String.format(" in %.2f seconds%n", getExecutionTimeNanoseconds() / 1.0e9)); System.out.println( "-----------------------------------------------------------------------------"); System.out.println("Reason: " + this.result.message); printIfNotEmpty("Reported issues", this.issues.toString()); - printIfNotEmpty("Compilation output", this.compilationLog.toString()); + printIfNotEmpty("Compilation output", this.compilationLog.toString(StandardCharsets.UTF_8)); printIfNotEmpty("Execution output", this.execLog.toString()); System.out.println( "+---------------------------------------------------------------------------+"); @@ -258,14 +263,13 @@ public Thread recordStdErr(Process process) { private Thread recordStream(StringBuffer builder, InputStream inputStream) { return new Thread( () -> { - try (Reader reader = new InputStreamReader(inputStream)) { + try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { int len; char[] buf = new char[1024]; while ((len = reader.read(buf)) > 0) { if (Runtime.getRuntime().freeMemory() < Runtime.getRuntime().totalMemory() / 2) { - Runtime.getRuntime().gc(); - if (Runtime.getRuntime().freeMemory() < Runtime.getRuntime().totalMemory() / 2) - builder.delete(0, builder.length() / 2); + builder.delete(0, builder.length() / 2); + builder.insert(0, "[earlier messages were removed to free up memory]%n"); } builder.append(buf, 0, len); } diff --git a/core/src/testFixtures/java/org/lflang/tests/TestBase.java b/core/src/testFixtures/java/org/lflang/tests/TestBase.java index 9fb8b93dc0..0c78c8b005 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestBase.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestBase.java @@ -9,7 +9,6 @@ import java.io.BufferedWriter; import java.io.File; import java.io.IOException; -import java.io.PrintStream; import java.io.PrintWriter; import java.io.StringWriter; import java.lang.reflect.Constructor; @@ -67,12 +66,6 @@ public abstract class TestBase extends LfInjectedTestBase { @Inject TestRegistry testRegistry; - /** Reference to System.out. */ - private static final PrintStream out = System.out; - - /** Reference to System.err. */ - private static final PrintStream err = System.err; - /** Execution timeout enforced for all tests. */ private static final long MAX_EXECUTION_TIME_SECONDS = 300; @@ -283,24 +276,6 @@ protected static boolean isLinux() { return OS.contains("linux"); } - /** End output redirection. */ - private static void restoreOutputs() { - System.out.flush(); - System.err.flush(); - System.setOut(out); - System.setErr(err); - } - - /** - * Redirect outputs to the given tests for recording. - * - * @param test The test to redirect outputs to. - */ - private static void redirectOutputs(LFTest test) { - System.setOut(new PrintStream(test.getOutputStream())); - System.setErr(new PrintStream(test.getOutputStream())); - } - /** * Run a test, print results on stderr. * @@ -694,7 +669,7 @@ private void validateAndRun(Set tests, Configurator configurator, TestLe for (var test : tests) { try { - redirectOutputs(test); + test.redirectOutputs(); configure(test, configurator, level); validate(test); if (level.compareTo(TestLevel.CODE_GEN) >= 0) { @@ -710,7 +685,7 @@ private void validateAndRun(Set tests, Configurator configurator, TestLe test.handleTestError( new TestError("Unknown exception during test execution", Result.TEST_EXCEPTION, e)); } finally { - restoreOutputs(); + test.restoreOutputs(); } done++; while (Math.floor(done * x) >= marks && marks < 78) { From f14d6c93f31f27e6e00228dab5ebda6f9804205e Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 14:44:46 +0200 Subject: [PATCH 104/141] clean up LFTest --- .../java/org/lflang/tests/RunSingleTest.java | 2 +- .../java/org/lflang/tests/LFTest.java | 19 ++----------------- .../java/org/lflang/tests/TestRegistry.java | 5 ++--- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/core/src/integrationTest/java/org/lflang/tests/RunSingleTest.java b/core/src/integrationTest/java/org/lflang/tests/RunSingleTest.java index 29e62e835b..fe813823bd 100644 --- a/core/src/integrationTest/java/org/lflang/tests/RunSingleTest.java +++ b/core/src/integrationTest/java/org/lflang/tests/RunSingleTest.java @@ -70,7 +70,7 @@ public void runSingleTest() throws FileNotFoundException { Class testClass = getTestInstance(target); - LFTest testCase = new LFTest(target, path.toAbsolutePath()); + LFTest testCase = new LFTest(path.toAbsolutePath()); TestBase.runSingleTestAndPrintResults(testCase, testClass, TestBase.pathToLevel(path)); } diff --git a/core/src/testFixtures/java/org/lflang/tests/LFTest.java b/core/src/testFixtures/java/org/lflang/tests/LFTest.java index fb2198d8be..e99fee4b54 100644 --- a/core/src/testFixtures/java/org/lflang/tests/LFTest.java +++ b/core/src/testFixtures/java/org/lflang/tests/LFTest.java @@ -6,7 +6,6 @@ import java.nio.file.Paths; import org.eclipse.xtext.util.RuntimeIOException; import org.lflang.FileConfig; -import org.lflang.Target; import org.lflang.generator.LFGeneratorContext; /** @@ -40,29 +39,19 @@ public class LFTest implements Comparable { /** String builder for collecting issues encountered during test execution. */ private final StringBuilder issues = new StringBuilder(); - /** The target of the test program. */ - private final Target target; - private long executionTimeNanoseconds; /** * Create a new test. * - * @param target The target of the test program. * @param srcFile The path to the file of the test program. */ - public LFTest(Target target, Path srcFile) { - this.target = target; + public LFTest(Path srcFile) { this.srcPath = srcFile; this.name = FileConfig.findPackageRoot(srcFile, s -> {}).relativize(srcFile).toString(); this.relativePath = Paths.get(name); } - /** Copy constructor */ - public LFTest(LFTest test) { - this(test.target, test.srcPath); - } - public FileConfig getFileConfig() { return context.getFileConfig(); } @@ -141,11 +130,7 @@ public boolean hasPassed() { return result == Result.TEST_PASS; } - /** - * Compile a string that contains all collected errors and return it. - * - * @return A string that contains all collected errors. - */ + /** Compile a string that contains all collected errors and return it. */ public void reportErrors() { if (this.hasFailed()) { System.out.println( diff --git a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java index 17b9984652..e5bb3334cc 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java @@ -116,7 +116,7 @@ public Set getRegisteredTests(Target target, TestCategory category, bool if (copy) { Set copies = new TreeSet<>(); for (LFTest test : registered.getTests(target, category)) { - copies.add(new LFTest(test)); + copies.add(new LFTest(test.getSrcPath())); } return copies; } else { @@ -237,8 +237,7 @@ public FileVisitResult visitFile(Path path, BasicFileAttributes attr) { if (attr.isRegularFile() && path.toString().endsWith(".lf")) { // Try to parse the file. Resource r = rs.getResource(URI.createFileURI(path.toFile().getAbsolutePath()), true); - // FIXME: issue warning if target doesn't match! - LFTest test = new LFTest(target, path); + LFTest test = new LFTest(path); Iterator reactors = IteratorExtensions.filter(r.getAllContents(), Reactor.class); From b09b8b10269f35f5fa2ae8bad826758c453ae257 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 17:22:38 +0200 Subject: [PATCH 105/141] fix warnings in TestRegistry --- .../java/org/lflang/tests/TestRegistry.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java index e5bb3334cc..80c20baafd 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java @@ -17,10 +17,12 @@ import java.util.EnumMap; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.TreeSet; + import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; @@ -42,9 +44,8 @@ public class TestRegistry { * List of directories that should be skipped when indexing test files. Any test file that has a * directory in its path that matches an entry in this array will not be discovered. */ - public static final String[] IGNORED_DIRECTORIES = { - "failing", "knownfailed", "failed", "fed-gen" - }; + public static final List IGNORED_DIRECTORIES = + List.of("failing", "knownfailed", "failed", "fed-gen"); /** Path to the root of the repository. */ public static final Path LF_REPO_PATH = Paths.get("").toAbsolutePath(); @@ -204,7 +205,8 @@ public TestDirVisitor(ResourceSet rs, Target target, Path srcBasePath) { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) { for (String ignored : IGNORED_DIRECTORIES) { - if (dir.getFileName().toString().equalsIgnoreCase(ignored)) { + final var name = dir.getFileName(); + if (name != null && name.toString().equalsIgnoreCase(ignored)) { return SKIP_SUBTREE; } } From 06ee3261e9bdaeeb4d5ea8939d6368cbe99a2d79 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 17:50:54 +0200 Subject: [PATCH 106/141] fix spotbugs and idea warnings in TestBase --- .../java/org/lflang/tests/TestBase.java | 57 +++++++------------ 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/core/src/testFixtures/java/org/lflang/tests/TestBase.java b/core/src/testFixtures/java/org/lflang/tests/TestBase.java index 0c78c8b005..a589beb882 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestBase.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestBase.java @@ -88,8 +88,6 @@ public abstract class TestBase extends LfInjectedTestBase { * @author Marten Lohstroh */ public enum TestLevel { - VALIDATION, - CODE_GEN, BUILD, EXECUTION } @@ -100,10 +98,11 @@ public enum TestLevel { * @author Anirudh Rengarajan */ public static TestLevel pathToLevel(Path path) { - while (path.getParent() != null) { - String name = path.getFileName().toString(); + path = path.getParent(); + while (path != null) { + final var name = path.getFileName(); for (var category : TestCategory.values()) { - if (category.name().equalsIgnoreCase(name)) { + if (name != null && name.toString().equalsIgnoreCase(category.name())) { return category.level; } } @@ -127,13 +126,11 @@ public static class Message { public static final String NO_ENCLAVE_SUPPORT = "Targeet does not support the enclave feature."; public static final String NO_DOCKER_SUPPORT = "Target does not support the 'docker' property."; public static final String NO_DOCKER_TEST_SUPPORT = "Docker tests are only supported on Linux."; - public static final String NO_GENERICS_SUPPORT = "Target does not support generic types."; /* Descriptions of collections of tests. */ public static final String DESC_SERIALIZATION = "Run serialization tests."; public static final String DESC_BASIC = "Run basic tests."; public static final String DESC_GENERICS = "Run generics tests."; - public static final String DESC_TYPE_PARMS = "Run tests for reactors with type parameters."; public static final String DESC_MULTIPORT = "Run multiport tests."; public static final String DESC_AS_FEDERATED = "Run non-federated tests in federated mode."; public static final String DESC_FEDERATED = "Run federated tests."; @@ -151,11 +148,6 @@ public static class Message { public static final String DESC_ROS2 = "Running tests using ROS2."; public static final String DESC_MODAL = "Run modal reactor tests."; public static final String DESC_VERIFIER = "Run verifier tests."; - - /* Missing dependency messages */ - public static final String MISSING_DOCKER = - "Executable 'docker' not found or 'docker' daemon thread not running"; - public static final String MISSING_ARDUINO_CLI = "Executable 'arduino-cli' not found"; } /** Constructor for test classes that test a single target. */ @@ -336,7 +328,7 @@ private static void checkAndReportFailures(Set tests) { var passed = tests.stream().filter(LFTest::hasPassed).toList(); var s = new StringBuffer(); s.append(THIN_LINE); - s.append("Passing: ").append(passed.size()).append("/").append(tests.size()).append("\n"); + s.append("Passing: ").append(passed.size()).append("/").append(tests.size()).append("%n"); s.append(THIN_LINE); passed.forEach( test -> @@ -344,7 +336,7 @@ private static void checkAndReportFailures(Set tests) { .append(test) .append( String.format( - " in %.2f seconds\n", test.getExecutionTimeNanoseconds() / 1.0e9))); + " in %.2f seconds%n", test.getExecutionTimeNanoseconds() / 1.0e9))); s.append(THIN_LINE); System.out.print(s); @@ -357,16 +349,14 @@ private static void checkAndReportFailures(Set tests) { } /** - * Configure a test by applying the given configurator and return a generator context. Also, if - * the given level is less than {@code TestLevel.BUILD}, add a {@code no-compile} flag to the - * generator context. If the configurator was not applied successfully, throw an AssertionError. + * Configure a test by applying the given configurator and return a generator context. + * If the configurator was not applied successfully, throw an AssertionError. * * @param test the test to configure. * @param configurator The configurator to apply to the test. - * @param level The level of testing in which the generator context will be used. */ - private void configure(LFTest test, Configurator configurator, TestLevel level) - throws IOException, TestError { + private void configure(LFTest test, Configurator configurator) + throws TestError { var props = new Properties(); props.setProperty("hierarchical-bin", "true"); @@ -412,11 +402,6 @@ private void configure(LFTest test, Configurator configurator, TestLevel level) test.configure(context); - // Set the no-compile flag the test is not supposed to reach the build stage. - if (level.compareTo(TestLevel.BUILD) < 0) { - context.getArgs().setProperty("no-compile", ""); - } - // Reload in case target properties have changed. context.loadTargetConfig(); // Update the test by applying the configuration. E.g., to carry out an AST transformation. @@ -462,9 +447,9 @@ protected void addExtraLfcArgs(Properties args, TargetConfig targetConfig) { * * @param test The test to generate code for. */ - private GeneratorResult generateCode(LFTest test) throws TestError { + private void generateCode(LFTest test) throws TestError { if (test.getFileConfig().resource == null) { - return GeneratorResult.NOTHING; + test.getContext().finish(GeneratorResult.NOTHING); } try { generator.doGenerate(test.getFileConfig().resource, fileAccess, test.getContext()); @@ -474,8 +459,6 @@ private GeneratorResult generateCode(LFTest test) throws TestError { if (generator.errorsOccurred()) { throw new TestError("Code generation unsuccessful.", Result.CODE_GEN_FAIL); } - - return test.getContext().getResult(); } /** @@ -507,13 +490,13 @@ private void execute(LFTest test) throws TestError { throw new TestError(Result.TEST_TIMEOUT); } else { if (stdoutException.get() != null || stderrException.get() != null) { - StringBuffer sb = new StringBuffer(); + StringBuilder sb = new StringBuilder(); if (stdoutException.get() != null) { - sb.append("Error during stdout handling:" + System.lineSeparator()); + sb.append("Error during stdout handling:%n"); sb.append(stackTraceToString(stdoutException.get())); } if (stderrException.get() != null) { - sb.append("Error during stderr handling:" + System.lineSeparator()); + sb.append("Error during stderr handling:%n"); sb.append(stackTraceToString(stderrException.get())); } throw new TestError(sb.toString(), Result.TEST_EXCEPTION); @@ -551,7 +534,7 @@ public static String stackTraceToString(Throwable t) { } /** Bash script that is used to execute docker tests. */ - private static String DOCKER_RUN_SCRIPT = + private static final String DOCKER_RUN_SCRIPT = """ #!/bin/bash @@ -584,7 +567,7 @@ public static String stackTraceToString(Throwable t) { * *

If the script does not yet exist, it is created. */ - private Path getDockerRunScript() throws TestError { + private static synchronized Path getDockerRunScript() throws TestError { if (dockerRunScript != null) { return dockerRunScript; } @@ -670,11 +653,9 @@ private void validateAndRun(Set tests, Configurator configurator, TestLe for (var test : tests) { try { test.redirectOutputs(); - configure(test, configurator, level); + configure(test, configurator); validate(test); - if (level.compareTo(TestLevel.CODE_GEN) >= 0) { - generateCode(test); - } + generateCode(test); if (level == TestLevel.EXECUTION) { execute(test); } From 89c13d2ae8f28ca56254cd688f0cc0cb2c6f3d67 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 18:00:42 +0200 Subject: [PATCH 107/141] fix spotbugs warnings in issue reporting --- .../src/test/kotlin/org/lflang/cli/LfcIssueReportingTest.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/lfc/src/test/kotlin/org/lflang/cli/LfcIssueReportingTest.kt b/cli/lfc/src/test/kotlin/org/lflang/cli/LfcIssueReportingTest.kt index c2839673be..21cdaf3043 100644 --- a/cli/lfc/src/test/kotlin/org/lflang/cli/LfcIssueReportingTest.kt +++ b/cli/lfc/src/test/kotlin/org/lflang/cli/LfcIssueReportingTest.kt @@ -38,7 +38,9 @@ import java.nio.file.Paths class SpyPrintStream { private val baout = ByteArrayOutputStream() - val ps = PrintStream(baout) + private val ps = PrintStream(baout, false, StandardCharsets.UTF_8) + + fun getSpiedErrIo(): Io = Io(err = ps) override fun toString(): String = baout.toString(StandardCharsets.UTF_8) } @@ -111,7 +113,7 @@ class LfcIssueReportingTest { val stderr = SpyPrintStream() - val io = Io(err = stderr.ps) + val io = stderr.getSpiedErrIo() val backend = ReportingBackend(io, AnsiColors(useColors).bold("lfc: "), AnsiColors(useColors), 2) val injector = LFStandaloneSetup(LFRuntimeModule(), LFStandaloneModule(backend, io)) .createInjectorAndDoEMFRegistration() From eddd59360dafe5a023a445b0c21e137dc07321fc Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Thu, 14 Sep 2023 18:10:05 +0200 Subject: [PATCH 108/141] formatting --- core/src/testFixtures/java/org/lflang/tests/TestBase.java | 7 +++---- .../testFixtures/java/org/lflang/tests/TestRegistry.java | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/testFixtures/java/org/lflang/tests/TestBase.java b/core/src/testFixtures/java/org/lflang/tests/TestBase.java index a589beb882..ee0d72ff02 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestBase.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestBase.java @@ -349,14 +349,13 @@ private static void checkAndReportFailures(Set tests) { } /** - * Configure a test by applying the given configurator and return a generator context. - * If the configurator was not applied successfully, throw an AssertionError. + * Configure a test by applying the given configurator and return a generator context. If the + * configurator was not applied successfully, throw an AssertionError. * * @param test the test to configure. * @param configurator The configurator to apply to the test. */ - private void configure(LFTest test, Configurator configurator) - throws TestError { + private void configure(LFTest test, Configurator configurator) throws TestError { var props = new Properties(); props.setProperty("hierarchical-bin", "true"); diff --git a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java index 80c20baafd..14b12647ad 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java @@ -22,7 +22,6 @@ import java.util.Set; import java.util.Stack; import java.util.TreeSet; - import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; From 5fb671c3f470da9ee667df9575814f7eb10ec55f Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Thu, 14 Sep 2023 20:23:47 +0200 Subject: [PATCH 109/141] Update nrf52 handling of the zephyr counter drivers --- .../lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay | 3 +++ .../lib/platform/zephyr/boards/nrf52dk_nrf52832_lf.conf | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay delete mode 100644 core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832_lf.conf diff --git a/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay b/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay new file mode 100644 index 0000000000..30472cd1fb --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay @@ -0,0 +1,3 @@ +&timer1 { + status = "okay"; +}; \ No newline at end of file diff --git a/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832_lf.conf b/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832_lf.conf deleted file mode 100644 index 8bc7cfdbc5..0000000000 --- a/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832_lf.conf +++ /dev/null @@ -1 +0,0 @@ -CONFIG_COUNTER_TIMER1=y From e9f3bade4f8e5c9e72b6e8ddd7f329ece28ab081 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Thu, 14 Sep 2023 17:03:29 -0700 Subject: [PATCH 110/141] Build epoch against fork --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6d7edf2145..25c12ebf0e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,8 @@ jobs: files: core/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/base/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfc/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfd/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lff/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml epoch: - uses: lf-lang/epoch/.github/workflows/build.yml@main + uses: lf-lang/epoch/.github/workflows/build.yml@build-against-fork with: lingua-franca-ref: ${{ github.head_ref || github.ref_name }} + lingua-franca-repo: ${{ github.repository }} upload-artifacts: false From 91b219b4fa42a2e51c3f384157cf80328467d363 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Thu, 14 Sep 2023 18:24:29 -0700 Subject: [PATCH 111/141] Pass in URL instead of repo name --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25c12ebf0e..32e34c9ffb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,5 +35,5 @@ jobs: uses: lf-lang/epoch/.github/workflows/build.yml@build-against-fork with: lingua-franca-ref: ${{ github.head_ref || github.ref_name }} - lingua-franca-repo: ${{ github.repository }} + lingua-franca-repo: ${{ github.event.pull_request.head.repo.full_name }} upload-artifacts: false From 63ddf066a7821fbd2272d02aca7ad0661f85b601 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Thu, 14 Sep 2023 19:24:44 -0700 Subject: [PATCH 112/141] Apply formatter --- core/src/main/java/org/lflang/ast/ToLf.java | 1 - .../src/main/java/org/lflang/generator/LfExpressionVisitor.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/ast/ToLf.java b/core/src/main/java/org/lflang/ast/ToLf.java index 149b9211a3..dd8096a5e3 100644 --- a/core/src/main/java/org/lflang/ast/ToLf.java +++ b/core/src/main/java/org/lflang/ast/ToLf.java @@ -874,7 +874,6 @@ public MalleableString caseBracedListExpression(BracedListExpression object) { return bracedListExpression(object.getItems()); } - @Override public MalleableString caseBracketListExpression(BracketListExpression object) { if (object.getItems().isEmpty()) { diff --git a/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java b/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java index e5b669b6f2..c50f805209 100644 --- a/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java +++ b/core/src/main/java/org/lflang/generator/LfExpressionVisitor.java @@ -44,6 +44,7 @@ public interface LfExpressionVisitor { R visitLiteral(Literal expr, P param); R visitBracedListExpr(BracedListExpression expr, P param); + R visitBracketListExpr(BracketListExpression expr, P param); R visitTimeLiteral(Time expr, P param); @@ -163,7 +164,6 @@ public Expression visitBracketListExpr(BracketListExpression expr, P param) { clone.getItems().add(dispatch(item, param, this)); } return clone; - } @Override From da30b7925e7358e622755a2e0516191f42b12894 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Thu, 14 Sep 2023 22:04:35 -0700 Subject: [PATCH 113/141] Update .github/workflows/build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 32e34c9ffb..da1990ca3f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: files: core/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/base/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfc/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfd/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lff/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml epoch: - uses: lf-lang/epoch/.github/workflows/build.yml@build-against-fork + uses: lf-lang/epoch/.github/workflows/build.yml@main with: lingua-franca-ref: ${{ github.head_ref || github.ref_name }} lingua-franca-repo: ${{ github.event.pull_request.head.repo.full_name }} From c69a519847ae761a13f7d0e64922f88a8bd74fe2 Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Fri, 15 Sep 2023 09:58:18 +0200 Subject: [PATCH 114/141] Add board-specific tests to the Zephyr regressions tests. We just make sure that HelloWorld programs compile for different boards. --- .gitmodules | 2 +- .../java/org/lflang/tests/runtime/CZephyrTest.java | 12 ++++++++++++ .../lib/platform/zephyr/boards/arduino_due.overlay | 4 ++++ .../platform/zephyr/boards/bl5340_dvk_cpuapp.conf | 5 +++++ .../zephyr/boards/bl5340_dvk_cpuapp.overlay | 12 ++++++++++++ .../platform/zephyr/boards/esp32c3_devkitm.overlay | 3 +++ .../platform/zephyr/boards/esp32s2_saola.overlay | 3 +++ .../platform/zephyr/boards/esp32s3_devkitm.overlay | 3 +++ .../platform/zephyr/boards/gd32e103v_eval.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32e507v_start.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32e507z_eval.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f350r_eval.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f403z_eval.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f407v_start.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f450i_eval.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f450v_start.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f450z_eval.overlay | 10 ++++++++++ .../platform/zephyr/boards/gd32f470i_eval.overlay | 10 ++++++++++ .../zephyr/boards/nrf51dk_nrf51422.overlay | 3 +++ .../zephyr/boards/nrf52840dk_nrf52840.overlay | 3 +++ .../zephyr/boards/nrf9160dk_nrf9160.overlay | 3 +++ .../zephyr/boards/s32z270dc2_rtu0_r52.overlay | 10 ++++++++++ .../zephyr/boards/s32z270dc2_rtu1_r52.overlay | 10 ++++++++++ .../lib/platform/zephyr/boards/sam4e_xpro.overlay | 4 ++++ .../platform/zephyr/boards/sam4s_xplained.overlay | 4 ++++ .../zephyr/boards/sam_e70_xplained.overlay | 4 ++++ .../zephyr/boards/sam_e70b_xplained.overlay | 4 ++++ .../platform/zephyr/boards/sam_v71_xult.overlay | 4 ++++ .../platform/zephyr/boards/sam_v71b_xult.overlay | 4 ++++ .../zephyr/boards/stm32h735g_disco.overlay | 6 ++++++ .../platform/zephyr/boards/stm32l562e_dk_ns.conf | 7 +++++++ .../java/org/lflang/tests/TestRegistry.java | 1 + test/C/src/zephyr/boards/ArduinoDue.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/ESP32.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/GD32.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/NRF52.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/NXPIMXRT1170.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/NXPS32.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/SAM.lf | 14 ++++++++++++++ test/C/src/zephyr/boards/STM32.lf | 12 ++++++++++++ 40 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/arduino_due.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.conf create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/esp32c3_devkitm.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/esp32s2_saola.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/esp32s3_devkitm.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32e103v_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32e507v_start.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32e507z_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f350r_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f403z_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f407v_start.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f450i_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f450v_start.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f450z_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/gd32f470i_eval.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/nrf51dk_nrf51422.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/nrf52840dk_nrf52840.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/nrf9160dk_nrf9160.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu0_r52.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu1_r52.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/sam4e_xpro.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/sam4s_xplained.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/sam_e70_xplained.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/sam_e70b_xplained.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/sam_v71_xult.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/sam_v71b_xult.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/stm32h735g_disco.overlay create mode 100644 core/src/main/resources/lib/platform/zephyr/boards/stm32l562e_dk_ns.conf create mode 100644 test/C/src/zephyr/boards/ArduinoDue.lf create mode 100644 test/C/src/zephyr/boards/ESP32.lf create mode 100644 test/C/src/zephyr/boards/GD32.lf create mode 100644 test/C/src/zephyr/boards/NRF52.lf create mode 100644 test/C/src/zephyr/boards/NXPIMXRT1170.lf create mode 100644 test/C/src/zephyr/boards/NXPS32.lf create mode 100644 test/C/src/zephyr/boards/SAM.lf create mode 100644 test/C/src/zephyr/boards/STM32.lf diff --git a/.gitmodules b/.gitmodules index 9cd89ffe1a..1eaef285c7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "org.lflang/src/lib/c/reactor-c"] path = core/src/main/resources/lib/c/reactor-c - url = https://github.com/lf-lang/reactor-c.git + url = git@github.com:lf-lang/reactor-c.git [submodule "org.lflang/src/lib/cpp/reactor-cpp"] path = core/src/main/resources/lib/cpp/reactor-cpp url = https://github.com/lf-lang/reactor-cpp diff --git a/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java b/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java index 145f4b1d53..6ab2490abe 100644 --- a/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java +++ b/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java @@ -55,6 +55,18 @@ public void buildZephyrUnthreadedTests() { false); } + @Test + public void buildZephyrBoardTests() { + Assumptions.assumeTrue(isLinux(), "Zephyr tests only run on Linux"); + super.runTestsFor( + List.of(Target.C), + Message.DESC_ZEPHYR, + TestCategory.ZEPHYR_BOARDS::equals, + Configurators::noChanges, + TestLevel.BUILD, + false); + } + @Test public void buildZephyrThreadedTests() { Assumptions.assumeTrue(isLinux(), "Zephyr tests only run on Linux"); diff --git a/core/src/main/resources/lib/platform/zephyr/boards/arduino_due.overlay b/core/src/main/resources/lib/platform/zephyr/boards/arduino_due.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/arduino_due.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.conf b/core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.conf new file mode 100644 index 0000000000..c9e4c07698 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.conf @@ -0,0 +1,5 @@ +# Enable RTC +CONFIG_I2C=y +CONFIG_COUNTER=y +CONFIG_COUNTER_MICROCHIP_MCP7940N=y +CONFIG_COUNTER_INIT_PRIORITY=65 diff --git a/core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.overlay b/core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.overlay new file mode 100644 index 0000000000..7869ff34ea --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/bl5340_dvk_cpuapp.overlay @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2021 Laird Connectivity + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&i2c1 { + /* Connect MCP7940N MFP pin TP9 to P0.04 */ + extrtc0: mcp7940n@6f { + int-gpios = <&gpio0 4 GPIO_ACTIVE_HIGH>; + }; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/esp32c3_devkitm.overlay b/core/src/main/resources/lib/platform/zephyr/boards/esp32c3_devkitm.overlay new file mode 100644 index 0000000000..241947b064 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/esp32c3_devkitm.overlay @@ -0,0 +1,3 @@ +&timer0 { + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/esp32s2_saola.overlay b/core/src/main/resources/lib/platform/zephyr/boards/esp32s2_saola.overlay new file mode 100644 index 0000000000..241947b064 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/esp32s2_saola.overlay @@ -0,0 +1,3 @@ +&timer0 { + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/esp32s3_devkitm.overlay b/core/src/main/resources/lib/platform/zephyr/boards/esp32s3_devkitm.overlay new file mode 100644 index 0000000000..241947b064 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/esp32s3_devkitm.overlay @@ -0,0 +1,3 @@ +&timer0 { + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32e103v_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32e103v_eval.overlay new file mode 100644 index 0000000000..abebc86c8e --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32e103v_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <29999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32e507v_start.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32e507v_start.overlay new file mode 100644 index 0000000000..9e20c4e607 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32e507v_start.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <44999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32e507z_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32e507z_eval.overlay new file mode 100644 index 0000000000..9e20c4e607 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32e507z_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <44999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f350r_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f350r_eval.overlay new file mode 100644 index 0000000000..7b0464653b --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f350r_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <26999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f403z_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f403z_eval.overlay new file mode 100644 index 0000000000..06918e09dd --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f403z_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <41999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f407v_start.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f407v_start.overlay new file mode 100644 index 0000000000..06918e09dd --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f407v_start.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <41999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f450i_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f450i_eval.overlay new file mode 100644 index 0000000000..ac50bfbe62 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f450i_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <49999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f450v_start.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f450v_start.overlay new file mode 100644 index 0000000000..ac50bfbe62 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f450v_start.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <49999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f450z_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f450z_eval.overlay new file mode 100644 index 0000000000..ac50bfbe62 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f450z_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <49999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/gd32f470i_eval.overlay b/core/src/main/resources/lib/platform/zephyr/boards/gd32f470i_eval.overlay new file mode 100644 index 0000000000..9ed334331f --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/gd32f470i_eval.overlay @@ -0,0 +1,10 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2022 TOKITA Hiroshi + */ + +&timer0 { + status = "okay"; + prescaler = <59999>; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/nrf51dk_nrf51422.overlay b/core/src/main/resources/lib/platform/zephyr/boards/nrf51dk_nrf51422.overlay new file mode 100644 index 0000000000..0c88903dc5 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/nrf51dk_nrf51422.overlay @@ -0,0 +1,3 @@ +&timer1 { + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/nrf52840dk_nrf52840.overlay b/core/src/main/resources/lib/platform/zephyr/boards/nrf52840dk_nrf52840.overlay new file mode 100644 index 0000000000..5e37ad9fff --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/nrf52840dk_nrf52840.overlay @@ -0,0 +1,3 @@ +&rtc0 { + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/nrf9160dk_nrf9160.overlay b/core/src/main/resources/lib/platform/zephyr/boards/nrf9160dk_nrf9160.overlay new file mode 100644 index 0000000000..5e37ad9fff --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/nrf9160dk_nrf9160.overlay @@ -0,0 +1,3 @@ +&rtc0 { + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu0_r52.overlay b/core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu0_r52.overlay new file mode 100644 index 0000000000..e0f2025d37 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu0_r52.overlay @@ -0,0 +1,10 @@ +/* + * Copyright 2022 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&stm0 { + prescaler = <1>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu1_r52.overlay b/core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu1_r52.overlay new file mode 100644 index 0000000000..e0f2025d37 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/s32z270dc2_rtu1_r52.overlay @@ -0,0 +1,10 @@ +/* + * Copyright 2022 NXP + * + * SPDX-License-Identifier: Apache-2.0 + */ + +&stm0 { + prescaler = <1>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/sam4e_xpro.overlay b/core/src/main/resources/lib/platform/zephyr/boards/sam4e_xpro.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/sam4e_xpro.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/sam4s_xplained.overlay b/core/src/main/resources/lib/platform/zephyr/boards/sam4s_xplained.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/sam4s_xplained.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/sam_e70_xplained.overlay b/core/src/main/resources/lib/platform/zephyr/boards/sam_e70_xplained.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/sam_e70_xplained.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/sam_e70b_xplained.overlay b/core/src/main/resources/lib/platform/zephyr/boards/sam_e70b_xplained.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/sam_e70b_xplained.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/sam_v71_xult.overlay b/core/src/main/resources/lib/platform/zephyr/boards/sam_v71_xult.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/sam_v71_xult.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/sam_v71b_xult.overlay b/core/src/main/resources/lib/platform/zephyr/boards/sam_v71b_xult.overlay new file mode 100644 index 0000000000..12087adfaa --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/sam_v71b_xult.overlay @@ -0,0 +1,4 @@ +&tc0 { + clk = <4>; + status = "okay"; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/stm32h735g_disco.overlay b/core/src/main/resources/lib/platform/zephyr/boards/stm32h735g_disco.overlay new file mode 100644 index 0000000000..00a10669ba --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/stm32h735g_disco.overlay @@ -0,0 +1,6 @@ +&timers2 { + st,prescaler = <83>; + counter { + status = "okay"; + }; +}; diff --git a/core/src/main/resources/lib/platform/zephyr/boards/stm32l562e_dk_ns.conf b/core/src/main/resources/lib/platform/zephyr/boards/stm32l562e_dk_ns.conf new file mode 100644 index 0000000000..52d11aac39 --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/boards/stm32l562e_dk_ns.conf @@ -0,0 +1,7 @@ +# +# Copyright (c) 2022 O.S.Systems +# +# SPDX-License-Identifier: Apache-2.0 +# +CONFIG_BUILD_WITH_TFM=y +CONFIG_TFM_PROFILE_TYPE_MEDIUM=y diff --git a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java index 17b9984652..1ffa93905b 100644 --- a/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java +++ b/core/src/testFixtures/java/org/lflang/tests/TestRegistry.java @@ -334,6 +334,7 @@ public enum TestCategory { ARDUINO(false, "", TestLevel.BUILD), ZEPHYR_THREADED(false, "zephyr" + File.separator + "threaded", TestLevel.BUILD), ZEPHYR_UNTHREADED(false, "zephyr" + File.separator + "unthreaded", TestLevel.BUILD), + ZEPHYR_BOARDS(false, "zephyr" + File.separator + "boards", TestLevel.BUILD), VERIFIER(false, "verifier", TestLevel.EXECUTION), TARGET(false, "", TestLevel.EXECUTION); diff --git a/test/C/src/zephyr/boards/ArduinoDue.lf b/test/C/src/zephyr/boards/ArduinoDue.lf new file mode 100644 index 0000000000..8bc1358c10 --- /dev/null +++ b/test/C/src/zephyr/boards/ArduinoDue.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: arduino_due + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/ESP32.lf b/test/C/src/zephyr/boards/ESP32.lf new file mode 100644 index 0000000000..4e1a6936c3 --- /dev/null +++ b/test/C/src/zephyr/boards/ESP32.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: esp32 + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/GD32.lf b/test/C/src/zephyr/boards/GD32.lf new file mode 100644 index 0000000000..2cee0ef537 --- /dev/null +++ b/test/C/src/zephyr/boards/GD32.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: gd32f403z_eval + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/NRF52.lf b/test/C/src/zephyr/boards/NRF52.lf new file mode 100644 index 0000000000..4d2a4fa551 --- /dev/null +++ b/test/C/src/zephyr/boards/NRF52.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: nrf52dk_nrf52832 + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/NXPIMXRT1170.lf b/test/C/src/zephyr/boards/NXPIMXRT1170.lf new file mode 100644 index 0000000000..f3f36a22bb --- /dev/null +++ b/test/C/src/zephyr/boards/NXPIMXRT1170.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: mimxrt1170_evk_cm7 + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/NXPS32.lf b/test/C/src/zephyr/boards/NXPS32.lf new file mode 100644 index 0000000000..64bb94f46d --- /dev/null +++ b/test/C/src/zephyr/boards/NXPS32.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: s32z270dc2_rtu0_r52 + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/SAM.lf b/test/C/src/zephyr/boards/SAM.lf new file mode 100644 index 0000000000..32641481d0 --- /dev/null +++ b/test/C/src/zephyr/boards/SAM.lf @@ -0,0 +1,14 @@ +target C { + platform: { + name: Zephyr, + board: sam4s_xplained + } +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} diff --git a/test/C/src/zephyr/boards/STM32.lf b/test/C/src/zephyr/boards/STM32.lf new file mode 100644 index 0000000000..c849ea0f30 --- /dev/null +++ b/test/C/src/zephyr/boards/STM32.lf @@ -0,0 +1,12 @@ +target C { + platform: "Zephyr", + board: stm32f4_disco +} + +main reactor { + timer t(0, 1 sec) + + reaction(t) {= + printf("Hello\n"); + =} +} From ff7f93f2dd09daa23779e3658116142f00c9e26d Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Fri, 15 Sep 2023 09:58:38 +0200 Subject: [PATCH 115/141] Add a small README to explain Zephr board files in our source tree --- core/src/main/resources/lib/platform/zephyr/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 core/src/main/resources/lib/platform/zephyr/README.md diff --git a/core/src/main/resources/lib/platform/zephyr/README.md b/core/src/main/resources/lib/platform/zephyr/README.md new file mode 100644 index 0000000000..a0d92819ec --- /dev/null +++ b/core/src/main/resources/lib/platform/zephyr/README.md @@ -0,0 +1,3 @@ +# Zephyr platform files +These are files needed to compile LF programs for the Zephyr target. +All of the files in the `boards` directory are for enabling a Timer peripheral for different devices so that we can use a Counter device for time-keeping. These device tree config overlays are copied from the `alarm` example found in the zephyr source tree under `samples/drivers/counter/alarm`. \ No newline at end of file From e841d6453f295e919325df0dae4abc67fd9f2d28 Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Fri, 15 Sep 2023 09:59:04 +0200 Subject: [PATCH 116/141] Do not generate CMake code for linking with Threads library when we are targeting Zephyr --- .../org/lflang/generator/c/CCmakeGenerator.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index 0ee24fc39a..ea1db3713e 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -326,25 +326,23 @@ CodeBuilder generateCMakeCode( cMakeCode.newLine(); } - if (targetConfig.threading) { + if (targetConfig.threading && targetConfig.platformOptions.platform != Platform.ZEPHYR) { // If threaded computation is requested, add the threads option. cMakeCode.pr("# Find threads and link to it"); cMakeCode.pr("find_package(Threads REQUIRED)"); cMakeCode.pr("target_link_libraries(${LF_MAIN_TARGET} PRIVATE Threads::Threads)"); cMakeCode.newLine(); - // If the LF program itself is threaded, we need to define NUMBER_OF_WORKERS so that - // platform-specific C files will contain the appropriate functions + } + + // Add additional flags so runtime can distinguish between multi-threaded and single-threaded + // mode + if (targetConfig.threading) { cMakeCode.pr("# Set the number of workers to enable threading/tracing"); cMakeCode.pr( "target_compile_definitions(${LF_MAIN_TARGET} PUBLIC NUMBER_OF_WORKERS=" + targetConfig.workers + ")"); cMakeCode.newLine(); - } - - // Add additional flags so runtime can distinguish between multi-threaded and single-threaded - // mode - if (targetConfig.threading) { cMakeCode.pr("# Set flag to indicate a multi-threaded runtime"); cMakeCode.pr("target_compile_definitions( ${LF_MAIN_TARGET} PUBLIC LF_THREADED=1)"); } else { From 75646f90fa1082e2e719208ea6833fddfa096106 Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Fri, 15 Sep 2023 10:04:31 +0200 Subject: [PATCH 117/141] Spotless --- core/src/main/resources/lib/platform/zephyr/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/resources/lib/platform/zephyr/README.md b/core/src/main/resources/lib/platform/zephyr/README.md index a0d92819ec..f74132f2a9 100644 --- a/core/src/main/resources/lib/platform/zephyr/README.md +++ b/core/src/main/resources/lib/platform/zephyr/README.md @@ -1,3 +1,3 @@ # Zephyr platform files -These are files needed to compile LF programs for the Zephyr target. -All of the files in the `boards` directory are for enabling a Timer peripheral for different devices so that we can use a Counter device for time-keeping. These device tree config overlays are copied from the `alarm` example found in the zephyr source tree under `samples/drivers/counter/alarm`. \ No newline at end of file +These are files needed to compile LF programs for the Zephyr target. +All of the files in the `boards` directory are for enabling a Timer peripheral for different devices so that we can use a Counter device for time-keeping. These device tree config overlays are copied from the `alarm` example found in the zephyr source tree under `samples/drivers/counter/alarm`. From b0adb56350526c6210906befcb47c55bb2396d23 Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Fri, 15 Sep 2023 10:04:50 +0200 Subject: [PATCH 118/141] Bump reactor-c to include cmake fix --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 9760f233d4..7e031ec140 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 9760f233d4b1d2653e61c7feb7e3e1379d6e8344 +Subproject commit 7e031ec1400fbebc1f90a7ce41fa10ffa40549d2 From 7b2c92b7a8d7c5e013d2652592ed2f62ae894764 Mon Sep 17 00:00:00 2001 From: erling Date: Fri, 15 Sep 2023 10:09:56 +0200 Subject: [PATCH 119/141] Update .gitmodules --- .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitmodules b/.gitmodules index 1eaef285c7..9cd89ffe1a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "org.lflang/src/lib/c/reactor-c"] path = core/src/main/resources/lib/c/reactor-c - url = git@github.com:lf-lang/reactor-c.git + url = https://github.com/lf-lang/reactor-c.git [submodule "org.lflang/src/lib/cpp/reactor-cpp"] path = core/src/main/resources/lib/cpp/reactor-cpp url = https://github.com/lf-lang/reactor-cpp From 600c44db5ba7e4718d77a1ddff2c8306564fcd87 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 15 Sep 2023 11:19:00 +0200 Subject: [PATCH 120/141] avoid using a dead dependency (jsr305) --- core/build.gradle | 4 ++++ core/src/main/java/org/lflang/Target.java | 2 +- gradle.properties | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index 23b412b6a8..142c347e03 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -44,6 +44,10 @@ dependencies { testImplementation "org.opentest4j:opentest4j:$openTest4jVersion" testImplementation "org.eclipse.xtext:org.eclipse.xtext.testing:$xtextVersion" testImplementation "org.eclipse.xtext:org.eclipse.xtext.xbase.testing:$xtextVersion" + + // For spotbugs annotations + compileOnly "com.github.spotbugs:spotbugs-annotations:$spotbugsToolVersion" + compileOnly "net.jcip:jcip-annotations:$jcipVersion" } configurations { diff --git a/core/src/main/java/org/lflang/Target.java b/core/src/main/java/org/lflang/Target.java index c7aadda74f..5e9f72fea1 100644 --- a/core/src/main/java/org/lflang/Target.java +++ b/core/src/main/java/org/lflang/Target.java @@ -24,7 +24,7 @@ import java.util.List; import java.util.Optional; import java.util.Set; -import javax.annotation.concurrent.Immutable; +import net.jcip.annotations.Immutable; import org.lflang.lf.TargetDecl; /** diff --git a/gradle.properties b/gradle.properties index 636741363c..edfd349707 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,6 @@ jacocoVersion=0.8.7 jsonVersion=20200518 jupiterVersion=5.8.2 jUnitPlatformVersion=1.8.2 -klighdVersion=2.3.0.v20230606 kotlinJvmTarget=17 lsp4jVersion=0.21.0 mwe2LaunchVersion=2.14.0 @@ -22,6 +21,7 @@ klighdVersion=2.3.0.v20230606 freehepVersion=2.4 swtVersion=3.124.0 spotbugsToolVersion=4.7.3 +jcipVersion=1.0 [manifestPropertyNames] org.eclipse.xtext=xtextVersion From ab439109823b91a55b92a4808c3b9648aad7be82 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Sat, 16 Sep 2023 11:04:36 +0200 Subject: [PATCH 121/141] Exclude Zephyr board tests from the other C regression tests --- core/src/testFixtures/java/org/lflang/tests/Configurators.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/testFixtures/java/org/lflang/tests/Configurators.java b/core/src/testFixtures/java/org/lflang/tests/Configurators.java index 4191687278..5929f2a5af 100644 --- a/core/src/testFixtures/java/org/lflang/tests/Configurators.java +++ b/core/src/testFixtures/java/org/lflang/tests/Configurators.java @@ -115,6 +115,7 @@ public static boolean compatibleWithThreadingOff(TestCategory category) { || category == TestCategory.ARDUINO || category == TestCategory.VERIFIER || category == TestCategory.ZEPHYR_UNTHREADED + || category == TestCategory.ZEPHYR_BOARDS || category == TestCategory.ZEPHYR_THREADED; // SERIALIZATION and TARGET tests are excluded on Windows. From 9c18925bc3b83e27956ddd958f295ba9ff6fdfe4 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Sat, 16 Sep 2023 11:12:35 +0200 Subject: [PATCH 122/141] Bump Zephyr to 3.4.0 --- .github/actions/setup-zephyr/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-zephyr/action.yml b/.github/actions/setup-zephyr/action.yml index 32cd307172..f414609105 100644 --- a/.github/actions/setup-zephyr/action.yml +++ b/.github/actions/setup-zephyr/action.yml @@ -6,7 +6,7 @@ runs: - name: Setup environment variables run: | echo "SDK_VERSION=0.16.1" >> $GITHUB_ENV - echo "ZEPHYR_VERSION=3.3.0" >> $GITHUB_ENV + echo "ZEPHYR_VERSION=3.4.0" >> $GITHUB_ENV shell: bash - name: Dependencies run: | From 56375242aa93b9ff78df1b265ec1ac04c65d39e5 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Sat, 16 Sep 2023 12:30:25 +0200 Subject: [PATCH 123/141] Exclude Zephyr board tests from CCpp tests --- .../integrationTest/java/org/lflang/tests/runtime/CCppTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/integrationTest/java/org/lflang/tests/runtime/CCppTest.java b/core/src/integrationTest/java/org/lflang/tests/runtime/CCppTest.java index 6324098963..3bbbda7dad 100644 --- a/core/src/integrationTest/java/org/lflang/tests/runtime/CCppTest.java +++ b/core/src/integrationTest/java/org/lflang/tests/runtime/CCppTest.java @@ -44,6 +44,7 @@ private static boolean isExcludedFromCCpp(TestCategory category) { isMac() && (category == TestCategory.DOCKER_FEDERATED || category == TestCategory.DOCKER); excluded |= category == TestCategory.ZEPHYR_UNTHREADED; excluded |= category == TestCategory.ZEPHYR_THREADED; + excluded |= category == TestCategory.ZEPHYR_BOARDS; excluded |= category == TestCategory.ARDUINO; excluded |= category == TestCategory.NO_INLINING; excluded |= category == TestCategory.VERIFIER; From 626d6188abd59fd757b8371a72754f8e24cd0130 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Sat, 16 Sep 2023 12:42:34 +0200 Subject: [PATCH 124/141] Update Zephyr CI --- .github/workflows/c-zephyr-tests.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/c-zephyr-tests.yml b/.github/workflows/c-zephyr-tests.yml index 49c073d03b..eb170bafcf 100644 --- a/.github/workflows/c-zephyr-tests.yml +++ b/.github/workflows/c-zephyr-tests.yml @@ -41,7 +41,9 @@ jobs: if: ${{ inputs.runtime-ref }} - name: Run Zephyr smoke tests run: | - ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyr* core:integrationTestCodeCoverageReport + ./gradlew core:integrationTest \ + --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrUnthreaded* \ + --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrThreaded* core:integrationTestCodeCoverageReport ./.github/scripts/run-zephyr-tests.sh test/C/src-gen rm -r test/C/src-gen - name: Run basic tests @@ -54,6 +56,10 @@ jobs: ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildConcurrent* core:integrationTestCodeCoverageReport ./.github/scripts/run-zephyr-tests.sh test/C/src-gen rm -r test/C/src-gen + - name: Run Zephyr board tests + run: | + ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyBoard core:integrationTestCodeCoverageReport + rm -r test/C/src-gen - name: Report to CodeCov uses: ./.github/actions/report-code-coverage with: From eac5f219313cd511eb27179ac3cadcecd8e02bd6 Mon Sep 17 00:00:00 2001 From: erlingrj Date: Sat, 16 Sep 2023 12:46:16 +0200 Subject: [PATCH 125/141] Zephyr v3.4.0 --- .../src/main/java/org/lflang/generator/c/CCmakeGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java index ea1db3713e..717f0714f5 100644 --- a/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java +++ b/core/src/main/java/org/lflang/generator/c/CCmakeGenerator.java @@ -144,8 +144,8 @@ CodeBuilder generateCMakeCode( cMakeCode.pr("# Selecting default board"); cMakeCode.pr("set(BOARD qemu_cortex_m3)"); } - cMakeCode.pr("# We recommend Zephyr v3.3.0 but we are compatible with older versions also"); - cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} 3.3.0)"); + cMakeCode.pr("# We recommend Zephyr v3.4.0 but we are compatible with older versions also"); + cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} 3.4.0)"); cMakeCode.newLine(); cMakeCode.pr("project(" + executableName + " LANGUAGES C)"); cMakeCode.newLine(); From c627127eb60df43e60531f922afbf02567650c6d Mon Sep 17 00:00:00 2001 From: erlingrj Date: Sat, 16 Sep 2023 12:49:33 +0200 Subject: [PATCH 126/141] Update STM32 test --- test/C/src/zephyr/boards/STM32.lf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/C/src/zephyr/boards/STM32.lf b/test/C/src/zephyr/boards/STM32.lf index c849ea0f30..409f169b85 100644 --- a/test/C/src/zephyr/boards/STM32.lf +++ b/test/C/src/zephyr/boards/STM32.lf @@ -1,6 +1,8 @@ target C { - platform: "Zephyr", - board: stm32f4_disco + platform: { + name: Zephyr, + board: stm32f4_disco + } } main reactor { From 9b02b6cba6530115e3ad67eccd288625b77a8ba9 Mon Sep 17 00:00:00 2001 From: erling Date: Sat, 16 Sep 2023 12:50:14 +0200 Subject: [PATCH 127/141] Update core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay Co-authored-by: Marten Lohstroh --- .../lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay b/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay index 30472cd1fb..0c88903dc5 100644 --- a/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay +++ b/core/src/main/resources/lib/platform/zephyr/boards/nrf52dk_nrf52832.overlay @@ -1,3 +1,3 @@ &timer1 { status = "okay"; -}; \ No newline at end of file +}; From 137a1499221439649875e17bad39d0a133b4f556 Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Sat, 16 Sep 2023 14:36:54 +0200 Subject: [PATCH 128/141] Typo in CI --- .github/workflows/c-zephyr-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/c-zephyr-tests.yml b/.github/workflows/c-zephyr-tests.yml index eb170bafcf..200b35e30f 100644 --- a/.github/workflows/c-zephyr-tests.yml +++ b/.github/workflows/c-zephyr-tests.yml @@ -58,7 +58,7 @@ jobs: rm -r test/C/src-gen - name: Run Zephyr board tests run: | - ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyBoard core:integrationTestCodeCoverageReport + ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyBoards* core:integrationTestCodeCoverageReport rm -r test/C/src-gen - name: Report to CodeCov uses: ./.github/actions/report-code-coverage From 7d3905fe97c397991a70a98bb2ab5e77b388fe49 Mon Sep 17 00:00:00 2001 From: Erling Rennemo Jellum Date: Sat, 16 Sep 2023 15:31:09 +0200 Subject: [PATCH 129/141] Another typo... --- .github/workflows/c-zephyr-tests.yml | 2 +- .../java/org/lflang/tests/runtime/CZephyrTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/c-zephyr-tests.yml b/.github/workflows/c-zephyr-tests.yml index 200b35e30f..16001457fb 100644 --- a/.github/workflows/c-zephyr-tests.yml +++ b/.github/workflows/c-zephyr-tests.yml @@ -58,7 +58,7 @@ jobs: rm -r test/C/src-gen - name: Run Zephyr board tests run: | - ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyBoards* core:integrationTestCodeCoverageReport + ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrBoards* core:integrationTestCodeCoverageReport rm -r test/C/src-gen - name: Report to CodeCov uses: ./.github/actions/report-code-coverage diff --git a/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java b/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java index 6ab2490abe..08b18b2a72 100644 --- a/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java +++ b/core/src/integrationTest/java/org/lflang/tests/runtime/CZephyrTest.java @@ -56,7 +56,7 @@ public void buildZephyrUnthreadedTests() { } @Test - public void buildZephyrBoardTests() { + public void buildZephyrBoardsTests() { Assumptions.assumeTrue(isLinux(), "Zephyr tests only run on Linux"); super.runTestsFor( List.of(Target.C), From 486377c395426dd9eac6496c227ed5335afe75dc Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Mon, 18 Sep 2023 14:41:32 +0200 Subject: [PATCH 130/141] Added test for unconnected outputs --- core/src/main/resources/lib/c/reactor-c | 2 +- test/C/src/UnconnectedOutput.lf | 34 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 test/C/src/UnconnectedOutput.lf diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 7e031ec140..f0bd1bc653 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 7e031ec1400fbebc1f90a7ce41fa10ffa40549d2 +Subproject commit f0bd1bc6533e4b47f2af9d4e9d8613fa5e670be0 diff --git a/test/C/src/UnconnectedOutput.lf b/test/C/src/UnconnectedOutput.lf new file mode 100644 index 0000000000..96a8fb3e7a --- /dev/null +++ b/test/C/src/UnconnectedOutput.lf @@ -0,0 +1,34 @@ +// Success here is not segfaulting. +target C { + timeout: 10 ms +} +reactor B(bank_index: int = 0) { + input in:int + output out_problem:int + reaction(in) -> out_problem {= + lf_set(out_problem, self->bank_index); + =} +} +reactor A { + input in:int + output out1:int + output out2:int + output out3:int + + b = new[3] B() + (in)+ -> b.in + b.out_problem -> out1, out2, out3 +} +main reactor { + m = new A() + timer t(0, 10 ms) + reaction(t) -> m.in {= + lf_set(m.in, 42); + =} + reaction(m.out3) {= + lf_print("out3 = %d", m.out3->value); + if (m.out3->value != 2) { + lf_print_error_and_exit("Expected 2."); + } + =} +} From f40157950be906b99771ca77251daaa727fe1e5c Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Mon, 18 Sep 2023 15:01:05 +0200 Subject: [PATCH 131/141] Formatted --- test/C/src/UnconnectedOutput.lf | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/C/src/UnconnectedOutput.lf b/test/C/src/UnconnectedOutput.lf index 96a8fb3e7a..571e6f1a04 100644 --- a/test/C/src/UnconnectedOutput.lf +++ b/test/C/src/UnconnectedOutput.lf @@ -1,30 +1,36 @@ // Success here is not segfaulting. target C { - timeout: 10 ms + timeout: 10 ms } + reactor B(bank_index: int = 0) { - input in:int - output out_problem:int + input in: int + output out_problem: int + reaction(in) -> out_problem {= lf_set(out_problem, self->bank_index); =} } + reactor A { - input in:int - output out1:int - output out2:int - output out3:int - + input in: int + output out1: int + output out2: int + output out3: int + b = new[3] B() (in)+ -> b.in b.out_problem -> out1, out2, out3 } + main reactor { m = new A() timer t(0, 10 ms) + reaction(t) -> m.in {= lf_set(m.in, 42); =} + reaction(m.out3) {= lf_print("out3 = %d", m.out3->value); if (m.out3->value != 2) { From 666a3ec347617bf5716651eceea7fce89a8e2fd4 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Mon, 18 Sep 2023 20:47:59 +0200 Subject: [PATCH 132/141] pull in https://github.com/lf-lang/reactor-cpp/pull/53 --- core/src/main/resources/lib/cpp/reactor-cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/cpp/reactor-cpp b/core/src/main/resources/lib/cpp/reactor-cpp index 521f1d852b..997421c0d3 160000 --- a/core/src/main/resources/lib/cpp/reactor-cpp +++ b/core/src/main/resources/lib/cpp/reactor-cpp @@ -1 +1 @@ -Subproject commit 521f1d852b6b3dc5850d3dcfc669ea812296db94 +Subproject commit 997421c0d35ef609b7ae202b4cbf2db38b884d12 From 57f92aa125140ebf5451499bc8fb7a35f002b10a Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Mon, 18 Sep 2023 20:48:22 +0200 Subject: [PATCH 133/141] improve shutdown tests --- test/Cpp/src/Starve.lf | 24 ++++++++++++++++++++++++ test/Cpp/src/TimeLimit.lf | 29 ++++++++++++++++++++++++++--- test/Cpp/src/Timeout_Test.lf | 16 ++++++++++++---- 3 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 test/Cpp/src/Starve.lf diff --git a/test/Cpp/src/Starve.lf b/test/Cpp/src/Starve.lf new file mode 100644 index 0000000000..ba9c45d998 --- /dev/null +++ b/test/Cpp/src/Starve.lf @@ -0,0 +1,24 @@ +target Cpp + +main reactor { + timer t(1 s) + logical action after_shutdown: void + + reaction(t) -> after_shutdown {= + reactor::log::Info() << "Timer triggered at " << get_tag(); + =} + + reaction(shutdown) -> after_shutdown {= + reactor::log::Info() << "Shutdown triggered at " << get_tag(); + if(get_elapsed_logical_time() != 1s || get_microstep() != 1) { + reactor::log::Error() << "Shutdown invoked at wrong tag"; + exit(2); + } + after_shutdown.schedule(); + =} + + reaction(after_shutdown) {= + reactor::log::Error() << "Executed a reaction after shutdown"; + exit(1); + =} +} diff --git a/test/Cpp/src/TimeLimit.lf b/test/Cpp/src/TimeLimit.lf index 1d11882740..28cb3894ef 100644 --- a/test/Cpp/src/TimeLimit.lf +++ b/test/Cpp/src/TimeLimit.lf @@ -19,23 +19,39 @@ reactor Clock(offset: time = 0, period: time = 1 sec) { reactor Destination { input x: int state s: int = 1 + state shutdown_invoked: bool = false + input check_shutdown: void reaction(x) {= //std::cout << "Received " << *x.get() << '\n'; if (*x.get() != s) { - std::cerr << "Error: Expected " << s << " and got " << *x.get() << '\n'; + reactor::log::Error() << "Expected " << s << " and got " << *x.get(); exit(1); } + if (*x.get() == 12 && !shutdown_invoked) { + reactor::log::Error() << "Shutdown wasn't invoked!"; + } s++; =} reaction(shutdown) {= std::cout << "**** shutdown reaction invoked.\n"; + shutdown_invoked = true; + if(get_microstep() != 1) { + reactor::log::Error() << "Expected microstep == 1, but got " << get_microstep(); + exit(2); + } if (s != 12) { - std::cerr << "ERROR: Expected 12 but got " << s << '\n'; + reactor::log::Error() << "Expected 12 but got " << s; exit(1); } =} + + reaction(check_shutdown) {= + if (!shutdown_invoked) { + reactor::log::Error() << "Shutdown wasn't invoked!"; + } + =} } main reactor TimeLimit(period: time = 1 sec) { @@ -44,7 +60,14 @@ main reactor TimeLimit(period: time = 1 sec) { d = new Destination() c.y -> d.x - reaction(stop) {= + logical action check: void + + reaction(stop) -> check {= environment()->sync_shutdown(); + check.schedule(); + =} + + reaction(check) -> d.check_shutdown {= + d.check_shutdown.set(); =} } diff --git a/test/Cpp/src/Timeout_Test.lf b/test/Cpp/src/Timeout_Test.lf index aac8a04934..6c0224941c 100644 --- a/test/Cpp/src/Timeout_Test.lf +++ b/test/Cpp/src/Timeout_Test.lf @@ -15,6 +15,8 @@ reactor Consumer { input in: int state success: bool = false + logical action after_shutdown: void + reaction(in) {= auto current{get_elapsed_logical_time()}; if(current > 11ms ){ @@ -25,15 +27,21 @@ reactor Consumer { } =} - reaction(shutdown) {= - reactor::log::Info() << "Shutdown invoked at " << get_elapsed_logical_time(); - if((get_elapsed_logical_time() == 11ms ) && (success == true)){ + reaction(shutdown) -> after_shutdown {= + reactor::log::Info() << "Shutdown invoked at tag " << get_tag(); + if((get_elapsed_logical_time() == 11ms ) && get_microstep() == 0 && (success == true)){ reactor::log::Info() << "SUCCESS: successfully enforced timeout."; + after_shutdown.schedule(); } else { - reactor::log::Error() << "Shutdown invoked at: " << get_elapsed_logical_time() << ". Failed to enforce timeout."; + reactor::log::Error() << "Failed to enforce timeout at the correct tag."; exit(1); } =} + + reaction(after_shutdown) {= + reactor::log::Error() << "Executed a reaction after timeout."; + exit(2); + =} } main reactor Timeout_Test { From f7386ed8148102d8b85a4ae5c2d5d73b96d00aa2 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Wed, 20 Sep 2023 16:41:54 +0200 Subject: [PATCH 134/141] update reactor-cpp, improve and add tests --- core/src/main/resources/lib/cpp/reactor-cpp | 2 +- test/Cpp/src/ShutdownAsync.lf | 28 +++++++++ test/Cpp/src/ShutdownSync.lf | 25 ++++++++ test/Cpp/src/Starve.lf | 2 +- test/Cpp/src/StarveZero.lf | 19 ++++++ test/Cpp/src/Timeout_Test.lf | 52 ---------------- test/Cpp/src/properties/Timeout.lf | 66 ++++++++++++++++----- test/Cpp/src/properties/TimeoutZero.lf | 28 +++------ 8 files changed, 132 insertions(+), 90 deletions(-) create mode 100644 test/Cpp/src/ShutdownAsync.lf create mode 100644 test/Cpp/src/ShutdownSync.lf create mode 100644 test/Cpp/src/StarveZero.lf delete mode 100644 test/Cpp/src/Timeout_Test.lf diff --git a/core/src/main/resources/lib/cpp/reactor-cpp b/core/src/main/resources/lib/cpp/reactor-cpp index 997421c0d3..fa685f1db9 160000 --- a/core/src/main/resources/lib/cpp/reactor-cpp +++ b/core/src/main/resources/lib/cpp/reactor-cpp @@ -1 +1 @@ -Subproject commit 997421c0d35ef609b7ae202b4cbf2db38b884d12 +Subproject commit fa685f1db99b1652e39a5cf3c6356a8db26b52bb diff --git a/test/Cpp/src/ShutdownAsync.lf b/test/Cpp/src/ShutdownAsync.lf new file mode 100644 index 0000000000..c1ec5ed8e5 --- /dev/null +++ b/test/Cpp/src/ShutdownAsync.lf @@ -0,0 +1,28 @@ +target Cpp + +main reactor { + logical action check_shutdown + timer request_shutdown(1 ms) + timer after_shutdown(2 ms) + + reaction(request_shutdown) -> check_shutdown {= + // async_shutdown can be called from external threads to shutdown + // at the next possible tag. If it is called from a reaction, the + // next possible tag should always be the next microstep. + environment()->async_shutdown(); + check_shutdown.schedule(); + =} + + reaction(shutdown, check_shutdown) {= + if (!(shutdown.is_present() && check_shutdown.is_present())) { + reactor::log::Error() << "shutdown was not triggered at the expcetd tag"; + exit(1); + } + reactor::log::Info() << "Success!"; + =} + + reaction(after_shutdown) {= + reactor::log::Error() << "triggered a reaction after shutdown"; + exit(2); + =} +} diff --git a/test/Cpp/src/ShutdownSync.lf b/test/Cpp/src/ShutdownSync.lf new file mode 100644 index 0000000000..a07e4f2a59 --- /dev/null +++ b/test/Cpp/src/ShutdownSync.lf @@ -0,0 +1,25 @@ +target Cpp + +main reactor { + logical action check_shutdown + timer request_shutdown(1 ms) + timer after_shutdown(2 ms) + + reaction(request_shutdown) -> check_shutdown {= + environment()->sync_shutdown(); + check_shutdown.schedule(); + =} + + reaction(shutdown, check_shutdown) {= + if (!(shutdown.is_present() && check_shutdown.is_present())) { + reactor::log::Error() << "shutdown was not triggered at the expcetd tag"; + exit(1); + } + reactor::log::Info() << "Success!"; + =} + + reaction(after_shutdown) {= + reactor::log::Error() << "triggered a reaction after shutdown"; + exit(2); + =} +} diff --git a/test/Cpp/src/Starve.lf b/test/Cpp/src/Starve.lf index ba9c45d998..73f4e4ecfc 100644 --- a/test/Cpp/src/Starve.lf +++ b/test/Cpp/src/Starve.lf @@ -19,6 +19,6 @@ main reactor { reaction(after_shutdown) {= reactor::log::Error() << "Executed a reaction after shutdown"; - exit(1); + exit(1); =} } diff --git a/test/Cpp/src/StarveZero.lf b/test/Cpp/src/StarveZero.lf new file mode 100644 index 0000000000..e7463f6424 --- /dev/null +++ b/test/Cpp/src/StarveZero.lf @@ -0,0 +1,19 @@ +target Cpp + +main reactor { + logical action after_shutdown: void + + reaction(shutdown) -> after_shutdown {= + reactor::log::Info() << "Shutdown triggered at " << get_tag(); + if(get_elapsed_logical_time() != 0s || get_microstep() != 1) { + reactor::log::Error() << "Shutdown invoked at wrong tag"; + exit(2); + } + after_shutdown.schedule(); + =} + + reaction(after_shutdown) {= + reactor::log::Error() << "Executed a reaction after shutdown"; + exit(1); + =} +} diff --git a/test/Cpp/src/Timeout_Test.lf b/test/Cpp/src/Timeout_Test.lf deleted file mode 100644 index 6c0224941c..0000000000 --- a/test/Cpp/src/Timeout_Test.lf +++ /dev/null @@ -1,52 +0,0 @@ -/** - * A test for the timeout functionality in Lingua Franca. - * - * @author Maiko Brants TU Dresden - * - * Modeled after the C version of this test. - */ -target Cpp { - timeout: 11 msec -} - -import Sender from "lib/LoopedActionSender.lf" - -reactor Consumer { - input in: int - state success: bool = false - - logical action after_shutdown: void - - reaction(in) {= - auto current{get_elapsed_logical_time()}; - if(current > 11ms ){ - reactor::log::Error() << "Received at: " << current.count() << ". Failed to enforce timeout."; - exit(1); - } else if(current == 11ms) { - success=true; - } - =} - - reaction(shutdown) -> after_shutdown {= - reactor::log::Info() << "Shutdown invoked at tag " << get_tag(); - if((get_elapsed_logical_time() == 11ms ) && get_microstep() == 0 && (success == true)){ - reactor::log::Info() << "SUCCESS: successfully enforced timeout."; - after_shutdown.schedule(); - } else { - reactor::log::Error() << "Failed to enforce timeout at the correct tag."; - exit(1); - } - =} - - reaction(after_shutdown) {= - reactor::log::Error() << "Executed a reaction after timeout."; - exit(2); - =} -} - -main reactor Timeout_Test { - consumer = new Consumer() - producer = new Sender(take_a_break_after=10, break_interval = 1 msec) - - producer.out -> consumer.in -} diff --git a/test/Cpp/src/properties/Timeout.lf b/test/Cpp/src/properties/Timeout.lf index a278d6d712..95d60963f5 100644 --- a/test/Cpp/src/properties/Timeout.lf +++ b/test/Cpp/src/properties/Timeout.lf @@ -1,31 +1,65 @@ +/** + * A test for the timeout functionality in Lingua Franca. + * + * @author Maiko Brants TU Dresden + * + * Modeled after the C version of this test. + */ target Cpp { - timeout: 1 sec + timeout: 11 msec } -main reactor { - timer t(1 sec, 1 sec) +import Sender from "../lib/LoopedActionSender.lf" + +reactor Consumer { + input in: int + state success: bool = false - state triggered: bool = false + logical action after_shutdown: void - reaction(t) {= - triggered = true; - if (get_elapsed_logical_time() != 1s) { - std::cout << "ERROR: triggered reaction at an unexpected tag"; + timer check_shutdown(11 ms) + + reaction(in) {= + auto current{get_elapsed_logical_time()}; + if(current > 11ms ){ + reactor::log::Error() << "Received at: " << current.count() << ". Failed to enforce timeout."; exit(1); + } else if(current == 11ms) { + success=true; } =} - reaction(shutdown) {= - if (get_elapsed_logical_time() != 1s || get_microstep() != 0) { - std::cout << "ERROR: shutdown invoked at an unexpected tag"; - exit(2); + reaction(shutdown) -> after_shutdown {= + reactor::log::Info() << "Shutdown invoked at tag " << get_tag(); + if((get_elapsed_logical_time() == 11ms ) && get_microstep() == 0 && (success == true)){ + reactor::log::Info() << "SUCCESS: successfully enforced timeout."; + after_shutdown.schedule(); + } else { + reactor::log::Error() << "Failed to enforce timeout at the correct tag."; + exit(1); } + =} - if (triggered) { - std::cout << "SUCCESS!\n"; - } else { - std::cout << "ERROR: reaction was not invoked!\n"; + reaction(check_shutdown, shutdown) {= + if (check_shutdown.is_present() && !shutdown.is_present()) { + reactor::log::Error() << "Shutdown was not triggered at the expected tag"; exit(2); } + if (!check_shutdown.is_present() && shutdown.is_present()) { + reactor::log::Error() << "Shutdown was triggered at an unxpected tag: " << get_tag(); + exit(2); + } + =} + + reaction(after_shutdown) {= + reactor::log::Error() << "Executed a reaction after timeout."; + exit(2); =} } + +main reactor { + consumer = new Consumer() + producer = new Sender(take_a_break_after=10, break_interval = 1 msec) + + producer.out -> consumer.in +} diff --git a/test/Cpp/src/properties/TimeoutZero.lf b/test/Cpp/src/properties/TimeoutZero.lf index 3aa45c7203..7f32565788 100644 --- a/test/Cpp/src/properties/TimeoutZero.lf +++ b/test/Cpp/src/properties/TimeoutZero.lf @@ -1,31 +1,19 @@ target Cpp { - timeout: 0 sec + timeout: 0 s } main reactor { - timer t(0, 1 sec) + timer should_never_trigger(1 s) - state triggered: bool = false - - reaction(t) {= - triggered = true; - if (get_elapsed_logical_time() != 0s) { - std::cout << "ERROR: triggered reaction at an unexpected tag"; + reaction(startup, shutdown) {= + if (!(startup.is_present() && shutdown.is_present())) { + reactor::log::Error() << "Shutdown was not triggered at startup"; exit(1); } =} - reaction(shutdown) {= - if (get_elapsed_logical_time() != 0s || get_microstep() != 0) { - std::cout << "ERROR: shutdown invoked at an unexpected tag"; - exit(2); - } - - if (triggered) { - std::cout << "SUCCESS!\n"; - } else { - std::cout << "ERROR: reaction was not invoked!\n"; - exit(2); - } + reaction(should_never_trigger) {= + reactor::log::Error() << "Executed a reaction after timeout."; + exit(2); =} } From 7b5f0a9ce82a4b5eb5261dd66f5f72d308f0a00e Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 22 Sep 2023 11:49:53 +0200 Subject: [PATCH 135/141] add lsp dependency on de.cau.cs.kieler.klighd.incremental This should stabilize the diagram generation in VS Code. See https://github.com/lf-lang/vscode-lingua-franca/issues/103 and this comment: https://github.com/lf-lang/vscode-lingua-franca/issues/103#issuecomment-1731023470 --- lsp/build.gradle | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lsp/build.gradle b/lsp/build.gradle index 772f618db1..65215162b7 100644 --- a/lsp/build.gradle +++ b/lsp/build.gradle @@ -10,6 +10,13 @@ dependencies { exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt.*' exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt' } + + // This dependency ensures correct animations and bookkeeping during updates + // See https://github.com/lf-lang/vscode-lingua-franca/issues/103#issuecomment-1731023470 + implementation ("de.cau.cs.kieler.klighd:de.cau.cs.kieler.klighd.incremental:$klighdVersion") { + exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt.*' + exclude group: 'org.eclipse.platform', module: 'org.eclipse.swt' + } } application { From d61d3e650334afdd4526c44ebccbbda5a87fa427 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 22 Sep 2023 16:43:51 +0200 Subject: [PATCH 136/141] add synthesis option to control if reactors are expanded by default --- .../lflang/diagram/synthesis/LinguaFrancaSynthesis.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index b51822c9a5..0c6c88d8d5 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -257,6 +257,9 @@ public class LinguaFrancaSynthesis extends AbstractDiagramSynthesis { SynthesisOption.createRangeOption("Reactor Parameter/Variable Columns", 1, 10, 1) .setCategory(APPEARANCE); + public static final SynthesisOption DEFAULT_EXPAND_ALL = + SynthesisOption.createCheckOption("Expand reactors by default", false); + public static final SynthesisOption FIXED_PORT_SIDE = SynthesisOption.createCheckOption("Fixed Port Sides", true).setCategory(LAYOUT); public static final SynthesisOption SPACING = @@ -273,6 +276,7 @@ public class LinguaFrancaSynthesis extends AbstractDiagramSynthesis { public List getDisplayedSynthesisOptions() { return List.of( SHOW_ALL_REACTORS, + DEFAULT_EXPAND_ALL, MemorizingExpandCollapseAction.MEMORIZE_EXPANSION_STATES, CYCLE_DETECTION, APPEARANCE, @@ -1019,18 +1023,16 @@ private Collection transformReactorNetwork( TriggerInstance reset = null; // Transform instances - int index = 0; for (ReactorInstance child : reactorInstance.children) { Boolean expansionState = MemorizingExpandCollapseAction.getExpansionState(child); Collection rNodes = createReactorNode( child, - expansionState != null ? expansionState : false, + expansionState != null ? expansionState : getBooleanValue(DEFAULT_EXPAND_ALL), inputPorts, outputPorts, allReactorNodes); nodes.addAll(rNodes); - index++; } // Create timers From b7ee795dffb8222756fa88dddc89b7e4f5b7322c Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 22 Sep 2023 17:06:32 +0200 Subject: [PATCH 137/141] Removed "Reaction level" diagram synthesis option Fixes https://github.com/lf-lang/lingua-franca/issues/2017 --- .../synthesis/LinguaFrancaSynthesis.java | 3 --- .../styles/LinguaFrancaShapeExtensions.java | 18 ------------------ 2 files changed, 21 deletions(-) diff --git a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java index b51822c9a5..1c992557b6 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/LinguaFrancaSynthesis.java @@ -237,8 +237,6 @@ public class LinguaFrancaSynthesis extends AbstractDiagramSynthesis { SynthesisOption.createCheckOption("Multiport Widths", false).setCategory(APPEARANCE); public static final SynthesisOption SHOW_REACTION_CODE = SynthesisOption.createCheckOption("Reaction Code", false).setCategory(APPEARANCE); - public static final SynthesisOption SHOW_REACTION_LEVEL = - SynthesisOption.createCheckOption("Reaction Level", false).setCategory(APPEARANCE); public static final SynthesisOption SHOW_REACTION_ORDER_EDGES = SynthesisOption.createCheckOption("Reaction Order Edges", false).setCategory(APPEARANCE); public static final SynthesisOption SHOW_REACTOR_HOST = @@ -287,7 +285,6 @@ public List getDisplayedSynthesisOptions() { SHOW_PORT_NAMES, SHOW_MULTIPORT_WIDTH, SHOW_REACTION_CODE, - SHOW_REACTION_LEVEL, SHOW_REACTION_ORDER_EDGES, SHOW_REACTOR_HOST, SHOW_INSTANCE_NAMES, diff --git a/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java b/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java index b8ee69fa1c..88d15db4f6 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java @@ -72,7 +72,6 @@ import org.eclipse.elk.graph.properties.Property; import org.eclipse.xtext.xbase.lib.Extension; import org.eclipse.xtext.xbase.lib.Functions.Function1; -import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.Pair; import org.eclipse.xtext.xbase.lib.StringExtensions; import org.lflang.ast.ASTUtils; @@ -424,23 +423,6 @@ public KPolygon addReactionFigure(KNode node, ReactionInstance reaction) { DiagramSyntheses.suppressSelectability(textToAdd); } - // optional reaction level - if (getBooleanValue(LinguaFrancaSynthesis.SHOW_REACTION_LEVEL)) { - // Force calculation of levels for reactions. This calculation - // will only be done once. Note that if this fails due to a causality loop, - // then some reactions will have level -1. - try { - String levels = IterableExtensions.join(reaction.getLevels(), ", "); - KText levelsText = - _kContainerRenderingExtensions.addText(contentContainer, ("level: " + levels)); - _kRenderingExtensions.setFontBold(levelsText, false); - _linguaFrancaStyleExtensions.noSelectionStyle(levelsText); - DiagramSyntheses.suppressSelectability(levelsText); - } catch (Exception ex) { - // If the graph has cycles, the above fails. Continue without showing levels. - } - } - // optional code content boolean hasCode = getBooleanValue(LinguaFrancaSynthesis.SHOW_REACTION_CODE) From 52180e2e1e04d02b920c633930c3f5da469de41a Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 22 Sep 2023 17:11:38 +0200 Subject: [PATCH 138/141] Avoid null pointer exception in diagrams with bodyless reactions --- .../diagram/synthesis/styles/LinguaFrancaShapeExtensions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java b/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java index b8ee69fa1c..893d7df47b 100644 --- a/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java +++ b/core/src/main/java/org/lflang/diagram/synthesis/styles/LinguaFrancaShapeExtensions.java @@ -444,6 +444,7 @@ public KPolygon addReactionFigure(KNode node, ReactionInstance reaction) { // optional code content boolean hasCode = getBooleanValue(LinguaFrancaSynthesis.SHOW_REACTION_CODE) + && reaction.getDefinition().getCode() != null && !StringExtensions.isNullOrEmpty(reaction.getDefinition().getCode().getBody()); if (hasCode) { KText hasCodeText = From 18d83214feeb03d96f79d607261fcbee7fb9d00e Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Fri, 22 Sep 2023 17:57:56 +0200 Subject: [PATCH 139/141] Removed stray print statement --- core/src/main/java/org/lflang/AttributeUtils.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/java/org/lflang/AttributeUtils.java b/core/src/main/java/org/lflang/AttributeUtils.java index 7e7b445d9c..147a4b6d0d 100644 --- a/core/src/main/java/org/lflang/AttributeUtils.java +++ b/core/src/main/java/org/lflang/AttributeUtils.java @@ -110,9 +110,6 @@ public static Attribute findAttributeByName(EObject node, String name) { */ public static List findAttributesByName(EObject node, String name) { List attrs = getAttributes(node); - if (!attrs.isEmpty()) { - System.out.println("Fun"); - } return attrs.stream() .filter( it -> From 9edab375febce6a03a2d11b90c32d889990e42c1 Mon Sep 17 00:00:00 2001 From: Marten Lohstroh Date: Fri, 22 Sep 2023 16:14:11 -0700 Subject: [PATCH 140/141] Fix ArrayAsParameter.lf --- test/Python/src/ArrayAsParameter.lf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Python/src/ArrayAsParameter.lf b/test/Python/src/ArrayAsParameter.lf index b794008a7c..58b4cb50e3 100644 --- a/test/Python/src/ArrayAsParameter.lf +++ b/test/Python/src/ArrayAsParameter.lf @@ -1,7 +1,7 @@ # Source has an array as a parameter, the elements of which it passes to Print. target Python -reactor Source(sequence(0, 1, 2)) { +reactor Source(sequence = [0, 1, 2]) { output out state count = 0 logical action next @@ -36,7 +36,7 @@ reactor Print { } main reactor ArrayAsParameter { - s = new Source(sequence(1, 2, 3, 4)) + s = new Source(sequence = [1, 2, 3, 4]) p = new Print() s.out -> p._in } From b3d0600de7bd7440e8b9e8b1fbe14021dfa1773c Mon Sep 17 00:00:00 2001 From: Shaokai Lin Date: Sun, 24 Sep 2023 23:40:46 -0700 Subject: [PATCH 141/141] Bump reactor-c --- core/src/main/resources/lib/c/reactor-c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index ccedcabdcb..7bea24f5ad 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit ccedcabdcbe257d27592c214478870bb1d6eba21 +Subproject commit 7bea24f5ad31ccdf26a1a676aecac9970c3576ba