From 5afa7dd69ff7bd15e2065ff1811b6a78dd3a6d03 Mon Sep 17 00:00:00 2001 From: VaclavT Date: Mon, 29 Mar 2021 23:18:29 +0200 Subject: [PATCH] compile on linux --- Readme.md | 7 ++++--- clib/csvparser.cpp | 3 ++- ml.cpp | 5 ++++- ml_profiler.cpp | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Readme.md b/Readme.md index d465748..028abb1 100644 --- a/Readme.md +++ b/Readme.md @@ -7,7 +7,7 @@ ### TODO -- add total tuntime into -p +- replace to_string macro in ml.cpp - add debug support, at least call stack - documentation - add url of source/inspiration to clib/*.cpp @@ -20,7 +20,7 @@ - file functions - name it here - string functions - - compare - needed for sorting + - compare - needed for sorting, cmp ignore case - regexp functions - date support - decode-universal-time @@ -34,10 +34,11 @@ - create pastebin like web using ml #### Performance +- define is one of most frequent callee, when in scope with very few vars, lookup sequentially - push_back - repeatedly without reserving size - range - with for(int i...) and reserving result size can be 3times faster on (range 1 10000) - mini_sprintf - unnecesary copying between vector and list -- (do ..) repeatedly assign to acc, maybe somewhere else +- (do, scope ..) repeatedly assign to acc #### Install ``` diff --git a/clib/csvparser.cpp b/clib/csvparser.cpp index 2448504..dc46cb3 100644 --- a/clib/csvparser.cpp +++ b/clib/csvparser.cpp @@ -1,5 +1,6 @@ #include "csvparser.h" +#include CsvParser::CsvParser(bool skip_hdr, char field_sep, char quote_ch, char line_sep, char line_sep2) { @@ -119,4 +120,4 @@ bool CsvParser::is_string_float(const std::string &s, double &val) const { if (errno == ERANGE && (val == HUGE_VAL || val == -HUGE_VAL)) return false; if (val == 0 && errno != 0) return false; return true; -} \ No newline at end of file +} diff --git a/ml.cpp b/ml.cpp index 80bb2f7..7af1322 100644 --- a/ml.cpp +++ b/ml.cpp @@ -51,8 +51,11 @@ // Convert an object to a string using a string stream conveniently +#if __APPLE_ #define to_string(x) static_cast((std::ostringstream() << std::dec << x )).str() - +#elif __linux +#define to_string(x) static_cast((std::ostringstream() << std::dec << x )).str() +#endif // Is this character a valid lisp symbol character bool is_symbol(char ch) { diff --git a/ml_profiler.cpp b/ml_profiler.cpp index e987d9c..d333d69 100644 --- a/ml_profiler.cpp +++ b/ml_profiler.cpp @@ -4,6 +4,7 @@ #include #include #include +#include using namespace std::chrono;