mirror of
https://github.com/nasa/fpp.git
synced 2025-12-11 03:05:32 -06:00
Merge branch 'feature/direct-port-calls' into topology-code-for-direct-port-calls
This commit is contained in:
commit
ce8e52d724
@ -28,6 +28,10 @@ case class Analysis(
|
||||
* module B where B is inside A and A is at the top level, the module name
|
||||
* list is [ B, A ]. */
|
||||
scopeNameList: List[Name.Unqualified] = List(),
|
||||
/** Whether dictionary generation is required */
|
||||
dictionaryGeneration: Boolean = false,
|
||||
/** Whether the dependency analysis includes dictionary dependencies */
|
||||
includeDictionaryDeps: Boolean = false,
|
||||
/** The current nested scope for symbol lookup */
|
||||
nestedScope: NestedScope = NestedScope.empty,
|
||||
/** The current parent symbol */
|
||||
@ -77,8 +81,6 @@ case class Analysis(
|
||||
dictionary: Option[Dictionary] = None,
|
||||
/** The telemetry packet set under construction */
|
||||
tlmPacketSet: Option[TlmPacketSet] = None,
|
||||
/** Whether dictionary generation is required */
|
||||
dictionaryGeneration: Boolean = false,
|
||||
/** The mapping from nodes to implied uses */
|
||||
impliedUseMap: Map[AstNode.Id, ImpliedUse.Uses] = Map(),
|
||||
/** The set of symbols defined with a dictionary specifier */
|
||||
|
||||
@ -6,6 +6,7 @@ import fpp.compiler.util._
|
||||
/** Check dictionary definitions */
|
||||
object CheckDictionaryDefs
|
||||
extends Analyzer
|
||||
with ComponentAnalyzer
|
||||
with ModuleAnalyzer
|
||||
{
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import fpp.compiler.util._
|
||||
/** Check F Prime framework definitions */
|
||||
object CheckFrameworkDefs
|
||||
extends Analyzer
|
||||
with ComponentAnalyzer
|
||||
with ModuleAnalyzer
|
||||
{
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ object CheckUses extends BasicUseAnalyzer {
|
||||
def visitExprNode(a: Analysis, node: AstNode[Ast.Expr]): Result = {
|
||||
def visitExprIdent(a: Analysis, node: AstNode[Ast.Expr], name: Name.Unqualified) = {
|
||||
val mapping = a.nestedScope.get (NameGroup.Value) _
|
||||
for (symbol <- helpers.getSymbolForName(mapping)(node.id, name)) yield {
|
||||
for (symbol <- helpers.getSymbolForName(NameGroup.Value, mapping)(node.id, name)) yield {
|
||||
val useDefMap = a.useDefMap + (node.id -> symbol)
|
||||
a.copy(useDefMap = useDefMap)
|
||||
}
|
||||
@ -51,7 +51,7 @@ object CheckUses extends BasicUseAnalyzer {
|
||||
case Some(qual) =>
|
||||
val scope = a.symbolScopeMap(qual)
|
||||
val mapping = scope.get (NameGroup.Value) _
|
||||
helpers.getSymbolForName(mapping)(id.id, id.data) match {
|
||||
helpers.getSymbolForName(NameGroup.Value, mapping)(id.id, id.data) match {
|
||||
case Right(value) => Right(Some(value))
|
||||
case Left(err) => Left(err)
|
||||
}
|
||||
@ -120,7 +120,7 @@ object CheckUses extends BasicUseAnalyzer {
|
||||
for {
|
||||
symbol <- {
|
||||
val mapping = a.nestedScope.get (NameGroup.Value) _
|
||||
helpers.getSymbolForName(mapping)(node.id, name)
|
||||
helpers.getSymbolForName(NameGroup.Value, mapping)(node.id, name)
|
||||
}
|
||||
a <- {
|
||||
val scope = a.symbolScopeMap(symbol)
|
||||
|
||||
@ -15,11 +15,11 @@ case class CheckUsesHelpers[A,NG,S <: SymbolInterface](
|
||||
|
||||
/** Get the symbol for a name from the environment */
|
||||
def getSymbolForName
|
||||
(mapping: Name.Unqualified => Option[S])
|
||||
(ng: NG, mapping: Name.Unqualified => Option[S])
|
||||
(id: AstNode.Id, name: Name.Unqualified): Result.Result[S] =
|
||||
mapping(name).map(Right(_)).getOrElse({
|
||||
val loc = Locations.get(id)
|
||||
Left(SemanticError.UndefinedSymbol(name, loc))
|
||||
Left(SemanticError.UndefinedSymbol(name, ng.toString(), loc))
|
||||
})
|
||||
|
||||
/** Visit an identifier node and check a use */
|
||||
@ -46,7 +46,7 @@ case class CheckUsesHelpers[A,NG,S <: SymbolInterface](
|
||||
name: Ast.Ident
|
||||
) = {
|
||||
val mapping = getNestedScope(a).get (ng) _
|
||||
for (symbol <- getSymbolForName(mapping)(id, name)) yield {
|
||||
for (symbol <- getSymbolForName(ng, mapping)(id, name)) yield {
|
||||
val useDefMap = getUseDefMap(a) + (id -> symbol)
|
||||
setUseDefMap(a, useDefMap)
|
||||
}
|
||||
@ -75,7 +75,7 @@ case class CheckUsesHelpers[A,NG,S <: SymbolInterface](
|
||||
}
|
||||
symbol <- {
|
||||
val mapping = scope.get (ng) _
|
||||
getSymbolForName(mapping)(name.id, name.data)
|
||||
getSymbolForName(ng, mapping)(name.id, name.data)
|
||||
}
|
||||
}
|
||||
yield {
|
||||
|
||||
@ -8,11 +8,45 @@ import fpp.compiler.util._
|
||||
/** Add dependencies */
|
||||
object AddDependencies extends BasicUseAnalyzer {
|
||||
|
||||
override def specLocAnnotatedNode(a: Analysis, node: Ast.Annotated[AstNode[Ast.SpecLoc]]) = {
|
||||
override def specLocAnnotatedNode(
|
||||
a: Analysis,
|
||||
node: Ast.Annotated[AstNode[Ast.SpecLoc]]
|
||||
) = {
|
||||
val specLoc = node._2.data
|
||||
if specLoc.isDictionaryDef
|
||||
then addDependencies (a) (specLoc)
|
||||
else Right(a)
|
||||
if a.includeDictionaryDeps && specLoc.isDictionaryDef
|
||||
then
|
||||
// We are visiting a dictionary specifier after visiting
|
||||
// the first topology. Add the depdendencies for the specifier.
|
||||
addDependencies (a) (specLoc)
|
||||
else
|
||||
// This is not a dictionary specifier, or we haven't seen a topology.
|
||||
// Nothing to do.
|
||||
Right(a)
|
||||
}
|
||||
|
||||
override def defTopologyAnnotatedNode(
|
||||
a: Analysis,
|
||||
node: Ast.Annotated[AstNode[Ast.DefTopology]]
|
||||
) = {
|
||||
for {
|
||||
// Add dependencies based on explicit and implicit uses in the topology
|
||||
a <- super.defTopologyAnnotatedNode(a, node)
|
||||
// Add dependencies based on dictionary specifiers
|
||||
a <- if !a.includeDictionaryDeps
|
||||
then
|
||||
// This is the first topology we have visited.
|
||||
// Set includeDictionaryDeps = true and add all dictionary dependencies
|
||||
// discovered so far.
|
||||
val a1 = a.copy(includeDictionaryDeps = true)
|
||||
val dictionarySpecLocs =
|
||||
a1.locationSpecifierMap.values.map(_.data).filter(_.isDictionaryDef)
|
||||
Result.foldLeft (dictionarySpecLocs.toList) (a1) {
|
||||
case (a, s) => addDependencies (a) (s)
|
||||
}
|
||||
else
|
||||
// This is the second or later topology; nothing to do
|
||||
Right(a)
|
||||
} yield a
|
||||
}
|
||||
|
||||
override def componentInstanceUse(a: Analysis, node: AstNode[Ast.QualIdent], use: Name.Qualified) =
|
||||
|
||||
@ -4,14 +4,37 @@ package fpp.compiler.analysis
|
||||
sealed trait NameGroup
|
||||
|
||||
object NameGroup {
|
||||
case object ComponentInstance extends NameGroup
|
||||
case object Component extends NameGroup
|
||||
case object Port extends NameGroup
|
||||
case object StateMachine extends NameGroup
|
||||
case object Topology extends NameGroup
|
||||
case object Interface extends NameGroup
|
||||
case object Type extends NameGroup
|
||||
case object Value extends NameGroup
|
||||
case object ComponentInstance extends NameGroup {
|
||||
override def toString(): String = "component instance"
|
||||
}
|
||||
|
||||
case object Component extends NameGroup {
|
||||
override def toString(): String = "component"
|
||||
}
|
||||
|
||||
case object Port extends NameGroup {
|
||||
override def toString(): String = "port"
|
||||
}
|
||||
|
||||
case object StateMachine extends NameGroup {
|
||||
override def toString(): String = "state machine"
|
||||
}
|
||||
|
||||
case object Topology extends NameGroup {
|
||||
override def toString(): String = "topology"
|
||||
}
|
||||
|
||||
case object Interface extends NameGroup {
|
||||
override def toString(): String = "interface"
|
||||
}
|
||||
|
||||
case object Type extends NameGroup {
|
||||
override def toString(): String = "type"
|
||||
}
|
||||
|
||||
case object Value extends NameGroup {
|
||||
override def toString(): String = "constant"
|
||||
}
|
||||
|
||||
val groups: List[NameGroup] = List(
|
||||
ComponentInstance,
|
||||
|
||||
@ -4,10 +4,21 @@ package fpp.compiler.analysis
|
||||
sealed trait StateMachineNameGroup
|
||||
|
||||
object StateMachineNameGroup {
|
||||
case object Action extends StateMachineNameGroup
|
||||
case object Guard extends StateMachineNameGroup
|
||||
case object Signal extends StateMachineNameGroup
|
||||
case object State extends StateMachineNameGroup
|
||||
case object Action extends StateMachineNameGroup {
|
||||
override def toString(): String = "action"
|
||||
}
|
||||
|
||||
case object Guard extends StateMachineNameGroup {
|
||||
override def toString(): String = "guard"
|
||||
}
|
||||
|
||||
case object Signal extends StateMachineNameGroup {
|
||||
override def toString(): String = "signal"
|
||||
}
|
||||
|
||||
case object State extends StateMachineNameGroup {
|
||||
override def toString(): String = "state"
|
||||
}
|
||||
|
||||
val groups: List[StateMachineNameGroup] = List(
|
||||
Action,
|
||||
|
||||
@ -162,17 +162,31 @@ case class ArrayCppWriter (
|
||||
|
||||
private val initElementsCall = guardedList (hasStringEltType) (lines("this->initElements();"))
|
||||
|
||||
private val defaultElementInitialization: Boolean = {
|
||||
val elements = arrayType.getDefaultValue.get.anonArray.elements
|
||||
val elementType = arrayType.anonArray.eltType.getDefaultValue
|
||||
elementType match {
|
||||
case None => false
|
||||
case Some(elementTypeDefault) =>
|
||||
elements.head == elementTypeDefault &&
|
||||
elements.tail.forall(_ == elements.head)
|
||||
}
|
||||
}
|
||||
|
||||
private def getConstructorMembers: List[CppDoc.Class.Member] = {
|
||||
val defaultValueConstructor = constructorClassMember(
|
||||
Some("Constructor (default value)"),
|
||||
Nil,
|
||||
List("Serializable()"),
|
||||
List(
|
||||
"Serializable()",
|
||||
"elements{}"
|
||||
),
|
||||
List.concat(
|
||||
initElementsCall,
|
||||
{
|
||||
guardedList (!defaultElementInitialization) ({
|
||||
val valueString = ValueCppWriter.write(s, arrayType.getDefaultValue.get)
|
||||
lines(s"*this = $valueString;")
|
||||
}
|
||||
})
|
||||
)
|
||||
)
|
||||
val singleElementConstructor = constructorClassMember(
|
||||
|
||||
@ -33,6 +33,13 @@ case class StructCppWriter(
|
||||
|
||||
private val formats = structType.formats
|
||||
|
||||
private val defaultValue = structType.getDefaultValue match {
|
||||
case Some(s) => Some(s.anonStruct)
|
||||
case None => structType.anonStruct.getDefaultValue
|
||||
}
|
||||
|
||||
private def defaultValueMembers = defaultValue.get.members
|
||||
|
||||
// List of tuples (<memberName>, <memberTypeName>)
|
||||
// Preserves ordering of struct members
|
||||
private val memberList = astMembers.map((_, node, _) => {
|
||||
@ -48,14 +55,26 @@ case class StructCppWriter(
|
||||
|
||||
private val nonArrayMemberNames = memberNames.filterNot(sizes.contains)
|
||||
|
||||
// Returns map from member name to its default value
|
||||
private def getDefaultValues = {
|
||||
val defaultValue = structType.getDefaultValue match {
|
||||
case Some(s) => Some(s.anonStruct)
|
||||
case None => structType.anonStruct.getDefaultValue
|
||||
}
|
||||
defaultValue.get.members
|
||||
}
|
||||
private val defaultMemberNames =
|
||||
structType.anonStruct.members.filter((name, ty) => {
|
||||
ty.getUnderlyingType match {
|
||||
case _: Type.String => false
|
||||
case _ => {
|
||||
val memberDefault = defaultValueMembers(name);
|
||||
ty.getDefaultValue match {
|
||||
case Some(typeDefault) =>
|
||||
typeDefault == memberDefault
|
||||
case None => false
|
||||
}
|
||||
}
|
||||
}
|
||||
}).map((n, _) => n).toList
|
||||
|
||||
private val nonInitializerListArrayMemberNames = memberNames.filter((name) =>
|
||||
(sizes.contains(name) && !defaultMemberNames.contains(name)))
|
||||
|
||||
private val initializerListMemberNames = memberNames.filter((name) =>
|
||||
defaultMemberNames.contains(name) || !sizes.contains(name))
|
||||
|
||||
private def getFormatStr(n: String) =
|
||||
if formats.contains(n) then formats(n)
|
||||
@ -169,7 +188,6 @@ case class StructCppWriter(
|
||||
}
|
||||
|
||||
private def getConstructorMembers: List[CppDoc.Class.Member] = {
|
||||
val defaultValues = getDefaultValues
|
||||
// Write this constructor only if the struct has an array member
|
||||
// In this case, the constructor provides scalar initialization
|
||||
// of the array members.
|
||||
@ -195,14 +213,17 @@ case class StructCppWriter(
|
||||
constructorClassMember(
|
||||
Some("Constructor (default value)"),
|
||||
Nil,
|
||||
"Serializable()" :: nonArrayMemberNames.map(n => {
|
||||
defaultValues(n) match {
|
||||
"Serializable()" :: initializerListMemberNames.map(n => {
|
||||
if defaultMemberNames.contains(n) then s"m_$n{}"
|
||||
else defaultValueMembers(n) match {
|
||||
case v: Value.Struct => s"m_$n(${ValueCppWriter.writeStructMembers(s, v)})"
|
||||
case _: Value.AbsType => s"m_$n()"
|
||||
case v => writeInitializer(n, ValueCppWriter.write(s, v))
|
||||
}
|
||||
}),
|
||||
writeArraySetters(n => ValueCppWriter.write(s, defaultValues(n)))
|
||||
nonInitializerListArrayMemberNames.flatMap(n => writeArrayMemberSetter(
|
||||
n, ValueCppWriter.write(s, defaultValueMembers(n)
|
||||
)))
|
||||
),
|
||||
constructorClassMember(
|
||||
Some("Member constructor"),
|
||||
@ -728,26 +749,28 @@ case class StructCppWriter(
|
||||
"Serializable()" ::
|
||||
nonArrayMemberNames.map(name => writeInitializer(name, getValue(name)))
|
||||
|
||||
// Writes a for loop to set the value of each array member
|
||||
private def writeArraySetters(getValue: String => String) =
|
||||
arrayMemberNames.flatMap(n =>
|
||||
iterateN(
|
||||
sizes(n),
|
||||
private def writeArrayMemberSetter(memberName: String, memberValue: String) = {
|
||||
iterateN(
|
||||
sizes(memberName),
|
||||
List.concat(
|
||||
{
|
||||
typeMembers(n).getUnderlyingType match {
|
||||
typeMembers(memberName).getUnderlyingType match {
|
||||
case _: Type.String =>
|
||||
val bufferName = getBufferName(n)
|
||||
val bufferName = getBufferName(memberName)
|
||||
lines(s"""|// Initialize the external string
|
||||
|this->m_$n[i].setBuffer(&m_$bufferName[i][0], sizeof m_$bufferName[i]);
|
||||
|this->m_$memberName[i].setBuffer(&m_$bufferName[i][0], sizeof m_$bufferName[i]);
|
||||
|// Set the array value""".stripMargin)
|
||||
case _ => Nil
|
||||
}
|
||||
},
|
||||
lines(s"this->m_$n[i] = ${getValue(n)};")
|
||||
lines(s"this->m_$memberName[i] = $memberValue;")
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// Writes a for loop to set the value of each array member
|
||||
private def writeArraySetters(getValue: String => String) =
|
||||
arrayMemberNames.flatMap(n => this.writeArrayMemberSetter(n, getValue(n)))
|
||||
|
||||
// Writes a for loop that iterates n times
|
||||
private def iterateN(n: Int, ll: List[Line]) =
|
||||
|
||||
@ -288,7 +288,7 @@ object AnalysisJsonEncoder extends JsonEncoder{
|
||||
}
|
||||
|
||||
private implicit val transitionGraphArcMapEncoder: Encoder[TransitionGraph.ArcMap] = {
|
||||
def f1(n: TransitionGraph.Node) = n.soc.getName
|
||||
def f1(n: TransitionGraph.Node) = n.soc.getSymbol.getNodeId.toString
|
||||
def f2(as: Set[TransitionGraph.Arc]) = (as.map(elem => elem.asJson)).toList.asJson
|
||||
Encoder.instance (mapAsJsonMap (f1) (f2) _)
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package fpp.compiler.util
|
||||
|
||||
import fpp.compiler.util.Location
|
||||
import java.util.Locale
|
||||
import fpp.compiler.util.Location
|
||||
|
||||
/** An exception for signaling internal compiler errors */
|
||||
final case class InternalError(val msg: String) extends Exception {
|
||||
@ -337,8 +336,9 @@ sealed trait Error {
|
||||
System.err.println("for this component instance:")
|
||||
System.err.println(instanceLoc)
|
||||
case SemanticError.TypeMismatch(loc, msg) => Error.print (Some(loc)) (msg)
|
||||
case SemanticError.UndefinedSymbol(name, loc) =>
|
||||
Error.print (Some(loc)) (s"undefined symbol ${name}")
|
||||
case SemanticError.UndefinedSymbol(name, symbolKind, loc) =>
|
||||
Error.print (Some(loc)) (s"symbol ${name} is not defined")
|
||||
printNote(s"looking for a $symbolKind here")
|
||||
case SemanticError.InterfaceImport(
|
||||
importLoc,
|
||||
err
|
||||
@ -782,7 +782,7 @@ object SemanticError {
|
||||
/** Type mismatch */
|
||||
final case class TypeMismatch(loc: Location, msg: String) extends Error
|
||||
/** Undefined symbol */
|
||||
final case class UndefinedSymbol(name: String, loc: Location) extends Error
|
||||
final case class UndefinedSymbol(name: String, symbolKind: String, loc: Location) extends Error
|
||||
/** Use-def cycle */
|
||||
final case class UseDefCycle(loc: Location, msg: String) extends Error
|
||||
}
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_undef_constant.fpp:2.29
|
||||
array A = [3] U32 default a
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/array_undef_type.fpp:2.17
|
||||
array A = [3] T
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_undef_constant.fpp:2.16
|
||||
enum E { X = a }
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/enum_undef_type.fpp:2.12
|
||||
enum E : T { X }
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_undef_constant.fpp:2.37
|
||||
struct S { x: U32 } default { x = a }
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/struct_undef_type.fpp:2.17
|
||||
struct S { x: T }
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component/undef_constant.fpp:2.16
|
||||
constant b = a
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_def/undef_component.fpp:1.13
|
||||
instance c: C base id 0x100
|
||||
^
|
||||
error: undefined symbol C
|
||||
error: symbol C is not defined
|
||||
note: looking for a component here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/component_instance_spec/undef_instance.fpp:3.12
|
||||
instance c
|
||||
^
|
||||
error: undefined symbol c
|
||||
error: symbol c is not defined
|
||||
note: looking for a component instance here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/connection_direct/undef_instance.fpp:3.5
|
||||
c.out -> c.in
|
||||
^
|
||||
error: undefined symbol c
|
||||
error: symbol c is not defined
|
||||
note: looking for a component instance here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/connection_pattern/undef_source.fpp:2.31
|
||||
health connections instance $health
|
||||
^
|
||||
error: undefined symbol health
|
||||
error: symbol health is not defined
|
||||
note: looking for a component instance here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/connection_pattern/undef_target.fpp:10.5
|
||||
c
|
||||
^
|
||||
error: undefined symbol c
|
||||
error: symbol c is not defined
|
||||
note: looking for a component instance here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/constant/undef_1.fpp:1.14
|
||||
constant b = a
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/constant/undef_2.fpp:1.14
|
||||
constant b = M.a
|
||||
^
|
||||
error: undefined symbol M
|
||||
error: symbol M is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/constant/undef_3.fpp:2.16
|
||||
constant b = M.a
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/enum/undef_constant_1.fpp:1.14
|
||||
enum E { X = a }
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/enum/undef_constant_2.fpp:2.16
|
||||
constant a = E.X
|
||||
^
|
||||
error: undefined symbol X
|
||||
error: symbol X is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/invalid_symbols/constant_as_type.fpp:2.15
|
||||
array A = [3] a
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/invalid_symbols/type_as_constant.fpp:2.14
|
||||
constant a = T
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_command_recv.fpp:3.3
|
||||
command recv port cmdIn
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_command_reg.fpp:3.3
|
||||
command reg port cmdRegOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_command_resp.fpp:3.3
|
||||
command resp port cmdResponseOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_event.fpp:3.3
|
||||
event port eventOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_general.fpp:3.22
|
||||
sync input port p: P
|
||||
^
|
||||
error: undefined symbol P
|
||||
error: symbol P is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_param_get.fpp:3.3
|
||||
param get port paramGetOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_param_set.fpp:3.3
|
||||
param set port paramSetOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_product_recv.fpp:3.3
|
||||
async product recv port productRecvIn
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_product_request.fpp:3.3
|
||||
product request port productRequestOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_product_send.fpp:3.3
|
||||
product send port productSendOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_telemetry.fpp:3.3
|
||||
telemetry port tlmOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_text_event.fpp:3.3
|
||||
text event port eventOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/port_instance/undef_time_get.fpp:3.3
|
||||
time get port timeGetOut
|
||||
^
|
||||
error: undefined symbol Fw
|
||||
error: symbol Fw is not defined
|
||||
note: looking for a port here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/spec_init/undef_phase.fpp:7.9
|
||||
phase P "c phase P"
|
||||
^
|
||||
error: undefined symbol P
|
||||
error: symbol P is not defined
|
||||
note: looking for a constant here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/types/action_undef_type.fpp:3.13
|
||||
action a: T
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/types/guard_undef_type.fpp:3.12
|
||||
guard g: T
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/types/signal_undef_type.fpp:3.13
|
||||
signal s: T
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a type here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/action_error.fpp:3.16
|
||||
initial do { a } enter S
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a action here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/choice_error.fpp:3.17
|
||||
initial enter C
|
||||
^
|
||||
error: undefined symbol C
|
||||
error: symbol C is not defined
|
||||
note: looking for a state here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/guard_error.fpp:4.17
|
||||
choice C { if g enter S else enter S }
|
||||
^
|
||||
error: undefined symbol g
|
||||
error: symbol g is not defined
|
||||
note: looking for a guard here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/nested_action_error.fpp:4.18
|
||||
initial do { a } enter T
|
||||
^
|
||||
error: undefined symbol a
|
||||
error: symbol a is not defined
|
||||
note: looking for a action here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/nested_choice_error.fpp:6.19
|
||||
initial enter C
|
||||
^
|
||||
error: undefined symbol C
|
||||
error: symbol C is not defined
|
||||
note: looking for a state here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/nested_guard_error.fpp:5.19
|
||||
choice C { if g enter S else enter S }
|
||||
^
|
||||
error: undefined symbol g
|
||||
error: symbol g is not defined
|
||||
note: looking for a guard here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/nested_state_error.fpp:4.19
|
||||
initial enter T
|
||||
^
|
||||
error: undefined symbol T
|
||||
error: symbol T is not defined
|
||||
note: looking for a state here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/signal_error.fpp:3.16
|
||||
state S { on s enter S }
|
||||
^
|
||||
error: undefined symbol s
|
||||
error: symbol s is not defined
|
||||
note: looking for a signal here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine/undef/state_error.fpp:2.17
|
||||
initial enter S
|
||||
^
|
||||
error: undefined symbol S
|
||||
error: symbol S is not defined
|
||||
note: looking for a state here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/state_machine_instance/undef_state_machine.fpp:3.30
|
||||
state machine instance s1: S
|
||||
^
|
||||
error: undefined symbol S
|
||||
error: symbol S is not defined
|
||||
note: looking for a state machine here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/tlm_packets/instance_not_defined.fpp:6.7
|
||||
u.T
|
||||
^
|
||||
error: undefined symbol u
|
||||
error: symbol u is not defined
|
||||
note: looking for a component instance here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/tlm_packets/omit_instance_not_defined.fpp:6.5
|
||||
u.T
|
||||
^
|
||||
error: undefined symbol u
|
||||
error: symbol u is not defined
|
||||
note: looking for a component instance here
|
||||
|
||||
@ -2,4 +2,5 @@ fpp-check
|
||||
[ local path prefix ]/compiler/tools/fpp-check/test/top_import/undef_topology.fpp:3.10
|
||||
import A
|
||||
^
|
||||
error: undefined symbol A
|
||||
error: symbol A is not defined
|
||||
note: looking for a topology here
|
||||
|
||||
@ -7,3 +7,5 @@ locate type T4 at "T4.fpp"
|
||||
type A1 = T
|
||||
type A2 = C.T
|
||||
type A3 = T2
|
||||
|
||||
topology T {}
|
||||
|
||||
@ -1,2 +1,7 @@
|
||||
# Topology in model: there should be dictionary
|
||||
# dependencies
|
||||
|
||||
locate dictionary constant c at "dictionary_c.fpp"
|
||||
locate dictionary type T1 at "dictionary_T1.fpp"
|
||||
|
||||
topology T {}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
[ local path prefix ]/compiler/tools/fpp-depend/test/dictionary_T1.fpp
|
||||
[ local path prefix ]/compiler/tools/fpp-depend/test/dictionary_T2.fpp
|
||||
[ local path prefix ]/compiler/tools/fpp-depend/test/dictionary_T4.fpp
|
||||
[ local path prefix ]/compiler/tools/fpp-depend/test/dictionary_c.fpp
|
||||
|
||||
2
compiler/tools/fpp-depend/test/dictionary_T2.fpp
Normal file
2
compiler/tools/fpp-depend/test/dictionary_T2.fpp
Normal file
@ -0,0 +1,2 @@
|
||||
locate dictionary type T4 at "dictionary_T4.fpp"
|
||||
type T2 = U32
|
||||
5
compiler/tools/fpp-depend/test/dictionary_no_top.fpp
Normal file
5
compiler/tools/fpp-depend/test/dictionary_no_top.fpp
Normal file
@ -0,0 +1,5 @@
|
||||
# No topology in model, so there should be no dictionary
|
||||
# dependencies
|
||||
|
||||
locate dictionary constant c at "dictionary_c.fpp"
|
||||
locate dictionary type T1 at "dictionary_T1.fpp"
|
||||
@ -9,6 +9,7 @@ def_port
|
||||
def_state_machine
|
||||
def_struct
|
||||
dictionary
|
||||
dictionary_no_top
|
||||
direct
|
||||
enum_constant
|
||||
expr_array
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
Abs ::
|
||||
Abs() :
|
||||
Serializable(),
|
||||
m_A()
|
||||
m_A{}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
Basic ::
|
||||
Basic() :
|
||||
Serializable(),
|
||||
m_A(0),
|
||||
m_B(0.0f),
|
||||
m_A{},
|
||||
m_B{},
|
||||
m_C(m___fprime_ac_C_buffer, sizeof m___fprime_ac_C_buffer, Fw::String("")),
|
||||
m_D(m___fprime_ac_D_buffer, sizeof m___fprime_ac_D_buffer, Fw::String(""))
|
||||
{
|
||||
|
||||
@ -14,10 +14,10 @@
|
||||
Namespace ::
|
||||
Namespace() :
|
||||
Serializable(),
|
||||
m_A(0),
|
||||
m_B(0),
|
||||
m_C(0),
|
||||
m_D(0)
|
||||
m_A{},
|
||||
m_B{},
|
||||
m_C{},
|
||||
m_D{}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
A ::
|
||||
A() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = A(0);
|
||||
|
||||
}
|
||||
|
||||
A ::
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
AbsType ::
|
||||
AbsType() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = AbsType(T());
|
||||
|
||||
}
|
||||
|
||||
AbsType ::
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
|
||||
AliasType ::
|
||||
AliasType() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = AliasType({0, 2, 3});
|
||||
}
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
C_A ::
|
||||
C_A() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = C_A(0);
|
||||
|
||||
}
|
||||
|
||||
C_A ::
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
|
||||
Enum1 ::
|
||||
Enum1() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = Enum1({M::E1::X, M::E1::Y});
|
||||
}
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
Enum2 ::
|
||||
Enum2() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = Enum2(E2::C);
|
||||
|
||||
}
|
||||
|
||||
Enum2 ::
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
HeaderPath ::
|
||||
HeaderPath() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = HeaderPath(T());
|
||||
|
||||
}
|
||||
|
||||
HeaderPath ::
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
LargeSize ::
|
||||
LargeSize() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = LargeSize(0);
|
||||
|
||||
}
|
||||
|
||||
LargeSize ::
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
PrimitiveArray ::
|
||||
PrimitiveArray() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = PrimitiveArray(M::PrimitiveF64({1.0, 2.0, 3.0, 4.0, 5.0}));
|
||||
|
||||
}
|
||||
|
||||
PrimitiveArray ::
|
||||
|
||||
@ -15,9 +15,10 @@ namespace M {
|
||||
|
||||
PrimitiveBool ::
|
||||
PrimitiveBool() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveBool(false);
|
||||
|
||||
}
|
||||
|
||||
PrimitiveBool ::
|
||||
|
||||
@ -15,7 +15,8 @@ namespace M {
|
||||
|
||||
PrimitiveF32e ::
|
||||
PrimitiveF32e() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveF32e(1.0f);
|
||||
}
|
||||
|
||||
@ -15,9 +15,10 @@ namespace M {
|
||||
|
||||
PrimitiveF32f ::
|
||||
PrimitiveF32f() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveF32f(0.0f);
|
||||
|
||||
}
|
||||
|
||||
PrimitiveF32f ::
|
||||
|
||||
@ -15,7 +15,8 @@ namespace M {
|
||||
|
||||
PrimitiveF64 ::
|
||||
PrimitiveF64() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveF64({1.0, 2.0, 3.0, 4.0, 5.0});
|
||||
}
|
||||
|
||||
@ -15,9 +15,10 @@ namespace M {
|
||||
|
||||
PrimitiveI32 ::
|
||||
PrimitiveI32() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveI32(0);
|
||||
|
||||
}
|
||||
|
||||
PrimitiveI32 ::
|
||||
|
||||
@ -15,9 +15,10 @@ namespace M {
|
||||
|
||||
PrimitiveI64 ::
|
||||
PrimitiveI64() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveI64(0);
|
||||
|
||||
}
|
||||
|
||||
PrimitiveI64 ::
|
||||
|
||||
@ -15,7 +15,8 @@ namespace M {
|
||||
|
||||
PrimitiveU16 ::
|
||||
PrimitiveU16() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveU16({1, 2, 3});
|
||||
}
|
||||
|
||||
@ -15,9 +15,10 @@ namespace M {
|
||||
|
||||
PrimitiveU8 ::
|
||||
PrimitiveU8() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = M::PrimitiveU8(0);
|
||||
|
||||
}
|
||||
|
||||
PrimitiveU8 ::
|
||||
|
||||
@ -16,17 +16,17 @@ namespace M {
|
||||
S1 ::
|
||||
S1() :
|
||||
Serializable(),
|
||||
m_mF32(0.0f),
|
||||
m_mF64(0.0),
|
||||
m_mI16(0),
|
||||
m_mI32(0),
|
||||
m_mI64(0),
|
||||
m_mI8(0),
|
||||
m_mU16(0),
|
||||
m_mU32(0),
|
||||
m_mU64(0),
|
||||
m_mU8(0),
|
||||
m_mBool(false),
|
||||
m_mF32{},
|
||||
m_mF64{},
|
||||
m_mI16{},
|
||||
m_mI32{},
|
||||
m_mI64{},
|
||||
m_mI8{},
|
||||
m_mU16{},
|
||||
m_mU32{},
|
||||
m_mU64{},
|
||||
m_mU8{},
|
||||
m_mBool{},
|
||||
m_mString(m___fprime_ac_mString_buffer, sizeof m___fprime_ac_mString_buffer, Fw::String(""))
|
||||
{
|
||||
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
S2 ::
|
||||
S2() :
|
||||
Serializable(),
|
||||
m_s1(0.0f, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, false, Fw::String(""))
|
||||
m_s1{}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@ -16,11 +16,10 @@ namespace S {
|
||||
S3 ::
|
||||
S3() :
|
||||
Serializable(),
|
||||
m_mF64(0.0)
|
||||
m_mU32Array{},
|
||||
m_mF64{}
|
||||
{
|
||||
for (FwSizeType i = 0; i < 3; i++) {
|
||||
this->m_mU32Array[i] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
S3 ::
|
||||
|
||||
151
compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.cpp
vendored
Normal file
151
compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.cpp
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
// ======================================================================
|
||||
// \title SDefaultSerializableAc.cpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief cpp file for SDefault struct
|
||||
// ======================================================================
|
||||
|
||||
#include "Fw/Types/Assert.hpp"
|
||||
#include "SDefaultSerializableAc.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SDefault ::
|
||||
SDefault() :
|
||||
Serializable(),
|
||||
m_x(42)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SDefault ::
|
||||
SDefault(U32 x) :
|
||||
Serializable(),
|
||||
m_x(x)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SDefault ::
|
||||
SDefault(const SDefault& obj) :
|
||||
Serializable(),
|
||||
m_x(obj.m_x)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SDefault& SDefault ::
|
||||
operator=(const SDefault& obj)
|
||||
{
|
||||
if (this == &obj) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
set(obj.m_x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool SDefault ::
|
||||
operator==(const SDefault& obj) const
|
||||
{
|
||||
return (this->m_x == obj.m_x);
|
||||
}
|
||||
|
||||
bool SDefault ::
|
||||
operator!=(const SDefault& obj) const
|
||||
{
|
||||
return !(*this == obj);
|
||||
}
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const SDefault& obj) {
|
||||
Fw::String s;
|
||||
obj.toString(s);
|
||||
os << s.toChar();
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus SDefault ::
|
||||
serializeTo(
|
||||
Fw::SerialBufferBase& buffer,
|
||||
Fw::Endianness mode
|
||||
) const
|
||||
{
|
||||
Fw::SerializeStatus status;
|
||||
|
||||
status = buffer.serializeFrom(this->m_x, mode);
|
||||
if (status != Fw::FW_SERIALIZE_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus SDefault ::
|
||||
deserializeFrom(
|
||||
Fw::SerialBufferBase& buffer,
|
||||
Fw::Endianness mode
|
||||
)
|
||||
{
|
||||
Fw::SerializeStatus status;
|
||||
|
||||
status = buffer.deserializeTo(this->m_x, mode);
|
||||
if (status != Fw::FW_SERIALIZE_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
FwSizeType SDefault ::
|
||||
serializedSize() const
|
||||
{
|
||||
FwSizeType size = 0;
|
||||
size += sizeof(U32);
|
||||
return size;
|
||||
}
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
|
||||
void SDefault ::
|
||||
toString(Fw::StringBase& sb) const
|
||||
{
|
||||
Fw::String tmp;
|
||||
sb = "( ";
|
||||
|
||||
// Format x
|
||||
sb += "x = ";
|
||||
tmp.format("%" PRIu32 "", this->m_x);
|
||||
sb += tmp;
|
||||
sb += " )";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void SDefault ::
|
||||
set(U32 x)
|
||||
{
|
||||
this->m_x = x;
|
||||
}
|
||||
|
||||
void SDefault ::
|
||||
set_x(U32 x)
|
||||
{
|
||||
this->m_x = x;
|
||||
}
|
||||
140
compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.hpp
vendored
Normal file
140
compiler/tools/fpp-to-cpp/test/array/SDefaultSerializableAc.ref.hpp
vendored
Normal file
@ -0,0 +1,140 @@
|
||||
// ======================================================================
|
||||
// \title SDefaultSerializableAc.hpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief hpp file for SDefault struct
|
||||
// ======================================================================
|
||||
|
||||
#ifndef SDefaultSerializableAc_HPP
|
||||
#define SDefaultSerializableAc_HPP
|
||||
|
||||
#include "Fw/FPrimeBasicTypes.hpp"
|
||||
#include "Fw/Types/ExternalString.hpp"
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
#include "Fw/Types/String.hpp"
|
||||
|
||||
//! Struct with a default value
|
||||
class SDefault :
|
||||
public Fw::Serializable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constants
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
//! The size of the serial representation
|
||||
SERIALIZED_SIZE =
|
||||
sizeof(U32)
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Constructor (default value)
|
||||
SDefault();
|
||||
|
||||
//! Member constructor
|
||||
SDefault(U32 x);
|
||||
|
||||
//! Copy constructor
|
||||
SDefault(
|
||||
const SDefault& obj //!< The source object
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Copy assignment operator
|
||||
SDefault& operator=(
|
||||
const SDefault& obj //!< The source object
|
||||
);
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(
|
||||
const SDefault& obj //!< The other object
|
||||
) const;
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(
|
||||
const SDefault& obj //!< The other object
|
||||
) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
//! Ostream operator
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, //!< The ostream
|
||||
const SDefault& obj //!< The object
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Serialization
|
||||
Fw::SerializeStatus serializeTo(
|
||||
Fw::SerialBufferBase& buffer, //!< The serial buffer
|
||||
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
|
||||
) const;
|
||||
|
||||
//! Deserialization
|
||||
Fw::SerializeStatus deserializeFrom(
|
||||
Fw::SerialBufferBase& buffer, //!< The serial buffer
|
||||
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
|
||||
);
|
||||
|
||||
//! Get the dynamic serialized size of the struct
|
||||
FwSizeType serializedSize() const;
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
|
||||
//! Convert struct to string
|
||||
void toString(
|
||||
Fw::StringBase& sb //!< The StringBase object to hold the result
|
||||
) const;
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Getter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Get member x
|
||||
U32 get_x() const
|
||||
{
|
||||
return this->m_x;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Set all members
|
||||
void set(U32 x);
|
||||
|
||||
//! Set member x
|
||||
void set_x(U32 x);
|
||||
|
||||
protected:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
U32 m_x;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
151
compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp
vendored
Normal file
151
compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.cpp
vendored
Normal file
@ -0,0 +1,151 @@
|
||||
// ======================================================================
|
||||
// \title SWrapperSerializableAc.cpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief cpp file for SWrapper struct
|
||||
// ======================================================================
|
||||
|
||||
#include "Fw/Types/Assert.hpp"
|
||||
#include "SWrapperSerializableAc.hpp"
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SWrapper ::
|
||||
SWrapper() :
|
||||
Serializable(),
|
||||
m_s{}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SWrapper ::
|
||||
SWrapper(const SDefault& s) :
|
||||
Serializable(),
|
||||
m_s(s)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
SWrapper ::
|
||||
SWrapper(const SWrapper& obj) :
|
||||
Serializable(),
|
||||
m_s(obj.m_s)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SWrapper& SWrapper ::
|
||||
operator=(const SWrapper& obj)
|
||||
{
|
||||
if (this == &obj) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
set(obj.m_s);
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool SWrapper ::
|
||||
operator==(const SWrapper& obj) const
|
||||
{
|
||||
return (this->m_s == obj.m_s);
|
||||
}
|
||||
|
||||
bool SWrapper ::
|
||||
operator!=(const SWrapper& obj) const
|
||||
{
|
||||
return !(*this == obj);
|
||||
}
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const SWrapper& obj) {
|
||||
Fw::String s;
|
||||
obj.toString(s);
|
||||
os << s.toChar();
|
||||
return os;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Fw::SerializeStatus SWrapper ::
|
||||
serializeTo(
|
||||
Fw::SerialBufferBase& buffer,
|
||||
Fw::Endianness mode
|
||||
) const
|
||||
{
|
||||
Fw::SerializeStatus status;
|
||||
|
||||
status = buffer.serializeFrom(this->m_s, mode);
|
||||
if (status != Fw::FW_SERIALIZE_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
Fw::SerializeStatus SWrapper ::
|
||||
deserializeFrom(
|
||||
Fw::SerialBufferBase& buffer,
|
||||
Fw::Endianness mode
|
||||
)
|
||||
{
|
||||
Fw::SerializeStatus status;
|
||||
|
||||
status = buffer.deserializeTo(this->m_s, mode);
|
||||
if (status != Fw::FW_SERIALIZE_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
FwSizeType SWrapper ::
|
||||
serializedSize() const
|
||||
{
|
||||
FwSizeType size = 0;
|
||||
size += this->m_s.serializedSize();
|
||||
return size;
|
||||
}
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
|
||||
void SWrapper ::
|
||||
toString(Fw::StringBase& sb) const
|
||||
{
|
||||
Fw::String tmp;
|
||||
sb = "( ";
|
||||
|
||||
// Format s
|
||||
sb += "s = ";
|
||||
this->m_s.toString(tmp);
|
||||
sb += tmp;
|
||||
sb += " )";
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
void SWrapper ::
|
||||
set(const SDefault& s)
|
||||
{
|
||||
this->m_s = s;
|
||||
}
|
||||
|
||||
void SWrapper ::
|
||||
set_s(const SDefault& s)
|
||||
{
|
||||
this->m_s = s;
|
||||
}
|
||||
147
compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.hpp
vendored
Normal file
147
compiler/tools/fpp-to-cpp/test/array/SWrapperSerializableAc.ref.hpp
vendored
Normal file
@ -0,0 +1,147 @@
|
||||
// ======================================================================
|
||||
// \title SWrapperSerializableAc.hpp
|
||||
// \author Generated by fpp-to-cpp
|
||||
// \brief hpp file for SWrapper struct
|
||||
// ======================================================================
|
||||
|
||||
#ifndef SWrapperSerializableAc_HPP
|
||||
#define SWrapperSerializableAc_HPP
|
||||
|
||||
#include "Fw/FPrimeBasicTypes.hpp"
|
||||
#include "Fw/Types/ExternalString.hpp"
|
||||
#include "Fw/Types/Serializable.hpp"
|
||||
#include "Fw/Types/String.hpp"
|
||||
#include "SDefaultSerializableAc.hpp"
|
||||
|
||||
//! Struct wrapping a struct with a default field
|
||||
class SWrapper :
|
||||
public Fw::Serializable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constants
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
enum {
|
||||
//! The size of the serial representation
|
||||
SERIALIZED_SIZE =
|
||||
SDefault::SERIALIZED_SIZE
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Constructors
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Constructor (default value)
|
||||
SWrapper();
|
||||
|
||||
//! Member constructor
|
||||
SWrapper(const SDefault& s);
|
||||
|
||||
//! Copy constructor
|
||||
SWrapper(
|
||||
const SWrapper& obj //!< The source object
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Operators
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Copy assignment operator
|
||||
SWrapper& operator=(
|
||||
const SWrapper& obj //!< The source object
|
||||
);
|
||||
|
||||
//! Equality operator
|
||||
bool operator==(
|
||||
const SWrapper& obj //!< The other object
|
||||
) const;
|
||||
|
||||
//! Inequality operator
|
||||
bool operator!=(
|
||||
const SWrapper& obj //!< The other object
|
||||
) const;
|
||||
|
||||
#ifdef BUILD_UT
|
||||
|
||||
//! Ostream operator
|
||||
friend std::ostream& operator<<(
|
||||
std::ostream& os, //!< The ostream
|
||||
const SWrapper& obj //!< The object
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
public:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Serialization
|
||||
Fw::SerializeStatus serializeTo(
|
||||
Fw::SerialBufferBase& buffer, //!< The serial buffer
|
||||
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
|
||||
) const;
|
||||
|
||||
//! Deserialization
|
||||
Fw::SerializeStatus deserializeFrom(
|
||||
Fw::SerialBufferBase& buffer, //!< The serial buffer
|
||||
Fw::Endianness mode = Fw::Endianness::BIG //!< Endianness of serialized buffer
|
||||
);
|
||||
|
||||
//! Get the dynamic serialized size of the struct
|
||||
FwSizeType serializedSize() const;
|
||||
|
||||
#if FW_SERIALIZABLE_TO_STRING
|
||||
|
||||
//! Convert struct to string
|
||||
void toString(
|
||||
Fw::StringBase& sb //!< The StringBase object to hold the result
|
||||
) const;
|
||||
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Getter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Get member s
|
||||
SDefault& get_s()
|
||||
{
|
||||
return this->m_s;
|
||||
}
|
||||
|
||||
//! Get member s (const)
|
||||
const SDefault& get_s() const
|
||||
{
|
||||
return this->m_s;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Setter functions
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
//! Set all members
|
||||
void set(const SDefault& s);
|
||||
|
||||
//! Set member s
|
||||
void set_s(const SDefault& s);
|
||||
|
||||
protected:
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Member variables
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
SDefault m_s;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
SingleElement ::
|
||||
SingleElement() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = SingleElement(0);
|
||||
|
||||
}
|
||||
|
||||
SingleElement ::
|
||||
|
||||
@ -13,10 +13,10 @@
|
||||
|
||||
String1 ::
|
||||
String1() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
this->initElements();
|
||||
*this = String1(Fw::String(""));
|
||||
}
|
||||
|
||||
String1 ::
|
||||
|
||||
@ -13,7 +13,8 @@
|
||||
|
||||
String2 ::
|
||||
String2() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
this->initElements();
|
||||
*this = String2({Fw::String("\"\\"), Fw::String("abc\ndef\n")});
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
StringArray ::
|
||||
StringArray() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = StringArray(String2({Fw::String("\"\\"), Fw::String("abc\ndef\n")}));
|
||||
|
||||
}
|
||||
|
||||
StringArray ::
|
||||
|
||||
@ -13,9 +13,10 @@
|
||||
|
||||
Struct1 ::
|
||||
Struct1() :
|
||||
Serializable()
|
||||
Serializable(),
|
||||
elements{}
|
||||
{
|
||||
*this = Struct1(M::S1(0.0f, 0.0, 0, 0, 0, 0, 0, 0, 0, 0, false, Fw::String("")));
|
||||
|
||||
}
|
||||
|
||||
Struct1 ::
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user