From c84e3b4daddce5b753e92b25c70a12e5034ddf5e Mon Sep 17 00:00:00 2001 From: Ernst Blecha Date: Tue, 25 Jun 2024 13:55:06 +0200 Subject: [PATCH 1/6] readd check for tabs in sources --- .github/workflows/tab_check.yml | 20 ++++++++++++++++++++ tests/findTabs.sh | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tab_check.yml diff --git a/.github/workflows/tab_check.yml b/.github/workflows/tab_check.yml new file mode 100644 index 00000000..0b9c0318 --- /dev/null +++ b/.github/workflows/tab_check.yml @@ -0,0 +1,20 @@ +# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml +name: Check for Tabs + +on: + push: + branches: [ "release", "develop", "freeze" ] + pull_request: + branches: [ "release", "develop", "freeze" ] + +jobs: + build: + runs-on: ubuntu-latest + container: quay.io/eclipse4diac/4diac-fortebuildcontainer:latest + + steps: + - uses: actions/checkout@v4.1.2 + + - name: Test for Tabs + run: tests/findTabs.sh diff --git a/tests/findTabs.sh b/tests/findTabs.sh index d77d01f0..369bea42 100755 --- a/tests/findTabs.sh +++ b/tests/findTabs.sh @@ -1,3 +1,4 @@ +#!/bin/bash if [ "$WORKSPACE" == "" ] then @@ -13,7 +14,7 @@ do echo $folder done -FOUND_TABS=$(grep -r "$(printf '\t')" $FOLDERS) #using -P with grep gave the error: invalid UTF-8 byte sequence in input +FOUND_TABS=$(grep -r --include \*.h --include \*.cpp "$(printf '\t')" $FOLDERS) #using -P with grep gave the error: invalid UTF-8 byte sequence in input if [ "$FOUND_TABS" == "" ] From 9135cfbf3cb2bc4bd24e9c30c354aad8cef9f60c Mon Sep 17 00:00:00 2001 From: Ernst Blecha Date: Tue, 25 Jun 2024 14:39:01 +0200 Subject: [PATCH 2/6] replace tabulator in manually written cpp and h files --- src/arch/timerha.cpp | 28 ++++++++++----------- src/arch/timerha.h | 8 +++--- src/arch/zephyr/sockhand.h | 6 ++--- src/com/opc_ua/opcua_layer.cpp | 2 +- src/core/cominfra/structmembercomlayer.h | 12 ++++----- src/core/funcbloc.cpp | 2 +- src/core/funcbloc.h | 2 +- src/modules/embrick/types/EBBusAdapter.h | 4 +-- src/modules/gpiochip/gpiochip_config_fb.cpp | 4 +-- tests/core/trace/EventMessage.cpp | 2 +- tests/core/trace/ctfTracerTest.cpp | 2 +- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/arch/timerha.cpp b/src/arch/timerha.cpp index a7f54332..7f6ba013 100644 --- a/src/arch/timerha.cpp +++ b/src/arch/timerha.cpp @@ -27,19 +27,19 @@ DEFINE_HANDLER(CTimerHandler) CTimerHandler::CTimerHandler(CDeviceExecution& paDeviceExecution) : CExternalEventHandler(paDeviceExecution), - mForteTime(0) { + mForteTime(0) { } CTimerHandler::~CTimerHandler() = default; void CTimerHandler::registerOneShotTimedFB(CEventSourceFB *const paTimedFB, const CIEC_TIME &paTimeInterval) { - TForteUInt32 interval = convertIntervalToTimerHandlerUnits(paTimeInterval); - addToAddFBList(STimedFBListEntry(paTimedFB, mForteTime + interval, scmOneShotIndicator)); + TForteUInt32 interval = convertIntervalToTimerHandlerUnits(paTimeInterval); + addToAddFBList(STimedFBListEntry(paTimedFB, mForteTime + interval, scmOneShotIndicator)); } void CTimerHandler::registerPeriodicTimedFB(CEventSourceFB *const paTimedFB, const CIEC_TIME &paTimeInterval) { - TForteUInt32 interval = convertIntervalToTimerHandlerUnits(paTimeInterval); - addToAddFBList(STimedFBListEntry(paTimedFB, mForteTime + interval, interval)); + TForteUInt32 interval = convertIntervalToTimerHandlerUnits(paTimeInterval); + addToAddFBList(STimedFBListEntry(paTimedFB, mForteTime + interval, interval)); } TForteUInt32 CTimerHandler::convertIntervalToTimerHandlerUnits(const CIEC_TIME &paTimeInterval){ @@ -64,7 +64,7 @@ void CTimerHandler::unregisterTimedFB(CEventSourceFB *paTimedFB) { void CTimerHandler::removeTimedFB(CEventSourceFB *paTimedFB) { auto it = std::remove_if(mTimedFBList.begin(), mTimedFBList.end(), - [&paTimedFB](const STimedFBListEntry& entry) { return entry.mTimedFB == paTimedFB; }); + [&paTimedFB](const STimedFBListEntry& entry) { return entry.mTimedFB == paTimedFB; }); mTimedFBList.erase(it, mTimedFBList.end()); } @@ -88,26 +88,26 @@ void CTimerHandler::processTimedFBList() { std::vector triggered(mTimedFBList.begin(), last); mTimedFBList.erase(mTimedFBList.begin(), last); for (auto &fb : triggered) { - triggerTimedFB(fb); + triggerTimedFB(fb); } } void CTimerHandler::triggerTimedFB(STimedFBListEntry paTimerListEntry) { mDeviceExecution.startNewEventChain(paTimerListEntry.mTimedFB); if(paTimerListEntry.mInterval != scmOneShotIndicator){ - paTimerListEntry.mTimeOut = mForteTime + paTimerListEntry.mInterval; // the next activation time of this FB - addTimedFBEntry(paTimerListEntry); //re-register the timed FB + paTimerListEntry.mTimeOut = mForteTime + paTimerListEntry.mInterval; // the next activation time of this FB + addTimedFBEntry(paTimerListEntry); //re-register the timed FB } } void CTimerHandler::processAddList() { CCriticalRegion criticalRegion(mAddListSync); for (auto entry : mAddFBList) { - if(entry.mTimeOut < mForteTime) { - triggerTimedFB(entry); - } else { - addTimedFBEntry(entry); - } + if(entry.mTimeOut < mForteTime) { + triggerTimedFB(entry); + } else { + addTimedFBEntry(entry); + } } mAddFBList.clear(); } diff --git a/src/arch/timerha.h b/src/arch/timerha.h index cfe83263..cdf19eae 100644 --- a/src/arch/timerha.h +++ b/src/arch/timerha.h @@ -59,15 +59,15 @@ class CTimerHandler : public CExternalEventHandler{ /*!\brief Register an Event source Function Block for receiving a single timed event. * - * \param paTimedFB the event source FB to be registered - * \param paTimeInterval delta time to next event + * \param paTimedFB the event source FB to be registered + * \param paTimeInterval delta time to next event */ void registerOneShotTimedFB(CEventSourceFB *const paTimedFB, const CIEC_TIME &paTimeInterval); /*!\brief Register an Event source Function Block for receiving a periodic events. * - * \param paTimedFB the event source FB to be registered - * \param paTimeInterval delta time between two events + * \param paTimedFB the event source FB to be registered + * \param paTimeInterval delta time between two events */ void registerPeriodicTimedFB(CEventSourceFB *const paTimedFB, const CIEC_TIME &paTimeInterval); diff --git a/src/arch/zephyr/sockhand.h b/src/arch/zephyr/sockhand.h index 4e84b499..351f2710 100644 --- a/src/arch/zephyr/sockhand.h +++ b/src/arch/zephyr/sockhand.h @@ -31,9 +31,9 @@ #endif inline in_addr_t inet_addr(const char *cp) { - in_addr_t in_addr; - if (0 == net_addr_pton(AF_INET, cp, &in_addr)) return in_addr; - return -1; + in_addr_t in_addr; + if (0 == net_addr_pton(AF_INET, cp, &in_addr)) return in_addr; + return -1; } void setupMulticastGroup(char* paIPAddr, const char* paMCInterface); diff --git a/src/com/opc_ua/opcua_layer.cpp b/src/com/opc_ua/opcua_layer.cpp index a2aeb77c..19522a35 100644 --- a/src/com/opc_ua/opcua_layer.cpp +++ b/src/com/opc_ua/opcua_layer.cpp @@ -156,7 +156,7 @@ EComResponse COPC_UA_Layer::sendData(void *, unsigned int) { EComResponse COPC_UA_Layer::processInterrupt() { CCriticalRegion criticalRegion(mRDBufferMutex); if(mIsObjectNodeStruct) { - COPC_UA_ObjectStruct_Helper::setMemberValues(getCommFB()->getRDs(), mRDBuffer); + COPC_UA_ObjectStruct_Helper::setMemberValues(getCommFB()->getRDs(), mRDBuffer); } else { for(size_t i = 0; i < getCommFB()->getNumRD(); ++i) { getCommFB()->getRDs()[i]->setValue(*mRDBuffer[i]); diff --git a/src/core/cominfra/structmembercomlayer.h b/src/core/cominfra/structmembercomlayer.h index e1f72364..ecf582dc 100644 --- a/src/core/cominfra/structmembercomlayer.h +++ b/src/core/cominfra/structmembercomlayer.h @@ -33,11 +33,11 @@ namespace forte { * structmemb[localgroupname;structtype;structmembername] * * It is also possible to wirte to children of the structs using: - * structmemb[localgroupname;structtype;structmembername.structchildmembername] + * structmemb[localgroupname;structtype;structmembername.structchildmembername] * * or writing to array elements using: - * structmemb[localgroupname;structtype;structmembername(10).structchildmembername] - * Note: Please use 'array(0)' to access instead of 'array[0]'!! + * structmemb[localgroupname;structtype;structmembername(10).structchildmembername] + * Note: Please use 'array(0)' to access instead of 'array[0]'!! * * * - localgroupname: is the local group this local com layer should attach to. If this is the @@ -69,9 +69,9 @@ namespace forte { bool parseArrayIndexFromString(const char *paNestedStructString, CIEC_INT& targetIndex); enum EComStringIndex { - e_LOCALGROUPNAME, - e_STRUCTTYPE, - e_STRUCTMEMBERNAME + e_LOCALGROUPNAME, + e_STRUCTTYPE, + e_STRUCTMEMBERNAME }; }; } diff --git a/src/core/funcbloc.cpp b/src/core/funcbloc.cpp index 1ee0c12c..f92298ba 100644 --- a/src/core/funcbloc.cpp +++ b/src/core/funcbloc.cpp @@ -375,7 +375,7 @@ void CFunctionBlock::readData(size_t paDINum, CIEC_ANY& paValue, const CDataConn #ifdef FORTE_TRACE_CTF void CFunctionBlock::writeData(size_t paDONum, CIEC_ANY& paValue, CDataConnection& paConn) { - if(paConn.isConnected()) { + if(paConn.isConnected()) { #ifdef FORTE_SUPPORT_MONITORING if(paValue.isForced() != true) { #endif //FORTE_SUPPORT_MONITORING diff --git a/src/core/funcbloc.h b/src/core/funcbloc.h index 6cd36069..5923d1f5 100644 --- a/src/core/funcbloc.h +++ b/src/core/funcbloc.h @@ -528,7 +528,7 @@ class CFunctionBlock { paConn.readData(paValue); } #endif //FORTE_SUPPORT_MONITORING - } + } } #endif //FORTE_TRACE_CTF diff --git a/src/modules/embrick/types/EBBusAdapter.h b/src/modules/embrick/types/EBBusAdapter.h index 3b033e43..c2435b1c 100644 --- a/src/modules/embrick/types/EBBusAdapter.h +++ b/src/modules/embrick/types/EBBusAdapter.h @@ -89,6 +89,6 @@ class FORTE_EBBusAdapter final : public forte::core::io::IOConfigFBMultiAdapter virtual ~FORTE_EBBusAdapter() = default; private: - static const TForteUInt8 scmSlaveConfigurationIO[]; - static const TForteUInt8 scmSlaveConfigurationIONum; + static const TForteUInt8 scmSlaveConfigurationIO[]; + static const TForteUInt8 scmSlaveConfigurationIONum; }; diff --git a/src/modules/gpiochip/gpiochip_config_fb.cpp b/src/modules/gpiochip/gpiochip_config_fb.cpp index 909b83ee..6dc5c470 100644 --- a/src/modules/gpiochip/gpiochip_config_fb.cpp +++ b/src/modules/gpiochip/gpiochip_config_fb.cpp @@ -52,13 +52,13 @@ void GPIOChipConfigFB::setInitialValues() { void GPIOChipConfigFB::readInputData(const TEventID paEIID) { for (auto i = 0; i < 7; i++) { - readData(i, *mDIs[i], mDIConns[i]); + readData(i, *mDIs[i], mDIConns[i]); } } void GPIOChipConfigFB::writeOutputData(const TEventID paEIID) { for (auto i = 0; i < 2; i++) { - writeData(i, *mDOs[i], mDOConns[i]); + writeData(i, *mDOs[i], mDOConns[i]); } } diff --git a/tests/core/trace/EventMessage.cpp b/tests/core/trace/EventMessage.cpp index 96ff1c55..986d2b83 100644 --- a/tests/core/trace/EventMessage.cpp +++ b/tests/core/trace/EventMessage.cpp @@ -36,7 +36,7 @@ EventMessage::EventMessage(const bt_message* paMessage) { &mTimestamp)){ std::cout << "Could not retrieve clock for message" << std::endl; std::abort(); - } + } } std::string EventMessage::getPayloadString() const { diff --git a/tests/core/trace/ctfTracerTest.cpp b/tests/core/trace/ctfTracerTest.cpp index fdacd2ad..12e17fa0 100644 --- a/tests/core/trace/ctfTracerTest.cpp +++ b/tests/core/trace/ctfTracerTest.cpp @@ -252,7 +252,7 @@ std::vector getEventMessages(std::string path){ std::abort(); } - return messages; + return messages; } void printPrettyMessages(const std::vector& messages) { From 753e5a6c68effa1c030049dbcfd9fa4b0662ebff Mon Sep 17 00:00:00 2001 From: Ernst Blecha Date: Tue, 25 Jun 2024 14:43:19 +0200 Subject: [PATCH 3/6] fix indentation in generated files needs a fix in the 4diac-ide code generator --- src/stdfblib/events/E_PULSE_fbt.cpp | 4 ++-- src/stdfblib/events/E_TOF_fbt.cpp | 6 +++--- src/stdfblib/events/E_TONOF_fbt.cpp | 8 ++++---- src/stdfblib/events/E_TON_fbt.cpp | 6 +++--- src/stdfblib/events/E_TP_fbt.cpp | 6 +++--- tests/stdfblib/CFB_TEST.cpp | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/stdfblib/events/E_PULSE_fbt.cpp b/src/stdfblib/events/E_PULSE_fbt.cpp index 9ea51591..176f10fd 100644 --- a/src/stdfblib/events/E_PULSE_fbt.cpp +++ b/src/stdfblib/events/E_PULSE_fbt.cpp @@ -54,8 +54,8 @@ FORTE_E_PULSE::FORTE_E_PULSE(const CStringDictionary::TStringId paInstanceNameId }; void FORTE_E_PULSE::setInitialValues() { - var_PT = 0_TIME; - var_Q = 0_BOOL; + var_PT = 0_TIME; + var_Q = 0_BOOL; } const SCFB_FBInstanceData FORTE_E_PULSE::scmInternalFBs[] = { diff --git a/src/stdfblib/events/E_TOF_fbt.cpp b/src/stdfblib/events/E_TOF_fbt.cpp index 9913b58d..382bc116 100644 --- a/src/stdfblib/events/E_TOF_fbt.cpp +++ b/src/stdfblib/events/E_TOF_fbt.cpp @@ -54,9 +54,9 @@ FORTE_E_TOF::FORTE_E_TOF(const CStringDictionary::TStringId paInstanceNameId, fo }; void FORTE_E_TOF::setInitialValues() { - var_IN = 0_BOOL; - var_PT = 0_TIME; - var_Q = 0_BOOL; + var_IN = 0_BOOL; + var_PT = 0_TIME; + var_Q = 0_BOOL; } const SCFB_FBInstanceData FORTE_E_TOF::scmInternalFBs[] = { diff --git a/src/stdfblib/events/E_TONOF_fbt.cpp b/src/stdfblib/events/E_TONOF_fbt.cpp index 23d146a3..83a4f53b 100644 --- a/src/stdfblib/events/E_TONOF_fbt.cpp +++ b/src/stdfblib/events/E_TONOF_fbt.cpp @@ -55,10 +55,10 @@ FORTE_E_TONOF::FORTE_E_TONOF(const CStringDictionary::TStringId paInstanceNameId }; void FORTE_E_TONOF::setInitialValues() { - var_IN = 0_BOOL; - var_PT_ON = 0_TIME; - var_PT_OFF = 0_TIME; - var_Q = 0_BOOL; + var_IN = 0_BOOL; + var_PT_ON = 0_TIME; + var_PT_OFF = 0_TIME; + var_Q = 0_BOOL; } const SCFB_FBInstanceData FORTE_E_TONOF::scmInternalFBs[] = { diff --git a/src/stdfblib/events/E_TON_fbt.cpp b/src/stdfblib/events/E_TON_fbt.cpp index 37043376..e93d4a3b 100644 --- a/src/stdfblib/events/E_TON_fbt.cpp +++ b/src/stdfblib/events/E_TON_fbt.cpp @@ -53,9 +53,9 @@ FORTE_E_TON::FORTE_E_TON(const CStringDictionary::TStringId paInstanceNameId, fo }; void FORTE_E_TON::setInitialValues() { - var_IN = 0_BOOL; - var_PT = 0_TIME; - var_Q = 0_BOOL; + var_IN = 0_BOOL; + var_PT = 0_TIME; + var_Q = 0_BOOL; } const SCFB_FBInstanceData FORTE_E_TON::scmInternalFBs[] = { diff --git a/src/stdfblib/events/E_TP_fbt.cpp b/src/stdfblib/events/E_TP_fbt.cpp index d857f726..08d9126b 100644 --- a/src/stdfblib/events/E_TP_fbt.cpp +++ b/src/stdfblib/events/E_TP_fbt.cpp @@ -54,9 +54,9 @@ FORTE_E_TP::FORTE_E_TP(const CStringDictionary::TStringId paInstanceNameId, fort }; void FORTE_E_TP::setInitialValues() { - var_IN = 0_BOOL; - var_PT = 0_TIME; - var_Q = 0_BOOL; + var_IN = 0_BOOL; + var_PT = 0_TIME; + var_Q = 0_BOOL; } const SCFB_FBInstanceData FORTE_E_TP::scmInternalFBs[] = { diff --git a/tests/stdfblib/CFB_TEST.cpp b/tests/stdfblib/CFB_TEST.cpp index db59d7ff..41240db5 100644 --- a/tests/stdfblib/CFB_TEST.cpp +++ b/tests/stdfblib/CFB_TEST.cpp @@ -48,8 +48,8 @@ FORTE_CFB_TEST::FORTE_CFB_TEST(const CStringDictionary::TStringId paInstanceName }; void FORTE_CFB_TEST::setInitialValues() { - var_QI = 0_BOOL; - var_QO = 0_BOOL; + var_QI = 0_BOOL; + var_QO = 0_BOOL; } const SCFB_FBInstanceData FORTE_CFB_TEST::scmInternalFBs[] = { From 8707a0cd1a23f8f51c841c76503f1a37426c0c21 Mon Sep 17 00:00:00 2001 From: Ernst Blecha Date: Tue, 25 Jun 2024 14:43:54 +0200 Subject: [PATCH 4/6] fix indentation in code of function ANY_AS_STRING --- src/modules/IEC61131-3/Conversion/F_ANY_AS_STRING_fbt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/IEC61131-3/Conversion/F_ANY_AS_STRING_fbt.cpp b/src/modules/IEC61131-3/Conversion/F_ANY_AS_STRING_fbt.cpp index 420b5c05..21426d70 100644 --- a/src/modules/IEC61131-3/Conversion/F_ANY_AS_STRING_fbt.cpp +++ b/src/modules/IEC61131-3/Conversion/F_ANY_AS_STRING_fbt.cpp @@ -131,6 +131,6 @@ CIEC_ANY *FORTE_F_ANY_AS_STRING::getVarInternal(size_t) { } void FORTE_F_ANY_AS_STRING::alg_REQ(void) { - var_OUT = func_ANY_AS_STRING(var_IN); + var_OUT = func_ANY_AS_STRING(var_IN); } From 82136a829ac7a21642b2c46c9f506dfb117bb9af Mon Sep 17 00:00:00 2001 From: moritzortmeier1 Date: Wed, 26 Jun 2024 20:13:17 +0200 Subject: [PATCH 5/6] tabs remove from resource.cpp --- src/core/resource.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/resource.cpp b/src/core/resource.cpp index 08fd49ff..19c6bcdc 100644 --- a/src/core/resource.cpp +++ b/src/core/resource.cpp @@ -249,8 +249,8 @@ EMGMResponse CResource::writeValue(forte::core::TNameIdentifier &paNameList, con //this is not an identifier for the resource interface fb = getContainedFB(runner); if(!runner.isLastEntry()){ - // currently we can not write values of FBs inside of FBs - return EMGMResponse::NoSuchObject; + // currently we can not write values of FBs inside of FBs + return EMGMResponse::NoSuchObject; } } From f00090047626934bc2c37bd9b02f51a2e1bf8646 Mon Sep 17 00:00:00 2001 From: Alois Zoitl Date: Tue, 18 Jun 2024 21:38:30 +0200 Subject: [PATCH 6/6] Upgraded CMake4Eclipse project config As CDT introduced incompatible api changes a new project setup is necessary for CMake4Eclipse. --- .cproject | 85 ++++++++++++++++--------------------------------------- .project | 12 ++------ 2 files changed, 27 insertions(+), 70 deletions(-) diff --git a/.cproject b/.cproject index 9351865a..e0f4ecfe 100644 --- a/.cproject +++ b/.cproject @@ -1,8 +1,17 @@ + + + + + + + + + - - + + @@ -14,80 +23,36 @@ - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + - - - - - - - - - - - - - - - - - - + - \ No newline at end of file diff --git a/.project b/.project index cc371472..d97de60a 100644 --- a/.project +++ b/.project @@ -6,22 +6,14 @@ - org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, - - - - - org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder - full,incremental, + de.marw.cmake4eclipse.mbs.genscriptbuilder + de.marw.cmake4eclipse.mbs.cmake4eclipsenature org.eclipse.cdt.core.cnature org.eclipse.cdt.core.ccnature - org.eclipse.cdt.managedbuilder.core.managedBuildNature - org.eclipse.cdt.managedbuilder.core.ScannerConfigNature