From 54d68cb2721e7ae599d6d731b05524a91371ab75 Mon Sep 17 00:00:00 2001 From: "Edward A. Lee" Date: Sat, 28 Dec 2024 17:24:00 -0800 Subject: [PATCH] Added lf_reactor_name function --- core/src/main/resources/lib/c/reactor-c | 2 +- test/C/src/ReactorName.lf | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/src/main/resources/lib/c/reactor-c b/core/src/main/resources/lib/c/reactor-c index 5e2779206e..6306c1196b 160000 --- a/core/src/main/resources/lib/c/reactor-c +++ b/core/src/main/resources/lib/c/reactor-c @@ -1 +1 @@ -Subproject commit 5e2779206ea5ab085dea1209e07a0c165df5366a +Subproject commit 6306c1196bb5e165dac8dd807c8d1cc01ba85754 diff --git a/test/C/src/ReactorName.lf b/test/C/src/ReactorName.lf index 8d14f13f41..0fa130168f 100644 --- a/test/C/src/ReactorName.lf +++ b/test/C/src/ReactorName.lf @@ -13,6 +13,10 @@ reactor A(parent_bank_index: size_t = 0) { char buffer[20]; snprintf(buffer, 20, "ReactorName.b[%zu].a", self->parent_bank_index); if (strcmp(buffer, name) != 0) { + lf_print_error_and_exit("full name does not match"); + } + name = lf_reactor_name(self); + if (strcmp("a", name) != 0) { lf_print_error_and_exit("name does not match"); } =} @@ -26,6 +30,11 @@ reactor B(bank_index: size_t = 0) { lf_print("name: %s", name); char buffer[20]; snprintf(buffer, 20, "ReactorName.b[%zu]", self->bank_index); + if (strcmp(buffer, name) != 0) { + lf_print_error_and_exit("full name does not match"); + } + name = lf_reactor_name(self); + snprintf(buffer, 20, "b[%zu]", self->bank_index); if (strcmp(buffer, name) != 0) { lf_print_error_and_exit("name does not match"); } @@ -38,6 +47,10 @@ main reactor { reaction(startup) {= const char* name = lf_reactor_full_name(self); lf_print("name: %s", name); + if (strcmp("ReactorName", name) != 0) { + lf_print_error_and_exit("full name does not match"); + } + name = lf_reactor_name(self); if (strcmp("ReactorName", name) != 0) { lf_print_error_and_exit("name does not match"); }