From 9ee692ac710730183fe30378943cef822cecd799 Mon Sep 17 00:00:00 2001 From: Andrei Tumbar Date: Tue, 12 Nov 2024 10:55:59 -0800 Subject: [PATCH 1/9] Add component state machine getter --- .../ComponentStateMachines.scala | 26 +++++++++++- .../ActiveStateMachinesComponentAc.ref.cpp | 40 +++++++++++++++++++ .../ActiveStateMachinesComponentAc.ref.hpp | 24 +++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala index d49304f32..28c5778ee 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala @@ -26,7 +26,8 @@ case class ComponentStateMachines( def getFunctionMembers: List[CppDoc.Class.Member] = { List.concat( getOverflowHooks, - getSignalSendMember + getSignalSendMember, + getStateGetterFunction ) } @@ -199,6 +200,29 @@ case class ComponentStateMachines( ) } + private def getStateGetterFunction: List[CppDoc.Class.Member] = { + lazy val members = stateMachineInstances.map { smi => + + val smiName = smi.getName + val smName = s.writeSymbol(smi.symbol) + functionClassMember( + Some(s"Get the state of state machine instance $smiName"), + s"${smiName}_getState", + Nil, + CppDoc.Type(s"$smName::State", Some(s"$name::$smName::State")), + lines(s"return this->m_stateMachine_$smiName.state;"), + CppDoc.Function.NonSV, + CppDoc.Function.Const + ) + } + + addAccessTagAndComment( + "PROTECTED", + "State getter functions", + guardedList (hasStateMachineInstances) (members) + ) + } + private def writeStateMachineUpdate: List[Line] = Line.blank :: line("// Call the state machine update function") :: diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp index 7340dd5eb..bc18d40e9 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp @@ -442,6 +442,46 @@ namespace M { ); } + // ---------------------------------------------------------------------- + // State getter functions + // ---------------------------------------------------------------------- + + ActiveStateMachines::M::ActiveStateMachines_S1::State ActiveStateMachinesComponentBase :: + sm1_getState() const + { + return this->m_stateMachine_sm1.state; + } + + ActiveStateMachines::M::ActiveStateMachines_S1::State ActiveStateMachinesComponentBase :: + sm2_getState() const + { + return this->m_stateMachine_sm2.state; + } + + ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + sm3_getState() const + { + return this->m_stateMachine_sm3.state; + } + + ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + sm4_getState() const + { + return this->m_stateMachine_sm4.state; + } + + ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + sm5_getState() const + { + return this->m_stateMachine_sm5.state; + } + + ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + sm6_getState() const + { + return this->m_stateMachine_sm6.state; + } + // ---------------------------------------------------------------------- // Message dispatch functions // ---------------------------------------------------------------------- diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp index 52fecf7b6..89d41d94d 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp @@ -131,6 +131,30 @@ namespace M { const Fw::SmSignalBuffer& data //!< The state machine data ); + PROTECTED: + + // ---------------------------------------------------------------------- + // State getter functions + // ---------------------------------------------------------------------- + + //! Get the state of state machine instance sm1 + M::ActiveStateMachines_S1::State sm1_getState() const; + + //! Get the state of state machine instance sm2 + M::ActiveStateMachines_S1::State sm2_getState() const; + + //! Get the state of state machine instance sm3 + M::ActiveStateMachines_S2::State sm3_getState() const; + + //! Get the state of state machine instance sm4 + M::ActiveStateMachines_S2::State sm4_getState() const; + + //! Get the state of state machine instance sm5 + M::ActiveStateMachines_S2::State sm5_getState() const; + + //! Get the state of state machine instance sm6 + M::ActiveStateMachines_S2::State sm6_getState() const; + PRIVATE: // ---------------------------------------------------------------------- From dba95ff88180e1fd6d5335f648cf26712b555983 Mon Sep 17 00:00:00 2001 From: Andrei Tumbar Date: Tue, 12 Nov 2024 18:31:31 -0800 Subject: [PATCH 2/9] Fix and cpp-check --- .../ComponentCppWriter/ComponentStateMachines.scala | 3 ++- .../base/ActiveStateMachinesComponentAc.ref.cpp | 12 ++++++------ .../base/ActiveStateMachinesComponentAc.ref.hpp | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala index 28c5778ee..5df925124 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala @@ -205,11 +205,12 @@ case class ComponentStateMachines( val smiName = smi.getName val smName = s.writeSymbol(smi.symbol) + val smEnumName = s"$smName::${s.getName(smi.symbol)}_States"; functionClassMember( Some(s"Get the state of state machine instance $smiName"), s"${smiName}_getState", Nil, - CppDoc.Type(s"$smName::State", Some(s"$name::$smName::State")), + CppDoc.Type(smEnumName, Some(smEnumName)), lines(s"return this->m_stateMachine_$smiName.state;"), CppDoc.Function.NonSV, CppDoc.Function.Const diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp index bc18d40e9..05fa61b7b 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp @@ -446,37 +446,37 @@ namespace M { // State getter functions // ---------------------------------------------------------------------- - ActiveStateMachines::M::ActiveStateMachines_S1::State ActiveStateMachinesComponentBase :: + M::ActiveStateMachines_S1::ActiveStateMachines_S1_States ActiveStateMachinesComponentBase :: sm1_getState() const { return this->m_stateMachine_sm1.state; } - ActiveStateMachines::M::ActiveStateMachines_S1::State ActiveStateMachinesComponentBase :: + M::ActiveStateMachines_S1::ActiveStateMachines_S1_States ActiveStateMachinesComponentBase :: sm2_getState() const { return this->m_stateMachine_sm2.state; } - ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States ActiveStateMachinesComponentBase :: sm3_getState() const { return this->m_stateMachine_sm3.state; } - ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States ActiveStateMachinesComponentBase :: sm4_getState() const { return this->m_stateMachine_sm4.state; } - ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States ActiveStateMachinesComponentBase :: sm5_getState() const { return this->m_stateMachine_sm5.state; } - ActiveStateMachines::M::ActiveStateMachines_S2::State ActiveStateMachinesComponentBase :: + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States ActiveStateMachinesComponentBase :: sm6_getState() const { return this->m_stateMachine_sm6.state; diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp index 89d41d94d..13c98b5ed 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp @@ -138,22 +138,22 @@ namespace M { // ---------------------------------------------------------------------- //! Get the state of state machine instance sm1 - M::ActiveStateMachines_S1::State sm1_getState() const; + M::ActiveStateMachines_S1::ActiveStateMachines_S1_States sm1_getState() const; //! Get the state of state machine instance sm2 - M::ActiveStateMachines_S1::State sm2_getState() const; + M::ActiveStateMachines_S1::ActiveStateMachines_S1_States sm2_getState() const; //! Get the state of state machine instance sm3 - M::ActiveStateMachines_S2::State sm3_getState() const; + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States sm3_getState() const; //! Get the state of state machine instance sm4 - M::ActiveStateMachines_S2::State sm4_getState() const; + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States sm4_getState() const; //! Get the state of state machine instance sm5 - M::ActiveStateMachines_S2::State sm5_getState() const; + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States sm5_getState() const; //! Get the state of state machine instance sm6 - M::ActiveStateMachines_S2::State sm6_getState() const; + M::ActiveStateMachines_S2::ActiveStateMachines_S2_States sm6_getState() const; PRIVATE: From 4f135683e95231f59f5ea56706a303ea9bb578dc Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Wed, 13 Nov 2024 07:47:33 -0800 Subject: [PATCH 3/9] Fix path to fpp-to-cpp --- compiler/tools/fpp-to-cpp/test/fprime/generate_cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp b/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp index d33ebbdcf..ebd8417dd 100755 --- a/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp +++ b/compiler/tools/fpp-to-cpp/test/fprime/generate_cpp @@ -9,7 +9,7 @@ cd `dirname $0` echo "generating framework C++" fpp_files=`find . -name '*.fpp'` -fpp-to-cpp -p $PWD $fpp_files +../../../../bin/fpp-to-cpp -p $PWD $fpp_files # Move config files into place for base in FppConstantsAc ProcTypeEnumAc From c7a2446b281a66020d42f6f2a154f3627e877f84 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Wed, 13 Nov 2024 08:04:11 -0800 Subject: [PATCH 4/9] Remove guarded list It's not needed, since the guard is true if and only if the computed list is nonempty. --- .../ComponentCppWriter/ComponentStateMachines.scala | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala index 5df925124..8bf5b45a4 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala @@ -201,7 +201,7 @@ case class ComponentStateMachines( } private def getStateGetterFunction: List[CppDoc.Class.Member] = { - lazy val members = stateMachineInstances.map { smi => + val members = stateMachineInstances.map { smi => val smiName = smi.getName val smName = s.writeSymbol(smi.symbol) @@ -217,11 +217,7 @@ case class ComponentStateMachines( ) } - addAccessTagAndComment( - "PROTECTED", - "State getter functions", - guardedList (hasStateMachineInstances) (members) - ) + addAccessTagAndComment("PROTECTED", "State getter functions", members) } private def writeStateMachineUpdate: List[Line] = From d8e689a17913ab8080417f3582f8fdeb8108fdb0 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Wed, 13 Nov 2024 09:01:24 -0800 Subject: [PATCH 5/9] Minor cleanup to related code --- .../ComponentStateMachines.scala | 14 +++++++------- .../base/ActiveStateMachinesComponentAc.ref.cpp | 2 +- .../base/ActiveStateMachinesComponentAc.ref.hpp | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala index 8bf5b45a4..c6ff91835 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/ComponentCppWriter/ComponentStateMachines.scala @@ -26,8 +26,8 @@ case class ComponentStateMachines( def getFunctionMembers: List[CppDoc.Class.Member] = { List.concat( getOverflowHooks, - getSignalSendMember, - getStateGetterFunction + getSignalSendFunctions, + getStateGetterFunctions ) } @@ -132,8 +132,8 @@ case class ComponentStateMachines( CppDoc.Lines.Hpp ) - private def getSignalSendMember: List[CppDoc.Class.Member] = { - lazy val members = stateMachineInstances.map { smi => + private def getSignalSendFunctions: List[CppDoc.Class.Member] = { + val members = stateMachineInstances.map { smi => val serializeCode = lines( @@ -195,12 +195,12 @@ case class ComponentStateMachines( addAccessTagAndComment( "PROTECTED", - "State machine function to push signals to the input queue", - guardedList (hasStateMachineInstances) (members) + "Functions for sending sending state machine signals to the input queue", + members ) } - private def getStateGetterFunction: List[CppDoc.Class.Member] = { + private def getStateGetterFunctions: List[CppDoc.Class.Member] = { val members = stateMachineInstances.map { smi => val smiName = smi.getName diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp index 05fa61b7b..bbf6533dd 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.cpp @@ -117,7 +117,7 @@ namespace M { } // ---------------------------------------------------------------------- - // State machine function to push signals to the input queue + // Functions for sending sending state machine signals to the input queue // ---------------------------------------------------------------------- void ActiveStateMachinesComponentBase :: diff --git a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp index 13c98b5ed..a57d4aa6a 100644 --- a/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/component/base/ActiveStateMachinesComponentAc.ref.hpp @@ -92,7 +92,7 @@ namespace M { PROTECTED: // ---------------------------------------------------------------------- - // State machine function to push signals to the input queue + // Functions for sending sending state machine signals to the input queue // ---------------------------------------------------------------------- //! State machine base-class function for sendSignals From 46a2b58c950f59d255497cff1f9f65862a5b2cf4 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Mon, 18 Nov 2024 16:11:42 -0800 Subject: [PATCH 6/9] Revise topology code gen Use fully-qualified names for instance defs --- .../TopologyCppWriter/TopologyCppWriterUtils.scala | 7 +------ .../tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp | 6 +++--- .../tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp | 8 ++++---- .../tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp | 4 ++-- .../tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp | 4 ++-- .../tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp | 4 ++-- .../tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp | 4 ++-- .../test/top/NestedNamespacesTopologyAc.ref.cpp | 2 +- .../test/top/NestedNamespacesTopologyAc.ref.hpp | 2 +- .../tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp | 4 ++-- .../tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp | 4 ++-- 11 files changed, 22 insertions(+), 27 deletions(-) diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriterUtils.scala b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriterUtils.scala index 90aa80067..886a309ad 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriterUtils.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriterUtils.scala @@ -52,13 +52,8 @@ abstract class TopologyCppWriterUtils( def getComponentNameAsQualIdent(ci: ComponentInstance): String = getNameAsQualIdent(getComponentName(ci)) - def getShortName(name: Name.Qualified): Name.Qualified = { - val ens = s.a.getEnclosingNames(symbol) - name.shortName(ens) - } - def getNameAsQualIdent(name: Name.Qualified): String = - CppWriter.writeQualifiedName(getShortName(name)) + CppWriter.writeQualifiedName(name) def getSpecifierForPhase (phase: Int) (ci: ComponentInstance): Option[InitSpecifier] = ci.initSpecifierMap.get(phase) diff --git a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp index c238b683a..1bb15dd72 100644 --- a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp @@ -12,7 +12,7 @@ namespace M { - Active active1(FW_OPTIONAL_NAME("active1")); + M::Active active1(FW_OPTIONAL_NAME("active1")); } @@ -23,13 +23,13 @@ namespace M { namespace M { - Active active3(FW_OPTIONAL_NAME("active3")); + M::Active active3(FW_OPTIONAL_NAME("active3")); } namespace M { - Passive passive1(FW_OPTIONAL_NAME("passive1")); + M::Passive passive1(FW_OPTIONAL_NAME("passive1")); } diff --git a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp index b98140a2f..588f3c197 100644 --- a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp @@ -18,28 +18,28 @@ namespace M { //! active1 - extern Active active1; + extern M::Active active1; } namespace M { //! active2 - extern Active active2; + extern M::Active active2; } namespace M { //! active3 - extern Active active3; + extern M::Active active3; } namespace M { //! passive1 - extern Passive passive1; + extern M::Passive passive1; } diff --git a/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp index c7006a2e4..68b5781a6 100644 --- a/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp @@ -12,13 +12,13 @@ namespace M { - C c1(FW_OPTIONAL_NAME("c1")); + M::C c1(FW_OPTIONAL_NAME("c1")); } namespace M { - C c2(FW_OPTIONAL_NAME("c2")); + M::C c2(FW_OPTIONAL_NAME("c2")); } diff --git a/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp index 684f55274..9f0fc4378 100644 --- a/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp @@ -17,14 +17,14 @@ namespace M { //! c1 - extern C c1; + extern M::C c1; } namespace M { //! c2 - extern C c2; + extern M::C c2; } diff --git a/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp index 32f9ac79c..e531570fe 100644 --- a/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp @@ -12,13 +12,13 @@ namespace M { - C c1(FW_OPTIONAL_NAME("c1")); + M::C c1(FW_OPTIONAL_NAME("c1")); } namespace M { - C c2(FW_OPTIONAL_NAME("c2")); + M::C c2(FW_OPTIONAL_NAME("c2")); } diff --git a/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp index c3ab0dbc5..5e9cbbe8a 100644 --- a/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp @@ -18,14 +18,14 @@ namespace M { //! c1 - extern C c1; + extern M::C c1; } namespace M { //! c2 - extern C c2; + extern M::C c2; } diff --git a/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp index f7953d5e9..8b343dc63 100644 --- a/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp @@ -10,7 +10,7 @@ // Component instances // ---------------------------------------------------------------------- -N::O::C c(FW_OPTIONAL_NAME("c")); +M::N::O::C c(FW_OPTIONAL_NAME("c")); namespace M { diff --git a/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.hpp index c4b43049e..1ddb411b8 100644 --- a/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.hpp @@ -15,7 +15,7 @@ // ---------------------------------------------------------------------- //! c -extern N::O::C c; +extern M::N::O::C c; namespace M { diff --git a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp index 54b862eed..ef108a998 100644 --- a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp @@ -12,13 +12,13 @@ namespace M { - C c1(FW_OPTIONAL_NAME("c1")); + M::C c1(FW_OPTIONAL_NAME("c1")); } namespace M { - C c2(FW_OPTIONAL_NAME("c2")); + M::C c2(FW_OPTIONAL_NAME("c2")); } diff --git a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp index 575c1ff28..8e0cd7b5d 100644 --- a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp @@ -17,14 +17,14 @@ namespace M { //! c1 - extern C c1; + extern M::C c1; } namespace M { //! c2 - extern C c2; + extern M::C c2; } From 7c64ff05204fd70a33ea0fa51f2901f8031876e8 Mon Sep 17 00:00:00 2001 From: Rob Bocchino Date: Mon, 18 Nov 2024 16:29:20 -0800 Subject: [PATCH 7/9] Revise basic test Exercise name generation outside of topology namespace --- .../test/top/BasicTopologyAc.ref.cpp | 30 ++++++++----------- .../test/top/BasicTopologyAc.ref.hpp | 24 +++++++-------- compiler/tools/fpp-to-cpp/test/top/basic.fpp | 11 +++++-- 3 files changed, 31 insertions(+), 34 deletions(-) diff --git a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp index 1bb15dd72..0fda8bc70 100644 --- a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp @@ -10,12 +10,6 @@ // Component instances // ---------------------------------------------------------------------- -namespace M { - - M::Active active1(FW_OPTIONAL_NAME("active1")); - -} - namespace M { Active active2; @@ -39,6 +33,8 @@ namespace M { } +M::Active active1(FW_OPTIONAL_NAME("active1")); + namespace M { @@ -60,11 +56,11 @@ namespace M { // ---------------------------------------------------------------------- void initComponents(const TopologyState& state) { - M::active1.init(QueueSizes::M_active1, InstanceIds::M_active1); M::active2.initSpecial(); M::active3.init(QueueSizes::M_active3, InstanceIds::M_active3); M::passive1.init(InstanceIds::M_passive1); M::passive2.init(InstanceIds::M_passive2); + active1.init(QueueSizes::active1, InstanceIds::active1); } void configComponents(const TopologyState& state) { @@ -72,7 +68,7 @@ namespace M { } void setBaseIds() { - M::active1.setIdBase(BaseIds::M_active1); + active1.setIdBase(BaseIds::active1); M::active2.setIdBase(BaseIds::M_active2); M::active3.setIdBase(BaseIds::M_active3); M::passive1.setIdBase(BaseIds::M_passive1); @@ -84,7 +80,7 @@ namespace M { // C1 M::passive1.set_p_OutputPort( 0, - M::active1.get_p_InputPort(0) + active1.get_p_InputPort(0) ); // C2 @@ -107,12 +103,6 @@ namespace M { } void startTasks(const TopologyState& state) { - M::active1.start( - static_cast(Priorities::M_active1), - static_cast(StackSizes::M_active1), - static_cast(CPUs::M_active1), - static_cast(TaskIds::M_active1) - ); M::active2.startSpecial(); M::active3.start( Os::Task::TASK_DEFAULT, // Default priority @@ -120,18 +110,24 @@ namespace M { Os::Task::TASK_DEFAULT, // Default CPU static_cast(TaskIds::M_active3) ); + active1.start( + static_cast(Priorities::active1), + static_cast(StackSizes::active1), + static_cast(CPUs::active1), + static_cast(TaskIds::active1) + ); } void stopTasks(const TopologyState& state) { - M::active1.exit(); M::active2.stopSpecial(); M::active3.exit(); + active1.exit(); } void freeThreads(const TopologyState& state) { - (void) M::active1.ActiveComponentBase::join(); M::active2.freeSpecial(); (void) M::active3.ActiveComponentBase::join(); + (void) active1.ActiveComponentBase::join(); } void tearDownComponents(const TopologyState& state) { diff --git a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp index 588f3c197..b7cfcddbd 100644 --- a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp @@ -15,13 +15,6 @@ // Component instances // ---------------------------------------------------------------------- -namespace M { - - //! active1 - extern M::Active active1; - -} - namespace M { //! active2 @@ -50,6 +43,9 @@ namespace M { } +//! active1 +extern M::Active active1; + namespace M { // ---------------------------------------------------------------------- @@ -67,7 +63,7 @@ namespace M { namespace BaseIds { enum { - M_active1 = 0x100, + active1 = 0x100, M_active2 = 0x200, M_active3 = 0x300, M_passive1 = 0x300, @@ -77,45 +73,45 @@ namespace M { namespace CPUs { enum { - M_active1 = 0, + active1 = 0, }; } namespace InstanceIds { enum { - M_active1, M_active2, M_active3, M_passive1, M_passive2, + active1, }; } namespace Priorities { enum { - M_active1 = 1, + active1 = 1, }; } namespace QueueSizes { enum { - M_active1 = 10, M_active2 = 10, M_active3 = 10, + active1 = 10, }; } namespace StackSizes { enum { - M_active1 = 1024, + active1 = 1024, }; } namespace TaskIds { enum { - M_active1, M_active2, M_active3, + active1, }; } diff --git a/compiler/tools/fpp-to-cpp/test/top/basic.fpp b/compiler/tools/fpp-to-cpp/test/top/basic.fpp index f0daaa2a4..b2a907f44 100644 --- a/compiler/tools/fpp-to-cpp/test/top/basic.fpp +++ b/compiler/tools/fpp-to-cpp/test/top/basic.fpp @@ -14,9 +14,14 @@ module M { } - instance active1: Active base id 0x100 \ - at "Active.hpp" \ - queue size 10 stack size 1024 priority 1 cpu 0 +} + +instance active1: M.Active base id 0x100 \ + at "Active.hpp" \ + queue size 10 stack size 1024 priority 1 cpu 0 + +module M { + instance active2: Active base id 0x200 \ queue size 10 \ { From 5c1325cd255ae4f66a08258a530a436932f42e1f Mon Sep 17 00:00:00 2001 From: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:33:56 -0800 Subject: [PATCH 8/9] Upgrade to manylinux_2_28_x86_64 --- .github/workflows/native-build.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml index b074762ff..ef6928a2d 100644 --- a/.github/workflows/native-build.yml +++ b/.github/workflows/native-build.yml @@ -106,8 +106,8 @@ jobs: }, { "runner": "ubuntu-22.04", - "tag": "manylinux2014_x86_64", - "container": "quay.io/pypa/manylinux2014_x86_64" + "tag": "manylinux_2_28_x86_64", + "container": "quay.io/pypa/manylinux_2_28_x86_64" } ] } @@ -131,16 +131,6 @@ jobs: container: image: ${{ matrix.run.container || '' }} steps: - - name: "Fix environment" - run: | - # https://github.com/actions/checkout/issues/1809 - # https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/ - # - # NOTE: actions/checkout et al. @v3 are deprecated - however the manylinux2014_x86_64 Docker image does not have node20 - # which prevents from upgrading to @v4. We keep the deprecated versions (@v3) for now for lack of a better solution - echo "ACTIONS_RUNNER_FORCED_INTERNAL_NODE_VERSION=node16" >> $GITHUB_ENV - echo "ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION=node16" >> $GITHUB_ENV - echo "ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true" >> $GITHUB_ENV - name: "Checkout repository" uses: actions/checkout@v3 with: From 92f22af99c80dcdefe73f3e40622026e6262975d Mon Sep 17 00:00:00 2001 From: M Starch Date: Tue, 3 Dec 2024 11:03:58 -0800 Subject: [PATCH 9/9] Bumping the macOS version to 13 --- .github/workflows/native-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/native-build.yml b/.github/workflows/native-build.yml index ef6928a2d..ced48d562 100644 --- a/.github/workflows/native-build.yml +++ b/.github/workflows/native-build.yml @@ -101,8 +101,8 @@ jobs: matrix = { "run": [ { - "runner": "macos-12", - "tag": "macosx_12_0_universal2" + "runner": "macos-13", + "tag": "macosx_13_0_universal2" }, { "runner": "ubuntu-22.04",