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..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 { - - Active active1(FW_OPTIONAL_NAME("active1")); - -} - namespace M { Active active2; @@ -23,13 +17,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")); } @@ -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 b98140a2f..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,31 +15,24 @@ // Component instances // ---------------------------------------------------------------------- -namespace M { - - //! active1 - extern 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; } @@ -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/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; } 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 \ {