Skip to content

Commit

Permalink
Som devel 20 (#57)
Browse files Browse the repository at this point in the history
* typos

* memory leak detection with valgrind

* data types

* doc

* reovered IL and systests

* M_Base private

* minor before removal of include guards

* removed include guards -> #pragma once

* getting into tcp

* ref #58: TCP features build untested

* ref #58: submodules?

* ref #58: submodules?

* ref #58: submodules?

* ref #58: just builds, no test failures

* ref #58: just builds, working on coverage

* ref #58: just builds, working on coverage

* ref #58: just builds and runs, working on coverage

* ref #58: just builds and runs, working on coverage

* ref #58: just builds and runs, working on coverage

* ref #58: coverage should be ok now; some methods not yet implemented

* ref #58: interim

* ref #58: interim: renaming

* ref #58: establishing runtime tests

* ref #58: establishing runtime tests

* ref #58: added coverage; establishing system tests

* ref #58: added coverage; establishing system tests

* ref #58: added coverage; establishing system tests

* ref #58: added coverage; establishing system tests

* ref #58: more system tests; renameing would make sense

* ref #57, #58: removed old system tests, renamed others

* ref #57, #58: findings rework

* ref #57, #58: findings rework: removed the plugs

* ref #57, #58: findings rework

* ref #57, #58: mainly system tests

* ref #57, #58: interim

* ref #57, #58: interim

* ref #57, #58: Log enables error output

* ref #57, #58: system tests also run on win

* ref #57, #58: more or less stable state

* ref #57, #58: sys tests linux / win

* ref #57, #58: doc

* ref #57, #58: doc, instances

* ref #57, #58: doc, instances

* ref #57, #58: link to submodule

* ref #57, #58: mainly doc

* ref #57, #58

* ref #57, #58: review rework

* ref #57, #58: review rework

* ref #57, #58: review rework
  • Loading branch information
sorgom authored May 9, 2024
1 parent 3896e1c commit c85f93c
Show file tree
Hide file tree
Showing 136 changed files with 11,983 additions and 11,167 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
*.mdj text eol=lf
*.md text eol=lf
*.make text eol=lf
.git* text eol=lf

3 changes: 3 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ jobs:
- name: check coverage
run: make/runGcov.sh

- name: run system tests
run: make/runSystemTests.sh

# - name: check env
# run: make/checkEnv.sh

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ __pycache__
# temporary
tmp.*
tmp_*
old_*

# vscode
tempCodeRunnerFile.py
Expand All @@ -81,5 +82,7 @@ transitions_*.md
# runtime test
*.proj

# valgrind
*.out.[0-9]*

.obsidian
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "cpputest"]
path = cpputest
url = [email protected]:cpputest/cpputest.git
[submodule "CppUTestSteps"]
path = CppUTestSteps
url = [email protected]:sorgom/CppUTestSteps.git
branch = dev
[submodule "cpputest"]
path = cpputest
url = [email protected]:cpputest/cpputest.git
24 changes: 12 additions & 12 deletions CLOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,50 @@
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 14 95 17 825
C/C++ Header 15 155 132 548
C++ 14 146 26 1174
C/C++ Header 17 167 150 647
-------------------------------------------------------------------------------
SUM: 29 250 149 1373
SUM: 31 313 176 1821
-------------------------------------------------------------------------------
```
**testenv**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 17 184 134 767
C++ 11 35 0 164
C/C++ Header 24 237 174 1124
C++ 9 37 0 217
-------------------------------------------------------------------------------
SUM: 28 219 134 931
SUM: 33 274 174 1341
-------------------------------------------------------------------------------
```
**moduletests**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 11 181 182 1809
C++ 14 286 297 2358
-------------------------------------------------------------------------------
SUM: 11 181 182 1809
SUM: 14 286 297 2358
-------------------------------------------------------------------------------
```
**systemtests**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 2 18 24 99
C++ 2 14 22 117
-------------------------------------------------------------------------------
SUM: 2 18 24 99
SUM: 2 14 22 117
-------------------------------------------------------------------------------
```
**specification**
```
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C/C++ Header 13 81 127 302
C/C++ Header 14 85 143 314
-------------------------------------------------------------------------------
SUM: 13 81 127 302
SUM: 14 85 143 314
-------------------------------------------------------------------------------
```
15 changes: 10 additions & 5 deletions Clinch.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# The model driven approach
## the plan
I happened to work for a project by the Clinch* that had (maybe still has) the following plan:
- develop software for a digital interlocking from the scratch.
- development should be model based.
- use the IMB* toolchain including the Raggedy* modeling tool.
I happened to work for a project of the Clinch* company that had (maybe still has) the following plan:
- develop software for a digital interlocking (DSTW) from the scratch
- development should be model based
- use the IMB* toolchain including the Raggedy* modeling tool

## SIL4
A DSTW software has to meet the standards of SIL4 / EN 50 129.

Security Integrity Level 4 requires following some rules, e.g.:

