kleinere organisatorische Änderungen

This commit is contained in:
Johannes Theiner 2018-10-07 14:06:52 +02:00
parent f7257a2cc8
commit d138db4245
80 changed files with 93 additions and 229 deletions

2
.gitignore vendored
View File

@ -4,7 +4,7 @@ cmake-build-debug
*~ *~
*.out *.out
*.save *.save
/bin bin/
/CMakeFiles /CMakeFiles
CMakeCache.txt CMakeCache.txt
cmake_install.cmake cmake_install.cmake

View File

@ -1,191 +0,0 @@
#include <stdio.h> /* 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++;
}*/

View File

@ -8,34 +8,4 @@ SET(CMAKE_BUILD_TYPE Debug)
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
set (LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH}) set (LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
add_executable(01_ENV_MP 01_ENV/MP/main.c 01_ENV/MP/func1.c) add_subdirectory(src)
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)

View File

@ -0,0 +1,48 @@
#include <stdio.h> /* 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);
}

View File

@ -1,5 +1,5 @@
// file: main_04_UDEF_a.cpp // file: main_04_UDEF_a.cpp
#include "../../helpers/println.hpp" #include "../../../helpers/println.hpp"
#include "RationalNumber.hpp" #include "RationalNumber.hpp"
// location 1 // location 1

View File

@ -9,6 +9,8 @@ struct BinaryOctet {
BinaryOctet(int x = 0); BinaryOctet(int x = 0);
BinaryOctet(const BinaryOctet&) = default; BinaryOctet(const BinaryOctet&) = default;
BinaryOctet &operator=(int &a); BinaryOctet &operator=(int &a);
bool operator!=(BinaryOctet &a);
bool operator==(BinaryOctet &a);
BinaryOctet operator--(int); BinaryOctet operator--(int);
BinaryOctet operator-(BinaryOctet &a); BinaryOctet operator-(BinaryOctet &a);
BinaryOctet operator+(BinaryOctet a); BinaryOctet operator+(BinaryOctet a);
@ -104,10 +106,14 @@ BinaryOctet BinaryOctet::operator/(BinaryOctet &a) {
return result; return result;
} }
bool operator!=(BinaryOctet a, BinaryOctet b) { bool BinaryOctet::operator==(BinaryOctet &a) {
if (a.evenParity != b.evenParity) return false; return !operator!=(a);
}
bool BinaryOctet::operator!=(BinaryOctet &a) {
if (a.evenParity != evenParity) return false;
for (int i = 0; i < bitsPerOctet; ++i) { 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; return true;
} }

View File

@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <cassert> #include <cassert>
#include <vector> #include <vector>
#include "../../helpers/println.hpp" #include "../../../helpers/println.hpp"
struct StackObject { struct StackObject {

31
src/CMakeLists.txt Normal file
View File

@ -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)