diff --git a/CMakeLists.txt b/CMakeLists.txt index 6691e1a..90577e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ set(SOURCE ml.cpp ml_io.cpp ml_date.cpp + ml_string.cpp clib/csvparser.cpp clib/sslclient.cpp clib/json11.cpp ml_date.h ml_date.cpp) @@ -32,3 +33,7 @@ set(SOURCE add_executable(${PROJECT_NAME} ${SOURCE}) target_link_libraries(${PROJECT_NAME} stdc++ m ssl crypto) + +INSTALL(TARGETS ml + CONFIGURATIONS Release + DESTINATION /usr/local/bin/) diff --git a/Readme.md b/Readme.md index 3eb1ec3..e688eaf 100644 --- a/Readme.md +++ b/Readme.md @@ -1,11 +1,12 @@ ### TODO -- date support - - decode-universal-time -- logical operators +- print-table +- download 1 year of data from api.nasdaq.com into test dir +- support for including lisp libs at startup from dir - documentation +- rename data.csv and add more tickers +- logical operators - add url of source/inspiration to clib/*.cpp -- support for including lisp libs - add stdtest - to test every functionality - rename ivaluize - add benchmark @@ -23,13 +24,14 @@ - string functions - name it here - regexp functions +- date support + - decode-universal-time +- anv function - add hash datatype - add support for nil - conversion functions like parse-integer - list function nth - in test.lisp some explaining prints -- rename data.csv and add more tickers - #### Performance - push_back - repeatedly without reserving size @@ -43,6 +45,7 @@ time ./build/ml -c '(include "../example.lisp") (print (fact 1000))' ``` ### Links +https://hyperpolyglot.org/lisp https://www.tutorialspoint.com/lisp/index.htm https://github.com/adam-mcdaniel/wisp @@ -61,4 +64,9 @@ https://stackoverflow.com/questions/25896916/parse-http-headers-in-c #### read stdout and stderr from popen -https://stackoverflow.com/questions/478898/how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po \ No newline at end of file +https://stackoverflow.com/questions/478898/how-do-i-execute-a-command-and-get-the-output-of-the-command-within-c-using-po + +#### VPS providers +https://www.skysilk.com/cloud/pricing/#classId=Standard§ion=2 +https://contabo.com/en/ +https://www.hetzner.com/de/ diff --git a/ml.cpp b/ml.cpp index 152c5d5..7c2b18f 100644 --- a/ml.cpp +++ b/ml.cpp @@ -2,6 +2,7 @@ #include "ml.h" #include "ml_io.h" #include "ml_date.h" +#include "ml_string.h" #include "csvparser.h" #include "sslclient.h" @@ -49,14 +50,6 @@ // Convert an object to a string using a string stream conveniently #define to_string(x) static_cast((std::ostringstream() << std::dec << x )).str() -// Replace a substring with a replacement string in a source string -void replace_substring(std::string &src, const std::string &substr, const std::string &replacement) { - size_t i = 0; - for (i = src.find(substr, i); i != std::string::npos; i = src.find(substr, i)) { - src.replace(i, substr.size(), replacement); - i += replacement.size(); - } -} // Is this character a valid lisp symbol character bool is_symbol(char ch) { diff --git a/ml_string.cpp b/ml_string.cpp new file mode 100644 index 0000000..118ef63 --- /dev/null +++ b/ml_string.cpp @@ -0,0 +1,14 @@ + +#include "ml_string.h" + + + +// Replace a substring with a replacement string in a source string +void replace_substring(std::string &src, const std::string &substr, const std::string &replacement) { + size_t i = 0; + for (i = src.find(substr, i); i != std::string::npos; i = src.find(substr, i)) { + src.replace(i, substr.size(), replacement); + i += replacement.size(); + } +} + diff --git a/ml_string.h b/ml_string.h new file mode 100644 index 0000000..20e5249 --- /dev/null +++ b/ml_string.h @@ -0,0 +1,12 @@ + +#pragma once + +#include "ml.h" + +#include + + +// Replace a substring with a replacement string in a source string +void replace_substring(std::string &src, const std::string &substr, const std::string &replacement); + +