From d138db42458f7d74830b7bf251167d258df51849 Mon Sep 17 00:00:00 2001 From: joethei Date: Sun, 7 Oct 2018 14:06:52 +0200 Subject: [PATCH] =?UTF-8?q?kleinere=20organisatorische=20=C3=84nderungen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +- 03_FLOW/MP/main_mp2_FLOW_a.cpp | 191 ------------------ CMakeLists.txt | 32 +-- {01_ENV => src/01_ENV}/MP/build-c.sh | 0 {01_ENV => src/01_ENV}/MP/build.sh | 0 {01_ENV => src/01_ENV}/MP/clean.sh | 0 {01_ENV => src/01_ENV}/MP/func1.c | 0 {01_ENV => src/01_ENV}/MP/func1.h | 0 {01_ENV => src/01_ENV}/MP/main.c | 0 {01_ENV => src/01_ENV}/MP/main_plain.c | 0 {01_ENV => src/01_ENV}/Testat/build-c.sh | 0 {01_ENV => src/01_ENV}/Testat/build.sh | 0 {01_ENV => src/01_ENV}/Testat/clean.sh | 0 {01_ENV => src/01_ENV}/Testat/func1.c | 0 {01_ENV => src/01_ENV}/Testat/func1.h | 0 {01_ENV => src/01_ENV}/Testat/main.c | 0 {02_MENT => src/02_MENT}/MP/build.sh | 0 {02_MENT => src/02_MENT}/MP/limits.cpp | 0 .../02_MENT}/MP/limits_println.cpp | 0 {02_MENT => src/02_MENT}/MP/main_02_MENT.cpp | 0 {02_MENT => src/02_MENT}/MP/printlnDemo.cpp | 0 .../MP/typedMemory/typedMemory/main.cpp | 0 .../typedMemory/typedMemory/typedMemory.cpp | 0 .../typedMemory/typedMemory/typedMemory.hpp | 0 {02_MENT => src/02_MENT}/Testat/build.sh | 0 .../02_MENT}/Testat/main_02_MENT.cpp | 0 {03_FLOW => src/03_FLOW}/MP/build.sh | 0 src/03_FLOW/MP/main_mp2_FLOW_a.cpp | 48 +++++ {03_FLOW => src/03_FLOW}/Testat/build.sh | 0 .../03_FLOW}/Testat/main_mp2_FLOW_a.cpp | 0 .../04_UDEF}/MP/RationalNumber.cpp | 0 .../04_UDEF}/MP/RationalNumber.hpp | 0 .../04_UDEF}/MP/main_04_UDEF_a.cpp | 2 +- .../04_UDEF}/MP/main_04_UDEF_e.cpp | 12 +- {04_UDEF => src/04_UDEF}/Testat/Testat.cpp | 0 {05_OO => src/05_OO}/MP/shapes_main.cpp | 0 {05_OO => src/05_OO}/Testat/shapes_main.cpp | 0 {06_POLY => src/06_POLY}/MP/main_mp5_POLY.cpp | 0 {06_POLY => src/06_POLY}/MP/shapes_main.cpp | 0 .../06_POLY}/Testat/shapes_main.cpp | 0 .../07_STD}/MP/6_STD_stacks/genericStack.hpp | 0 .../07_STD}/MP/6_STD_stacks/intStack.cpp | 0 .../07_STD}/MP/6_STD_stacks/intStack.hpp | 0 .../07_STD}/MP/6_STD_stacks/main.cpp | 0 {07_STD => src/07_STD}/MP/grundgeruest.cpp | 0 {07_STD => src/07_STD}/MP/grundgeruest.hpp | 0 .../07_STD}/Testat/grundgeruest.cpp | 0 {08_PTRN => src/08_PTRN}/MP/Car.cpp | 0 {08_PTRN => src/08_PTRN}/MP/Car.hpp | 0 {08_PTRN => src/08_PTRN}/MP/Logger.cpp | 0 {08_PTRN => src/08_PTRN}/MP/Logger.hpp | 0 {08_PTRN => src/08_PTRN}/MP/Truck.cpp | 0 {08_PTRN => src/08_PTRN}/MP/Truck.hpp | 0 {08_PTRN => src/08_PTRN}/MP/Vehicle.cpp | 0 {08_PTRN => src/08_PTRN}/MP/Vehicle.hpp | 0 .../08_PTRN}/MP/VehicleFactory.cpp | 0 .../08_PTRN}/MP/VehicleFactory.hpp | 0 {08_PTRN => src/08_PTRN}/MP/main.cpp | 0 .../10_PITF}/MP/banking_base_rawptr.cpp | 2 +- {10_PITF => src/10_PITF}/MP/build.sh | 0 .../MP/doubleDelete/LifeCycleProbe.cpp | 0 .../MP/doubleDelete/LifeCycleProbe.hpp | 0 .../10_PITF}/MP/doubleDelete/main.cpp | 0 .../10_PITF}/MP/main_objectSlicing.cpp | 0 .../11_PUTT}/02_Ment/LCDDisplay.cpp | 0 {11_PUTT => src/11_PUTT}/02_Ment/LCDDisplay.h | 0 .../05_OO_b/SequenceDiagramCreator.cpp | 0 .../11_PUTT}/05_OO_b/SequenceDiagramCreator.h | 0 {11_PUTT => src/11_PUTT}/05_OO_b/main.cpp | 0 .../11_PUTT}/CopyOnWrite/LargeCowMatrix.cpp | 0 .../11_PUTT}/CopyOnWrite/LargeCowMatrix.h | 0 .../11_PUTT}/CopyOnWrite/OneByOneMatrix.cpp | 0 .../11_PUTT}/CopyOnWrite/OneByOneMatrix.h | 0 {11_PUTT => src/11_PUTT}/CopyOnWrite/main.cpp | 0 {11_PUTT => src/11_PUTT}/Test.cpp | 0 {11_PUTT => src/11_PUTT}/Test.h | 0 src/CMakeLists.txt | 31 +++ {helpers => src/helpers}/AnsiConsole.cpp | 0 {helpers => src/helpers}/AnsiConsole.h | 0 {helpers => src/helpers}/println.hpp | 0 80 files changed, 93 insertions(+), 229 deletions(-) delete mode 100644 03_FLOW/MP/main_mp2_FLOW_a.cpp rename {01_ENV => src/01_ENV}/MP/build-c.sh (100%) rename {01_ENV => src/01_ENV}/MP/build.sh (100%) rename {01_ENV => src/01_ENV}/MP/clean.sh (100%) rename {01_ENV => src/01_ENV}/MP/func1.c (100%) rename {01_ENV => src/01_ENV}/MP/func1.h (100%) rename {01_ENV => src/01_ENV}/MP/main.c (100%) rename {01_ENV => src/01_ENV}/MP/main_plain.c (100%) rename {01_ENV => src/01_ENV}/Testat/build-c.sh (100%) rename {01_ENV => src/01_ENV}/Testat/build.sh (100%) rename {01_ENV => src/01_ENV}/Testat/clean.sh (100%) rename {01_ENV => src/01_ENV}/Testat/func1.c (100%) rename {01_ENV => src/01_ENV}/Testat/func1.h (100%) rename {01_ENV => src/01_ENV}/Testat/main.c (100%) rename {02_MENT => src/02_MENT}/MP/build.sh (100%) rename {02_MENT => src/02_MENT}/MP/limits.cpp (100%) rename {02_MENT => src/02_MENT}/MP/limits_println.cpp (100%) rename {02_MENT => src/02_MENT}/MP/main_02_MENT.cpp (100%) rename {02_MENT => src/02_MENT}/MP/printlnDemo.cpp (100%) rename {02_MENT => src/02_MENT}/MP/typedMemory/typedMemory/main.cpp (100%) rename {02_MENT => src/02_MENT}/MP/typedMemory/typedMemory/typedMemory.cpp (100%) rename {02_MENT => src/02_MENT}/MP/typedMemory/typedMemory/typedMemory.hpp (100%) rename {02_MENT => src/02_MENT}/Testat/build.sh (100%) rename {02_MENT => src/02_MENT}/Testat/main_02_MENT.cpp (100%) rename {03_FLOW => src/03_FLOW}/MP/build.sh (100%) create mode 100644 src/03_FLOW/MP/main_mp2_FLOW_a.cpp rename {03_FLOW => src/03_FLOW}/Testat/build.sh (100%) rename {03_FLOW => src/03_FLOW}/Testat/main_mp2_FLOW_a.cpp (100%) rename {04_UDEF => src/04_UDEF}/MP/RationalNumber.cpp (100%) rename {04_UDEF => src/04_UDEF}/MP/RationalNumber.hpp (100%) rename {04_UDEF => src/04_UDEF}/MP/main_04_UDEF_a.cpp (94%) rename {04_UDEF => src/04_UDEF}/MP/main_04_UDEF_e.cpp (93%) rename {04_UDEF => src/04_UDEF}/Testat/Testat.cpp (100%) rename {05_OO => src/05_OO}/MP/shapes_main.cpp (100%) rename {05_OO => src/05_OO}/Testat/shapes_main.cpp (100%) rename {06_POLY => src/06_POLY}/MP/main_mp5_POLY.cpp (100%) rename {06_POLY => src/06_POLY}/MP/shapes_main.cpp (100%) rename {06_POLY => src/06_POLY}/Testat/shapes_main.cpp (100%) rename {07_STD => src/07_STD}/MP/6_STD_stacks/genericStack.hpp (100%) rename {07_STD => src/07_STD}/MP/6_STD_stacks/intStack.cpp (100%) rename {07_STD => src/07_STD}/MP/6_STD_stacks/intStack.hpp (100%) rename {07_STD => src/07_STD}/MP/6_STD_stacks/main.cpp (100%) rename {07_STD => src/07_STD}/MP/grundgeruest.cpp (100%) rename {07_STD => src/07_STD}/MP/grundgeruest.hpp (100%) rename {07_STD => src/07_STD}/Testat/grundgeruest.cpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Car.cpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Car.hpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Logger.cpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Logger.hpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Truck.cpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Truck.hpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Vehicle.cpp (100%) rename {08_PTRN => src/08_PTRN}/MP/Vehicle.hpp (100%) rename {08_PTRN => src/08_PTRN}/MP/VehicleFactory.cpp (100%) rename {08_PTRN => src/08_PTRN}/MP/VehicleFactory.hpp (100%) rename {08_PTRN => src/08_PTRN}/MP/main.cpp (100%) rename {10_PITF => src/10_PITF}/MP/banking_base_rawptr.cpp (98%) rename {10_PITF => src/10_PITF}/MP/build.sh (100%) rename {10_PITF => src/10_PITF}/MP/doubleDelete/LifeCycleProbe.cpp (100%) rename {10_PITF => src/10_PITF}/MP/doubleDelete/LifeCycleProbe.hpp (100%) rename {10_PITF => src/10_PITF}/MP/doubleDelete/main.cpp (100%) rename {10_PITF => src/10_PITF}/MP/main_objectSlicing.cpp (100%) rename {11_PUTT => src/11_PUTT}/02_Ment/LCDDisplay.cpp (100%) rename {11_PUTT => src/11_PUTT}/02_Ment/LCDDisplay.h (100%) rename {11_PUTT => src/11_PUTT}/05_OO_b/SequenceDiagramCreator.cpp (100%) rename {11_PUTT => src/11_PUTT}/05_OO_b/SequenceDiagramCreator.h (100%) rename {11_PUTT => src/11_PUTT}/05_OO_b/main.cpp (100%) rename {11_PUTT => src/11_PUTT}/CopyOnWrite/LargeCowMatrix.cpp (100%) rename {11_PUTT => src/11_PUTT}/CopyOnWrite/LargeCowMatrix.h (100%) rename {11_PUTT => src/11_PUTT}/CopyOnWrite/OneByOneMatrix.cpp (100%) rename {11_PUTT => src/11_PUTT}/CopyOnWrite/OneByOneMatrix.h (100%) rename {11_PUTT => src/11_PUTT}/CopyOnWrite/main.cpp (100%) rename {11_PUTT => src/11_PUTT}/Test.cpp (100%) rename {11_PUTT => src/11_PUTT}/Test.h (100%) create mode 100644 src/CMakeLists.txt rename {helpers => src/helpers}/AnsiConsole.cpp (100%) rename {helpers => src/helpers}/AnsiConsole.h (100%) rename {helpers => src/helpers}/println.hpp (100%) diff --git a/.gitignore b/.gitignore index 8e95ce4..928bd41 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,9 @@ cmake-build-debug *~ *.out *.save -/bin +bin/ /CMakeFiles CMakeCache.txt cmake_install.cmake Makefile -/C +/C \ No newline at end of file diff --git a/03_FLOW/MP/main_mp2_FLOW_a.cpp b/03_FLOW/MP/main_mp2_FLOW_a.cpp deleted file mode 100644 index d51e9b1..0000000 --- a/03_FLOW/MP/main_mp2_FLOW_a.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include /* file main_mp2_FLOW_a.cpp */ -#include "../../helpers/AnsiConsole.h" - -//TODO: verstehen - -AnsiConsole console; int firstLine; int currentTick; Colors currentColor; -#define INITPRINT(label) {firstLine=__LINE__;console.printText(2*currentTick,0,label,Colors::BLACK);} -#define PRINT printLineNumber(__LINE__) -void printLineNumber(int lineNumber); - -void recurse(int); // forward declaration because of firstLine initialization -void start_Recursion(){ - INITPRINT("Recursion"); - PRINT;recurse(10); - PRINT; -} -void recurse(int turns){ - PRINT; if(turns>0){ - PRINT; recurse(turns - 1); - } - PRINT; -} - - -void test_Iteration() { - INITPRINT("Test Iteration"); - int array[6] = {}; - for(int i = 0; i <= 6; i++) { - PRINT; array[i] = 0; - } - -} - -void test() { - INITPRINT("Test"); - int array[6] = {}; - PRINT; array[0] = 0; - PRINT; array[1] = 0; - PRINT; array[2] = 0; - PRINT; array[3] = 0; - PRINT; array[4] = 0; - PRINT; array[5] = 0; -} - - - - - -void start_Sequence(void){ - INITPRINT("Sequence"); - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; -} - - - - - - - -void start_SeqSelection(void){ - INITPRINT("Selection"); - PRINT; int b = 1; - PRINT; if (b == 1){ - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; }else{ - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; - }PRINT; - PRINT; -} - - - -void start_Iteration(void){ - INITPRINT("Iteration"); - PRINT; int i=9; - PRINT; while(i>=0){ - PRINT; i--; - }PRINT; - PRINT; -} - - -int func_1(int arg); - -// Sequence, Selection, Iteration, Subroutine -void start_subroutine(void){ - INITPRINT("Subroutine"); - PRINT; func_1(1); - PRINT; func_1(1); - PRINT; -} - -int func_1(int arg){ - PRINT; int local_1; - PRINT; - PRINT; - PRINT; - PRINT; return arg * local_1; -} - -void modifikation1(); -void modifikation2(); - - -int main(int argc, const char * argv[]) { - /* - console.clearScreen(); - - currentColor = Colors::BLUE; - start_Sequence(); - currentColor = Colors::RED; - start_SeqSelection(); - currentColor = Colors::YELLOW; - start_subroutine(); - currentColor = Colors::GREEN; - start_Iteration(); - currentColor = Colors::CYAN; - start_Recursion(); - - //start_goto(); - //start_switch(); - //start_interrupt(); - //start_coroutine(); - //start_exception(); - - - - - currentColor = Colors::WHITE; - test_Iteration(); - currentColor = Colors::MAGENTA; - test(); - - */ - - console.clearScreen(); - currentColor = Colors::BLUE; - modifikation1(); - currentColor = Colors::RED; - modifikation2(); - - - std::string s; - std::cin >> s; - - - return 0; -} - -void modifikation1() { - INITPRINT("Modifikation 1"); - PRINT; - PRINT; - PRINT; - PRINT; - PRINT; -} - -void modifikation2() { - -} - -void printLineNumber(int lineNumber){ - std::string line = std::to_string(lineNumber); - currentTick++; - console.printText(currentTick*2-1, 1+lineNumber-firstLine, line, currentColor); -} - - -/*void printLineNumber(int lineNumber){ - std::string line = std::to_string(lineNumber); - console.printText(currentTick*2, 1+lineNumber-firstLine, line, currentColor); - currentTick++; -}*/ - diff --git a/CMakeLists.txt b/CMakeLists.txt index bc68644..b1f0080 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,34 +8,4 @@ SET(CMAKE_BUILD_TYPE Debug) set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) set (LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) -add_executable(01_ENV_MP 01_ENV/MP/main.c 01_ENV/MP/func1.c) -target_link_libraries(01_ENV_MP m) -add_executable(01_ENV_Testat 01_ENV/Testat/main.c 01_ENV/Testat/func1.c) - -add_executable(02_MENT_MP 02_MENT/MP/main_02_MENT.cpp) -add_executable(02_MENT_Testat 02_MENT/Testat/main_02_MENT.cpp) - -add_executable(03_FLOW_MP 03_FLOW/MP/main_mp2_FLOW_a.cpp helpers/AnsiConsole.cpp) -add_executable(03_FLOW_Testat 03_FLOW/Testat/main_mp2_FLOW_a.cpp helpers/AnsiConsole.cpp) - -add_executable(04_UDEF_MP 04_UDEF/MP/main_04_UDEF_e.cpp) -add_executable(04_UDEF_Testat 04_UDEF/Testat/Testat.cpp) - -add_executable(05_OO_MP 05_OO/MP/shapes_main.cpp helpers/AnsiConsole.cpp) -add_executable(05_OO_Testat 05_OO/Testat/shapes_main.cpp helpers/AnsiConsole.cpp) - -add_executable(06_POLY_MP 06_POLY/MP/shapes_main.cpp helpers/AnsiConsole.cpp) -add_executable(06_POLY_Testat 06_POLY/Testat/shapes_main.cpp helpers/AnsiConsole.cpp) - -add_executable(07_STD_MP 07_STD/MP/grundgeruest.cpp) -add_executable(07_STD_Testat 07_STD/Testat/grundgeruest.cpp) - -#add_executable(SequenceDiagram 11_PUTT/05_OO_b/SequenceDiagramCreator.cpp 11_PUTT/05_OO_b/main.cpp) - -#add_executable(LCDDisplay 11_PUTT/02_Ment/LCDDisplay.cpp) - -#add_executable(CopyOnWrite 11_PUTT/CopyOnWrite/OneByOneMatrix.cpp 11_PUTT/CopyOnWrite/LargeCowMatrix.cpp 11_PUTT/CopyOnWrite/main.cpp) - -#add_executable(Banking 10_PITF/MP/banking_base_rawptr.cpp) - -add_executable(Test 11_PUTT/Test.cpp) +add_subdirectory(src) \ No newline at end of file diff --git a/01_ENV/MP/build-c.sh b/src/01_ENV/MP/build-c.sh similarity index 100% rename from 01_ENV/MP/build-c.sh rename to src/01_ENV/MP/build-c.sh diff --git a/01_ENV/MP/build.sh b/src/01_ENV/MP/build.sh similarity index 100% rename from 01_ENV/MP/build.sh rename to src/01_ENV/MP/build.sh diff --git a/01_ENV/MP/clean.sh b/src/01_ENV/MP/clean.sh similarity index 100% rename from 01_ENV/MP/clean.sh rename to src/01_ENV/MP/clean.sh diff --git a/01_ENV/MP/func1.c b/src/01_ENV/MP/func1.c similarity index 100% rename from 01_ENV/MP/func1.c rename to src/01_ENV/MP/func1.c diff --git a/01_ENV/MP/func1.h b/src/01_ENV/MP/func1.h similarity index 100% rename from 01_ENV/MP/func1.h rename to src/01_ENV/MP/func1.h diff --git a/01_ENV/MP/main.c b/src/01_ENV/MP/main.c similarity index 100% rename from 01_ENV/MP/main.c rename to src/01_ENV/MP/main.c diff --git a/01_ENV/MP/main_plain.c b/src/01_ENV/MP/main_plain.c similarity index 100% rename from 01_ENV/MP/main_plain.c rename to src/01_ENV/MP/main_plain.c diff --git a/01_ENV/Testat/build-c.sh b/src/01_ENV/Testat/build-c.sh similarity index 100% rename from 01_ENV/Testat/build-c.sh rename to src/01_ENV/Testat/build-c.sh diff --git a/01_ENV/Testat/build.sh b/src/01_ENV/Testat/build.sh similarity index 100% rename from 01_ENV/Testat/build.sh rename to src/01_ENV/Testat/build.sh diff --git a/01_ENV/Testat/clean.sh b/src/01_ENV/Testat/clean.sh similarity index 100% rename from 01_ENV/Testat/clean.sh rename to src/01_ENV/Testat/clean.sh diff --git a/01_ENV/Testat/func1.c b/src/01_ENV/Testat/func1.c similarity index 100% rename from 01_ENV/Testat/func1.c rename to src/01_ENV/Testat/func1.c diff --git a/01_ENV/Testat/func1.h b/src/01_ENV/Testat/func1.h similarity index 100% rename from 01_ENV/Testat/func1.h rename to src/01_ENV/Testat/func1.h diff --git a/01_ENV/Testat/main.c b/src/01_ENV/Testat/main.c similarity index 100% rename from 01_ENV/Testat/main.c rename to src/01_ENV/Testat/main.c diff --git a/02_MENT/MP/build.sh b/src/02_MENT/MP/build.sh similarity index 100% rename from 02_MENT/MP/build.sh rename to src/02_MENT/MP/build.sh diff --git a/02_MENT/MP/limits.cpp b/src/02_MENT/MP/limits.cpp similarity index 100% rename from 02_MENT/MP/limits.cpp rename to src/02_MENT/MP/limits.cpp diff --git a/02_MENT/MP/limits_println.cpp b/src/02_MENT/MP/limits_println.cpp similarity index 100% rename from 02_MENT/MP/limits_println.cpp rename to src/02_MENT/MP/limits_println.cpp diff --git a/02_MENT/MP/main_02_MENT.cpp b/src/02_MENT/MP/main_02_MENT.cpp similarity index 100% rename from 02_MENT/MP/main_02_MENT.cpp rename to src/02_MENT/MP/main_02_MENT.cpp diff --git a/02_MENT/MP/printlnDemo.cpp b/src/02_MENT/MP/printlnDemo.cpp similarity index 100% rename from 02_MENT/MP/printlnDemo.cpp rename to src/02_MENT/MP/printlnDemo.cpp diff --git a/02_MENT/MP/typedMemory/typedMemory/main.cpp b/src/02_MENT/MP/typedMemory/typedMemory/main.cpp similarity index 100% rename from 02_MENT/MP/typedMemory/typedMemory/main.cpp rename to src/02_MENT/MP/typedMemory/typedMemory/main.cpp diff --git a/02_MENT/MP/typedMemory/typedMemory/typedMemory.cpp b/src/02_MENT/MP/typedMemory/typedMemory/typedMemory.cpp similarity index 100% rename from 02_MENT/MP/typedMemory/typedMemory/typedMemory.cpp rename to src/02_MENT/MP/typedMemory/typedMemory/typedMemory.cpp diff --git a/02_MENT/MP/typedMemory/typedMemory/typedMemory.hpp b/src/02_MENT/MP/typedMemory/typedMemory/typedMemory.hpp similarity index 100% rename from 02_MENT/MP/typedMemory/typedMemory/typedMemory.hpp rename to src/02_MENT/MP/typedMemory/typedMemory/typedMemory.hpp diff --git a/02_MENT/Testat/build.sh b/src/02_MENT/Testat/build.sh similarity index 100% rename from 02_MENT/Testat/build.sh rename to src/02_MENT/Testat/build.sh diff --git a/02_MENT/Testat/main_02_MENT.cpp b/src/02_MENT/Testat/main_02_MENT.cpp similarity index 100% rename from 02_MENT/Testat/main_02_MENT.cpp rename to src/02_MENT/Testat/main_02_MENT.cpp diff --git a/03_FLOW/MP/build.sh b/src/03_FLOW/MP/build.sh similarity index 100% rename from 03_FLOW/MP/build.sh rename to src/03_FLOW/MP/build.sh diff --git a/src/03_FLOW/MP/main_mp2_FLOW_a.cpp b/src/03_FLOW/MP/main_mp2_FLOW_a.cpp new file mode 100644 index 0000000..f43cfc6 --- /dev/null +++ b/src/03_FLOW/MP/main_mp2_FLOW_a.cpp @@ -0,0 +1,48 @@ +#include /* file main_mp2_FLOW_a.cpp */ +#include "../../helpers/AnsiConsole.h" + +//TODO: verstehen + +AnsiConsole console; int firstLine; int currentTick; Colors currentColor; +#define INITPRINT(label) {firstLine=__LINE__;console.printText(2*currentTick,0,label,Colors::BLACK);} +#define PRINT printLineNumber(__LINE__) +void printLineNumber(int lineNumber);void mod1();void mod2();void mod1a(); +void mod1() { + INITPRINT("Modification 1"); + PRINT;mod1a(); + PRINT; +} +void mod1a() { + for(int i = 0; i < 6; i++) { PRINT; + }for(int i = 0; i < 7; i++) { + PRINT; + } +} + + + +void mod2() { + +} + + +int main(int argc, const char * argv[]) { + console.clearScreen(); + currentColor = Colors::BLUE; + mod1(); + currentColor = Colors::RED; + mod2(); + + + std::string s; + std::cin >> s; + + + return 0; +} + +void printLineNumber(int lineNumber){ + std::string line = std::to_string(lineNumber); + currentTick++; + console.printText(currentTick*2-1, 1+lineNumber-firstLine, line, currentColor); +} \ No newline at end of file diff --git a/03_FLOW/Testat/build.sh b/src/03_FLOW/Testat/build.sh similarity index 100% rename from 03_FLOW/Testat/build.sh rename to src/03_FLOW/Testat/build.sh diff --git a/03_FLOW/Testat/main_mp2_FLOW_a.cpp b/src/03_FLOW/Testat/main_mp2_FLOW_a.cpp similarity index 100% rename from 03_FLOW/Testat/main_mp2_FLOW_a.cpp rename to src/03_FLOW/Testat/main_mp2_FLOW_a.cpp diff --git a/04_UDEF/MP/RationalNumber.cpp b/src/04_UDEF/MP/RationalNumber.cpp similarity index 100% rename from 04_UDEF/MP/RationalNumber.cpp rename to src/04_UDEF/MP/RationalNumber.cpp diff --git a/04_UDEF/MP/RationalNumber.hpp b/src/04_UDEF/MP/RationalNumber.hpp similarity index 100% rename from 04_UDEF/MP/RationalNumber.hpp rename to src/04_UDEF/MP/RationalNumber.hpp diff --git a/04_UDEF/MP/main_04_UDEF_a.cpp b/src/04_UDEF/MP/main_04_UDEF_a.cpp similarity index 94% rename from 04_UDEF/MP/main_04_UDEF_a.cpp rename to src/04_UDEF/MP/main_04_UDEF_a.cpp index f084c93..179296e 100644 --- a/04_UDEF/MP/main_04_UDEF_a.cpp +++ b/src/04_UDEF/MP/main_04_UDEF_a.cpp @@ -1,5 +1,5 @@ // file: main_04_UDEF_a.cpp -#include "../../helpers/println.hpp" +#include "../../../helpers/println.hpp" #include "RationalNumber.hpp" // location 1 diff --git a/04_UDEF/MP/main_04_UDEF_e.cpp b/src/04_UDEF/MP/main_04_UDEF_e.cpp similarity index 93% rename from 04_UDEF/MP/main_04_UDEF_e.cpp rename to src/04_UDEF/MP/main_04_UDEF_e.cpp index a9afe15..3ebef38 100644 --- a/04_UDEF/MP/main_04_UDEF_e.cpp +++ b/src/04_UDEF/MP/main_04_UDEF_e.cpp @@ -9,6 +9,8 @@ struct BinaryOctet { BinaryOctet(int x = 0); BinaryOctet(const BinaryOctet&) = default; BinaryOctet &operator=(int &a); + bool operator!=(BinaryOctet &a); + bool operator==(BinaryOctet &a); BinaryOctet operator--(int); BinaryOctet operator-(BinaryOctet &a); BinaryOctet operator+(BinaryOctet a); @@ -104,10 +106,14 @@ BinaryOctet BinaryOctet::operator/(BinaryOctet &a) { return result; } -bool operator!=(BinaryOctet a, BinaryOctet b) { - if (a.evenParity != b.evenParity) return false; +bool BinaryOctet::operator==(BinaryOctet &a) { + return !operator!=(a); +} + +bool BinaryOctet::operator!=(BinaryOctet &a) { + if (a.evenParity != evenParity) return false; for (int i = 0; i < bitsPerOctet; ++i) { - if (a.bitsAsDigits[i] != b.bitsAsDigits[i]) return false; + if (a.bitsAsDigits[i] != bitsAsDigits[i]) return false; } return true; } diff --git a/04_UDEF/Testat/Testat.cpp b/src/04_UDEF/Testat/Testat.cpp similarity index 100% rename from 04_UDEF/Testat/Testat.cpp rename to src/04_UDEF/Testat/Testat.cpp diff --git a/05_OO/MP/shapes_main.cpp b/src/05_OO/MP/shapes_main.cpp similarity index 100% rename from 05_OO/MP/shapes_main.cpp rename to src/05_OO/MP/shapes_main.cpp diff --git a/05_OO/Testat/shapes_main.cpp b/src/05_OO/Testat/shapes_main.cpp similarity index 100% rename from 05_OO/Testat/shapes_main.cpp rename to src/05_OO/Testat/shapes_main.cpp diff --git a/06_POLY/MP/main_mp5_POLY.cpp b/src/06_POLY/MP/main_mp5_POLY.cpp similarity index 100% rename from 06_POLY/MP/main_mp5_POLY.cpp rename to src/06_POLY/MP/main_mp5_POLY.cpp diff --git a/06_POLY/MP/shapes_main.cpp b/src/06_POLY/MP/shapes_main.cpp similarity index 100% rename from 06_POLY/MP/shapes_main.cpp rename to src/06_POLY/MP/shapes_main.cpp diff --git a/06_POLY/Testat/shapes_main.cpp b/src/06_POLY/Testat/shapes_main.cpp similarity index 100% rename from 06_POLY/Testat/shapes_main.cpp rename to src/06_POLY/Testat/shapes_main.cpp diff --git a/07_STD/MP/6_STD_stacks/genericStack.hpp b/src/07_STD/MP/6_STD_stacks/genericStack.hpp similarity index 100% rename from 07_STD/MP/6_STD_stacks/genericStack.hpp rename to src/07_STD/MP/6_STD_stacks/genericStack.hpp diff --git a/07_STD/MP/6_STD_stacks/intStack.cpp b/src/07_STD/MP/6_STD_stacks/intStack.cpp similarity index 100% rename from 07_STD/MP/6_STD_stacks/intStack.cpp rename to src/07_STD/MP/6_STD_stacks/intStack.cpp diff --git a/07_STD/MP/6_STD_stacks/intStack.hpp b/src/07_STD/MP/6_STD_stacks/intStack.hpp similarity index 100% rename from 07_STD/MP/6_STD_stacks/intStack.hpp rename to src/07_STD/MP/6_STD_stacks/intStack.hpp diff --git a/07_STD/MP/6_STD_stacks/main.cpp b/src/07_STD/MP/6_STD_stacks/main.cpp similarity index 100% rename from 07_STD/MP/6_STD_stacks/main.cpp rename to src/07_STD/MP/6_STD_stacks/main.cpp diff --git a/07_STD/MP/grundgeruest.cpp b/src/07_STD/MP/grundgeruest.cpp similarity index 100% rename from 07_STD/MP/grundgeruest.cpp rename to src/07_STD/MP/grundgeruest.cpp diff --git a/07_STD/MP/grundgeruest.hpp b/src/07_STD/MP/grundgeruest.hpp similarity index 100% rename from 07_STD/MP/grundgeruest.hpp rename to src/07_STD/MP/grundgeruest.hpp diff --git a/07_STD/Testat/grundgeruest.cpp b/src/07_STD/Testat/grundgeruest.cpp similarity index 100% rename from 07_STD/Testat/grundgeruest.cpp rename to src/07_STD/Testat/grundgeruest.cpp diff --git a/08_PTRN/MP/Car.cpp b/src/08_PTRN/MP/Car.cpp similarity index 100% rename from 08_PTRN/MP/Car.cpp rename to src/08_PTRN/MP/Car.cpp diff --git a/08_PTRN/MP/Car.hpp b/src/08_PTRN/MP/Car.hpp similarity index 100% rename from 08_PTRN/MP/Car.hpp rename to src/08_PTRN/MP/Car.hpp diff --git a/08_PTRN/MP/Logger.cpp b/src/08_PTRN/MP/Logger.cpp similarity index 100% rename from 08_PTRN/MP/Logger.cpp rename to src/08_PTRN/MP/Logger.cpp diff --git a/08_PTRN/MP/Logger.hpp b/src/08_PTRN/MP/Logger.hpp similarity index 100% rename from 08_PTRN/MP/Logger.hpp rename to src/08_PTRN/MP/Logger.hpp diff --git a/08_PTRN/MP/Truck.cpp b/src/08_PTRN/MP/Truck.cpp similarity index 100% rename from 08_PTRN/MP/Truck.cpp rename to src/08_PTRN/MP/Truck.cpp diff --git a/08_PTRN/MP/Truck.hpp b/src/08_PTRN/MP/Truck.hpp similarity index 100% rename from 08_PTRN/MP/Truck.hpp rename to src/08_PTRN/MP/Truck.hpp diff --git a/08_PTRN/MP/Vehicle.cpp b/src/08_PTRN/MP/Vehicle.cpp similarity index 100% rename from 08_PTRN/MP/Vehicle.cpp rename to src/08_PTRN/MP/Vehicle.cpp diff --git a/08_PTRN/MP/Vehicle.hpp b/src/08_PTRN/MP/Vehicle.hpp similarity index 100% rename from 08_PTRN/MP/Vehicle.hpp rename to src/08_PTRN/MP/Vehicle.hpp diff --git a/08_PTRN/MP/VehicleFactory.cpp b/src/08_PTRN/MP/VehicleFactory.cpp similarity index 100% rename from 08_PTRN/MP/VehicleFactory.cpp rename to src/08_PTRN/MP/VehicleFactory.cpp diff --git a/08_PTRN/MP/VehicleFactory.hpp b/src/08_PTRN/MP/VehicleFactory.hpp similarity index 100% rename from 08_PTRN/MP/VehicleFactory.hpp rename to src/08_PTRN/MP/VehicleFactory.hpp diff --git a/08_PTRN/MP/main.cpp b/src/08_PTRN/MP/main.cpp similarity index 100% rename from 08_PTRN/MP/main.cpp rename to src/08_PTRN/MP/main.cpp diff --git a/10_PITF/MP/banking_base_rawptr.cpp b/src/10_PITF/MP/banking_base_rawptr.cpp similarity index 98% rename from 10_PITF/MP/banking_base_rawptr.cpp rename to src/10_PITF/MP/banking_base_rawptr.cpp index b6d39b5..4918f33 100644 --- a/10_PITF/MP/banking_base_rawptr.cpp +++ b/src/10_PITF/MP/banking_base_rawptr.cpp @@ -1,7 +1,7 @@ #include #include #include -#include "../../helpers/println.hpp" +#include "../../../helpers/println.hpp" struct StackObject { diff --git a/10_PITF/MP/build.sh b/src/10_PITF/MP/build.sh similarity index 100% rename from 10_PITF/MP/build.sh rename to src/10_PITF/MP/build.sh diff --git a/10_PITF/MP/doubleDelete/LifeCycleProbe.cpp b/src/10_PITF/MP/doubleDelete/LifeCycleProbe.cpp similarity index 100% rename from 10_PITF/MP/doubleDelete/LifeCycleProbe.cpp rename to src/10_PITF/MP/doubleDelete/LifeCycleProbe.cpp diff --git a/10_PITF/MP/doubleDelete/LifeCycleProbe.hpp b/src/10_PITF/MP/doubleDelete/LifeCycleProbe.hpp similarity index 100% rename from 10_PITF/MP/doubleDelete/LifeCycleProbe.hpp rename to src/10_PITF/MP/doubleDelete/LifeCycleProbe.hpp diff --git a/10_PITF/MP/doubleDelete/main.cpp b/src/10_PITF/MP/doubleDelete/main.cpp similarity index 100% rename from 10_PITF/MP/doubleDelete/main.cpp rename to src/10_PITF/MP/doubleDelete/main.cpp diff --git a/10_PITF/MP/main_objectSlicing.cpp b/src/10_PITF/MP/main_objectSlicing.cpp similarity index 100% rename from 10_PITF/MP/main_objectSlicing.cpp rename to src/10_PITF/MP/main_objectSlicing.cpp diff --git a/11_PUTT/02_Ment/LCDDisplay.cpp b/src/11_PUTT/02_Ment/LCDDisplay.cpp similarity index 100% rename from 11_PUTT/02_Ment/LCDDisplay.cpp rename to src/11_PUTT/02_Ment/LCDDisplay.cpp diff --git a/11_PUTT/02_Ment/LCDDisplay.h b/src/11_PUTT/02_Ment/LCDDisplay.h similarity index 100% rename from 11_PUTT/02_Ment/LCDDisplay.h rename to src/11_PUTT/02_Ment/LCDDisplay.h diff --git a/11_PUTT/05_OO_b/SequenceDiagramCreator.cpp b/src/11_PUTT/05_OO_b/SequenceDiagramCreator.cpp similarity index 100% rename from 11_PUTT/05_OO_b/SequenceDiagramCreator.cpp rename to src/11_PUTT/05_OO_b/SequenceDiagramCreator.cpp diff --git a/11_PUTT/05_OO_b/SequenceDiagramCreator.h b/src/11_PUTT/05_OO_b/SequenceDiagramCreator.h similarity index 100% rename from 11_PUTT/05_OO_b/SequenceDiagramCreator.h rename to src/11_PUTT/05_OO_b/SequenceDiagramCreator.h diff --git a/11_PUTT/05_OO_b/main.cpp b/src/11_PUTT/05_OO_b/main.cpp similarity index 100% rename from 11_PUTT/05_OO_b/main.cpp rename to src/11_PUTT/05_OO_b/main.cpp diff --git a/11_PUTT/CopyOnWrite/LargeCowMatrix.cpp b/src/11_PUTT/CopyOnWrite/LargeCowMatrix.cpp similarity index 100% rename from 11_PUTT/CopyOnWrite/LargeCowMatrix.cpp rename to src/11_PUTT/CopyOnWrite/LargeCowMatrix.cpp diff --git a/11_PUTT/CopyOnWrite/LargeCowMatrix.h b/src/11_PUTT/CopyOnWrite/LargeCowMatrix.h similarity index 100% rename from 11_PUTT/CopyOnWrite/LargeCowMatrix.h rename to src/11_PUTT/CopyOnWrite/LargeCowMatrix.h diff --git a/11_PUTT/CopyOnWrite/OneByOneMatrix.cpp b/src/11_PUTT/CopyOnWrite/OneByOneMatrix.cpp similarity index 100% rename from 11_PUTT/CopyOnWrite/OneByOneMatrix.cpp rename to src/11_PUTT/CopyOnWrite/OneByOneMatrix.cpp diff --git a/11_PUTT/CopyOnWrite/OneByOneMatrix.h b/src/11_PUTT/CopyOnWrite/OneByOneMatrix.h similarity index 100% rename from 11_PUTT/CopyOnWrite/OneByOneMatrix.h rename to src/11_PUTT/CopyOnWrite/OneByOneMatrix.h diff --git a/11_PUTT/CopyOnWrite/main.cpp b/src/11_PUTT/CopyOnWrite/main.cpp similarity index 100% rename from 11_PUTT/CopyOnWrite/main.cpp rename to src/11_PUTT/CopyOnWrite/main.cpp diff --git a/11_PUTT/Test.cpp b/src/11_PUTT/Test.cpp similarity index 100% rename from 11_PUTT/Test.cpp rename to src/11_PUTT/Test.cpp diff --git a/11_PUTT/Test.h b/src/11_PUTT/Test.h similarity index 100% rename from 11_PUTT/Test.h rename to src/11_PUTT/Test.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..8cb46e6 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,31 @@ +add_executable(01_ENV_MP 01_ENV/MP/main.c 01_ENV/MP/func1.c) +target_link_libraries(01_ENV_MP m) +add_executable(01_ENV_Testat 01_ENV/Testat/main.c 01_ENV/Testat/func1.c) + +add_executable(02_MENT_MP 02_MENT/MP/main_02_MENT.cpp) +add_executable(02_MENT_Testat 02_MENT/Testat/main_02_MENT.cpp) + +add_executable(03_FLOW_MP 03_FLOW/MP/main_mp2_FLOW_a.cpp helpers/AnsiConsole.cpp) +add_executable(03_FLOW_Testat 03_FLOW/Testat/main_mp2_FLOW_a.cpp helpers/AnsiConsole.cpp) + +add_executable(04_UDEF_MP 04_UDEF/MP/main_04_UDEF_e.cpp) +add_executable(04_UDEF_Testat 04_UDEF/Testat/Testat.cpp) + +add_executable(05_OO_MP 05_OO/MP/shapes_main.cpp helpers/AnsiConsole.cpp) +add_executable(05_OO_Testat 05_OO/Testat/shapes_main.cpp helpers/AnsiConsole.cpp) + +add_executable(06_POLY_MP 06_POLY/MP/shapes_main.cpp helpers/AnsiConsole.cpp) +add_executable(06_POLY_Testat 06_POLY/Testat/shapes_main.cpp helpers/AnsiConsole.cpp) + +add_executable(07_STD_MP 07_STD/MP/grundgeruest.cpp) +add_executable(07_STD_Testat 07_STD/Testat/grundgeruest.cpp) + +#add_executable(SequenceDiagram 11_PUTT/05_OO_b/SequenceDiagramCreator.cpp 11_PUTT/05_OO_b/main.cpp) + +#add_executable(LCDDisplay 11_PUTT/02_Ment/LCDDisplay.cpp) + +#add_executable(CopyOnWrite 11_PUTT/CopyOnWrite/OneByOneMatrix.cpp 11_PUTT/CopyOnWrite/LargeCowMatrix.cpp 11_PUTT/CopyOnWrite/main.cpp) + +#add_executable(Banking 10_PITF/MP/banking_base_rawptr.cpp) + +add_executable(Test 11_PUTT/Test.cpp) \ No newline at end of file diff --git a/helpers/AnsiConsole.cpp b/src/helpers/AnsiConsole.cpp similarity index 100% rename from helpers/AnsiConsole.cpp rename to src/helpers/AnsiConsole.cpp diff --git a/helpers/AnsiConsole.h b/src/helpers/AnsiConsole.h similarity index 100% rename from helpers/AnsiConsole.h rename to src/helpers/AnsiConsole.h diff --git a/helpers/println.hpp b/src/helpers/println.hpp similarity index 100% rename from helpers/println.hpp rename to src/helpers/println.hpp