From 7d016c6312a7411674c5d4c1bbdcf66a28454877 Mon Sep 17 00:00:00 2001 From: sorgom <110917257+sorgom@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:51:50 +0200 Subject: [PATCH] Som devel 20 (#66) * coverage * coverage * coverage * added sompy * added sompy * pre-commit * check of pre-commit * test * test * test * test * removed pass() * removed pass() * review rework * review rework * Squashed commit of the following: commit 1491ebc943d1c2da1dc9d5d22796250a916629ae Author: sorgom <110917257+sorgom@users.noreply.github.com> Date: Sun Oct 13 18:53:18 2024 +0200 merge SOM_DEVEL_20 * bullseye build & run * include guards I * include guards I * include guards I * minor corrections --- .gitHooks/pre-commit | 47 ++++--- .gitignore | 5 +- application/components/BAS/BAS_Provider.h | 3 + application/components/BAS/Containers.h | 5 +- application/components/BAS/NcpIndex.h | 7 +- application/components/BAS/coding.h | 3 + application/components/COM/Com.h | 3 + application/components/COM/TCP.h | 3 + application/components/COM/TCP_Com.h | 3 + application/components/LCR/LCR_Provider.h | 3 + application/components/LCR/LCR_X.h | 3 + application/components/SIG/SIG_Provider.h | 3 + application/components/SIG/SIG_X.h | 3 + application/components/SYS/Dispatcher.h | 3 + application/components/SYS/IL.h | 3 + application/components/SYS/Log.h | 3 + application/components/SYS/Reader.h | 3 + application/components/SYS/src/Dispatcher.cpp | 2 +- application/components/TSW/TSW.h | 3 + application/components/TSW/TSW_Provider.h | 3 + make/bullseye/_covexclude.txt | 3 + make/bullseye/_covoptions.txt | 9 ++ make/bullseye/covBuildAndRun.cmd | 129 ++++++++++++++++++ scripts/cleanMdj.py | 23 ---- scripts/cleanSvg.py | 26 ---- scripts/srcNums.py | 30 ---- sompy | 2 +- specification/codebase/BaseTypes.h | 3 + specification/codebase/Mem.h | 4 +- specification/codebase/nocopy.h | 3 + specification/codebase/packBegin.h | 5 + specification/codebase/packEnd.h | 5 + specification/ifs/DataTypes.h | 11 +- specification/ifs/I_Com.h | 3 + specification/ifs/I_Dispatcher.h | 5 +- specification/ifs/I_Elem.h | 3 + specification/ifs/I_Log.h | 3 + specification/ifs/I_Provider.h | 3 + specification/ifs/I_Reader.h | 3 + specification/ifs/I_TCP.h | 3 + specification/ifs/values.h | 3 + testing/testenv/mocks/M_Dispatcher.h | 2 +- 42 files changed, 280 insertions(+), 112 deletions(-) create mode 100644 make/bullseye/_covexclude.txt create mode 100644 make/bullseye/_covoptions.txt create mode 100644 make/bullseye/covBuildAndRun.cmd delete mode 100644 scripts/cleanMdj.py delete mode 100644 scripts/cleanSvg.py delete mode 100644 scripts/srcNums.py diff --git a/.gitHooks/pre-commit b/.gitHooks/pre-commit index 40d3d70b..59824787 100644 --- a/.gitHooks/pre-commit +++ b/.gitHooks/pre-commit @@ -2,39 +2,46 @@ # use: git config core.hooksPath .gitHooks py=$(which py || which python || which python3) -if [[ -z $py ]]; then exit 0; fi -echo "Using python: $py" +if [[ -z $py ]] +then + echo "No python found" + exit 0 +fi cd $(git rev-parse --show-toplevel) -echo current directory: $(pwd) sompy=$(pwd)/sompy/somutil +mdjs= +svgs= +txts= + for file in `git diff-index --cached --name-only HEAD`; do if [[ -f $file ]] then add=1 - echo checking file: $file - if [[ $file == *.mdj ]] - then - echo cleaning mdj file: $file - $py $sompy/cleanMdj.py $file - elif [[ $file == *.svg ]] - then - echo cleaning svg file: $file - $py $sompy/cleanSvg.py $file - elif [[ $file == *.py ]] || [[ $file == *.cpp ]] || [[ $file == *.h ]] - then - echo cleaning text file: $file - $py $sompy/cleanTxt.py $file + if [[ $file == *.mdj ]]; then mdjs="$mdjs $file" + elif [[ $file == *.svg ]]; then svgs="$svgs $file" + elif [[ $file == *.py ]] || [[ $file == *.cpp ]] || [[ $file == *.h ]] || [[ $file == *.cmd ]] + then + txts="$txts $file" else add=0 fi - if [[ $add -eq 1 ]] - then - git add $file - fi + if [[ $add -eq 1 ]]; then git add $file; fi fi done +if [[ -n $mdjs ]]; then + echo cleaning mdj files + $py $sompy/cleanMdj.py $mdjs +fi +if [[ -n $svgs ]]; then + echo cleaning svg files + $py $sompy/cleanSvg.py $svgs +fi +if [[ -n $txts ]]; then + echo cleaning text files + $py $sompy/cleanTxt.py $txts +fi diff --git a/.gitignore b/.gitignore index adeea473..ec3d6d94 100644 --- a/.gitignore +++ b/.gitignore @@ -85,4 +85,7 @@ transitions_*.md # valgrind *.out.[0-9]* -.obsidian \ No newline at end of file +.obsidian + +!_cov*.txt +reports diff --git a/application/components/BAS/BAS_Provider.h b/application/components/BAS/BAS_Provider.h index 0df49c77..95516acb 100644 --- a/application/components/BAS/BAS_Provider.h +++ b/application/components/BAS/BAS_Provider.h @@ -9,6 +9,8 @@ // created by Manfred Sorgo #pragma once +#ifndef BAS_PROVIDER_H +#define BAS_PROVIDER_H #include #include @@ -44,3 +46,4 @@ class BAS_Provider : public I_Provider PolyVec mElems; }; +#endif // _H diff --git a/application/components/BAS/Containers.h b/application/components/BAS/Containers.h index 350830dc..ae332fc1 100644 --- a/application/components/BAS/Containers.h +++ b/application/components/BAS/Containers.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef CONTAINERS_H +#define CONTAINERS_H #include #include @@ -145,7 +147,7 @@ class Index pos = mid; } } - return PosRes{pos, found}; + return PosRes{found, pos}; } private: // data storage @@ -190,3 +192,4 @@ class Index return dups; } }; +#endif // _H diff --git a/application/components/BAS/NcpIndex.h b/application/components/BAS/NcpIndex.h index d07e9848..b2eff74e 100644 --- a/application/components/BAS/NcpIndex.h +++ b/application/components/BAS/NcpIndex.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef NCPINDEX_H +#define NCPINDEX_H #include #include @@ -41,8 +43,9 @@ class NcpIndex : public Index NOCOPY(NcpIndex) protected: - inline const ComName& getKey(const Ncp& ntp) const final + inline const ComName& getKey(const Ncp& ncp) const final { - return ntp.name; + return ncp.name; } }; +#endif // _H diff --git a/application/components/BAS/coding.h b/application/components/BAS/coding.h index 270fa1b7..5fdcf82a 100644 --- a/application/components/BAS/coding.h +++ b/application/components/BAS/coding.h @@ -3,6 +3,8 @@ // ============================================================ // created by Manfred Sorgo #pragma once +#ifndef CODING_H +#define CODING_H #include #include @@ -21,3 +23,4 @@ static NAME instance; \ return instance; \ } +#endif // _H diff --git a/application/components/COM/Com.h b/application/components/COM/Com.h index aaf9c412..b9097d1f 100644 --- a/application/components/COM/Com.h +++ b/application/components/COM/Com.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef COM_H +#define COM_H #include #include @@ -23,3 +25,4 @@ class Com : public I_Com inline Com() = default; bool mRunning = false; }; +#endif // _H diff --git a/application/components/COM/TCP.h b/application/components/COM/TCP.h index cad8b168..d1c220fc 100644 --- a/application/components/COM/TCP.h +++ b/application/components/COM/TCP.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef TCP_H +#define TCP_H #include #include @@ -41,3 +43,4 @@ class TCP : public I_TCP UINT32 mSec = 0; UINT32 mMicro = 10000; }; +#endif // _H diff --git a/application/components/COM/TCP_Com.h b/application/components/COM/TCP_Com.h index 5f2faa50..f2bafe8b 100644 --- a/application/components/COM/TCP_Com.h +++ b/application/components/COM/TCP_Com.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef TCP_COM_H +#define TCP_COM_H #include #include @@ -132,3 +134,4 @@ class TCP_Con_Ctrl : public TCP_Con_Base private: inline TCP_Con_Ctrl() = default; }; +#endif // _H diff --git a/application/components/LCR/LCR_Provider.h b/application/components/LCR/LCR_Provider.h index 8ccdd69c..751e1947 100644 --- a/application/components/LCR/LCR_Provider.h +++ b/application/components/LCR/LCR_Provider.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef LCR_PROVIDER_H +#define LCR_PROVIDER_H #include #include @@ -19,3 +21,4 @@ class LCR_Provider : public BAS_Provider private: inline LCR_Provider() = default; }; +#endif // _H diff --git a/application/components/LCR/LCR_X.h b/application/components/LCR/LCR_X.h index 0c228030..286c868f 100644 --- a/application/components/LCR/LCR_X.h +++ b/application/components/LCR/LCR_X.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef LCR_X_H +#define LCR_X_H #include #include @@ -75,3 +77,4 @@ class LCR_UBK : public LCR_X UINT8 mUbkToGui; static bool validUbk(UINT8 ubk); }; +#endif // _H diff --git a/application/components/SIG/SIG_Provider.h b/application/components/SIG/SIG_Provider.h index 3a91a5bb..2de8aefc 100644 --- a/application/components/SIG/SIG_Provider.h +++ b/application/components/SIG/SIG_Provider.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef SIG_PROVIDER_H +#define SIG_PROVIDER_H #include #include @@ -19,3 +21,4 @@ class SIG_Provider : public BAS_Provider private: inline SIG_Provider() = default; }; +#endif // _H diff --git a/application/components/SIG/SIG_X.h b/application/components/SIG/SIG_X.h index 0ae8d333..c195a461 100644 --- a/application/components/SIG/SIG_X.h +++ b/application/components/SIG/SIG_X.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef SIG_X_H +#define SIG_X_H #include #include @@ -136,3 +138,4 @@ class SIG_H_N : public SIG_XS void proc_H1_N0(UINT8 speed); void proc_H1_N1(UINT8 speed); }; +#endif // _H diff --git a/application/components/SYS/Dispatcher.h b/application/components/SYS/Dispatcher.h index 3567058e..e8609325 100644 --- a/application/components/SYS/Dispatcher.h +++ b/application/components/SYS/Dispatcher.h @@ -3,6 +3,8 @@ // ============================================================ // created by Manfred Sorgo #pragma once +#ifndef DISPATCHER_H +#define DISPATCHER_H #include #include @@ -37,3 +39,4 @@ class Dispatcher : public I_Dispatcher static void forwardGui(I_Provider& prov, const Ncp& ncp, const ComTele& tele); static void reGui(I_Provider& prov); }; +#endif // _H diff --git a/application/components/SYS/IL.h b/application/components/SYS/IL.h index 44c60790..bbe90709 100644 --- a/application/components/SYS/IL.h +++ b/application/components/SYS/IL.h @@ -6,6 +6,8 @@ // created by Manfred Sorgo #pragma once +#ifndef IL_H +#define IL_H #include #include @@ -34,3 +36,4 @@ namespace IL inline I_TCP_Listener& getTCP_Listener_Gui() { return TCP_Listener_Gui::instance(); } inline I_TCP_Listener& getTCP_Listener_Ctrl() { return TCP_Listener_Ctrl::instance(); } } // namespace +#endif // _H diff --git a/application/components/SYS/Log.h b/application/components/SYS/Log.h index 0615984e..d1730dd9 100644 --- a/application/components/SYS/Log.h +++ b/application/components/SYS/Log.h @@ -5,6 +5,8 @@ // created by Manfred Sorgo #pragma once +#ifndef LOG_H +#define LOG_H #include #include @@ -27,3 +29,4 @@ class Log : public I_Log E_Ret mErr = RET_NO_ERR; inline Log() = default; }; +#endif // _H diff --git a/application/components/SYS/Reader.h b/application/components/SYS/Reader.h index 680880d5..b29ff405 100644 --- a/application/components/SYS/Reader.h +++ b/application/components/SYS/Reader.h @@ -2,6 +2,8 @@ // class Reader implements I_Reader // ============================================================ #pragma once +#ifndef READER_H +#define READER_H #include #include @@ -18,3 +20,4 @@ class Reader : public I_Reader ComSetup mComSetup = {}; inline Reader() = default; }; +#endif // _H diff --git a/application/components/SYS/src/Dispatcher.cpp b/application/components/SYS/src/Dispatcher.cpp index 6f1edfc2..5324f6c0 100644 --- a/application/components/SYS/src/Dispatcher.cpp +++ b/application/components/SYS/src/Dispatcher.cpp @@ -24,7 +24,7 @@ const PosRes Dispatcher::assign( const size_t pos) { mIndx.add(name, comp, pos); - return PosRes{mIndx.size() - 1, true}; + return PosRes{true, mIndx.size() - 1}; } void Dispatcher::fromFld(const ComTele& tele) const diff --git a/application/components/TSW/TSW.h b/application/components/TSW/TSW.h index 5e8037b0..9d605dc7 100644 --- a/application/components/TSW/TSW.h +++ b/application/components/TSW/TSW.h @@ -7,6 +7,8 @@ // created by Manfred Sorgo #pragma once +#ifndef TSW_H +#define TSW_H #include #include @@ -38,3 +40,4 @@ class TSW : public I_Elem void chgState(UINT8 state); void toFld(UINT8 state) const; }; +#endif // _H diff --git a/application/components/TSW/TSW_Provider.h b/application/components/TSW/TSW_Provider.h index a8fa4ae4..db406fba 100644 --- a/application/components/TSW/TSW_Provider.h +++ b/application/components/TSW/TSW_Provider.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef TSW_PROVIDER_H +#define TSW_PROVIDER_H #include #include @@ -25,3 +27,4 @@ class TSW_Provider : public BAS_Provider private: inline TSW_Provider() = default; }; +#endif // _H diff --git a/make/bullseye/_covexclude.txt b/make/bullseye/_covexclude.txt new file mode 100644 index 00000000..0aa28bf0 --- /dev/null +++ b/make/bullseye/_covexclude.txt @@ -0,0 +1,3 @@ +exclude all / +include folder application/ +include folder specification/ diff --git a/make/bullseye/_covoptions.txt b/make/bullseye/_covoptions.txt new file mode 100644 index 00000000..e26e6c7f --- /dev/null +++ b/make/bullseye/_covoptions.txt @@ -0,0 +1,9 @@ +options: +-p [VS-version] run premake e.g. -p vs2019 +-c force clean build +-r remove reports +-H generate HTML +-u just update coverage file (no report, no HTML) +-h this help + +all options must be given separately \ No newline at end of file diff --git a/make/bullseye/covBuildAndRun.cmd b/make/bullseye/covBuildAndRun.cmd new file mode 100644 index 00000000..4257cbfd --- /dev/null +++ b/make/bullseye/covBuildAndRun.cmd @@ -0,0 +1,129 @@ +@echo off +rem ======================================================================== +rem Bullseye coverage: build and run tests (requires VS shell) +rem ======================================================================== + +SETLOCAL +rem minmal coverage setup +rem - minimal function coverage % +set minFunctionCov=100 +rem - minimal decision coverage % +set minDecisionCov=99 + +cd /d %~dp0 +set myDir=%cd% +cd .. +set makeDir=%cd% +cd .. +set dstwDir=%cd% + +set premakeFile=%makeDir%\premake5_vs.lua + +set executable=%makeDir%\exe\tests.exe +set vsSolution=%makeDir%\tests.sln +set vsBuildTarget=tests + +set reportsDir=%dstwDir%\reports +set buildLog=%reportsDir%\buildReport.txt +set covLog=%reportsDir%\coverageReport.txt +set covHtmlDir=%reportsDir%\html + +set covfile=%makeDir%\dstw.cov +set covcopt=--srcdir %dstwDir% +set excludeFile=%myDir%\_covexclude.txt +set optsTxt=%myDir%\_covoptions.txt + +set covMin=%minFunctionCov%,%minDecisionCov% + +set _vsversion=vs2019 +set _premake=0 +set _cleanbuild=0 +set _cleanreports=0 +set _genhtml=0 +set _update=0 + +for %%p in (%*) do ( + if "%%p" == "-h" ( + echo Usage: %~n0%~x0 [options] + cat %optsTxt% + exit /b 0 + ) else if "%%p" == "-c" ( + set _cleanbuild=1 + ) else if "%%p" == "-r" ( + set _cleanreports=1 + ) else if "%%p" == "-H" ( + set _genhtml=1 + ) else if "%%p" == "-u" ( + set _update=1 + ) else if "%%p" == "-p" ( + set _premake=1 + ) else ( + set _vsversion=%%p + ) +) + +if not exist %vsSolution% set _premake=1 +if not exist %covfile% set _cleanbuild=1 + +if %_premake% == 1 ( + echo - premake for %_vsversion% + call premake5 --file=%premakeFile% %_vsversion% + set _cleanbuild=1 +) + +if %_cleanreports% == 1 ( + echo - clean reports + if exist %reportsDir% rm -rf %reportsDir% +) + +if %_cleanbuild% == 1 ( + echo - clean + if exist %covfile% rm -f %covfile% + call msbuild /t:Clean %vsSolution% >NUL +) + +if not exist %reportsDir% mkdir %reportsDir% + +call cov01 -q1 + +echo - build +call msbuild /t:%vsBuildTarget% %vsSolution% > %buildLog% 2>&1 + +call cov01 -q0 + +if not exist %executable% ( + echo %executable% not found + exit /b 1 +) + +if not exist %covfile% ( + echo %covfile% not found + exit /b 1 +) + +rm -f %buildLog% + +rem rewind coverage file if it was not removed before +call covclear -q + +echo - run +call %executable% >NUL + +if %_update% == 1 exit /b 0 + +if %_genhtml% == 1 ( + echo - html + call covhtml -q --allNum %covHtmlDir% +) + +echo - report +call covselect -qd +call covselect -q --import %excludeFile% + +cd %dstwDir% +call covdir -q --by-name --srcdir . | tee %covLog% + +set _result=failed +call covdir -q --checkmin %covMin% +if %errorlevel% == 0 set _result=passed +echo covmin %covMin% %_result% | tee -a %covLog% diff --git a/scripts/cleanMdj.py b/scripts/cleanMdj.py deleted file mode 100644 index 3b0169ba..00000000 --- a/scripts/cleanMdj.py +++ /dev/null @@ -1,23 +0,0 @@ -# ============================================================ -# put line breaks into mdj files -# to create smaller git diffs -# ============================================================ -# created by Manfred Sorgo - -from modUtilz import fileTxt, writeFile -import re -from sys import argv - -rxOpen = re.compile(r'([\[\{}])\n?') -rxClose = re.compile(r'\n?([\]\}])') - -def cleanMdj(fps:list): - for fp in fps: - txt = fileTxt(fp) - out = rxClose.sub(r'\n\1', rxOpen.sub(r'\1\n', txt)) - writeFile(fp, out) - -if __name__ == '__main__': - cleanMdj(argv[1:]) - - diff --git a/scripts/cleanSvg.py b/scripts/cleanSvg.py deleted file mode 100644 index 7460bd34..00000000 --- a/scripts/cleanSvg.py +++ /dev/null @@ -1,26 +0,0 @@ -# ============================================================ -# clean SVG files from UNREGISTERED background -# also put line breaks behind tags -# to create smaller git diffs -# ============================================================ -# created by Manfred Sorgo - -from modUtilz import fileTxt, writeFile -import re -from sys import argv - -rxClean = re.compile(r'UNREGISTERED') -rxTags = re.compile(r'(<[^>]*>)\n?') -rxEnd = re.compile(r'[ \t]+$', re.M) -rxLine = re.compile(r'^\n', re.M) - -def cleanSvg(fps:list): - for fp in fps: - txt = fileTxt(fp) - out = rxLine.sub('', rxEnd.sub('', rxTags.sub(r'\1\n', rxClean.sub('', txt)))) - writeFile(fp, out) - -if __name__ == '__main__': - cleanSvg(argv[1:]) - - diff --git a/scripts/srcNums.py b/scripts/srcNums.py deleted file mode 100644 index 7f5a3325..00000000 --- a/scripts/srcNums.py +++ /dev/null @@ -1,30 +0,0 @@ -# ============================================================ -# simple line numbering for source sample markups -# ============================================================ -# created by Manfred Sorgo - -import re -from sys import argv - -class SrcNums(object): - def __init__(self): - self.rxLin = re.compile(r'^(.*)', re.M) - - def num(self, src): - with open(src, 'r') as fh: - txt = fh.read() - nl = len(self.rxLin.findall(txt)) - ln = len(str(nl)) - self.frm = f'%0{ln}d\t%s' - self.nr = 0 - txt = self.rxLin.sub(self.repl, txt).expandtabs(4) - print(txt) - - def repl(self, mo): - self.nr += 1 - return self.frm % (self.nr, mo.group(1)) - -if __name__ == '__main__': - srcNums = SrcNums() - for src in argv[1:]: - srcNums.num(src) diff --git a/sompy b/sompy index 55a2c8a9..9dc194c5 160000 --- a/sompy +++ b/sompy @@ -1 +1 @@ -Subproject commit 55a2c8a978aa88120d33fe526656431884574544 +Subproject commit 9dc194c50052c6b3ee48c43387036b4fbb44b86a diff --git a/specification/codebase/BaseTypes.h b/specification/codebase/BaseTypes.h index c4130b03..7f2b02ba 100644 --- a/specification/codebase/BaseTypes.h +++ b/specification/codebase/BaseTypes.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef BASETYPES_H +#define BASETYPES_H #include @@ -27,3 +29,4 @@ using CONST_C_STRING = const CHAR*; #ifndef _MSC_VER using std::size_t; #endif +#endif // _H diff --git a/specification/codebase/Mem.h b/specification/codebase/Mem.h index 8b899b1f..11318531 100644 --- a/specification/codebase/Mem.h +++ b/specification/codebase/Mem.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef MEM_H +#define MEM_H #include #include @@ -32,4 +34,4 @@ class Mem return std::memcmp(c1, c2, N); } }; - +#endif // _H diff --git a/specification/codebase/nocopy.h b/specification/codebase/nocopy.h index 3911dd1d..85235522 100644 --- a/specification/codebase/nocopy.h +++ b/specification/codebase/nocopy.h @@ -3,6 +3,8 @@ // ============================================================ // created by Manfred Sorgo #pragma once +#ifndef NOCOPY_H +#define NOCOPY_H // disable copy constructor and copy operator #define NOCOPY(CLASS) \ @@ -13,3 +15,4 @@ CLASS& operator = (const CLASS&) = delete; // disable default constructor #define NODEF(CLASS) \ CLASS() = delete; +#endif // _H diff --git a/specification/codebase/packBegin.h b/specification/codebase/packBegin.h index 2fbe7813..33769489 100644 --- a/specification/codebase/packBegin.h +++ b/specification/codebase/packBegin.h @@ -3,6 +3,11 @@ // ============================================================ // created by Manfred Sorgo +// prevent include guards to be inserted by script +#ifndef PACKBEGIN_H +#define PACKBEGIN_H +#endif // _H + //! check if we have an nested Pack definition #ifdef IS_PACKED #error Nested use of PackBegin.h (probably missing #include "packEnd.h") diff --git a/specification/codebase/packEnd.h b/specification/codebase/packEnd.h index 0eef1c84..93a18af1 100644 --- a/specification/codebase/packEnd.h +++ b/specification/codebase/packEnd.h @@ -3,6 +3,11 @@ // ============================================================ // created by Manfred Sorgo +// prevent include guards to be inserted by script +#ifndef PACKEND_H +#define PACKEND_H +#endif // _H + //! check if packBegin.h has been included before #ifdef IS_PACKED #undef IS_PACKED diff --git a/specification/ifs/DataTypes.h b/specification/ifs/DataTypes.h index 5964bcc6..030dc1b7 100644 --- a/specification/ifs/DataTypes.h +++ b/specification/ifs/DataTypes.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef DATATYPES_H +#define DATATYPES_H #include "values.h" #include @@ -80,11 +82,12 @@ static_assert(8 == sizeof(ComSetup)); // result of a find operation struct PosRes { - const size_t pos; const bool valid; - inline PosRes(size_t pos, bool valid): - pos(pos), - valid(valid) + const size_t pos; + inline PosRes(bool valid, size_t pos = 0) : + valid(valid), + pos(pos) {} NODEF(PosRes) }; +#endif // _H diff --git a/specification/ifs/I_Com.h b/specification/ifs/I_Com.h index bc4c1191..2ab14e88 100644 --- a/specification/ifs/I_Com.h +++ b/specification/ifs/I_Com.h @@ -5,6 +5,8 @@ // created by Manfred Sorgo #pragma once +#ifndef I_COM_H +#define I_COM_H #include "DataTypes.h" @@ -16,3 +18,4 @@ class I_Com virtual void toFld(const ComTele& tele) const = 0; virtual void toGui(const ComTele& tele) const = 0; }; +#endif // _H diff --git a/specification/ifs/I_Dispatcher.h b/specification/ifs/I_Dispatcher.h index 40c7ad95..979a27af 100644 --- a/specification/ifs/I_Dispatcher.h +++ b/specification/ifs/I_Dispatcher.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef I_DISPATCHER_H +#define I_DISPATCHER_H #include "values.h" #include "DataTypes.h" @@ -16,7 +18,7 @@ class I_Dispatcher // when loading project data // components providers (TSW, SIG, LCR, SEG) - // assign themselves with: + // assign their elements with: // - element name // - component id // - own processing element position @@ -39,3 +41,4 @@ class I_Dispatcher // dispatcher shall re-send all GUI states when triggered virtual void reGui() const = 0; }; +#endif // _H diff --git a/specification/ifs/I_Elem.h b/specification/ifs/I_Elem.h index e77d374e..dad95137 100644 --- a/specification/ifs/I_Elem.h +++ b/specification/ifs/I_Elem.h @@ -7,6 +7,8 @@ // created by Manfred Sorgo #pragma once +#ifndef I_ELEM_H +#define I_ELEM_H #include "DataTypes.h" @@ -25,3 +27,4 @@ class I_Elem // this is test code: type info if relevant virtual E_Type type() const = 0; }; +#endif // _H diff --git a/specification/ifs/I_Log.h b/specification/ifs/I_Log.h index e6d99892..6febcecf 100644 --- a/specification/ifs/I_Log.h +++ b/specification/ifs/I_Log.h @@ -5,6 +5,8 @@ // created by Manfred Sorgo #pragma once +#ifndef I_LOG_H +#define I_LOG_H #include "values.h" #include @@ -15,3 +17,4 @@ class I_Log virtual std::ostream& log(E_Comp comp, E_Ret ret) = 0; virtual E_Ret maxerr() const = 0; }; +#endif // _H diff --git a/specification/ifs/I_Provider.h b/specification/ifs/I_Provider.h index 6cfd2ffb..df149912 100644 --- a/specification/ifs/I_Provider.h +++ b/specification/ifs/I_Provider.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef I_PROVIDER_H +#define I_PROVIDER_H #include "I_Elem.h" #include "DataTypes.h" @@ -17,3 +19,4 @@ class I_Provider virtual void clear() = 0; virtual void load(const ProjItem* data, UINT32 num) = 0; }; +#endif // _H diff --git a/specification/ifs/I_Reader.h b/specification/ifs/I_Reader.h index 2938de0c..65d91b62 100644 --- a/specification/ifs/I_Reader.h +++ b/specification/ifs/I_Reader.h @@ -8,6 +8,8 @@ // ============================================================ // created by Manfred Sorgo #pragma once +#ifndef I_READER_H +#define I_READER_H #include #include @@ -17,3 +19,4 @@ class I_Reader virtual void read(CONST_C_STRING filename) = 0; virtual const ComSetup& getComSetup() const = 0; }; +#endif // _H diff --git a/specification/ifs/I_TCP.h b/specification/ifs/I_TCP.h index 08f963b3..a67e03b4 100644 --- a/specification/ifs/I_TCP.h +++ b/specification/ifs/I_TCP.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef I_TCP_H +#define I_TCP_H #include "DataTypes.h" @@ -72,3 +74,4 @@ class I_TCP_Con // close client virtual void close() = 0; }; +#endif // _H diff --git a/specification/ifs/values.h b/specification/ifs/values.h index d4e332dd..b12af106 100644 --- a/specification/ifs/values.h +++ b/specification/ifs/values.h @@ -4,6 +4,8 @@ // created by Manfred Sorgo #pragma once +#ifndef VALUES_H +#define VALUES_H #include @@ -124,3 +126,4 @@ enum E_ComCtrl : UINT8 COM_CTRL_PING, COM_CTRL_RE_GUI }; +#endif // _H diff --git a/testing/testenv/mocks/M_Dispatcher.h b/testing/testenv/mocks/M_Dispatcher.h index 17e8f6d2..e1a2bc9f 100644 --- a/testing/testenv/mocks/M_Dispatcher.h +++ b/testing/testenv/mocks/M_Dispatcher.h @@ -36,7 +36,7 @@ namespace test inline const PosRes assign(const ComName& name, E_Comp comp, size_t pos) override { const INT32 i = call("assign").TPARAM(ComName, name).PARAM(comp).PARAM(pos).RETURN_DEF_INT(0); - return i < 0 ? PosRes {0, false} : PosRes {static_cast(i), true}; + return i < 0 ? PosRes {false} : PosRes {true, static_cast(i)}; } inline void expectAssign(const ComName& name, E_Comp comp, size_t pos, INT32 ret = 0) const {