From 7723bdb51154dfcb283553d7021e402e4183ba69 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sun, 8 Dec 2024 15:24:20 -0800 Subject: [PATCH] Cleaned up lf_get_federation_id --- core/src/main/resources/lib/c/reactor-c | 2 +- .../transient/TransientDownstreamWithTimer.lf | 9 ------- .../TransientDownstreamWithTwoUpstream.lf | 9 ------- .../federated/transient/TransientHotSwap.lf | 9 ------- .../transient/TransientStatePersistence.lf | 25 +++++-------------- 5 files changed, 7 insertions(+), 47 deletions(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 5af472c73b..83bf6c4f19 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 5af472c73b4082fef33c35783a0101ec2c3550a1 +Subproject commit 83bf6c4f191e5d5cda09aea0e54ccd5c604b82e0 diff --git a/test/C/src/federated/transient/TransientDownstreamWithTimer.lf b/test/C/src/federated/transient/TransientDownstreamWithTimer.lf index aaa99718d1..cdac2d994c 100644 --- a/test/C/src/federated/transient/TransientDownstreamWithTimer.lf +++ b/test/C/src/federated/transient/TransientDownstreamWithTimer.lf @@ -13,15 +13,6 @@ target C { preamble {= #include #include - #ifdef __cplusplus - extern "C" { - #endif - - const char* lf_get_federation_id(); - - #ifdef __cplusplus - } - #endif =} /** Persistent federate that is responsible for lauching the transient federate */ diff --git a/test/C/src/federated/transient/TransientDownstreamWithTwoUpstream.lf b/test/C/src/federated/transient/TransientDownstreamWithTwoUpstream.lf index a3f8c92754..44395f244f 100644 --- a/test/C/src/federated/transient/TransientDownstreamWithTwoUpstream.lf +++ b/test/C/src/federated/transient/TransientDownstreamWithTwoUpstream.lf @@ -19,15 +19,6 @@ import Middle from "TransientDownstreamWithTimer.lf" preamble {= #include #include - #ifdef __cplusplus - extern "C" { - #endif - - const char* lf_get_federation_id(); - - #ifdef __cplusplus - } - #endif =} /** Persistent federate that is responsible for lauching the transient federate */ diff --git a/test/C/src/federated/transient/TransientHotSwap.lf b/test/C/src/federated/transient/TransientHotSwap.lf index 99ee3a428c..b8270af8d7 100644 --- a/test/C/src/federated/transient/TransientHotSwap.lf +++ b/test/C/src/federated/transient/TransientHotSwap.lf @@ -18,15 +18,6 @@ import Down from "TransientDownstreamWithTimer.lf" preamble {= #include #include - #ifdef __cplusplus - extern "C" { - #endif - - const char* lf_get_federation_id(); - - #ifdef __cplusplus - } - #endif =} /** Persistent federate that is responsible for lauching the transient federate */ diff --git a/test/C/src/federated/transient/TransientStatePersistence.lf b/test/C/src/federated/transient/TransientStatePersistence.lf index e22c1e6b3e..d7b28382df 100644 --- a/test/C/src/federated/transient/TransientStatePersistence.lf +++ b/test/C/src/federated/transient/TransientStatePersistence.lf @@ -1,30 +1,17 @@ /** * This LF program showcases and tests the persistance of the internal state of a transient federate * across executions. Using the hot swap mechanism, the transient federate `Middle` leaves and then - * joins. Whenever the state to save changes (of type `federate_state_t`), it notifies - * `Persistence`. `Middle` notifies `Persistence` also when it joins. When it joins the second time - * or after, it receives the saved state and sets it. In this, the order of the reactions is - * important. + * joins. Whenever the state (of type `federate_state_t`) changes, it notifies `Persistence`. `Middle` + * notifies `Persistence` also when it joins. When `Middle` joins the second time or after, it receives + * the saved state and sets it. In this, the order of the reactions is important. */ target C { - timeout: 2900 ms, - logging: LOG + timeout: 2900 ms } preamble {= #include #include - - #ifdef __cplusplus - extern "C" { - #endif - - const char* lf_get_federation_id(); - - #ifdef __cplusplus - } - #endif - // The internal federate state to be persistent across executions typedef struct federate_state_t { char state_char; @@ -81,7 +68,7 @@ reactor Persistence { reaction(in_from_middle) {= self->middle_state.state_char = in_from_middle->value.state_char; self->middle_state.state_count = in_from_middle->value.state_count; - lf_print("Latest recieved state: {%c,%d}", self->middle_state.state_char, + lf_print("Latest received state: {%c,%d}", self->middle_state.state_char, self->middle_state.state_count); =} } @@ -139,7 +126,7 @@ reactor Middle { reaction(in_from_persistence) {= self->middle_state = in_from_persistence->value; - lf_print("Recieved the latest state of: {%c,%d} at " PRINTF_TIME ".", + lf_print("Received the latest state of: {%c,%d} at " PRINTF_TIME ".", self->middle_state.state_char, self->middle_state.state_count, lf_time_logical_elapsed());