From eb22058fd3b230ae986822bd5a0a56c86486e729 Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Sat, 20 Jan 2024 22:26:57 +0100 Subject: [PATCH] Generate human-readable state names --- generator/src/generator/InstanceState.egl | 2 +- generator/src/generator/Transformations.egl | 2 ++ test/generated/IoArHandlerMainInstance.hxx | 22 ++++++++++----------- test/generated/ScXmlTestInstance.hxx | 6 +++--- 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/generator/src/generator/InstanceState.egl b/generator/src/generator/InstanceState.egl index d4a9f6c..013dda7 100644 --- a/generator/src/generator/InstanceState.egl +++ b/generator/src/generator/InstanceState.egl @@ -4,7 +4,7 @@ handlerTemplate.populate("statemachine", statemachine); %] // State [%=state.name%] -const [%=statemachine.name%]::[%=state.state_type%] [%=statemachine.name%]::[%=state.variable_name%]("[%=state.name%]", &[%=state.name%]Handler, [%=state.parent_variable_pointer%], [%=state.initial_variable_pointer%], [%=state.entry_pointer%], [%=state.exit_pointer%]); +const [%=statemachine.name%]::[%=state.state_type%] [%=statemachine.name%]::[%=state.variable_name%]("[%=state.readable_scoped_name%]", &[%=state.name%]Handler, [%=state.parent_variable_pointer%], [%=state.initial_variable_pointer%], [%=state.entry_pointer%], [%=state.exit_pointer%]); [%=handlerTemplate.process()%] [% if (state.region.isDefined()) { diff --git a/generator/src/generator/Transformations.egl b/generator/src/generator/Transformations.egl index 93679b4..0fff83f 100644 --- a/generator/src/generator/Transformations.egl +++ b/generator/src/generator/Transformations.egl @@ -50,8 +50,10 @@ operation Tuple transformState(statemachine : Tuple, region : Tuple, parent_stat if (parent_state.isDefined()) { self.scoped_name = parent_state.scoped_name + self.name; + self.readable_scoped_name = parent_state.readable_scoped_name + "::" + self.name; } else { self.scoped_name = self.name; + self.readable_scoped_name = self.name; } self.variable_name = "k" + self.scoped_name; diff --git a/test/generated/IoArHandlerMainInstance.hxx b/test/generated/IoArHandlerMainInstance.hxx index 5525a88..18aff8e 100644 --- a/test/generated/IoArHandlerMainInstance.hxx +++ b/test/generated/IoArHandlerMainInstance.hxx @@ -123,7 +123,7 @@ IoArHandlerMain::Transition IoArHandlerMain::OpenHandler(ImplPtr impl, Event eve } // State ApplicationReady -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReady("ApplicationReady", &ApplicationReadyHandler, &kOpen, &kOpenApplicationReadyReady, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReady("Open::ApplicationReady", &ApplicationReadyHandler, &kOpen, &kOpenApplicationReadyReady, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::ApplicationReadyHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -136,7 +136,7 @@ IoArHandlerMain::Transition IoArHandlerMain::ApplicationReadyHandler(ImplPtr imp } // State DynamicReconfigurationRunning -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunning("DynamicReconfigurationRunning", &DynamicReconfigurationRunningHandler, &kOpenApplicationReady, &kOpenApplicationReadyDynamicReconfigurationRunningDrWaitPlugCnf, &Impl::StartDynReconfTimer, &Impl::StopDynReconfTimer); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunning("Open::ApplicationReady::DynamicReconfigurationRunning", &DynamicReconfigurationRunningHandler, &kOpenApplicationReady, &kOpenApplicationReadyDynamicReconfigurationRunningDrWaitPlugCnf, &Impl::StartDynReconfTimer, &Impl::StopDynReconfTimer); IoArHandlerMain::Transition IoArHandlerMain::DynamicReconfigurationRunningHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -157,7 +157,7 @@ IoArHandlerMain::Transition IoArHandlerMain::DynamicReconfigurationRunningHandle } // State DrPlugPrmSequence -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrPlugPrmSequence("DrPlugPrmSequence", &DrPlugPrmSequenceHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrPlugPrmSequence("Open::ApplicationReady::DynamicReconfigurationRunning::DrPlugPrmSequence", &DrPlugPrmSequenceHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::DrPlugPrmSequenceHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -178,7 +178,7 @@ IoArHandlerMain::Transition IoArHandlerMain::DrPlugPrmSequenceHandler(ImplPtr im } // State DrWaitApplicationReadyCnfPlugSubmodule -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitApplicationReadyCnfPlugSubmodule("DrWaitApplicationReadyCnfPlugSubmodule", &DrWaitApplicationReadyCnfPlugSubmoduleHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitApplicationReadyCnfPlugSubmodule("Open::ApplicationReady::DynamicReconfigurationRunning::DrWaitApplicationReadyCnfPlugSubmodule", &DrWaitApplicationReadyCnfPlugSubmoduleHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::DrWaitApplicationReadyCnfPlugSubmoduleHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -199,7 +199,7 @@ IoArHandlerMain::Transition IoArHandlerMain::DrWaitApplicationReadyCnfPlugSubmod } // State DrWaitApplicationReadyPlugSubmodule -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitApplicationReadyPlugSubmodule("DrWaitApplicationReadyPlugSubmodule", &DrWaitApplicationReadyPlugSubmoduleHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, &Impl::StartWaitApplicationReadyTimer, &Impl::StopWaitApplicationReadyTimer); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitApplicationReadyPlugSubmodule("Open::ApplicationReady::DynamicReconfigurationRunning::DrWaitApplicationReadyPlugSubmodule", &DrWaitApplicationReadyPlugSubmoduleHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, &Impl::StartWaitApplicationReadyTimer, &Impl::StopWaitApplicationReadyTimer); IoArHandlerMain::Transition IoArHandlerMain::DrWaitApplicationReadyPlugSubmoduleHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -223,7 +223,7 @@ IoArHandlerMain::Transition IoArHandlerMain::DrWaitApplicationReadyPlugSubmodule } // State DrWaitPlugCnf -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitPlugCnf("DrWaitPlugCnf", &DrWaitPlugCnfHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitPlugCnf("Open::ApplicationReady::DynamicReconfigurationRunning::DrWaitPlugCnf", &DrWaitPlugCnfHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::DrWaitPlugCnfHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -243,7 +243,7 @@ IoArHandlerMain::Transition IoArHandlerMain::DrWaitPlugCnfHandler(ImplPtr impl, } // State DrWaitPullCnf -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitPullCnf("DrWaitPullCnf", &DrWaitPullCnfHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyDynamicReconfigurationRunningDrWaitPullCnf("Open::ApplicationReady::DynamicReconfigurationRunning::DrWaitPullCnf", &DrWaitPullCnfHandler, &kOpenApplicationReadyDynamicReconfigurationRunning, nullptr, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::DrWaitPullCnfHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -264,7 +264,7 @@ IoArHandlerMain::Transition IoArHandlerMain::DrWaitPullCnfHandler(ImplPtr impl, } // State Ready -const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyReady("Ready", &ReadyHandler, &kOpenApplicationReady, nullptr, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenApplicationReadyReady("Open::ApplicationReady::Ready", &ReadyHandler, &kOpenApplicationReady, nullptr, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::ReadyHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -293,7 +293,7 @@ IoArHandlerMain::Transition IoArHandlerMain::ReadyHandler(ImplPtr impl, Event ev } // State Parameterizing -const IoArHandlerMain::State IoArHandlerMain::kOpenParameterizing("Parameterizing", &ParameterizingHandler, &kOpen, nullptr, nullptr, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenParameterizing("Open::Parameterizing", &ParameterizingHandler, &kOpen, nullptr, nullptr, nullptr); IoArHandlerMain::Transition IoArHandlerMain::ParameterizingHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -318,7 +318,7 @@ IoArHandlerMain::Transition IoArHandlerMain::ParameterizingHandler(ImplPtr impl, } // State WaitApplicationReady -const IoArHandlerMain::State IoArHandlerMain::kOpenWaitApplicationReady("WaitApplicationReady", &WaitApplicationReadyHandler, &kOpen, nullptr, &Impl::StartWaitApplicationReadyTimer, &Impl::StopWaitApplicationReadyTimer); +const IoArHandlerMain::State IoArHandlerMain::kOpenWaitApplicationReady("Open::WaitApplicationReady", &WaitApplicationReadyHandler, &kOpen, nullptr, &Impl::StartWaitApplicationReadyTimer, &Impl::StopWaitApplicationReadyTimer); IoArHandlerMain::Transition IoArHandlerMain::WaitApplicationReadyHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -342,7 +342,7 @@ IoArHandlerMain::Transition IoArHandlerMain::WaitApplicationReadyHandler(ImplPtr } // State WaitApplicationReadyCnf -const IoArHandlerMain::State IoArHandlerMain::kOpenWaitApplicationReadyCnf("WaitApplicationReadyCnf", &WaitApplicationReadyCnfHandler, &kOpen, nullptr, &Impl::SendApplicationReady, nullptr); +const IoArHandlerMain::State IoArHandlerMain::kOpenWaitApplicationReadyCnf("Open::WaitApplicationReadyCnf", &WaitApplicationReadyCnfHandler, &kOpen, nullptr, &Impl::SendApplicationReady, nullptr); IoArHandlerMain::Transition IoArHandlerMain::WaitApplicationReadyCnfHandler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here diff --git a/test/generated/ScXmlTestInstance.hxx b/test/generated/ScXmlTestInstance.hxx index 4c8c7a7..124e453 100644 --- a/test/generated/ScXmlTestInstance.hxx +++ b/test/generated/ScXmlTestInstance.hxx @@ -27,7 +27,7 @@ ScXmlTest::Transition ScXmlTest::State_1Handler(ImplPtr impl, Event event) } // State State_2 -const ScXmlTest::HistoryState ScXmlTest::kState_1State_2("State_2", &State_2Handler, &kState_1, nullptr, nullptr, nullptr); +const ScXmlTest::HistoryState ScXmlTest::kState_1State_2("State_1::State_2", &State_2Handler, &kState_1, nullptr, nullptr, nullptr); ScXmlTest::Transition ScXmlTest::State_2Handler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -56,7 +56,7 @@ ScXmlTest::Transition ScXmlTest::State_2Handler(ImplPtr impl, Event event) } // State State_3 -const ScXmlTest::State ScXmlTest::kState_1State_3("State_3", &State_3Handler, &kState_1, nullptr, &Impl::entry, &Impl::exit); +const ScXmlTest::State ScXmlTest::kState_1State_3("State_1::State_3", &State_3Handler, &kState_1, nullptr, &Impl::entry, &Impl::exit); ScXmlTest::Transition ScXmlTest::State_3Handler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here @@ -76,7 +76,7 @@ ScXmlTest::Transition ScXmlTest::State_3Handler(ImplPtr impl, Event event) } // State State_4 -const ScXmlTest::State ScXmlTest::kState_1State_4("State_4", &State_4Handler, &kState_1, nullptr, nullptr, nullptr); +const ScXmlTest::State ScXmlTest::kState_1State_4("State_1::State_4", &State_4Handler, &kState_1, nullptr, nullptr, nullptr); ScXmlTest::Transition ScXmlTest::State_4Handler(ImplPtr impl, Event event) { (void)impl; // impl parameter is unused when there is no guard function being called in here