From 08d940224bc99acfa690468dbab004c3a29220c1 Mon Sep 17 00:00:00 2001 From: Joshua Moerman Date: Fri, 28 Jul 2017 15:03:02 +0100 Subject: [PATCH] Removes the boost dependency --- .gitmodules | 0 CMakeLists.txt | 8 +------- README.md | 5 ++--- lib/read_mealy.cpp | 18 +++++++++++++++--- 4 files changed, 18 insertions(+), 13 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e69de29..0000000 diff --git a/CMakeLists.txt b/CMakeLists.txt index c5a4c64..41108ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,13 +4,7 @@ cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y") find_package (Threads) - -find_package(Boost REQUIRED COMPONENTS) -include_directories(SYSTEM ${Boost_INCLUDE_DIRS}) -set(libs ${libs} ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) +set(libs ${libs} ${CMAKE_THREAD_LIBS_INIT}) add_subdirectory("lib") add_subdirectory("src") - -# file(GLOB resources "resources/*") -# file(COPY ${resources} DESTINATION ${CMAKE_BINARY_DIR}) diff --git a/README.md b/README.md index 1b2a79f..9f65c16 100644 --- a/README.md +++ b/README.md @@ -46,8 +46,8 @@ at the provided example to get started. ## Building -Currently there is still one dependency: Boost. Assuming boost is installed on -your system, we can build the tool with cmake: +There are no dependencies to install. +You can build the tool with `cmake`: ``` mkdir build @@ -82,7 +82,6 @@ prefixes. However, this can quickly grow in size. Be warned! ## TODO * Implement a proper radix tree (or Patricia tree) to reduce memory usage. -* Remove the dependency on boost. * Implement the SPY method for finding smarter prefixes. * Compute independent structures in parallel (this was done in the first version of the tool). diff --git a/lib/read_mealy.cpp b/lib/read_mealy.cpp index c1ec122..b9c981b 100644 --- a/lib/read_mealy.cpp +++ b/lib/read_mealy.cpp @@ -1,9 +1,8 @@ #include "read_mealy.hpp" #include "mealy.hpp" -#include - #include +#include #include #include #include @@ -15,6 +14,20 @@ static string easy_substr(string const & s, size_t begin, size_t end){ return s.substr(begin, end - begin); } +static string trim_copy(string const & str) { + auto it = str.begin(); + while(it != str.end() && isspace(*it)){ + it++; + } + + auto e = str.end(); + while(it != e && isspace(*(e-1))) { + e--; + } + + return string(it, e); +} + mealy read_mealy_from_txt(std::istream & in, bool check) { mealy m; @@ -71,7 +84,6 @@ mealy read_mealy_from_dot(std::istream & in, translation & t, bool check){ string line; while(getline(in, line)){ - using boost::algorithm::trim_copy; const auto npos = std::string::npos; if(line.find("}") != string::npos) break;