mirror of
https://github.com/nasa/fpp.git
synced 2025-12-10 17:29:15 -06:00
Move extern C to HPP
This commit is contained in:
parent
07b23f76a1
commit
a0e69ffb3f
@ -86,34 +86,28 @@ case class AliasCppWriter (
|
||||
}
|
||||
|
||||
private def getHppMembers: List[CppDoc.Member] = {
|
||||
List(
|
||||
List(getHppIncludes),
|
||||
wrapInNamespaces(namespaceIdentList, List(getHppDefinition))
|
||||
).flatten
|
||||
List.concat(
|
||||
List(getHppIncludes),
|
||||
wrapInNamespaces(namespaceIdentList, List(getHppDefinition))
|
||||
)
|
||||
}
|
||||
|
||||
private def getHMembers: List[CppDoc.Member] = {
|
||||
List(
|
||||
getHIncludes,
|
||||
getHOpenCPPGuard,
|
||||
getHDefinition,
|
||||
getHCloseCPPGuard,
|
||||
)
|
||||
}
|
||||
|
||||
private def getHOpenCPPGuard: CppDoc.Member = {
|
||||
private def getHPPCPPGuard: CppDoc.Member = {
|
||||
linesMember(addBlankPrefix(lines(
|
||||
"""|#ifdef __cplusplus
|
||||
|extern "C" {
|
||||
|#endif""")
|
||||
"""extern "C" {""")
|
||||
))
|
||||
}
|
||||
|
||||
private def getHCloseCPPGuard: CppDoc.Member = {
|
||||
private def getHPPCloseCPPGuard: CppDoc.Member = {
|
||||
linesMember(addBlankPrefix(lines(
|
||||
"""|#ifdef __cplusplus
|
||||
|}
|
||||
|#endif""")
|
||||
"""}""")
|
||||
))
|
||||
}
|
||||
|
||||
@ -153,11 +147,14 @@ case class AliasCppWriter (
|
||||
val name = s.getName(symbol)
|
||||
|
||||
supportedCHeader match {
|
||||
case true => linesMember(addBlankPrefix(lines(
|
||||
// Include the C definition of the type alias
|
||||
// This is using a `typedef`
|
||||
CppWriterState.headerString(s.getIncludePath(symbol, ComputeCppFiles.FileNames.getAliasType(name), "h"))
|
||||
)))
|
||||
case true => linesMember(
|
||||
// Include the C definition of the type alias
|
||||
// This is using a `typedef`
|
||||
addBlankPrefix(lines(
|
||||
s"""|extern "C" {
|
||||
|${CppWriterState.headerString(s.getIncludePath(symbol, ComputeCppFiles.FileNames.getAliasType(name), "h"))}
|
||||
|}""")
|
||||
))
|
||||
case false => linesMember(addBlankPrefix(
|
||||
// Define a C++ only
|
||||
AnnotationCppWriter.writePreComment(aNode) ++ lines(
|
||||
|
||||
@ -10,16 +10,8 @@
|
||||
#include "FppConfig.h"
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! An alias of a built-in type
|
||||
typedef FwOpcodeType BuiltInType;
|
||||
#define PRI_BuiltInType PRI_FwOpcodeType
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "FppConfig.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "BuiltInTypeAliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -10,17 +10,9 @@
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "SimpleCTypeAliasAc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! A simple type alias that references another simple type alias
|
||||
//! Tests if we can handle C header file include chaining
|
||||
typedef SimpleCType SimpleCType2;
|
||||
#define PRI_SimpleCType2 PRI_SimpleCType
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
#include "SimpleCTypeAliasAc.hpp"
|
||||
|
||||
extern "C" {
|
||||
#include "SimpleCType2AliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,16 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//! A simple type alias that supports C codegen
|
||||
typedef U32 SimpleCType;
|
||||
#define PRI_SimpleCType PRI_u32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "SimpleCTypeAliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,15 +9,7 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef U32 T;
|
||||
#define PRI_T PRI_u32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "TAliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,15 +9,7 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef F32 TF32;
|
||||
#define PRI_TF32 PRI_f32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "TF32AliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,15 +9,7 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef U32 TU32;
|
||||
#define PRI_TU32 PRI_u32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "TU32AliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,15 +9,7 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef U32 AT;
|
||||
#define PRI_AT PRI_u32
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "ATAliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,15 +9,7 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef U16 U16Alias;
|
||||
#define PRI_U16Alias PRI_u16
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -9,6 +9,8 @@
|
||||
|
||||
#include "Fw/Types/BasicTypes.h"
|
||||
|
||||
extern "C" {
|
||||
#include "U16AliasAliasAc.h"
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user