Before code can be checked in into a main branch it has to
Expand All @@ -26,12 +28,15 @@ What the tools don’t provide is:
- a working source control
- a working review facility
- a continuous integration
- an understandable documentation
- a community

What they provide is:
- the permanent need of workarounds and repetitive click surface work down
- a great collection of pitfalls and error driven frustration
- permanent dysfunction
- a high demand on support by specialists
- a high demand on support by doubtful specialists
- repetitive "hm, last time it worked" in so called trainings
- crappy C-code in bits and pieces
- 90 % of the effort spent for the tools and not for work to be done

Expand Down
2 changes: 1 addition & 1 deletion CppUTestSteps
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ It consists of the following components:
- LCR: level crossings
- SEG: track segments
- SYS: commonly used system
- COM: TCP communication to field and GUI

The project does not intend an implementation that would work in a real digital interlocking (DSTW).

Expand All @@ -23,5 +24,5 @@ It shows a completely different approach than the [model driven](Clinch.md) one
- [testing](testing/README.md)
- [transition tables](specification/doc/transition_tables.md)
- [code coverage](testing/coverage.md)
- [how to build](make/howto_build.md)
- [how to build](make/README.md)
- [current lines of code](CLOC.md)
2 changes: 1 addition & 1 deletion SIL4.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Visual Studio turned out to be an even more pedantic code analyzer with the righ
|/W4|highest warning level|
|/MP|multi processor build|

Additional flags see header of [premake5_vs.lua](make/README.md####premake5_vs.lua)
Additional flags see header of [premake5_vs.lua](make/premake5_vs.lua)

## code coverage
Application code coverage by tests must be 100%.
Expand Down
5 changes: 0 additions & 5 deletions application/components/BAS/BAS_Provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
// created by Manfred Sorgo

#pragma once
#ifndef BAS_PROVIDER_H
#define BAS_PROVIDER_H

#include <BAS/Containers.h>
#include <ifs/I_Provider.h>
Expand Down Expand Up @@ -46,6 +44,3 @@ class BAS_Provider : public I_Provider

PolyVec<I_Elem> mElems;
};


#endif // H_
4 changes: 0 additions & 4 deletions application/components/BAS/Containers.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// created by Manfred Sorgo

#pragma once
#ifndef CONTAINERS_H
#define CONTAINERS_H

#include <BAS/coding.h>
#include <ifs/DataTypes.h>
Expand Down Expand Up @@ -192,5 +190,3 @@ class Index
return dups;
}
};

#endif // _H
4 changes: 0 additions & 4 deletions application/components/BAS/NcpIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
// created by Manfred Sorgo

#pragma once
#ifndef NCPINDEX_H
#define NCPINDEX_H

#include <BAS/coding.h>
#include <BAS/Containers.h>
Expand Down Expand Up @@ -48,5 +46,3 @@ class NcpIndex : public Index<const ComName&, Ncp>
return ntp.name;
}
};

#endif // H_
4 changes: 0 additions & 4 deletions application/components/BAS/coding.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
// ============================================================
// created by Manfred Sorgo
#pragma once
#ifndef CODING_H
#define CODING_H

#include <codebase/BaseTypes.h>
#include <codebase/nocopy.h>
Expand All @@ -26,5 +24,3 @@ inline void pass() {}
static NAME instance; \
return instance; \
}

#endif // H_
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
// created by Manfred Sorgo

#pragma once
#ifndef COM_H
#define COM_H

#include <ifs/I_Com.h>
#include <BAS/coding.h>

class Com : public I_Com
{
public:
inline Com() = default;
inline void toFld(const ComTele& tele) const {}
inline void toGui(const ComTele& tele) const {}
void run() override;
void stop() override;
void toFld(const ComTele& tele) const;
void toGui(const ComTele& tele) const;

INSTANCE_DEC(Com)

NOCOPY(Com)
};

#endif // H_
private:
inline Com() = default;
bool mRunning = false;
};
43 changes: 43 additions & 0 deletions application/components/COM/TCP.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// ============================================================
// implementation TCP base system
// ============================================================
// created by Manfred Sorgo

#pragma once

#include <ifs/I_TCP.h>
#include <BAS/coding.h>

class TCP : public I_TCP
{
public:
void setTimeout(UINT32 ms);

bool init();

void cleanup();

INT32 socket() const;

bool bind(INT32 socket, UINT16 port) const;

bool listen(INT32 socket) const;

INT32 select(INT32 socket) const;

INT32 accept(INT32 socket) const;

INT32 recv(INT32 socket, PTR buffer, size_t size) const;

INT32 send(INT32 socket, CPTR buffer, size_t size) const;

void close(INT32& socket) const;

INSTANCE_DEC(TCP)

NOCOPY(TCP)
private:
TCP() = default;
UINT32 mSec = 0;
UINT32 mMicro = 10000;
};
Loading

0 comments on commit c85f93c

Please sign in to comment.