diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala index 78329f243..f9724561c 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocCppWriter.scala @@ -161,6 +161,9 @@ object CppDocCppWriter extends CppDocWriter { override def visitNamespace(in: Input, namespace: CppDoc.Namespace) = namespace.members.flatMap(visitNamespaceMember(in, _)) match { + // If the namespace has no members, then don't write it out. + // This can happen where a namespace member has members + // that write code to some cpp files and not others. case Nil => Nil case outputLines => val name = namespace.name diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala index 29903b1ef..6e1359983 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocHppWriter.scala @@ -62,7 +62,7 @@ object CppDocHppWriter extends CppDocWriter { val commentLines = CppDocWriter.writeDoxygenCommentOpt(c.comment) val openLines = c.superclassDecls match { case Some(d) => List( - line(s"class $name :"), + line(s"class $name :"), indentIn(line(d)), line("{") ) @@ -170,12 +170,4 @@ object CppDocHppWriter extends CppDocWriter { } } - override def visitNamespace(in: Input, namespace: CppDoc.Namespace) = { - val name = namespace.name - val startLines = List(Line.blank, line(s"namespace $name {")) - val outputLines = namespace.members.map(visitNamespaceMember(in, _)).flatten - val endLines = List(Line.blank, line("}")) - startLines ++ outputLines.map(indentIn(_)) ++ endLines - } - } diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocWriter.scala index d7faaf0ac..ec8d75ee0 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppDocWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppDocWriter.scala @@ -34,6 +34,14 @@ trait CppDocWriter extends CppDocVisitor with LineUtils { type Output = List[Line] + override def visitNamespace(in: Input, namespace: CppDoc.Namespace) = { + val name = namespace.name + val startLines = List(Line.blank, line(s"namespace $name {")) + val outputLines = namespace.members.flatMap(visitNamespaceMember(in, _)) + val endLines = List(Line.blank, line("}")) + startLines ++ outputLines.map(indentIn(_)) ++ endLines + } + } object CppDocWriter extends LineUtils { diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterUtils.scala b/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterUtils.scala index f840e0aa8..ec5b252e6 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterUtils.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/CppWriterUtils.scala @@ -63,6 +63,15 @@ trait CppWriterUtils extends LineUtils { def wrapInNamespace(namespace: String, ll: List[Line]): List[Line] = wrapInScope(s"namespace $namespace {", ll, "}") + def wrapInNamespaceLines( + namespaceNames: List[String], + ll: List[Line] + ): List[Line] = namespaceNames match { + case Nil => ll + case head :: tail => + wrapInNamespace(head, wrapInNamespaceLines(tail, ll)) + } + def wrapInNamedEnum(name: String, ll: List[Line]): List[Line] = wrapInScope(s"enum $name {", ll, "};") diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopComponentInstances.scala b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopComponentInstances.scala index 7256e12f5..930720f7d 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopComponentInstances.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopComponentInstances.scala @@ -10,42 +10,45 @@ case class TopComponentInstances( aNode: Ast.Annotated[AstNode[Ast.DefTopology]] ) extends TopologyCppWriterUtils(s, aNode) { - private val bannerComment = "Component instances" + def getMembers: List[CppDoc.Member] = { + val instanceMembers = getInstanceMembers + List.concat( + guardedList (!instanceMembers.isEmpty) (List(getCommentMember)), + instanceMembers + ) + } - def getHppLines: List[Line] = addBannerComment( - bannerComment, - getDeclLines - ) + private val bannerComment = "Component instances" - def getCppLines: List[Line] = addBannerComment( - bannerComment, - getDefLines + private def getCommentMember = linesMember( + CppDocWriter.writeBannerComment(bannerComment), + CppDoc.Lines.Both ) - private def getDeclLines = { - def getCode(ci: ComponentInstance): List[Line] = { + private def getInstanceMembers = { + def getMembers(ci: ComponentInstance): List[CppDoc.Member] = { val implType = getImplType(ci) - val instanceName = getNameAsIdent(ci.qualifiedName) - Line.addPrefixLine (line(s"//! $instanceName")) ( + val instanceName = ci.getUnqualifiedName + val hppMember = linesMember( lines( - s"extern $implType $instanceName;" - ) + s"""| + |//! $instanceName + |extern $implType $instanceName;""" + ), + CppDoc.Lines.Hpp ) - } - flattenWithBlankPrefix(instances.map(getCode)) - } - - private def getDefLines = { - def getCode(ci: ComponentInstance): List[Line] = { - val implType = getImplType(ci) - val instanceName = getNameAsIdent(ci.qualifiedName) - getCodeLinesForPhase (CppWriter.Phases.instances) (ci).getOrElse( - lines( - s"$implType $instanceName(FW_OPTIONAL_NAME($q$instanceName$q));" + val cppMember = { + val instLines = getCodeLinesForPhase (CppWriter.Phases.instances) (ci).getOrElse( + lines( + s"""| + |$implType $instanceName(FW_OPTIONAL_NAME($q$instanceName$q));""" + ) ) - ) + linesMember(instLines, CppDoc.Lines.Cpp) + } + wrapInNamespaces(ci.qualifiedName.qualifier, List(hppMember, cppMember)) } - flattenWithBlankPrefix(instances.map(getCode)) + instances.flatMap(getMembers) } private def getImplType(ci: ComponentInstance) = { diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConfigObjects.scala b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConfigObjects.scala index 3ec15dcae..2e6676810 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConfigObjects.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConfigObjects.scala @@ -44,7 +44,7 @@ case class TopConfigObjects( flattenWithBlankPrefix( pairs.map { case (ci, code) => wrapInNamespace( - getNameAsIdent(ci.qualifiedName), + CppWriter.identFromQualifiedName(ci.qualifiedName), code ) } @@ -77,7 +77,7 @@ case class TopConfigObjects( flattenWithBlankPrefix( pairs.map { case (ci, code) => wrapInNamespace( - getNameAsIdent(ci.qualifiedName), + CppWriter.identFromQualifiedName(ci.qualifiedName), code ) } @@ -99,7 +99,7 @@ case class TopConfigObjects( // Entry for connected port case Some(ci) => val name = ci.qualifiedName - val ident = getNameAsIdent(name) + val ident = CppWriter.identFromQualifiedName(name) List( s"PingEntries::$ident::WARN,", s"PingEntries::$ident::FATAL,", diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConstants.scala b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConstants.scala index df23fe47f..4be494cfe 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConstants.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopConstants.scala @@ -37,7 +37,7 @@ case class TopConstants( "ConfigConstants", pairs.flatMap { case (ci, code) => wrapInNamespace( - getNameAsIdent(ci.qualifiedName), + CppWriter.identFromQualifiedName(ci.qualifiedName), lines(code) ) } @@ -62,7 +62,7 @@ case class TopConstants( generateEnum( "BaseIds", ci => { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) val value = CppWriter.writeId(ci.baseId) Some(s"$name = $value") }, @@ -74,7 +74,7 @@ case class TopConstants( "CPUs", ci => ci.cpu.map( cpu => { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) s"$name = $cpu" } ) @@ -84,7 +84,7 @@ case class TopConstants( generateEnum( "InstanceIds", ci => { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) Some(s"$name") } ) @@ -94,7 +94,7 @@ case class TopConstants( "Priorities", ci => ci.priority.map( priority => { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) s"$name = $priority" } ) @@ -105,7 +105,7 @@ case class TopConstants( "QueueSizes", ci => ci.queueSize.map( queueSize => { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) s"$name = $queueSize" } ) @@ -116,7 +116,7 @@ case class TopConstants( "StackSizes", ci => ci.stackSize.map( stackSize => { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) s"$name = $stackSize" } ) @@ -130,7 +130,7 @@ case class TopConstants( val kind = c.aNode._2.data.kind kind match { case Ast.ComponentKind.Active => - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) Some(name.toString) case _ => None } diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopHelperFns.scala b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopHelperFns.scala index 18c581728..57c0d4525 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopHelperFns.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopHelperFns.scala @@ -51,13 +51,14 @@ case class TopHelperFns( private def getInitComponentsFn = { def getCode(ci: ComponentInstance): List[Line] = { - val name = getNameAsIdent(ci.qualifiedName) + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) getCodeLinesForPhase (CppWriter.Phases.initComponents) (ci).getOrElse( ci.component.aNode._2.data.kind match { case Ast.ComponentKind.Passive => - lines(s"$name.init(InstanceIds::$name);") + lines(s"$cppQualifiedName.init(InstanceIds::$name);") case _ => - lines(s"$name.init(QueueSizes::$name, InstanceIds::$name);") + lines(s"$cppQualifiedName.init(QueueSizes::$name, InstanceIds::$name);") } ) } @@ -73,7 +74,7 @@ case class TopHelperFns( private def getConfigComponentsFn = { def getCode(ci: ComponentInstance): List[Line] = { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) getCodeLinesForPhase (CppWriter.Phases.configComponents) (ci).getOrElse(Nil) } val name = "configComponents" @@ -89,8 +90,9 @@ case class TopHelperFns( private def getSetBaseIdsFn = { val name = "setBaseIds" val body = instancesByBaseId.map(ci => { - val name = getNameAsIdent(ci.qualifiedName) - line(s"$name.setIdBase(BaseIds::$name);") + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) + line(s"$cppQualifiedName.setIdBase(BaseIds::$name);") }) val memberOpt = getFnMemberOpt( "Set component base Ids", @@ -103,10 +105,10 @@ case class TopHelperFns( private def getConnectComponentsFn = { def getPortInfo(pii: PortInstanceIdentifier, c: Connection) = { - val instanceName = getNameAsIdent(pii.componentInstance.qualifiedName) + val cppQualifiedName = CppWriter.writeQualifiedName(pii.componentInstance.qualifiedName) val portName = pii.portInstance.getUnqualifiedName val portNumber = t.getPortNumber(pii.portInstance, c).get - (instanceName, portName, portNumber) + (cppQualifiedName, portName, portNumber) } def writeConnection(c: Connection) = { val out = getPortInfo(c.from.port, c) @@ -140,8 +142,8 @@ case class TopHelperFns( def getCode(ci: ComponentInstance): List[Line] = { getCodeLinesForPhase (CppWriter.Phases.regCommands) (ci).getOrElse( if (hasCommands(ci)) { - val name = getNameAsIdent(ci.qualifiedName) - lines(s"$name.regCommands();") + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + lines(s"$cppQualifiedName.regCommands();") } else Nil ) @@ -173,8 +175,8 @@ case class TopHelperFns( def getCode(ci: ComponentInstance): List[Line] = { getCodeLinesForPhase (CppWriter.Phases.loadParameters) (ci).getOrElse( if (hasParams(ci)) { - val name = getNameAsIdent(ci.qualifiedName) - lines(s"$name.loadParameters();") + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + lines(s"$cppQualifiedName.loadParameters();") } else Nil ) @@ -193,7 +195,8 @@ case class TopHelperFns( def getCode(ci: ComponentInstance): List[Line] = getCodeLinesForPhase (CppWriter.Phases.startTasks) (ci).getOrElse { if (isActive(ci)) { - val name = getNameAsIdent(ci.qualifiedName) + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) val priority = ci.priority match { case Some(_) => s"static_cast(Priorities::$name)," case None => "Os::Task::TASK_DEFAULT, // Default priority" @@ -207,7 +210,7 @@ case class TopHelperFns( case None => "Os::Task::TASK_DEFAULT, // Default CPU" } wrapInScope( - s"$name.start(", + s"$cppQualifiedName.start(", ( List( priority, @@ -235,8 +238,8 @@ case class TopHelperFns( def getCode(ci: ComponentInstance): List[Line] = getCodeLinesForPhase (CppWriter.Phases.stopTasks) (ci).getOrElse { if (isActive(ci)) { - val name = getNameAsIdent(ci.qualifiedName) - lines(s"$name.exit();") + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + lines(s"$cppQualifiedName.exit();") } else Nil } @@ -254,8 +257,8 @@ case class TopHelperFns( def getCode(ci: ComponentInstance): List[Line] = getCodeLinesForPhase (CppWriter.Phases.freeThreads) (ci).getOrElse { if (isActive(ci)) { - val name = getNameAsIdent(ci.qualifiedName) - lines(s"(void) $name.ActiveComponentBase::join();") + val cppQualifiedName = CppWriter.writeQualifiedName(ci.qualifiedName) + lines(s"(void) $cppQualifiedName.ActiveComponentBase::join();") } else Nil } @@ -271,7 +274,7 @@ case class TopHelperFns( private def getTearDownComponentsFn = { def getCode(ci: ComponentInstance): List[Line] = { - val name = getNameAsIdent(ci.qualifiedName) + val name = CppWriter.identFromQualifiedName(ci.qualifiedName) getCodeLinesForPhase (CppWriter.Phases.tearDownComponents) (ci).getOrElse(Nil) } val name = "tearDownComponents" diff --git a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriter.scala b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriter.scala index 806fe8975..84f847948 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriter.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriter.scala @@ -24,8 +24,18 @@ case class TopologyCppWriter( ) } - private def getMembers: List[CppDoc.Member] = { - val hppIncludes = { + private def getMembers: List[CppDoc.Member] = + List.concat( + getIncludeMembers, + getComponentInstanceMembers, + getTopologyMembers + ) + + private def getComponentInstanceMembers = + TopComponentInstances(s, aNode).getMembers + + private def getIncludeMembers: List[CppDoc.Member] = { + val hpp = { val strings = ( TopComponentIncludes(s, aNode).getHeaderStrings :+ CppWriter.headerString( @@ -34,12 +44,7 @@ case class TopologyCppWriter( ).sorted linesMember(Line.blank :: strings.map(line)) } - val hppLines = linesMember( - TopConstants(s, aNode).getLines ++ - TopConfigObjects(s, aNode).getHppLines ++ - TopComponentInstances(s, aNode).getHppLines - ) - val cppIncludes = { + val cpp = { val fileName = s"${ComputeCppFiles.FileNames.getTopology(name)}.hpp" linesMember( List( @@ -49,24 +54,23 @@ case class TopologyCppWriter( CppDoc.Lines.Cpp ) } + List(hpp, cpp) + } + + private def getTopologyMembers: List[CppDoc.Member] = { + val hppLines = linesMember( + TopConstants(s, aNode).getLines ++ + TopConfigObjects(s, aNode).getHppLines + ) val cppLines = linesMember( - Line.blank :: - List.concat( - addBlankPostfix( - TopConfigObjects(s, aNode).getCppLines, - ), - TopComponentInstances(s, aNode).getCppLines - ), + Line.blank :: addBlankPostfix(TopConfigObjects(s, aNode).getCppLines), CppDoc.Lines.Cpp ) val (helperFnNames, helperFns) = TopHelperFns(s, aNode).getMembers - val setupTeardownFns = TopSetupTeardownFns(s, aNode, helperFnNames). - getMembers + val setupTeardownFns = + TopSetupTeardownFns(s, aNode, helperFnNames).getMembers val defs = hppLines :: cppLines :: (helperFns ++ setupTeardownFns) - List( - List(hppIncludes, cppIncludes), - wrapInNamespaces(namespaceIdentList, defs) - ).flatten + wrapInNamespaces(namespaceIdentList, defs) } } 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 0f48a25e4..90aa80067 100644 --- a/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriterUtils.scala +++ b/compiler/lib/src/main/scala/codegen/CppWriter/TopologyCppWriter/TopologyCppWriterUtils.scala @@ -57,9 +57,6 @@ abstract class TopologyCppWriterUtils( name.shortName(ens) } - def getNameAsIdent(name: Name.Qualified): String = - CppWriter.identFromQualifiedName(getShortName(name)) - def getNameAsQualIdent(name: Name.Qualified): String = CppWriter.writeQualifiedName(getShortName(name)) diff --git a/compiler/lib/src/main/scala/codegen/DictionaryJsonWriter/DictionaryJsonEncoder.scala b/compiler/lib/src/main/scala/codegen/DictionaryJsonWriter/DictionaryJsonEncoder.scala index 04818cd63..f04e08c42 100644 --- a/compiler/lib/src/main/scala/codegen/DictionaryJsonWriter/DictionaryJsonEncoder.scala +++ b/compiler/lib/src/main/scala/codegen/DictionaryJsonWriter/DictionaryJsonEncoder.scala @@ -314,8 +314,7 @@ case class DictionaryJsonEncoder( override def apply(entry: (BigInt, CommandEntry)): Json = { val opcode = entry._1 val command = entry._2.command - val componentInstUnqualName = entry._2.componentInstance.getUnqualifiedName - val name = s"${componentInstUnqualName}.${command.getName}" + val name = s"${entry._2.componentInstance.toString}.${command.getName}" command match { case Command.NonParam(aNode, kind) => { val (preA, node, postA) = aNode @@ -365,8 +364,7 @@ case class DictionaryJsonEncoder( override def apply(entry: (BigInt, ParamEntry)): Json = { val numIdentifier = entry._1 val param = entry._2.param - val componentInstUnqualName = entry._2.componentInstance.getUnqualifiedName - val name = s"${componentInstUnqualName}.${param.getName}" + val name = s"${entry._2.componentInstance.toString}.${param.getName}" val (preA, node, postA) = param.aNode val json = Json.obj( "name" -> name.asJson, @@ -386,8 +384,7 @@ case class DictionaryJsonEncoder( override def apply(entry: (BigInt, EventEntry)): Json = { val event = entry._2.event val numIdentifier = entry._1 - val componentInstUnqualName = entry._2.componentInstance.getUnqualifiedName - val name = s"${componentInstUnqualName}.${event.getName}" + val name = s"${entry._2.componentInstance.toString}.${event.getName}" val (preA, node, postA) = event.aNode val severityStr = node.data.severity match { case Ast.SpecEvent.ActivityHigh => "ACTIVITY_HI" @@ -423,8 +420,7 @@ case class DictionaryJsonEncoder( override def apply(entry: (BigInt, TlmChannelEntry)): Json = { val channel = entry._2.tlmChannel val numIdentifier = entry._1 - val componentInstUnqualName = entry._2.componentInstance.getUnqualifiedName - val name = s"${componentInstUnqualName}.${channel.getName}" + val name = s"${entry._2.componentInstance.toString}.${channel.getName}" val (preA, node, postA) = channel.aNode val json = Json.obj( "name" -> name.asJson, @@ -456,8 +452,7 @@ case class DictionaryJsonEncoder( override def apply(entry: (BigInt, RecordEntry)): Json = { val record = entry._2.record val numIdentifier = entry._1 - val componentInstUnqualName = entry._2.componentInstance.getUnqualifiedName - val name = s"${componentInstUnqualName}.${record.getName}" + val name = s"${entry._2.componentInstance.toString}.${record.getName}" val (preA, node, postA) = record.aNode val json = Json.obj( "name" -> name.asJson, @@ -477,8 +472,7 @@ case class DictionaryJsonEncoder( override def apply(entry: (BigInt, ContainerEntry)): Json = { val container = entry._2.container val numIdentifier = entry._1 - val componentInstUnqualName = entry._2.componentInstance.getUnqualifiedName - val name = s"${componentInstUnqualName}.${container.getName}" + val name = s"${entry._2.componentInstance.toString}.${container.getName}" val (preA, node, postA) = container.aNode val json = Json.obj( "name" -> name.asJson, 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 604fd119f..c238b683a 100644 --- a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.cpp @@ -6,72 +6,91 @@ #include "BasicTopologyAc.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + namespace M { + Active active1(FW_OPTIONAL_NAME("active1")); - // ---------------------------------------------------------------------- - // Component configuration objects - // ---------------------------------------------------------------------- +} - namespace ConfigObjects { +namespace M { + Active active2; - namespace active2 { - U32 x = 0; - } +} - } +namespace M { + Active active3(FW_OPTIONAL_NAME("active3")); - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- +} - Active active1(FW_OPTIONAL_NAME("active1")); +namespace M { - Active active2; + Passive passive1(FW_OPTIONAL_NAME("passive1")); - Active active3(FW_OPTIONAL_NAME("active3")); +} - Passive passive1(FW_OPTIONAL_NAME("passive1")); +namespace M { ConcretePassive passive2(FW_OPTIONAL_NAME("passive2")); +} + +namespace M { + + + // ---------------------------------------------------------------------- + // Component configuration objects + // ---------------------------------------------------------------------- + + namespace ConfigObjects { + + namespace M_active2 { + U32 x = 0; + } + + } + + // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- void initComponents(const TopologyState& state) { - active1.init(QueueSizes::active1, InstanceIds::active1); - active2.initSpecial(); - active3.init(QueueSizes::active3, InstanceIds::active3); - passive1.init(InstanceIds::passive1); - passive2.init(InstanceIds::passive2); + 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); } void configComponents(const TopologyState& state) { - active2.config(); + M::active2.config(); } void setBaseIds() { - active1.setIdBase(BaseIds::active1); - active2.setIdBase(BaseIds::active2); - active3.setIdBase(BaseIds::active3); - passive1.setIdBase(BaseIds::passive1); - passive2.setIdBase(BaseIds::passive2); + M::active1.setIdBase(BaseIds::M_active1); + M::active2.setIdBase(BaseIds::M_active2); + M::active3.setIdBase(BaseIds::M_active3); + M::passive1.setIdBase(BaseIds::M_passive1); + M::passive2.setIdBase(BaseIds::M_passive2); } void connectComponents() { // C1 - passive1.set_p_OutputPort( + M::passive1.set_p_OutputPort( 0, - active1.get_p_InputPort(0) + M::active1.get_p_InputPort(0) ); // C2 - passive2.set_p_OutputPort( + M::passive2.set_p_OutputPort( 0, - active2.get_p_InputPort(0) + M::active2.get_p_InputPort(0) ); } @@ -88,35 +107,35 @@ namespace M { } void startTasks(const TopologyState& state) { - active1.start( - static_cast(Priorities::active1), - static_cast(StackSizes::active1), - static_cast(CPUs::active1), - static_cast(TaskIds::active1) + M::active1.start( + static_cast(Priorities::M_active1), + static_cast(StackSizes::M_active1), + static_cast(CPUs::M_active1), + static_cast(TaskIds::M_active1) ); - active2.startSpecial(); - active3.start( + M::active2.startSpecial(); + M::active3.start( Os::Task::TASK_DEFAULT, // Default priority Os::Task::TASK_DEFAULT, // Default stack size Os::Task::TASK_DEFAULT, // Default CPU - static_cast(TaskIds::active3) + static_cast(TaskIds::M_active3) ); } void stopTasks(const TopologyState& state) { - active1.exit(); - active2.stopSpecial(); - active3.exit(); + M::active1.exit(); + M::active2.stopSpecial(); + M::active3.exit(); } void freeThreads(const TopologyState& state) { - (void) active1.ActiveComponentBase::join(); - active2.freeSpecial(); - (void) active3.ActiveComponentBase::join(); + (void) M::active1.ActiveComponentBase::join(); + M::active2.freeSpecial(); + (void) M::active3.ActiveComponentBase::join(); } void tearDownComponents(const TopologyState& state) { - active2.tearDown(); + M::active2.tearDown(); } // ---------------------------------------------------------------------- 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 28dac8ff9..b98140a2f 100644 --- a/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/BasicTopologyAc.ref.hpp @@ -11,6 +11,45 @@ #include "BasicTopologyDefs.hpp" #include "Passive.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + +namespace M { + + //! active1 + extern Active active1; + +} + +namespace M { + + //! active2 + extern Active active2; + +} + +namespace M { + + //! active3 + extern Active active3; + +} + +namespace M { + + //! passive1 + extern Passive passive1; + +} + +namespace M { + + //! passive2 + extern ConcretePassive passive2; + +} + namespace M { // ---------------------------------------------------------------------- @@ -18,7 +57,7 @@ namespace M { // ---------------------------------------------------------------------- namespace ConfigConstants { - namespace active2 { + namespace M_active2 { enum { X = 0, Y = 1 @@ -28,77 +67,58 @@ namespace M { namespace BaseIds { enum { - active1 = 0x100, - active2 = 0x200, - active3 = 0x300, - passive1 = 0x300, - passive2 = 0x400, + M_active1 = 0x100, + M_active2 = 0x200, + M_active3 = 0x300, + M_passive1 = 0x300, + M_passive2 = 0x400, }; } namespace CPUs { enum { - active1 = 0, + M_active1 = 0, }; } namespace InstanceIds { enum { - active1, - active2, - active3, - passive1, - passive2, + M_active1, + M_active2, + M_active3, + M_passive1, + M_passive2, }; } namespace Priorities { enum { - active1 = 1, + M_active1 = 1, }; } namespace QueueSizes { enum { - active1 = 10, - active2 = 10, - active3 = 10, + M_active1 = 10, + M_active2 = 10, + M_active3 = 10, }; } namespace StackSizes { enum { - active1 = 1024, + M_active1 = 1024, }; } namespace TaskIds { enum { - active1, - active2, - active3, + M_active1, + M_active2, + M_active3, }; } - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- - - //! active1 - extern Active active1; - - //! active2 - extern Active active2; - - //! active3 - extern Active active3; - - //! passive1 - extern Passive passive1; - - //! passive2 - extern ConcretePassive passive2; - // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- 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 fd6a365fc..c7006a2e4 100644 --- a/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.cpp @@ -6,24 +6,32 @@ #include "CommandsTopologyAc.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + namespace M { + C c1(FW_OPTIONAL_NAME("c1")); - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- +} - C c1(FW_OPTIONAL_NAME("c1")); +namespace M { C c2(FW_OPTIONAL_NAME("c2")); +} + +namespace M { + + // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- void initComponents(const TopologyState& state) { - c1.init(InstanceIds::c1); - c2.init(InstanceIds::c2); + M::c1.init(InstanceIds::M_c1); + M::c2.init(InstanceIds::M_c2); } void configComponents(const TopologyState& state) { @@ -31,8 +39,8 @@ namespace M { } void setBaseIds() { - c1.setIdBase(BaseIds::c1); - c2.setIdBase(BaseIds::c2); + M::c1.setIdBase(BaseIds::M_c1); + M::c2.setIdBase(BaseIds::M_c2); } void connectComponents() { @@ -40,8 +48,8 @@ namespace M { } void regCommands() { - c1.regCommandsSpecial(); - c2.regCommands(); + M::c1.regCommandsSpecial(); + M::c2.regCommands(); } void readParameters() { 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 a7fc3c984..684f55274 100644 --- a/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/CommandsTopologyAc.ref.hpp @@ -10,6 +10,24 @@ #include "C.hpp" #include "CommandsTopologyDefs.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + +namespace M { + + //! c1 + extern C c1; + +} + +namespace M { + + //! c2 + extern C c2; + +} + namespace M { // ---------------------------------------------------------------------- @@ -18,28 +36,18 @@ namespace M { namespace BaseIds { enum { - c1 = 0x100, - c2 = 0x200, + M_c1 = 0x100, + M_c2 = 0x200, }; } namespace InstanceIds { enum { - c1, - c2, + M_c1, + M_c2, }; } - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- - - //! c1 - extern C c1; - - //! c2 - extern C c2; - // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- 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 2ace23686..32f9ac79c 100644 --- a/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.cpp @@ -6,6 +6,28 @@ #include "HealthTopologyAc.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + +namespace M { + + C c1(FW_OPTIONAL_NAME("c1")); + +} + +namespace M { + + C c2(FW_OPTIONAL_NAME("c2")); + +} + +namespace M { + + Svc::Health health(FW_OPTIONAL_NAME("health")); + +} + namespace M { @@ -15,17 +37,17 @@ namespace M { namespace ConfigObjects { - namespace health { + namespace M_health { Svc::Health::PingEntry pingEntries[NUM_PING_ENTRIES] = { { - PingEntries::c1::WARN, - PingEntries::c1::FATAL, - "c1" + PingEntries::M_c1::WARN, + PingEntries::M_c1::FATAL, + "M_c1" }, { - PingEntries::c2::WARN, - PingEntries::c2::FATAL, - "c2" + PingEntries::M_c2::WARN, + PingEntries::M_c2::FATAL, + "M_c2" }, }; } @@ -33,24 +55,14 @@ namespace M { } - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- - - C c1(FW_OPTIONAL_NAME("c1")); - - C c2(FW_OPTIONAL_NAME("c2")); - - Svc::Health health(FW_OPTIONAL_NAME("health")); - // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- void initComponents(const TopologyState& state) { - c1.init(InstanceIds::c1); - c2.init(InstanceIds::c2); - health.init(InstanceIds::health); + M::c1.init(InstanceIds::M_c1); + M::c2.init(InstanceIds::M_c2); + M::health.init(InstanceIds::M_health); } void configComponents(const TopologyState& state) { @@ -58,29 +70,29 @@ namespace M { } void setBaseIds() { - health.setIdBase(BaseIds::health); - c1.setIdBase(BaseIds::c1); - c2.setIdBase(BaseIds::c2); + M::health.setIdBase(BaseIds::M_health); + M::c1.setIdBase(BaseIds::M_c1); + M::c2.setIdBase(BaseIds::M_c2); } void connectComponents() { // Health - c1.set_pingOut_OutputPort( + M::c1.set_pingOut_OutputPort( 0, - health.get_pingIn_InputPort(0) + M::health.get_pingIn_InputPort(0) ); - c2.set_pingOut_OutputPort( + M::c2.set_pingOut_OutputPort( 0, - health.get_pingIn_InputPort(1) + M::health.get_pingIn_InputPort(1) ); - health.set_pingOut_OutputPort( + M::health.set_pingOut_OutputPort( 0, - c1.get_pingIn_InputPort(0) + M::c1.get_pingIn_InputPort(0) ); - health.set_pingOut_OutputPort( + M::health.set_pingOut_OutputPort( 1, - c2.get_pingIn_InputPort(0) + M::c2.get_pingIn_InputPort(0) ); } 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 b6df48883..c3ab0dbc5 100644 --- a/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/HealthTopologyAc.ref.hpp @@ -11,6 +11,31 @@ #include "Health.hpp" #include "HealthTopologyDefs.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + +namespace M { + + //! c1 + extern C c1; + +} + +namespace M { + + //! c2 + extern C c2; + +} + +namespace M { + + //! health + extern Svc::Health health; + +} + namespace M { // ---------------------------------------------------------------------- @@ -19,17 +44,17 @@ namespace M { namespace BaseIds { enum { - health = 0x100, - c1 = 0x200, - c2 = 0x300, + M_health = 0x100, + M_c1 = 0x200, + M_c2 = 0x300, }; } namespace InstanceIds { enum { - c1, - c2, - health, + M_c1, + M_c2, + M_health, }; } @@ -39,7 +64,7 @@ namespace M { namespace ConfigObjects { - namespace health { + namespace M_health { //!< Number of entries in the pingEntryies array constexpr FwSizeType NUM_PING_ENTRIES = 2; //!< Ping entry configuration for Svc::Health @@ -48,19 +73,6 @@ namespace M { } - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- - - //! c1 - extern C c1; - - //! c2 - extern C c2; - - //! health - extern Svc::Health health; - // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- 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 0e63afa0a..f7953d5e9 100644 --- a/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.cpp @@ -6,14 +6,14 @@ #include "NestedNamespacesTopologyAc.hpp" -namespace M { +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- +N::O::C c(FW_OPTIONAL_NAME("c")); - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- +namespace M { - N::O::C c(FW_OPTIONAL_NAME("c")); // ---------------------------------------------------------------------- // Helper functions 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 6b35604ef..c4b43049e 100644 --- a/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/NestedNamespacesTopologyAc.ref.hpp @@ -10,6 +10,13 @@ #include "C.hpp" #include "NestedNamespacesTopologyDefs.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + +//! c +extern N::O::C c; + namespace M { // ---------------------------------------------------------------------- @@ -28,13 +35,6 @@ namespace M { }; } - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- - - //! c - extern N::O::C c; - // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- 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 0cd036571..54b862eed 100644 --- a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp +++ b/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.cpp @@ -6,24 +6,32 @@ #include "ParamsTopologyAc.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + namespace M { + C c1(FW_OPTIONAL_NAME("c1")); - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- +} - C c1(FW_OPTIONAL_NAME("c1")); +namespace M { C c2(FW_OPTIONAL_NAME("c2")); +} + +namespace M { + + // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- void initComponents(const TopologyState& state) { - c1.init(InstanceIds::c1); - c2.init(InstanceIds::c2); + M::c1.init(InstanceIds::M_c1); + M::c2.init(InstanceIds::M_c2); } void configComponents(const TopologyState& state) { @@ -31,8 +39,8 @@ namespace M { } void setBaseIds() { - c1.setIdBase(BaseIds::c1); - c2.setIdBase(BaseIds::c2); + M::c1.setIdBase(BaseIds::M_c1); + M::c2.setIdBase(BaseIds::M_c2); } void connectComponents() { @@ -40,17 +48,17 @@ namespace M { } void regCommands() { - c1.regCommands(); - c2.regCommands(); + M::c1.regCommands(); + M::c2.regCommands(); } void readParameters() { - c1.readParamFile(); + M::c1.readParamFile(); } void loadParameters() { - c1.loadParamsSpecial(); - c2.loadParameters(); + M::c1.loadParamsSpecial(); + M::c2.loadParameters(); } void startTasks(const TopologyState& state) { 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 43a0fde78..575c1ff28 100644 --- a/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/ParamsTopologyAc.ref.hpp @@ -10,6 +10,24 @@ #include "C.hpp" #include "ParamsTopologyDefs.hpp" +// ---------------------------------------------------------------------- +// Component instances +// ---------------------------------------------------------------------- + +namespace M { + + //! c1 + extern C c1; + +} + +namespace M { + + //! c2 + extern C c2; + +} + namespace M { // ---------------------------------------------------------------------- @@ -18,28 +36,18 @@ namespace M { namespace BaseIds { enum { - c1 = 0x100, - c2 = 0x200, + M_c1 = 0x100, + M_c2 = 0x200, }; } namespace InstanceIds { enum { - c1, - c2, + M_c1, + M_c2, }; } - // ---------------------------------------------------------------------- - // Component instances - // ---------------------------------------------------------------------- - - //! c1 - extern C c1; - - //! c2 - extern C c2; - // ---------------------------------------------------------------------- // Helper functions // ---------------------------------------------------------------------- diff --git a/compiler/tools/fpp-to-cpp/test/top/basic.fpp b/compiler/tools/fpp-to-cpp/test/top/basic.fpp index 64a08f6c2..f0daaa2a4 100644 --- a/compiler/tools/fpp-to-cpp/test/top/basic.fpp +++ b/compiler/tools/fpp-to-cpp/test/top/basic.fpp @@ -37,27 +37,27 @@ module M { """ phase Phases.initComponents """ - active2.initSpecial(); + M::active2.initSpecial(); """ phase Phases.configComponents """ - active2.config(); + M::active2.config(); """ phase Phases.startTasks """ - active2.startSpecial(); + M::active2.startSpecial(); """ phase Phases.stopTasks """ - active2.stopSpecial(); + M::active2.stopSpecial(); """ phase Phases.freeThreads """ - active2.freeSpecial(); + M::active2.freeSpecial(); """ phase Phases.tearDownComponents """ - active2.tearDown(); + M::active2.tearDown(); """ } diff --git a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Health/HealthTopologyDefs.hpp b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Health/HealthTopologyDefs.hpp index 0b6e0187e..c9d16bebf 100644 --- a/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Health/HealthTopologyDefs.hpp +++ b/compiler/tools/fpp-to-cpp/test/top/check-cpp-dir/Health/HealthTopologyDefs.hpp @@ -3,13 +3,13 @@ namespace M { typedef int TopologyState; namespace PingEntries { - namespace c1 { + namespace M_c1 { enum { WARN = 1, FATAL = 2 }; } - namespace c2 { + namespace M_c2 { enum { WARN = 1, FATAL = 2 diff --git a/compiler/tools/fpp-to-cpp/test/top/commands.fpp b/compiler/tools/fpp-to-cpp/test/top/commands.fpp index 9a5e87b85..73d50516b 100644 --- a/compiler/tools/fpp-to-cpp/test/top/commands.fpp +++ b/compiler/tools/fpp-to-cpp/test/top/commands.fpp @@ -15,7 +15,7 @@ module M { instance c1: C base id 0x100 { phase Phases.regCommands """ - c1.regCommandsSpecial(); + M::c1.regCommandsSpecial(); """ } diff --git a/compiler/tools/fpp-to-cpp/test/top/params.fpp b/compiler/tools/fpp-to-cpp/test/top/params.fpp index 64d4c5177..23053a8a4 100644 --- a/compiler/tools/fpp-to-cpp/test/top/params.fpp +++ b/compiler/tools/fpp-to-cpp/test/top/params.fpp @@ -19,11 +19,11 @@ module M { instance c1: C base id 0x100 { phase Phases.readParameters """ - c1.readParamFile(); + M::c1.readParamFile(); """ phase Phases.loadParameters """ - c1.loadParamsSpecial(); + M::c1.loadParamsSpecial(); """ } diff --git a/compiler/tools/fpp-to-dict/test/top/BasicDpTopologyDictionary.ref.json b/compiler/tools/fpp-to-dict/test/top/BasicDpTopologyDictionary.ref.json index 48e190a3f..a07bec0c6 100644 --- a/compiler/tools/fpp-to-dict/test/top/BasicDpTopologyDictionary.ref.json +++ b/compiler/tools/fpp-to-dict/test/top/BasicDpTopologyDictionary.ref.json @@ -70,7 +70,7 @@ ], "records" : [ { - "name" : "c2.DataArrayRecord", + "name" : "FppTest.c2.DataArrayRecord", "type" : { "name" : "FppTest.DpTestComponent.Data", "kind" : "qualifiedIdentifier" @@ -80,7 +80,7 @@ "annotation" : "Record 5" }, { - "name" : "c2.U32Record", + "name" : "FppTest.c2.U32Record", "type" : { "name" : "U32", "kind" : "integer", @@ -92,7 +92,7 @@ "annotation" : "Record 1" }, { - "name" : "c2.ComplexRecord", + "name" : "FppTest.c2.ComplexRecord", "type" : { "name" : "FppTest.DpTestComponent.Complex", "kind" : "qualifiedIdentifier" @@ -102,7 +102,7 @@ "annotation" : "Record 2" }, { - "name" : "c2.U32ArrayRecord", + "name" : "FppTest.c2.U32ArrayRecord", "type" : { "name" : "U32", "kind" : "integer", @@ -114,7 +114,7 @@ "annotation" : "Record 4" }, { - "name" : "c1.U32Record", + "name" : "FppTest.c1.U32Record", "type" : { "name" : "U32", "kind" : "integer", @@ -126,7 +126,7 @@ "annotation" : "Record 1" }, { - "name" : "c2.U8ArrayRecord", + "name" : "FppTest.c2.U8ArrayRecord", "type" : { "name" : "U8", "kind" : "integer", @@ -138,7 +138,7 @@ "annotation" : "Record 3" }, { - "name" : "c1.ComplexRecord2", + "name" : "FppTest.c1.ComplexRecord2", "type" : { "name" : "FppTest.DpTestComponent.Complex", "kind" : "qualifiedIdentifier" @@ -148,7 +148,7 @@ "annotation" : "Record 6" }, { - "name" : "c1.DataArrayRecord", + "name" : "FppTest.c1.DataArrayRecord", "type" : { "name" : "FppTest.DpTestComponent.Data", "kind" : "qualifiedIdentifier" @@ -158,7 +158,7 @@ "annotation" : "Record 5" }, { - "name" : "c2.ComplexRecord2", + "name" : "FppTest.c2.ComplexRecord2", "type" : { "name" : "FppTest.DpTestComponent.Complex", "kind" : "qualifiedIdentifier" @@ -168,7 +168,7 @@ "annotation" : "Record 6" }, { - "name" : "c1.U32ArrayRecord", + "name" : "FppTest.c1.U32ArrayRecord", "type" : { "name" : "U32", "kind" : "integer", @@ -180,7 +180,7 @@ "annotation" : "Record 4" }, { - "name" : "c1.U8ArrayRecord", + "name" : "FppTest.c1.U8ArrayRecord", "type" : { "name" : "U8", "kind" : "integer", @@ -192,7 +192,7 @@ "annotation" : "Record 3" }, { - "name" : "c1.ComplexRecord", + "name" : "FppTest.c1.ComplexRecord", "type" : { "name" : "FppTest.DpTestComponent.Complex", "kind" : "qualifiedIdentifier" @@ -204,61 +204,61 @@ ], "containers" : [ { - "name" : "c2.Container5", + "name" : "FppTest.c2.Container5", "id" : 6268, "defaultPriority" : 50, "annotation" : "Container 5" }, { - "name" : "c2.Container1", + "name" : "FppTest.c2.Container1", "id" : 5868, "defaultPriority" : 10, "annotation" : "Container 1" }, { - "name" : "c2.Container2", + "name" : "FppTest.c2.Container2", "id" : 5968, "defaultPriority" : 20, "annotation" : "Container 2" }, { - "name" : "c2.Container4", + "name" : "FppTest.c2.Container4", "id" : 6168, "defaultPriority" : 40, "annotation" : "Container 4" }, { - "name" : "c1.Container4", + "name" : "FppTest.c1.Container4", "id" : 5400, "defaultPriority" : 40, "annotation" : "Container 4" }, { - "name" : "c1.Container1", + "name" : "FppTest.c1.Container1", "id" : 5100, "defaultPriority" : 10, "annotation" : "Container 1" }, { - "name" : "c2.Container3", + "name" : "FppTest.c2.Container3", "id" : 6068, "defaultPriority" : 30, "annotation" : "Container 3" }, { - "name" : "c1.Container5", + "name" : "FppTest.c1.Container5", "id" : 5500, "defaultPriority" : 50, "annotation" : "Container 5" }, { - "name" : "c1.Container3", + "name" : "FppTest.c1.Container3", "id" : 5300, "defaultPriority" : 30, "annotation" : "Container 3" }, { - "name" : "c1.Container2", + "name" : "FppTest.c1.Container2", "id" : 5200, "defaultPriority" : 20, "annotation" : "Container 2" diff --git a/compiler/tools/fpp-to-dict/test/top/FirstTopTopologyDictionary.ref.json b/compiler/tools/fpp-to-dict/test/top/FirstTopTopologyDictionary.ref.json index 8f439e793..35e044681 100644 --- a/compiler/tools/fpp-to-dict/test/top/FirstTopTopologyDictionary.ref.json +++ b/compiler/tools/fpp-to-dict/test/top/FirstTopTopologyDictionary.ref.json @@ -206,7 +206,7 @@ ], "commands" : [ { - "name" : "myFirstC2.Command1", + "name" : "Module1.myFirstC2.Command1", "commandKind" : "sync", "opcode" : 1024, "formalParams" : [ @@ -222,7 +222,7 @@ "annotation" : "Command with 1 arg (of type struct)" }, { - "name" : "myFirstC1.PARAM2_PARAM_SET", + "name" : "Module1.myFirstC1.PARAM2_PARAM_SET", "commandKind" : "set", "opcode" : 898, "formalParams" : [ @@ -238,7 +238,7 @@ "annotation" : "Parameter of type array (with 4 U32 values)" }, { - "name" : "myFirstC1.PARAM5_PARAM_SAVE", + "name" : "Module1.myFirstC1.PARAM5_PARAM_SAVE", "commandKind" : "save", "opcode" : 905, "formalParams" : [ @@ -246,7 +246,7 @@ "annotation" : "Parameter of type enum" }, { - "name" : "myFirstC1.PARAM3_PARAM_SAVE", + "name" : "Module1.myFirstC1.PARAM3_PARAM_SAVE", "commandKind" : "save", "opcode" : 901, "formalParams" : [ @@ -254,7 +254,7 @@ "annotation" : "Parameter of type string" }, { - "name" : "myFirstC1.PARAM1_PARAM_SAVE", + "name" : "Module1.myFirstC1.PARAM1_PARAM_SAVE", "commandKind" : "save", "opcode" : 773, "formalParams" : [ @@ -262,7 +262,7 @@ "annotation" : "Parameter (struct)" }, { - "name" : "myFirstC1.PARAM3_PARAM_SET", + "name" : "Module1.myFirstC1.PARAM3_PARAM_SET", "commandKind" : "set", "opcode" : 900, "formalParams" : [ @@ -279,7 +279,7 @@ "annotation" : "Parameter of type string" }, { - "name" : "myFirstC1.Command2", + "name" : "Module1.myFirstC1.Command2", "commandKind" : "sync", "opcode" : 769, "formalParams" : [ @@ -296,7 +296,7 @@ "annotation" : "Command with string arg" }, { - "name" : "myFirstC1.Command1", + "name" : "Module1.myFirstC1.Command1", "commandKind" : "async", "opcode" : 768, "formalParams" : [ @@ -317,7 +317,7 @@ "annotation" : "Command with I32 arg" }, { - "name" : "myFirstC2.Command2", + "name" : "Module1.myFirstC2.Command2", "commandKind" : "sync", "opcode" : 1025, "formalParams" : [ @@ -353,7 +353,7 @@ "annotation" : "Command with 3 args (of types string, I32, and bool)" }, { - "name" : "myFirstC1.PARAM2_PARAM_SAVE", + "name" : "Module1.myFirstC1.PARAM2_PARAM_SAVE", "commandKind" : "save", "opcode" : 899, "formalParams" : [ @@ -361,7 +361,7 @@ "annotation" : "Parameter of type array (with 4 U32 values)" }, { - "name" : "myFirstC1.PARAM4_PARAM_SET", + "name" : "Module1.myFirstC1.PARAM4_PARAM_SET", "commandKind" : "set", "opcode" : 902, "formalParams" : [ @@ -378,7 +378,7 @@ "annotation" : "Parameter of type F32" }, { - "name" : "myFirstC1.Command3", + "name" : "Module1.myFirstC1.Command3", "commandKind" : "sync", "opcode" : 770, "formalParams" : [ @@ -406,7 +406,7 @@ "annotation" : "Command with 2 args (array of strings and U32)" }, { - "name" : "myFirstC1.PARAM5_PARAM_SET", + "name" : "Module1.myFirstC1.PARAM5_PARAM_SET", "commandKind" : "set", "opcode" : 904, "formalParams" : [ @@ -422,7 +422,7 @@ "annotation" : "Parameter of type enum" }, { - "name" : "myFirstC1.PARAM1_PARAM_SET", + "name" : "Module1.myFirstC1.PARAM1_PARAM_SET", "commandKind" : "set", "opcode" : 772, "formalParams" : [ @@ -438,7 +438,7 @@ "annotation" : "Parameter (struct)" }, { - "name" : "myFirstC1.PARAM4_PARAM_SAVE", + "name" : "Module1.myFirstC1.PARAM4_PARAM_SAVE", "commandKind" : "save", "opcode" : 903, "formalParams" : [ @@ -446,7 +446,7 @@ "annotation" : "Parameter of type F32" }, { - "name" : "myFirstC1.Command4", + "name" : "Module1.myFirstC1.Command4", "commandKind" : "sync", "opcode" : 771, "formalParams" : [ @@ -456,7 +456,7 @@ ], "parameters" : [ { - "name" : "myFirstC1.Param2", + "name" : "Module1.myFirstC1.Param2", "type" : { "name" : "Module1.U32x4", "kind" : "qualifiedIdentifier" @@ -465,7 +465,7 @@ "annotation" : "Parameter of type array (with 4 U32 values)" }, { - "name" : "myFirstC1.Param5", + "name" : "Module1.myFirstC1.Param5", "type" : { "name" : "Module1.E1", "kind" : "qualifiedIdentifier" @@ -474,7 +474,7 @@ "annotation" : "Parameter of type enum" }, { - "name" : "myFirstC1.Param4", + "name" : "Module1.myFirstC1.Param4", "type" : { "name" : "F32", "kind" : "float", @@ -484,7 +484,7 @@ "annotation" : "Parameter of type F32" }, { - "name" : "myFirstC1.Param1", + "name" : "Module1.myFirstC1.Param1", "type" : { "name" : "Module1.S1", "kind" : "qualifiedIdentifier" @@ -497,7 +497,7 @@ "annotation" : "Parameter (struct)" }, { - "name" : "myFirstC1.Param3", + "name" : "Module1.myFirstC1.Param3", "type" : { "name" : "string", "kind" : "string", @@ -509,7 +509,7 @@ ], "events" : [ { - "name" : "myFirstC1.Event1", + "name" : "Module1.myFirstC1.Event1", "severity" : "ACTIVITY_HI", "formalParams" : [ { @@ -527,7 +527,7 @@ "annotation" : "Event with array arg (containing 4 F32 values)" }, { - "name" : "myFirstC1.Event2", + "name" : "Module1.myFirstC1.Event2", "severity" : "ACTIVITY_HI", "formalParams" : [ { @@ -545,7 +545,7 @@ "annotation" : "Event with enum arg" }, { - "name" : "myFirstC1.Event3", + "name" : "Module1.myFirstC1.Event3", "severity" : "ACTIVITY_HI", "formalParams" : [ { @@ -564,7 +564,7 @@ "annotation" : "Event with format specifier\nMultiple lines of annotation\nAnd not used on purpose" }, { - "name" : "myFirstC2.Event1", + "name" : "Module1.myFirstC2.Event1", "severity" : "WARNING_LO", "formalParams" : [ { @@ -586,7 +586,7 @@ ], "telemetryChannels" : [ { - "name" : "myFirstC2.TlmChannel1", + "name" : "Module1.myFirstC2.TlmChannel1", "type" : { "name" : "U32", "kind" : "integer", @@ -598,7 +598,7 @@ "annotation" : "Telemetry channel of type U32 with no high/low limits" }, { - "name" : "myFirstC1.MyTlmChannel3", + "name" : "Module1.myFirstC1.MyTlmChannel3", "type" : { "name" : "U64", "kind" : "integer", @@ -610,7 +610,7 @@ "annotation" : "Telemetry channel of type U64" }, { - "name" : "myFirstC2.TlmChannel3", + "name" : "Module1.myFirstC2.TlmChannel3", "type" : { "name" : "F64", "kind" : "float", @@ -628,7 +628,7 @@ } }, { - "name" : "myFirstC1.MyTlmChannel2", + "name" : "Module1.myFirstC1.MyTlmChannel2", "type" : { "name" : "F32", "kind" : "float", @@ -639,7 +639,7 @@ "annotation" : "Telemetry channel of type F32" }, { - "name" : "myFirstC1.TlmChannel1", + "name" : "Module1.myFirstC1.TlmChannel1", "type" : { "name" : "F64", "kind" : "float", @@ -662,7 +662,7 @@ } }, { - "name" : "myFirstC2.TlmChannel2", + "name" : "Module1.myFirstC2.TlmChannel2", "type" : { "name" : "F64", "kind" : "float", @@ -682,7 +682,7 @@ ], "records" : [ { - "name" : "myFirstC1.Record1", + "name" : "Module1.myFirstC1.Record1", "type" : { "name" : "U32", "kind" : "integer", @@ -694,7 +694,7 @@ "annotation" : "Record with single U32 value" }, { - "name" : "myFirstC1.Record2", + "name" : "Module1.myFirstC1.Record2", "type" : { "name" : "Module1.F64x4", "kind" : "qualifiedIdentifier" @@ -704,7 +704,7 @@ "annotation" : "Record with a single F64x4 value" }, { - "name" : "myFirstC1.Record3", + "name" : "Module1.myFirstC1.Record3", "type" : { "name" : "F32", "kind" : "float", @@ -717,17 +717,17 @@ ], "containers" : [ { - "name" : "myFirstC1.Container1", + "name" : "Module1.myFirstC1.Container1", "id" : 784, "annotation" : "Description of Container 1" }, { - "name" : "myFirstC1.Container2", + "name" : "Module1.myFirstC1.Container2", "id" : 785, "annotation" : "Description Container 2" }, { - "name" : "myFirstC1.Container3", + "name" : "Module1.myFirstC1.Container3", "id" : 786, "defaultPriority" : 10, "annotation" : "Description Container 3 with a default priority of 10" diff --git a/compiler/tools/fpp-to-dict/test/top/QualifiedCompInstTopologyDictionary.ref.json b/compiler/tools/fpp-to-dict/test/top/QualifiedCompInstTopologyDictionary.ref.json new file mode 100644 index 000000000..8e64ae12d --- /dev/null +++ b/compiler/tools/fpp-to-dict/test/top/QualifiedCompInstTopologyDictionary.ref.json @@ -0,0 +1,81 @@ +{ + "metadata" : { + "deploymentName" : "QualifiedCompInst", + "projectVersion" : "1.0.0", + "frameworkVersion" : "3.4.3", + "libraryVersions" : [ + "lib1-1.0.0", + "lib2-2.0.0" + ], + "dictionarySpecVersion" : "1.0.0" + }, + "typeDefinitions" : [ + { + "kind" : "enum", + "qualifiedName" : "M.E1", + "representationType" : { + "name" : "U32", + "kind" : "integer", + "size" : 32, + "signed" : false + }, + "enumeratedConstants" : [ + { + "name" : "X", + "value" : 0 + }, + { + "name" : "Y", + "value" : 1 + }, + { + "name" : "Z", + "value" : 2 + } + ], + "default" : "M.E1.X" + } + ], + "commands" : [ + { + "name" : "M.I1.P_PARAM_SET", + "commandKind" : "set", + "opcode" : 256, + "formalParams" : [ + { + "name" : "val", + "type" : { + "name" : "M.E1", + "kind" : "qualifiedIdentifier" + }, + "ref" : false + } + ] + }, + { + "name" : "M.I1.P_PARAM_SAVE", + "commandKind" : "save", + "opcode" : 257, + "formalParams" : [ + ] + } + ], + "parameters" : [ + { + "name" : "M.I1.P", + "type" : { + "name" : "M.E1", + "kind" : "qualifiedIdentifier" + }, + "id" : 256 + } + ], + "events" : [ + ], + "telemetryChannels" : [ + ], + "records" : [ + ], + "containers" : [ + ] +} diff --git a/compiler/tools/fpp-to-dict/test/top/SecondTopTopologyDictionary.ref.json b/compiler/tools/fpp-to-dict/test/top/SecondTopTopologyDictionary.ref.json index 10c17d844..a5637c339 100644 --- a/compiler/tools/fpp-to-dict/test/top/SecondTopTopologyDictionary.ref.json +++ b/compiler/tools/fpp-to-dict/test/top/SecondTopTopologyDictionary.ref.json @@ -206,7 +206,7 @@ ], "commands" : [ { - "name" : "mySecondC1.PARAM2_PARAM_SAVE", + "name" : "Module1.mySecondC1.PARAM2_PARAM_SAVE", "commandKind" : "save", "opcode" : 1411, "formalParams" : [ @@ -214,7 +214,7 @@ "annotation" : "Parameter of type array (with 4 U32 values)" }, { - "name" : "mySecondC1.Command2", + "name" : "Module1.mySecondC1.Command2", "commandKind" : "sync", "opcode" : 1281, "formalParams" : [ @@ -231,7 +231,7 @@ "annotation" : "Command with string arg" }, { - "name" : "mySecondC1.PARAM4_PARAM_SET", + "name" : "Module1.mySecondC1.PARAM4_PARAM_SET", "commandKind" : "set", "opcode" : 1414, "formalParams" : [ @@ -248,7 +248,7 @@ "annotation" : "Parameter of type F32" }, { - "name" : "mySecondC1.Command3", + "name" : "Module1.mySecondC1.Command3", "commandKind" : "sync", "opcode" : 1282, "formalParams" : [ @@ -276,7 +276,7 @@ "annotation" : "Command with 2 args (array of strings and U32)" }, { - "name" : "mySecondC1.PARAM3_PARAM_SAVE", + "name" : "Module1.mySecondC1.PARAM3_PARAM_SAVE", "commandKind" : "save", "opcode" : 1413, "formalParams" : [ @@ -284,7 +284,7 @@ "annotation" : "Parameter of type string" }, { - "name" : "mySecondC1.PARAM1_PARAM_SAVE", + "name" : "Module1.mySecondC1.PARAM1_PARAM_SAVE", "commandKind" : "save", "opcode" : 1285, "formalParams" : [ @@ -292,7 +292,7 @@ "annotation" : "Parameter (struct)" }, { - "name" : "mySecondC1.PARAM3_PARAM_SET", + "name" : "Module1.mySecondC1.PARAM3_PARAM_SET", "commandKind" : "set", "opcode" : 1412, "formalParams" : [ @@ -309,7 +309,7 @@ "annotation" : "Parameter of type string" }, { - "name" : "mySecondC1.Command1", + "name" : "Module1.mySecondC1.Command1", "commandKind" : "async", "opcode" : 1280, "formalParams" : [ @@ -330,7 +330,7 @@ "annotation" : "Command with I32 arg" }, { - "name" : "mySecondC1.PARAM2_PARAM_SET", + "name" : "Module1.mySecondC1.PARAM2_PARAM_SET", "commandKind" : "set", "opcode" : 1410, "formalParams" : [ @@ -346,7 +346,7 @@ "annotation" : "Parameter of type array (with 4 U32 values)" }, { - "name" : "mySecondC2.Command2", + "name" : "Module1.mySecondC2.Command2", "commandKind" : "sync", "opcode" : 1537, "formalParams" : [ @@ -382,7 +382,7 @@ "annotation" : "Command with 3 args (of types string, I32, and bool)" }, { - "name" : "mySecondC1.PARAM4_PARAM_SAVE", + "name" : "Module1.mySecondC1.PARAM4_PARAM_SAVE", "commandKind" : "save", "opcode" : 1415, "formalParams" : [ @@ -390,7 +390,7 @@ "annotation" : "Parameter of type F32" }, { - "name" : "mySecondC1.Command4", + "name" : "Module1.mySecondC1.Command4", "commandKind" : "sync", "opcode" : 1283, "formalParams" : [ @@ -398,7 +398,7 @@ "annotation" : "Command with no args" }, { - "name" : "mySecondC2.Command1", + "name" : "Module1.mySecondC2.Command1", "commandKind" : "sync", "opcode" : 1536, "formalParams" : [ @@ -414,7 +414,7 @@ "annotation" : "Command with 1 arg (of type struct)" }, { - "name" : "mySecondC1.PARAM1_PARAM_SET", + "name" : "Module1.mySecondC1.PARAM1_PARAM_SET", "commandKind" : "set", "opcode" : 1284, "formalParams" : [ @@ -430,7 +430,7 @@ "annotation" : "Parameter (struct)" }, { - "name" : "mySecondC1.PARAM5_PARAM_SET", + "name" : "Module1.mySecondC1.PARAM5_PARAM_SET", "commandKind" : "set", "opcode" : 1416, "formalParams" : [ @@ -446,7 +446,7 @@ "annotation" : "Parameter of type enum" }, { - "name" : "mySecondC1.PARAM5_PARAM_SAVE", + "name" : "Module1.mySecondC1.PARAM5_PARAM_SAVE", "commandKind" : "save", "opcode" : 1417, "formalParams" : [ @@ -456,7 +456,7 @@ ], "parameters" : [ { - "name" : "mySecondC1.Param3", + "name" : "Module1.mySecondC1.Param3", "type" : { "name" : "string", "kind" : "string", @@ -466,7 +466,7 @@ "annotation" : "Parameter of type string" }, { - "name" : "mySecondC1.Param1", + "name" : "Module1.mySecondC1.Param1", "type" : { "name" : "Module1.S1", "kind" : "qualifiedIdentifier" @@ -479,7 +479,7 @@ "annotation" : "Parameter (struct)" }, { - "name" : "mySecondC1.Param2", + "name" : "Module1.mySecondC1.Param2", "type" : { "name" : "Module1.U32x4", "kind" : "qualifiedIdentifier" @@ -488,7 +488,7 @@ "annotation" : "Parameter of type array (with 4 U32 values)" }, { - "name" : "mySecondC1.Param5", + "name" : "Module1.mySecondC1.Param5", "type" : { "name" : "Module1.E1", "kind" : "qualifiedIdentifier" @@ -497,7 +497,7 @@ "annotation" : "Parameter of type enum" }, { - "name" : "mySecondC1.Param4", + "name" : "Module1.mySecondC1.Param4", "type" : { "name" : "F32", "kind" : "float", @@ -509,7 +509,7 @@ ], "events" : [ { - "name" : "mySecondC1.Event1", + "name" : "Module1.mySecondC1.Event1", "severity" : "ACTIVITY_HI", "formalParams" : [ { @@ -527,7 +527,7 @@ "annotation" : "Event with array arg (containing 4 F32 values)" }, { - "name" : "mySecondC1.Event2", + "name" : "Module1.mySecondC1.Event2", "severity" : "ACTIVITY_HI", "formalParams" : [ { @@ -545,7 +545,7 @@ "annotation" : "Event with enum arg" }, { - "name" : "mySecondC1.Event3", + "name" : "Module1.mySecondC1.Event3", "severity" : "ACTIVITY_HI", "formalParams" : [ { @@ -564,7 +564,7 @@ "annotation" : "Event with format specifier\nMultiple lines of annotation\nAnd not used on purpose" }, { - "name" : "mySecondC2.Event1", + "name" : "Module1.mySecondC2.Event1", "severity" : "WARNING_LO", "formalParams" : [ { @@ -586,7 +586,7 @@ ], "telemetryChannels" : [ { - "name" : "mySecondC1.MyTlmChannel2", + "name" : "Module1.mySecondC1.MyTlmChannel2", "type" : { "name" : "F32", "kind" : "float", @@ -597,7 +597,7 @@ "annotation" : "Telemetry channel of type F32" }, { - "name" : "mySecondC1.MyTlmChannel3", + "name" : "Module1.mySecondC1.MyTlmChannel3", "type" : { "name" : "U64", "kind" : "integer", @@ -609,7 +609,7 @@ "annotation" : "Telemetry channel of type U64" }, { - "name" : "mySecondC2.TlmChannel3", + "name" : "Module1.mySecondC2.TlmChannel3", "type" : { "name" : "F64", "kind" : "float", @@ -627,7 +627,7 @@ } }, { - "name" : "mySecondC2.TlmChannel1", + "name" : "Module1.mySecondC2.TlmChannel1", "type" : { "name" : "U32", "kind" : "integer", @@ -639,7 +639,7 @@ "annotation" : "Telemetry channel of type U32 with no high/low limits" }, { - "name" : "mySecondC1.TlmChannel1", + "name" : "Module1.mySecondC1.TlmChannel1", "type" : { "name" : "F64", "kind" : "float", @@ -662,7 +662,7 @@ } }, { - "name" : "mySecondC2.TlmChannel2", + "name" : "Module1.mySecondC2.TlmChannel2", "type" : { "name" : "F64", "kind" : "float", @@ -682,7 +682,7 @@ ], "records" : [ { - "name" : "mySecondC1.Record1", + "name" : "Module1.mySecondC1.Record1", "type" : { "name" : "U32", "kind" : "integer", @@ -694,7 +694,7 @@ "annotation" : "Record with single U32 value" }, { - "name" : "mySecondC1.Record2", + "name" : "Module1.mySecondC1.Record2", "type" : { "name" : "Module1.F64x4", "kind" : "qualifiedIdentifier" @@ -704,7 +704,7 @@ "annotation" : "Record with a single F64x4 value" }, { - "name" : "mySecondC1.Record3", + "name" : "Module1.mySecondC1.Record3", "type" : { "name" : "F32", "kind" : "float", @@ -717,17 +717,17 @@ ], "containers" : [ { - "name" : "mySecondC1.Container1", + "name" : "Module1.mySecondC1.Container1", "id" : 1296, "annotation" : "Description of Container 1" }, { - "name" : "mySecondC1.Container2", + "name" : "Module1.mySecondC1.Container2", "id" : 1297, "annotation" : "Description Container 2" }, { - "name" : "mySecondC1.Container3", + "name" : "Module1.mySecondC1.Container3", "id" : 1298, "defaultPriority" : 10, "annotation" : "Description Container 3 with a default priority of 10" diff --git a/compiler/tools/fpp-to-dict/test/top/UnqualifiedCompInstTopologyDictionary.ref.json b/compiler/tools/fpp-to-dict/test/top/UnqualifiedCompInstTopologyDictionary.ref.json new file mode 100644 index 000000000..4cfebfd39 --- /dev/null +++ b/compiler/tools/fpp-to-dict/test/top/UnqualifiedCompInstTopologyDictionary.ref.json @@ -0,0 +1,81 @@ +{ + "metadata" : { + "deploymentName" : "UnqualifiedCompInst", + "projectVersion" : "1.0.0", + "frameworkVersion" : "3.4.3", + "libraryVersions" : [ + "lib1-1.0.0", + "lib2-2.0.0" + ], + "dictionarySpecVersion" : "1.0.0" + }, + "typeDefinitions" : [ + { + "kind" : "enum", + "qualifiedName" : "M.E1", + "representationType" : { + "name" : "U32", + "kind" : "integer", + "size" : 32, + "signed" : false + }, + "enumeratedConstants" : [ + { + "name" : "X", + "value" : 0 + }, + { + "name" : "Y", + "value" : 1 + }, + { + "name" : "Z", + "value" : 2 + } + ], + "default" : "M.E1.X" + } + ], + "commands" : [ + { + "name" : "I2.P_PARAM_SET", + "commandKind" : "set", + "opcode" : 768, + "formalParams" : [ + { + "name" : "val", + "type" : { + "name" : "M.E1", + "kind" : "qualifiedIdentifier" + }, + "ref" : false + } + ] + }, + { + "name" : "I2.P_PARAM_SAVE", + "commandKind" : "save", + "opcode" : 769, + "formalParams" : [ + ] + } + ], + "parameters" : [ + { + "name" : "I2.P", + "type" : { + "name" : "M.E1", + "kind" : "qualifiedIdentifier" + }, + "id" : 768 + } + ], + "events" : [ + ], + "telemetryChannels" : [ + ], + "records" : [ + ], + "containers" : [ + ] +} diff --git a/compiler/tools/fpp-to-dict/test/top/run.sh b/compiler/tools/fpp-to-dict/test/top/run.sh index b6dd742cb..e2e604e00 100644 --- a/compiler/tools/fpp-to-dict/test/top/run.sh +++ b/compiler/tools/fpp-to-dict/test/top/run.sh @@ -18,4 +18,13 @@ duplicate() { run_test '' duplicate && \ compare duplicate -} \ No newline at end of file +} + +unqualifiedComponentInstances() +{ + run_test "-i builtin.fpp -p 1.0.0 -f 3.4.3 -l lib1-1.0.0,lib2-2.0.0" unqualifiedComponentInstances && \ + validate_json_schema QualifiedCompInst && \ + validate_json_schema UnqualifiedCompInst && \ + diff_json QualifiedCompInst && \ + diff_json UnqualifiedCompInst +} diff --git a/compiler/tools/fpp-to-dict/test/top/tests.sh b/compiler/tools/fpp-to-dict/test/top/tests.sh index 14929e6ef..347daf0d0 100644 --- a/compiler/tools/fpp-to-dict/test/top/tests.sh +++ b/compiler/tools/fpp-to-dict/test/top/tests.sh @@ -2,4 +2,5 @@ tests=" multipleTops dataProducts duplicate +unqualifiedComponentInstances " diff --git a/compiler/tools/fpp-to-dict/test/top/unqualifiedComponentInstances.fpp b/compiler/tools/fpp-to-dict/test/top/unqualifiedComponentInstances.fpp new file mode 100644 index 000000000..f8c6d0a96 --- /dev/null +++ b/compiler/tools/fpp-to-dict/test/top/unqualifiedComponentInstances.fpp @@ -0,0 +1,40 @@ +module M { + + # enums + enum E1: U32 { + X = 0 + Y = 1 + Z = 2 + } default X + + passive component C { + + command recv port cmdOut + + command reg port cmdRegOut + + command resp port cmdResponseIn + + param P: M.E1 + + param get port prmGetOut + + param set port prmSetOut + } + + instance I1: C base id 0x100 +} + +topology QualifiedCompInst { + + instance M.I1 + +} + +instance I2: M.C base id 0x300 + +topology UnqualifiedCompInst { + + instance I2 + +} diff --git a/compiler/tools/fpp-to-dict/test/top/update-ref.sh b/compiler/tools/fpp-to-dict/test/top/update-ref.sh index 8265476ac..2b091d650 100644 --- a/compiler/tools/fpp-to-dict/test/top/update-ref.sh +++ b/compiler/tools/fpp-to-dict/test/top/update-ref.sh @@ -9,4 +9,11 @@ dataProducts() { update "-i builtin.fpp -p 1.0.0 -f 3.4.3" dataProducts move_json BasicDp -} \ No newline at end of file +} + +unqualifiedComponentInstances() +{ + update "-i builtin.fpp -p 1.0.0 -f 3.4.3 -l lib1-1.0.0,lib2-2.0.0" unqualifiedComponentInstances + move_json QualifiedCompInst + move_json UnqualifiedCompInst +}