From 0096d9985da224c812c5a0fda14c616cecc5afec Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 24 Mar 2023 12:31:18 -0700 Subject: [PATCH 01/12] Delete some includes from reactor.h. --- include/core/reactor.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/include/core/reactor.h b/include/core/reactor.h index a70084820..39ef96e9e 100644 --- a/include/core/reactor.h +++ b/include/core/reactor.h @@ -49,19 +49,9 @@ #ifndef REACTOR_H #define REACTOR_H -#include -#include -#include -#include -#include -#include - #include "lf_types.h" -#include "lf_token.h" #include "modes.h" // Modal model support -#include "platform.h" // Platform-specific times and APIs #include "port.h" -#include "pqueue.h" #include "tag.h" // Time-related functions. #include "trace.h" #include "util.h" From dd1e472072b30e8d41810f5685802c4f7f91ef2d Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 24 Mar 2023 13:44:52 -0700 Subject: [PATCH 02/12] Pare down user-visible namespace. This primarily consists of removing platform.h from the public namespace. It is still included in federate.h, but this is not a problem that needs to be dealt with right now. --- core/federated/clock-sync.c | 1 + core/federated/federate.c | 3 ++- core/modal_models/modes.c | 1 + core/platform/lf_unix_clock_support.c | 1 + core/tag.c | 2 ++ core/threaded/reactor_threaded.c | 2 +- core/utils/pqueue.c | 1 + include/core/federated/federate.h | 4 +++- include/core/lf_types.h | 1 - include/core/modal_models/modes.h | 2 +- include/core/platform.h | 19 ++--------------- include/core/platform/lf_arduino_support.h | 16 --------------- include/core/platform/lf_nrf52_support.h | 12 ----------- include/core/platform/lf_tag_64_32.h | 18 ---------------- include/core/platform/lf_zephyr_support.h | 16 --------------- include/core/port.h | 1 - include/core/tag.h | 24 ++++++++++++++++++---- 17 files changed, 35 insertions(+), 89 deletions(-) diff --git a/core/federated/clock-sync.c b/core/federated/clock-sync.c index feeb2f070..dd6bd8fcd 100644 --- a/core/federated/clock-sync.c +++ b/core/federated/clock-sync.c @@ -38,6 +38,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +#include "platform.h" #include "clock-sync.h" #include "net_common.h" #include "net_util.h" diff --git a/core/federated/federate.c b/core/federated/federate.c index 820269a6b..c0964e2d3 100644 --- a/core/federated/federate.c +++ b/core/federated/federate.c @@ -48,6 +48,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include // Defines read(), write(), and close() +#include #include "clock-sync.h" #include "federate.h" @@ -2940,4 +2941,4 @@ parse_rti_code_t parse_rti_addr(const char* rti_addr) { void set_federation_id(const char* fid) { federation_metadata.federation_id = fid; } -#endif \ No newline at end of file +#endif diff --git a/core/modal_models/modes.c b/core/modal_models/modes.c index 2d5a33bcb..35e10718c 100644 --- a/core/modal_models/modes.c +++ b/core/modal_models/modes.c @@ -39,6 +39,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include +#include "platform.h" #include "lf_types.h" #include "modes.h" #include "reactor_common.h" diff --git a/core/platform/lf_unix_clock_support.c b/core/platform/lf_unix_clock_support.c index a936d8a15..65d5e31be 100644 --- a/core/platform/lf_unix_clock_support.c +++ b/core/platform/lf_unix_clock_support.c @@ -2,6 +2,7 @@ #include #include +#include "platform.h" #include "lf_unix_clock_support.h" /** diff --git a/core/tag.c b/core/tag.c index f10bed4cf..a38caa5fb 100644 --- a/core/tag.c +++ b/core/tag.c @@ -37,6 +37,8 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "tag.h" #include "util.h" +#include "platform.h" +#include "util.h" // Global variables :( diff --git a/core/threaded/reactor_threaded.c b/core/threaded/reactor_threaded.c index 3e0a67fb5..2697c2782 100644 --- a/core/threaded/reactor_threaded.c +++ b/core/threaded/reactor_threaded.c @@ -1192,4 +1192,4 @@ int lf_critical_section_enter() { int lf_critical_section_exit() { return lf_mutex_unlock(&mutex); } -#endif \ No newline at end of file +#endif diff --git a/core/utils/pqueue.c b/core/utils/pqueue.c index 6977a958f..aa1f1bd15 100644 --- a/core/utils/pqueue.c +++ b/core/utils/pqueue.c @@ -37,6 +37,7 @@ #include #include +#include "platform.h" #include "pqueue.h" #include "util.h" #include "lf_types.h" diff --git a/include/core/federated/federate.h b/include/core/federated/federate.h index d15a0e920..2cfb6f5c1 100644 --- a/include/core/federated/federate.h +++ b/include/core/federated/federate.h @@ -32,9 +32,11 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef FEDERATE_H #define FEDERATE_H +#include + #include "tag.h" #include "lf_types.h" -#include +#include "platform.h" #ifndef ADVANCE_MESSAGE_INTERVAL #define ADVANCE_MESSAGE_INTERVAL MSEC(10) diff --git a/include/core/lf_types.h b/include/core/lf_types.h index 4698f8abd..5a0bde4bf 100644 --- a/include/core/lf_types.h +++ b/include/core/lf_types.h @@ -40,7 +40,6 @@ #include "modal_models/modes.h" // Modal model support #include "utils/pqueue.h" -#include "platform.h" #include "tag.h" #include "lf_token.h" diff --git a/include/core/modal_models/modes.h b/include/core/modal_models/modes.h index 334df011e..7a3b82667 100644 --- a/include/core/modal_models/modes.h +++ b/include/core/modal_models/modes.h @@ -47,8 +47,8 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "platform.h" #include "lf_types.h" +#include "tag.h" typedef struct event_t event_t; typedef struct reaction_t reaction_t; diff --git a/include/core/platform.h b/include/core/platform.h index c0ea35ce8..b3715c869 100644 --- a/include/core/platform.h +++ b/include/core/platform.h @@ -42,6 +42,8 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef PLATFORM_H #define PLATFORM_H +#include "lf_types.h" + #if defined(LF_THREADED) && defined(LF_UNTHREADED) #error LF_UNTHREADED and LF_THREADED runtime requested #endif @@ -85,23 +87,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define LF_TIMEOUT _LF_TIMEOUT - -/** - * Time instant. Both physical and logical times are represented - * using this typedef. - */ -typedef _instant_t instant_t; - -/** - * Interval of time. - */ -typedef _interval_t interval_t; - -/** - * Microstep instant. - */ -typedef _microstep_t microstep_t; - /** * Enter a critical section where logical time and the event queue are guaranteed * to not change unless they are changed within the critical section. diff --git a/include/core/platform/lf_arduino_support.h b/include/core/platform/lf_arduino_support.h index 310731015..8db4c84c1 100644 --- a/include/core/platform/lf_arduino_support.h +++ b/include/core/platform/lf_arduino_support.h @@ -135,20 +135,4 @@ extern lf_cond_t event_q_changed; // Arduinos are embedded platforms with no tty #define NO_TTY -/** - * Time instant. Both physical and logical times are represented - * using this typedef. - */ -typedef int64_t _instant_t; - -/** - * Interval of time. - */ -typedef int64_t _interval_t; - -/** - * Microstep instant. - */ -typedef uint32_t _microstep_t; - #endif // LF_ARDUINO_SUPPORT_H diff --git a/include/core/platform/lf_nrf52_support.h b/include/core/platform/lf_nrf52_support.h index cca307e17..a0a10d278 100644 --- a/include/core/platform/lf_nrf52_support.h +++ b/include/core/platform/lf_nrf52_support.h @@ -46,18 +46,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define PRINTF_MICROSTEP "%" PRIu32 #define PRINTF_TAG "(%" PRId64 ", %" PRIu32 ")" -typedef int64_t _instant_t; - -/** - * Interval of time. - */ -typedef int64_t _interval_t; - -/** - * Microstep instant. - */ -typedef uint32_t _microstep_t; - /** * No mutex or condition variable needed for single threaded NRF platforms */ diff --git a/include/core/platform/lf_tag_64_32.h b/include/core/platform/lf_tag_64_32.h index 74c2b07cd..6d9c0fc1d 100644 --- a/include/core/platform/lf_tag_64_32.h +++ b/include/core/platform/lf_tag_64_32.h @@ -48,24 +48,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // printf("Tag is " PRINTF_TAG "\n", time_value, microstep); #define PRINTF_TAG "(" PRINTF_TIME ", " PRINTF_MICROSTEP ")" -/** - * Time instant. Both physical and logical times are represented - * using this typedef. - * WARNING: If this code is used after about the year 2262, - * then representing time as a 64-bit long long will be insufficient. - */ -typedef int64_t _instant_t; - -/** - * Interval of time. - */ -typedef int64_t _interval_t; - -/** - * Microstep instant. - */ -typedef uint32_t _microstep_t; - /** * For user-friendly reporting of time values, the buffer length required. * This is calculated as follows, based on 64-bit time in nanoseconds: diff --git a/include/core/platform/lf_zephyr_support.h b/include/core/platform/lf_zephyr_support.h index 010eee599..68bd6ab0f 100644 --- a/include/core/platform/lf_zephyr_support.h +++ b/include/core/platform/lf_zephyr_support.h @@ -45,22 +45,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define PRINTF_TAG "(" PRINTF_TIME ", " PRINTF_MICROSTEP ")" #define _LF_TIMEOUT 1 -/** - * Time instant. Both physical and logical times are represented - * using this typedef. - */ -typedef int64_t _instant_t; - -/** - * Interval of time. - */ -typedef int64_t _interval_t; - -/** - * Microstep instant. - */ -typedef uint32_t _microstep_t; - #ifdef LF_THREADED typedef struct k_mutex lf_mutex_t; diff --git a/include/core/port.h b/include/core/port.h index 3544b26ae..a8888c8bc 100644 --- a/include/core/port.h +++ b/include/core/port.h @@ -68,7 +68,6 @@ #include #include #include "lf_token.h" // Defines token types and lf_port_base_t, lf_sparse_io_record -#include "utils/vector.h" /** Threshold for width of multiport s.t. sparse reading is supported. */ #define LF_SPARSE_WIDTH_THRESHOLD 10 diff --git a/include/core/tag.h b/include/core/tag.h index 356ea8d8c..86776983f 100644 --- a/include/core/tag.h +++ b/include/core/tag.h @@ -34,10 +34,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef TAG_H #define TAG_H -#include - -#include "platform.h" - #define NSEC(t) (t * 1LL) #define NSECS(t) (t * 1LL) #define USEC(t) (t * 1000LL) @@ -69,6 +65,26 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Convenience for converting times #define BILLION 1000000000LL +#include +#include +#include + +/** + * Time instant. Both physical and logical times are represented + * using this typedef. + */ +typedef int64_t instant_t; + +/** + * Interval of time. + */ +typedef int64_t interval_t; + +/** + * Microstep instant. + */ +typedef uint32_t microstep_t; + /** * Global physical clock offset. * Initially set according to the RTI's clock in federated From db35201b5e78745acc9a517d33528b1504b15e88 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 24 Mar 2023 14:05:16 -0700 Subject: [PATCH 03/12] Fix RTI build. --- core/federated/RTI/message_record/message_record.c | 1 + core/federated/RTI/message_record/rti_pqueue_support.h | 1 + core/federated/RTI/rti_lib.c | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/federated/RTI/message_record/message_record.c b/core/federated/RTI/message_record/message_record.c index b2086e567..697b9ee86 100644 --- a/core/federated/RTI/message_record/message_record.c +++ b/core/federated/RTI/message_record/message_record.c @@ -29,6 +29,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***************/ #include "message_record.h" +#include "platform.h" #include /** diff --git a/core/federated/RTI/message_record/rti_pqueue_support.h b/core/federated/RTI/message_record/rti_pqueue_support.h index bf692d4c5..6265f1f99 100644 --- a/core/federated/RTI/message_record/rti_pqueue_support.h +++ b/core/federated/RTI/message_record/rti_pqueue_support.h @@ -34,6 +34,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "tag.h" #include "utils/pqueue.h" #include "utils/util.h" +#include "platform.h" // ********** Priority Queue Support Start /** diff --git a/core/federated/RTI/rti_lib.c b/core/federated/RTI/rti_lib.c index b456c4f8f..f0e3f2c1d 100644 --- a/core/federated/RTI/rti_lib.c +++ b/core/federated/RTI/rti_lib.c @@ -47,6 +47,8 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "rti_lib.h" +#include "string.h" + /** * The state of this RTI instance. */ @@ -2032,4 +2034,4 @@ int process_args(int argc, const char* argv[]) { return 0; } return 1; -} \ No newline at end of file +} From 40a88610469c8f7148a8f2855f6d94355fc89627 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 24 Mar 2023 23:23:36 -0700 Subject: [PATCH 04/12] Remove _instant_t. There might have been a reason why this was created, but I consider it to be excess generality. I do not see us moving toward representing time with less than 64 bits in the near future unless I missed something in our conversations on the topic, and I question whether emulation of 64 bit integers is as much slower than the alternatives as it is imagined to be. It has also been commented multiple times that defining _instant_t in one place and then always aliasing it as instant_t smells like overengineering. --- include/core/platform.h | 6 ------ include/core/platform/lf_tag_64_32.h | 2 +- include/core/platform/lf_windows_support.h | 7 ++++--- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/core/platform.h b/include/core/platform.h index b3715c869..30fa251ce 100644 --- a/include/core/platform.h +++ b/include/core/platform.h @@ -29,12 +29,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * This file detects the platform on which the C compiler is being run * (e.g. Windows, Linux, Mac) and conditionally includes platform-specific * files that define core datatypes and function signatures for Lingua Franca. - * For example, the type instant_t represents a time value (long long on - * most of the platforms). The conditionally included files define a type - * _instant_t, and this file defines the type instant_t to be whatever - * the included defines _instant_t to be. All platform-independent code - * in Lingua Franca, therefore, should use the type instant_t for time - * values. * * @author{Soroush Bateni } */ diff --git a/include/core/platform/lf_tag_64_32.h b/include/core/platform/lf_tag_64_32.h index 6d9c0fc1d..49f9e38c0 100644 --- a/include/core/platform/lf_tag_64_32.h +++ b/include/core/platform/lf_tag_64_32.h @@ -38,7 +38,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // If you are targeting a platform that uses some other type // for time and microsteps, you can simply define // PRINTF_TIME and PRINTF_MICROSTEP directly in the same file that -// defines the types _instant_t, _interval_t, and _microstep_t. +// defines the types instant_t, interval_t, and microstep_t. #include #define PRINTF_TIME "%" PRId64 #define PRINTF_MICROSTEP "%" PRIu32 diff --git a/include/core/platform/lf_windows_support.h b/include/core/platform/lf_windows_support.h index 3979290d7..3812e84d2 100644 --- a/include/core/platform/lf_windows_support.h +++ b/include/core/platform/lf_windows_support.h @@ -50,9 +50,10 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _LF_TIMEOUT ETIMEDOUT // Use 64-bit times and 32-bit unsigned microsteps #include "lf_tag_64_32.h" +#include "tag.h" // Forward declare lf_clock_gettime which is needed by lf_cond_timedwait -extern int lf_clock_gettime(_instant_t* t); +extern int lf_clock_gettime(instant_t* t); #if defined LF_THREADED || defined _LF_TRACE #if __STDC_VERSION__ < 201112L || defined (__STDC_NO_THREADS__) // (Not C++11 or later) or no threads support @@ -218,9 +219,9 @@ static int lf_cond_wait(lf_cond_t* cond) { * * @return 0 on success and LF_TIMEOUT on timeout, 1 otherwise. */ -static int lf_cond_timedwait(lf_cond_t* cond, _instant_t absolute_time_ns) { +static int lf_cond_timedwait(lf_cond_t* cond, instant_t absolute_time_ns) { // Convert the absolute time to a relative time - _instant_t current_time_ns; + instant_t current_time_ns; lf_clock_gettime(¤t_time_ns); _interval_t relative_time_ns = (absolute_time_ns - current_time_ns); if (relative_time_ns <= 0) { From ee91739d4d4fc8b10d0aa615838f7b12efefb71d Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 25 Mar 2023 12:54:09 -0700 Subject: [PATCH 05/12] Address failing windows compilation. --- core/platform/lf_windows_support.c | 9 +++++---- core/reactor_common.c | 1 + include/core/platform/lf_windows_support.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/core/platform/lf_windows_support.c b/core/platform/lf_windows_support.c index 4e563d0d9..df0c97aef 100644 --- a/core/platform/lf_windows_support.c +++ b/core/platform/lf_windows_support.c @@ -34,15 +34,16 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @see https://gist.github.com/Soroosh129/127d1893fa4c1da6d3e1db33381bb273 */ -#include +#include #include #include -#include +#include +#include + #include "lf_windows_support.h" #include "platform.h" -#include "util.h" #include "tag.h" -#include +#include "util.h" /** * Indicate whether or not the underlying hardware diff --git a/core/reactor_common.c b/core/reactor_common.c index 9617fd235..5be23ff9c 100644 --- a/core/reactor_common.c +++ b/core/reactor_common.c @@ -38,6 +38,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #include "platform.h" #include "lf_types.h" diff --git a/include/core/platform/lf_windows_support.h b/include/core/platform/lf_windows_support.h index 3812e84d2..e573be277 100644 --- a/include/core/platform/lf_windows_support.h +++ b/include/core/platform/lf_windows_support.h @@ -223,7 +223,7 @@ static int lf_cond_timedwait(lf_cond_t* cond, instant_t absolute_time_ns) { // Convert the absolute time to a relative time instant_t current_time_ns; lf_clock_gettime(¤t_time_ns); - _interval_t relative_time_ns = (absolute_time_ns - current_time_ns); + interval_t relative_time_ns = (absolute_time_ns - current_time_ns); if (relative_time_ns <= 0) { // physical time has already caught up sufficiently and we do not need to wait anymore return 0; From ad17fab9f5068e6e4db61a4a5e36455e78a36d53 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 25 Mar 2023 14:14:37 -0700 Subject: [PATCH 06/12] Include windows.h first. Yes, windows.h really is that broken. The mess that comes with Windows support in C is the reason for this namespacing struggle over the past couple days and it is abominable and in principle avoidable. --- core/platform/lf_windows_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/platform/lf_windows_support.c b/core/platform/lf_windows_support.c index df0c97aef..585b75a1a 100644 --- a/core/platform/lf_windows_support.c +++ b/core/platform/lf_windows_support.c @@ -34,11 +34,11 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * @see https://gist.github.com/Soroosh129/127d1893fa4c1da6d3e1db33381bb273 */ +#include // Order in which windows.h is included does matter! #include #include #include #include -#include #include "lf_windows_support.h" #include "platform.h" From 3ab930e0d4cb30524a946097f199185d32ea789f Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Sat, 25 Mar 2023 19:12:40 -0700 Subject: [PATCH 07/12] Another windows support fix. --- core/platform/lf_windows_support.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/platform/lf_windows_support.c b/core/platform/lf_windows_support.c index 585b75a1a..382870107 100644 --- a/core/platform/lf_windows_support.c +++ b/core/platform/lf_windows_support.c @@ -60,8 +60,6 @@ double _lf_frequency_to_ns = 1.0; #define LF_MIN_SLEEP_NS USEC(10) -#define BILLION 1000000000 - #if defined LF_THREADED || defined _LF_TRACE /** From a6fe56c7d5f822c3714d69bfddc094bd21250191 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 31 Mar 2023 01:20:36 -0700 Subject: [PATCH 08/12] Update lingua-franca-ref.txt. --- lingua-franca-ref.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lingua-franca-ref.txt b/lingua-franca-ref.txt index 1f7391f92..7f1686ea5 100644 --- a/lingua-franca-ref.txt +++ b/lingua-franca-ref.txt @@ -1 +1 @@ -master +bodyless-reactions From ac3d19a58ad86dd57c14b2505289f64b8c651d79 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 31 Mar 2023 01:31:31 -0700 Subject: [PATCH 09/12] Address adaptive scheduler test failure. --- include/core/threaded/worker_assignments.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/core/threaded/worker_assignments.h b/include/core/threaded/worker_assignments.h index 5bd5d1589..163f1bddc 100644 --- a/include/core/threaded/worker_assignments.h +++ b/include/core/threaded/worker_assignments.h @@ -39,6 +39,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "scheduler.h" #include "util.h" +#include "platform.h" /** The queued reactions. */ static reaction_t**** reactions_by_worker_by_level; From 9eb95b0559fc30d192790fd13af1891ccbf57746 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 31 Mar 2023 13:21:30 -0700 Subject: [PATCH 10/12] Add stdio.h back into the user-visible namespace. I think that in the long run this might not be what we want, but it reduces the impact of this and the accompanying lingua-franca PR on existing LF programs. --- include/api/api.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/api/api.h b/include/api/api.h index b4b4274c6..85e06ff9f 100644 --- a/include/api/api.h +++ b/include/api/api.h @@ -35,6 +35,7 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef API_H #define API_H +#include // Included for backwards compatibility so that users do not need to explicitly include this #include "lf_types.h" #include "tag.h" From d008e46913b46d359e965aa9f866e1bebf975bf1 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 31 Mar 2023 13:38:18 -0700 Subject: [PATCH 11/12] Move type definitions for time. This is because although time types are not platform-dependent currently, they could be in the future. --- include/core/platform.h | 16 ++++++++++++++++ include/core/tag.h | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/core/platform.h b/include/core/platform.h index 30fa251ce..14acf38ae 100644 --- a/include/core/platform.h +++ b/include/core/platform.h @@ -81,6 +81,22 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define LF_TIMEOUT _LF_TIMEOUT +/** + * Time instant. Both physical and logical times are represented + * using this typedef. + */ +typedef int64_t instant_t; + +/** + * Interval of time. + */ +typedef int64_t interval_t; + +/** + * Microstep instant. + */ +typedef uint32_t microstep_t; + /** * Enter a critical section where logical time and the event queue are guaranteed * to not change unless they are changed within the critical section. diff --git a/include/core/tag.h b/include/core/tag.h index 86776983f..1490e7647 100644 --- a/include/core/tag.h +++ b/include/core/tag.h @@ -69,22 +69,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -/** - * Time instant. Both physical and logical times are represented - * using this typedef. - */ -typedef int64_t instant_t; - -/** - * Interval of time. - */ -typedef int64_t interval_t; - -/** - * Microstep instant. - */ -typedef uint32_t microstep_t; - /** * Global physical clock offset. * Initially set according to the RTI's clock in federated From ac05b8ebc8aec4d5596ade92e39429846af51d45 Mon Sep 17 00:00:00 2001 From: Peter Donovan Date: Fri, 31 Mar 2023 15:04:24 -0700 Subject: [PATCH 12/12] Revert "Move type definitions for time." This reverts commit d008e46913b46d359e965aa9f866e1bebf975bf1. This is causing build problems that would be hard to fix without bringing platform.h into user namespace. See https://github.com/lf-lang/reactor-c/pull/189#issuecomment-1492662773 --- include/core/platform.h | 16 ---------------- include/core/tag.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/core/platform.h b/include/core/platform.h index 14acf38ae..30fa251ce 100644 --- a/include/core/platform.h +++ b/include/core/platform.h @@ -81,22 +81,6 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define LF_TIMEOUT _LF_TIMEOUT -/** - * Time instant. Both physical and logical times are represented - * using this typedef. - */ -typedef int64_t instant_t; - -/** - * Interval of time. - */ -typedef int64_t interval_t; - -/** - * Microstep instant. - */ -typedef uint32_t microstep_t; - /** * Enter a critical section where logical time and the event queue are guaranteed * to not change unless they are changed within the critical section. diff --git a/include/core/tag.h b/include/core/tag.h index 1490e7647..86776983f 100644 --- a/include/core/tag.h +++ b/include/core/tag.h @@ -69,6 +69,22 @@ THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include +/** + * Time instant. Both physical and logical times are represented + * using this typedef. + */ +typedef int64_t instant_t; + +/** + * Interval of time. + */ +typedef int64_t interval_t; + +/** + * Microstep instant. + */ +typedef uint32_t microstep_t; + /** * Global physical clock offset. * Initially set according to the RTI's clock in federated