Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.c1
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_VariableSize.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etBufferSender.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etConsoleLogger.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etDataLogger.h5
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h12
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etStdMacros.h33
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etLock.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h3
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h23
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h11
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h12
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h9
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h13
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h12
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c6
37 files changed, 177 insertions, 114 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.c
index f0bba33c4..92dd54062 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.c
@@ -14,6 +14,7 @@
#include "base/etMemory.h"
#include "debugging/etMSCLogger.h"
+#include "runtime/etRuntime.h"
#define DO_LOCK \
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
index 42b365204..28b36cc9f 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
@@ -18,6 +18,8 @@
#include "etDatatypes.h"
#include "osal/etLock.h"
+ET_EXTERN_C_BEGIN
+
/**
* this macro computes the memory aligned value for a given size. It uses the ALIGNMENT
* defined in etDatatypes.h
@@ -104,4 +106,6 @@ void etMemory_setUserLock(etMemory* mem, etLock* lock);
*/
void etMemory_destroy(etMemory* mem);
+ET_EXTERN_C_END
+
#endif /* _ETMEMORY_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h
index 6dcf77d04..1adabe504 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FixedSize.h
@@ -26,6 +26,8 @@
#include "base/etMemory.h"
#include "base/etQueue.h"
+ET_EXTERN_C_BEGIN
+
/**
* initializes the heap with a simple block management
*
@@ -46,4 +48,6 @@ etMemory* etMemory_FixedSize_init(void* heap, etUInt32 size, etUInt16 blockSize)
*/
etUInt32 etMemory_FixedSize_getFreeHeapMem(etMemory* mem);
+ET_EXTERN_C_END
+
#endif /* _ETMEMORY_FIXED_SIZE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h
index 812e78af2..68fd21c2b 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.h
@@ -25,6 +25,8 @@
#include "base/etMemory.h"
#include "osal/etLock.h"
+ET_EXTERN_C_BEGIN
+
typedef etUInt16 roundUpSize(etUInt16 size);
/**
@@ -96,4 +98,6 @@ etUInt16 etMemory_FreeList_freeSlots(etMemory* mem);
*/
etUInt16 etMemory_FreeList_MgmtDataPerObject();
+ET_EXTERN_C_END
+
#endif /* _ETMEMORY_FREE_LIST_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_VariableSize.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_VariableSize.h
index cc9f85ead..fe811bc6d 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_VariableSize.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_VariableSize.h
@@ -27,6 +27,8 @@
#include "base/etQueue.h"
#include "osal/etLock.h"
+ET_EXTERN_C_BEGIN
+
/**
* initializes the heap with a simple block management
*
@@ -44,5 +46,6 @@ etMemory* etMemory_VariableSize_init(void* heap, etUInt32 size);
*/
etUInt8 etMemory_VariableSize_freeHeapMem(etMemory* mem);
+ET_EXTERN_C_END
#endif /* _ETMEMORY_VARIABLE_SIZE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
index 3b8873783..89109c64a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etQueue.h
@@ -18,6 +18,8 @@
#include <stddef.h>
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
typedef struct etQueueObj {
struct etQueueObj* next;
} etQueueObj;
@@ -46,6 +48,6 @@ etInt16 etQueue_getHighWaterMark(etQueue* self);
etInt16 etQueue_getSize(etQueue* self);
-
+ET_EXTERN_C_END
#endif /* _ETQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h b/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h
index 4f45581ca..04edffe12 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/container/etStaticDeque.h
@@ -16,6 +16,9 @@
#define SRC_COMMON_CONTAINERS_ETSTATICDEQUE_H_
#include <stdint.h>
+#include "etDatatypes.h"
+
+ET_EXTERN_C_BEGIN
/**
* etStaticDeque (static double ended queue) is a data structure for storing objects of equal size in order.
@@ -103,4 +106,6 @@ void* etStaticDeque_front(const etStaticDeque* self);
*/
void* etStaticDeque_back(const etStaticDeque* self);
+ET_EXTERN_C_END
+
#endif /* SRC_COMMON_CONTAINERS_ETSTATICDEQUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etBufferSender.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etBufferSender.h
index 92c17c8ee..d1cea4396 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etBufferSender.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etBufferSender.h
@@ -19,9 +19,6 @@
*
* \author: hrentzreichert
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETBUFFERSENDER_H_
#define _ETBUFFERSENDER_H_
@@ -29,6 +26,8 @@ extern "C" {
#include <stddef.h>
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
struct etBufferSender;
typedef void* etBufferSender_getBuffer(struct etBufferSender* self, size_t size);
@@ -40,8 +39,6 @@ typedef struct etBufferSender {
}
etBufferSender;
-#endif /* _ETBUFFERSENDER_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETBUFFERSENDER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etConsoleLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etConsoleLogger.h
index 1875e5f87..fc286ffc8 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etConsoleLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etConsoleLogger.h
@@ -19,9 +19,6 @@
*
* \author: hrentzreichert
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETCONSOLELOGGER_H_
#define _ETCONSOLELOGGER_H_
@@ -29,6 +26,8 @@ extern "C" {
#include <debugging/etBufferSender.h>
#include "etLogger.h"
+ET_EXTERN_C_BEGIN
+
extern etLogger theConsoleLogger;
/**
@@ -37,8 +36,6 @@ extern etLogger theConsoleLogger;
*/
void etConsoleLogger_init();
-#endif /* _ETCONSOLELOGGER_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETCONSOLELOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etDataLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etDataLogger.h
index fc56abc07..2e0577f4f 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etDataLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etDataLogger.h
@@ -26,6 +26,9 @@
#define ETDATALOGGER_H_
#include "etRuntimeConfig.h"
+#include "etDatatypes.h"
+
+ET_EXTERN_C_BEGIN
/**
* opens a file for data logging
@@ -127,4 +130,6 @@ void etDataLogger_newRow();
#define ET_DATA_LOGGER_NEW_ROW
#endif
+ET_EXTERN_C_END
+
#endif /* ETDATALOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
index 2967bbda9..95b60b631 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etLogger.h
@@ -19,9 +19,6 @@
*
* \author: tschuetz
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETLOGGER_H_
#define _ETLOGGER_H_
@@ -29,6 +26,8 @@ extern "C" {
#include <stdio.h>
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/**
* open a log file
*
@@ -183,9 +182,6 @@ void etLogger_log(etLogger* self, LogSeverity severity, const char* msg);
*/
void etLogger_logF(etLogger* self, LogSeverity severity, const char* format, ... );
+ET_EXTERN_C_END
#endif /* _ETLOGGER_H_ */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
index 1753b61c0..b4b98913c 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.h
@@ -25,6 +25,9 @@
#define _ETMSCLOGGER_H_
#include "etRuntimeConfig.h"
+#include "etDatatypes.h"
+
+ET_EXTERN_C_BEGIN
/**
* opens a log file for the MSC. Only one at a time can be open.
@@ -191,5 +194,6 @@ void etMSCLogger_setState(const char* objectName, const char* stateName);
#define ET_MSC_LOGGER_CHANGE_STATE(objectName, stateName)
#endif
+ET_EXTERN_C_END
#endif /* _ETMSCLOGGER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h
index 57384965e..6f5c9e63c 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h
@@ -15,9 +15,6 @@
/*
* Generic version for most platforms based on std.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETSTDDATATYPES_H_
#define _ETSTDDATATYPES_H_
@@ -26,6 +23,8 @@ extern "C" {
#error etStdDatatypes must not be included before etDatatypes (include etDatatypes instead).
#endif
+#include "etStdMacros.h"
+
/*
Define switches for additional data types:
#define ET_INT64
@@ -38,6 +37,8 @@ extern "C" {
#include <inttypes.h>
#include <stdbool.h>
+ET_EXTERN_C_BEGIN
+
/* --- Data types for room.basic.types */
/* bool already defined */
@@ -123,9 +124,6 @@ typedef etInt16 etAddressId;
*/
/*-----------------------------------------------------------*/
+ET_EXTERN_C_END
#endif /* _ETSTDDATATYPES_H_ */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etStdMacros.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdMacros.h
new file mode 100644
index 000000000..e4de4be6b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdMacros.h
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2019 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+
+#ifndef _ETSTDMACROS_H_
+#define _ETSTDMACROS_H_
+
+#ifdef __cplusplus
+#define ET_EXTERN_C_BEGIN extern "C" {
+#define ET_EXTERN_C_END }
+#define ET_CONST_MEMBER
+#define ET_INITIALIZATION_OF_INST_VAR
+#define ET_FOWARD_DECLARATION_OF_INST_VAR extern
+#else
+#define ET_EXTERN_C_BEGIN
+#define ET_EXTERN_C_END
+#define ET_CONST_MEMBER const
+#define ET_INITIALIZATION_OF_INST_VAR static
+#define ET_FOWARD_DECLARATION_OF_INST_VAR static
+#endif
+
+#endif /* _ETSTDMACROS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
index de5b812e0..e666b00b0 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
@@ -21,9 +21,6 @@
*
* \author Thomas Schuetz
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETUNIT_H_
#define _ETUNIT_H_
@@ -31,6 +28,8 @@ extern "C" {
#include "etDatatypes.h"
#include <string.h>
+ET_EXTERN_C_BEGIN
+
// compile time evaluated
#define ETUNIT_FILENAME (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__))
@@ -422,9 +421,7 @@ void expectOrder(etInt16 id, const char* msg, etInt16 identifier, const char* fi
*/
void expectOrderEnd(etInt16 id, const char* msg, etInt16 identifier, const char* file, int line);
-#endif /* _ETUNIT_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETUNIT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
index db8d0e7e0..115d65355 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
@@ -25,6 +25,8 @@
#include "osal/etTime.h"
+ET_EXTERN_C_BEGIN
+
/**
* normalizes the time value to ensure that part is always 0 <= nSec < 1E9
*
@@ -96,4 +98,6 @@ etBool etTimeHelpers_isGreater(etTime* t1, etTime* t2);
*/
etBool etTimeHelpers_isGreaterOrEqual(etTime* t1, etTime* t2);
+ET_EXTERN_C_END
+
#endif /* _ETTIMEHELPERS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
index be3978ea3..cc3bbdb9a 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessage.h
@@ -25,6 +25,8 @@
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/**
* the message structure
*/
@@ -41,4 +43,6 @@ typedef struct etMessage {
*/
void etMessage_init(etMessage* self);
+ET_EXTERN_C_END
+
#endif /* _ETMESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
index b320cca59..eb3727034 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageQueue.h
@@ -26,6 +26,8 @@
#include "messaging/etMessage.h"
#include <stddef.h>
+ET_EXTERN_C_BEGIN
+
/**
* a data structure for the queue statistics
*/
@@ -131,5 +133,6 @@ etInt16 etMessageQueue_getLowWaterMark(etMessageQueue* self);
*/
void etMessageQueue_resetLowWaterMark(etMessageQueue* self);
+ET_EXTERN_C_END
#endif /* _RMESSAGEQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
index 9f80de5f9..631f57663 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageReceiver.h
@@ -25,6 +25,8 @@
#include "messaging/etMessage.h"
+ET_EXTERN_C_BEGIN
+
/**
* method prototype that receives a message
*
@@ -48,4 +50,6 @@ typedef etBool (*etDispatcherReceiveMessage)(const etMessage* msg);
*/
typedef void (*etDispatcherExecute)(void);
+ET_EXTERN_C_END
+
#endif /* _ETMESSAGERECEIVER_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
index 653eaf53e..1d52a5f3c 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etMessageService.h
@@ -33,6 +33,8 @@
#include "osal/etSema.h"
#include "osal/etTimer.h"
+ET_EXTERN_C_BEGIN
+
/** the address of the message service */
#define MESSAGESERVICE_ADDRESS 1
/** the base address for other receivers */
@@ -221,4 +223,6 @@ etInt16 etMessageService_getMessagePoolLowWaterMark(etMessageService* self);
void etMessageService_registerHighPrioFunc(etMessageService* self, etHighPrioFunc* func);
void etMessageService_unregisterHighPrioFunc(etMessageService* self, etHighPrioFunc* func);
+ET_EXTERN_C_END
+
#endif /* RMESSAGESERVICE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h
index 260e15608..398079be9 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/messaging/etSystemProtocol.h
@@ -11,6 +11,8 @@
#include "etDatatypes.h"
#include "modelbase/etPort.h"
+ET_EXTERN_C_BEGIN
+
/* message IDs */
enum etSystemProtocol_msg_ids {
etSystemProtocol_MSG_MIN = 0,
@@ -46,6 +48,7 @@ etInt32 etSystemProtocolConjReplPort_getReplication(const etSystemProtocolConjRe
/* get message string for message id */
const char* etSystemProtocol_getMessageString(int msg_id);
+ET_EXTERN_C_END
#endif /* _ETSYSTEMPROTOCOL_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
index da5de60bb..ed9bc7e38 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etActor.h
@@ -24,6 +24,8 @@
#include "etDatatypes.h"
#include "modelbase/etPort.h"
+ET_EXTERN_C_BEGIN
+
/** transition chain ID indicating that no chain fired */
#define NOT_CAUGHT 0
@@ -45,4 +47,6 @@
*/
etBool handleSystemEvent(InterfaceItemBase* ifitem, int evt, void* generic_data);
+ET_EXTERN_C_END
+
#endif /* _ETACTOR_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
index 58a2e81c0..6c4846677 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/modelbase/etPort.h
@@ -28,6 +28,8 @@
#include "messaging/etMessageService.h"
#include "etRuntimeConfig.h"
+ET_EXTERN_C_BEGIN
+
/**
* the data structure of a port that holds the constant data
*/
@@ -77,6 +79,6 @@ typedef etPort InterfaceItemBase;
*/
void etPort_sendMessage(const etPort* self, etInt16 evtId, int size, void* data);
-
+ET_EXTERN_C_END
#endif /* _ETPORT_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etLock.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etLock.h
index 8e018131a..7c01bc555 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etLock.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etLock.h
@@ -20,13 +20,12 @@
*
* \author Henrik Rentz-Reichert
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETLOCK_H_
#define _ETLOCK_H_
+ET_EXTERN_C_BEGIN
+
typedef void etLock_lock(void* lockData);
typedef void etLock_unlock(void* lockData);
@@ -37,8 +36,6 @@ typedef struct etLock {
}
etLock;
-#endif /* _ETLOCK_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETLOCK_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
index 4768cf8e6..9c3583280 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etMutex.h
@@ -20,15 +20,14 @@
*
* \author Thomas Schuetz, Thomas Jung
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETMUTEX_H_
#define _ETMUTEX_H_
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/**
* etMutex holds the object data for a mutex (for self pointer)
*/
@@ -60,8 +59,6 @@ void etMutex_enter(etMutex* self);
*/
void etMutex_leave(etMutex* self);
-#endif /* _ETMUTEX_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETMUTEX_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
index 298b05c0b..3897b0316 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etPlatformLifecycle.h
@@ -27,6 +27,7 @@
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
/**
* Platform specific code, called at the start of the system startup of the main function
@@ -48,4 +49,6 @@ void etUserPostRun(void);
*/
void etUserExit(void);
+ET_EXTERN_C_END
+
#endif /* _ETPLATFORMLIFECYCLE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
index 6819e5d2b..1794a9737 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSema.h
@@ -11,9 +11,6 @@
* Thomas Schuetz (initial contribution)
*
*******************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETSEMA_H_
#define _ETSEMA_H_
@@ -28,6 +25,8 @@ extern "C" {
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/**
* etSema holds the object data for a semaphore (for self pointer)
*/
@@ -60,9 +59,6 @@ void etSema_wakeupFromISR(etSema* self);
*/
void etSema_waitForWakeup(etSema* self);
+ET_EXTERN_C_END
#endif /* _ETSEMA_H_ */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h
index de729de9a..3252912f4 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etSocket.h
@@ -1,12 +1,24 @@
-#ifdef __cplusplus
-extern "C" {
-#endif
+/*******************************************************************************
+ * Copyright (c) 2017 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * CONTRIBUTORS:
+ * Jan Belle (initial contribution)
+ *
+ *******************************************************************************/
#ifndef _ETSOCKET_H_
#define _ETSOCKET_H_
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/*
* Data structure representing an etSocket
* etSocket is used to establish a tcp connection
@@ -91,9 +103,6 @@ int etServerSocket_destruct(etServerSocket* self);
*/
int etServerSocket_accept(etServerSocket* self, etSocket* socket);
+ET_EXTERN_C_END
#endif /* _ETSOCKET_H_ */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h
index 02458a406..3bd72dede 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTcpSockets.h
@@ -19,15 +19,14 @@
*
* \author Henrik Rentz-Reichert
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETTCPSOCKETS_H_
#define _ETTCPSOCKETS_H_
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/** the maximum number of connections per server */
#define MAX_CONNECTIONS 32
@@ -177,8 +176,6 @@ etSocketError etWriteSocket(etSocketConnectionData* self, int size, const int8*
*/
etSocketError etCloseSocket(etSocketConnectionData* self);
-#endif /* _ETTCPSOCKETS_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETTCPSOCKETS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
index 94cede364..d164c0127 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etThread.h
@@ -20,15 +20,14 @@
* \author Thomas Schuetz, Thomas Jung
*
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETTHREAD_H_
#define _ETTHREAD_H_
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/*
* typedefs for etThread
*/
@@ -101,9 +100,6 @@ etOSThreadData etThread_self(void);
*/
etOSThreadId etThread_self_id(void);
+ET_EXTERN_C_END
#endif /* _ETTHREAD_H_ */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
index 677c4df65..cc3785952 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTime.h
@@ -20,15 +20,13 @@
* \author Thomas Schuetz
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef _ETTIME_H_
#define _ETTIME_H_
#include "etDatatypes.h"
+ET_EXTERN_C_BEGIN
+
/**
* time definition composed by the number of seconds and the number of nano seconds
* negative values have only negative sec, nSec is always positive
@@ -54,8 +52,6 @@ typedef etInt32 etTimeDiff;
*/
void getTimeFromTarget(etTime *t);
-#endif /* _ETTIME_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETTIME_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
index 3d38f76c0..253b40bb8 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/osal/etTimer.h
@@ -19,9 +19,6 @@
*
* \author Thomas Jung
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
#ifndef _ETTIMER_H_
#define _ETTIMER_H_
@@ -29,6 +26,7 @@ extern "C" {
#include "etDatatypes.h"
#include "etTime.h"
+ET_EXTERN_C_BEGIN
/**
* the prototype for the time callback function
@@ -74,9 +72,6 @@ void etTimer_stop(etTimer* self);
*/
void etTimer_destruct(etTimer* self);
+ET_EXTERN_C_END
#endif /* __ETTIMER_H__ */
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
index 90533e78b..f7706c020 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etRuntime.h
@@ -12,15 +12,12 @@
*
*******************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef _ETRUNTIME_H_
#define _ETRUNTIME_H_
#include "messaging/etMessageService.h"
#include "base/etMemory.h"
+#include "osal/etSema.h"
/**
* \file etRuntime.h
@@ -30,7 +27,7 @@ extern "C" {
* \author Thomas Schuetz
*/
-#include "osal/etSema.h"
+ET_EXTERN_C_BEGIN
/**
* returns the number of message services in this process
@@ -135,8 +132,6 @@ void etRuntime_resetAllMemoryManagementStatistics();
*/
etSema* etRuntime_getTerminateSemaphore();
-#endif /* _ETRUNTIME_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _ETRUNTIME_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
index e80edc41c..144d00ee7 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/runtime/etThreadList.h
@@ -26,6 +26,8 @@
#include "osal/etThread.h"
+ET_EXTERN_C_BEGIN
+
typedef struct etThreadController{
etThread* threadList; /**< list of all thread data (as array) **/
int32 size; /**< size of the list **/
@@ -36,4 +38,6 @@ void etThreadController_startAll(etThreadController* self);
void etThreadController_stopAll(etThreadController* self);
void etThreadController_getCurrentThreadId(void);
+ET_EXTERN_C_END
+
#endif /* _etThreadController_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
index aefbb96b0..c35952a98 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
@@ -36,6 +36,8 @@
#include <pthread.h>
#include <semaphore.h>
+ET_EXTERN_C_BEGIN
+
/*--- Data types for room.basic.types */
/*-----------------------------------------------------------*/
@@ -61,4 +63,6 @@ typedef timer_t etOSTimerId;
/*-----------------------------------------------------------*/
+ET_EXTERN_C_END
+
#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
index b969c8f4b..6a3a63bdd 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
@@ -12,10 +12,6 @@
*
*******************************************************************************/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#ifndef _ETDATATYPES_H_
#define _ETDATATYPES_H_
@@ -36,6 +32,8 @@ extern "C" {
#define WINVER 0x0500
#include <windows.h>
+ET_EXTERN_C_BEGIN
+
/*--- Data types for room.basic.types */
/*-----------------------------------------------------------*/
@@ -57,8 +55,6 @@ typedef SOCKET etOSSocketData;
/*-----------------------------------------------------------*/
-#endif /* _DATATYPES_H_ */
+ET_EXTERN_C_END
-#ifdef __cplusplus
-}
-#endif
+#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c
index b6492af2f..f3118a5ad 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etSocket.c
@@ -49,7 +49,7 @@ int etSocket_destruct(etSocket* self) {
}
int etSocket_recv(etSocket* self, uint8* buffer, size_t length) {
- int result = recv(self->socket, buffer, length, 0);
+ int result = recv(self->socket, (char*) buffer, length, 0);
if(result < 0) {
printf("Error: socket could not receive data\n");
printLastError();
@@ -58,7 +58,7 @@ int etSocket_recv(etSocket* self, uint8* buffer, size_t length) {
}
int etSocket_send(etSocket* self, uint8* buffer, size_t length) {
- int result = send(self->socket, buffer, length, 0);
+ int result = send(self->socket, (const char*) buffer, length, 0);
if(result < 0) {
printf("Error: socket could not send data\n");
printLastError();
@@ -162,6 +162,6 @@ void printLastError() {
NULL, WSAGetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPWSTR)&s, 0, NULL);
- printf("%S\n", s);
+ wprintf(L"%S\n", s);
LocalFree(s);
}

Back to the top