diff --git a/.ci/clang-tidy.sh b/.ci/clang-tidy.sh index eae5b12..913c79a 100644 --- a/.ci/clang-tidy.sh +++ b/.ci/clang-tidy.sh @@ -5,11 +5,11 @@ bool=false # explicitly set IFS to contain only a line feed IFS=' ' -filelist="$(find . -not \( -path './client/cpptoml/*' -prune \) -type f ! -name "$(printf "*\n*")")" +filelist="$(find . -not \( -path './*build*' -prune \) -type f ! -name "$(printf "*\n*")")" for file in $filelist; do - if echo "$file" | grep -q -E ".*\.cpp$" ; then + if echo "$file" | grep -q -E ".*(\.cpp|\.h|\.hpp)$" ; then #Extra check missing dependencies due to clang-tidy doesn't toggle exit code. - clang_tidy_lib_check="$(clang-tidy -warnings-as-errors='*' -header-filter='.*,-cpptoml.hpp' -checks='*,-llvm-header-guard,-fuchsia-statically-constructed-objects,-fuchsia-default-arguments,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-bugprone-narrowing-conversions,-cppcoreguidelines-narrowing-conversions,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-hicpp-signed-bitwise,-bugprone-exception-escape,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-cstyle-cast,-hicpp-member-init' "$file" -- -I. -std=c++14 2>&1)" + clang_tidy_lib_check="$(clang-tidy -warnings-as-errors='*' -header-filter='.*,-cpptoml.hpp' -checks='*,-llvm-header-guard,-fuchsia-statically-constructed-objects,-fuchsia-default-arguments,-fuchsia-default-arguments-calls,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-pro-bounds-constant-array-index,-bugprone-narrowing-conversions,-cppcoreguidelines-narrowing-conversions,-cppcoreguidelines-pro-type-const-cast,-cppcoreguidelines-pro-type-reinterpret-cast,-hicpp-signed-bitwise,-bugprone-exception-escape,-cppcoreguidelines-pro-type-member-init,-cppcoreguidelines-pro-type-cstyle-cast,-hicpp-member-init' "$file" -- -I. -std=c++14 2>&1)" for tidy_line in $clang_tidy_lib_check; do echo "$tidy_line" | grep -q -v -E "^Error while processing*" if [ $? -eq 1 ]; then diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index eb1309a..522f05f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ stages: clang_tidy: - image: jhasse/clang-tidy + image: joethei/clang_tidy stage: style tags: - docker-ci diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c40c64..6c14a86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,7 @@ set(LIB_PATH "${CMAKE_SOURCE_DIR}/../library") include_directories(${LIB_PATH}/include) add_executable(SharedMemory ${SOURCES} ${HEADERS} main/main.cpp) + target_link_libraries(SharedMemory ${LIB_PATH}/lib/liblibrary.a) diff --git a/main/main.cpp b/main/main.cpp index 1bef42a..33b3f4e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -3,19 +3,20 @@ #include "../src/SharedMemory.h" #include #include +#include "vkvm.h" -int main(int argc, char** argv) -{ +int main(int argc, char** argv) { + initialize(0); initSharedMemory(); struct sigaction sigIntHandler; sigIntHandler.sa_handler = deleteSharedMemory; sigemptyset(&sigIntHandler.sa_mask); sigIntHandler.sa_flags = 0; - sigaction(SIGINT, &sigIntHandler, NULL); - + sigaction(SIGINT, &sigIntHandler, nullptr); + setDefaultValues(); std::atexit(deleteSharedMemory); - std::string eingabe = ""; + std::string eingabe; while(eingabe != "exit") { std::cout << "cmd# "; std::cin >> eingabe; @@ -28,7 +29,28 @@ int main(int argc, char** argv) std::cout << "OUTPUT ------------------------ OUTPUT\n" << std::endl; //Memory that is used now //outprint of all memory - } else if (eingabe != "exit"){ + } else if(eingabe == "write") { + std::cout << "text: "; + std::cin >> eingabe; + setText(eingabe); + //write a bitMap for example 2 (width) * 2 (high) * 3 (color) in Schared Memory + /* + char bitMap[12] = {0}; + for(int i = 0; i < sizeof(bitMap); i++) + bitMap[i] = 'y'; + writeSharedMemory(bitMap, sizeof(bitMap),1); + */ + } else if(eingabe == "read") { + auto str = getText(); + std::cout << str << std::endl; + /* + char content[12] = {0}; + std::cout << "key "<< impl.sharedMemoryKey << std::endl; + getSharedMemory(content, sizeof(content), 1); + + std::cout << content << std::endl; + */ + } else if (eingabe != "exit"){ std::cout << eingabe << " <- is not a known command" << std::endl; } }