ml_string
This commit is contained in:
parent
a39e61a061
commit
fa7cbad70b
|
|
@ -25,6 +25,7 @@ set(SOURCE
|
||||||
ml.cpp
|
ml.cpp
|
||||||
ml_io.cpp
|
ml_io.cpp
|
||||||
ml_date.cpp
|
ml_date.cpp
|
||||||
|
ml_string.cpp
|
||||||
clib/csvparser.cpp
|
clib/csvparser.cpp
|
||||||
clib/sslclient.cpp
|
clib/sslclient.cpp
|
||||||
clib/json11.cpp ml_date.h ml_date.cpp)
|
clib/json11.cpp ml_date.h ml_date.cpp)
|
||||||
|
|
@ -32,3 +33,7 @@ set(SOURCE
|
||||||
add_executable(${PROJECT_NAME} ${SOURCE})
|
add_executable(${PROJECT_NAME} ${SOURCE})
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} stdc++ m ssl crypto)
|
target_link_libraries(${PROJECT_NAME} stdc++ m ssl crypto)
|
||||||
|
|
||||||
|
INSTALL(TARGETS ml
|
||||||
|
CONFIGURATIONS Release
|
||||||
|
DESTINATION /usr/local/bin/)
|
||||||
|
|
|
||||||
22
Readme.md
22
Readme.md
|
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
### TODO
|
### TODO
|
||||||
- date support
|
- print-table
|
||||||
- decode-universal-time
|
- download 1 year of data from api.nasdaq.com into test dir
|
||||||
- logical operators
|
- support for including lisp libs at startup from dir
|
||||||
- documentation
|
- documentation
|
||||||
|
- rename data.csv and add more tickers
|
||||||
|
- logical operators
|
||||||
- add url of source/inspiration to clib/*.cpp
|
- add url of source/inspiration to clib/*.cpp
|
||||||
- support for including lisp libs
|
|
||||||
- add stdtest - to test every functionality
|
- add stdtest - to test every functionality
|
||||||
- rename ivaluize
|
- rename ivaluize
|
||||||
- add benchmark
|
- add benchmark
|
||||||
|
|
@ -23,13 +24,14 @@
|
||||||
- string functions
|
- string functions
|
||||||
- name it here
|
- name it here
|
||||||
- regexp functions
|
- regexp functions
|
||||||
|
- date support
|
||||||
|
- decode-universal-time
|
||||||
|
- anv function
|
||||||
- add hash datatype
|
- add hash datatype
|
||||||
- add support for nil
|
- add support for nil
|
||||||
- conversion functions like parse-integer
|
- conversion functions like parse-integer
|
||||||
- list function nth
|
- list function nth
|
||||||
- in test.lisp some explaining prints
|
- in test.lisp some explaining prints
|
||||||
- rename data.csv and add more tickers
|
|
||||||
|
|
||||||
|
|
||||||
#### Performance
|
#### Performance
|
||||||
- push_back - repeatedly without reserving size
|
- push_back - repeatedly without reserving size
|
||||||
|
|
@ -43,6 +45,7 @@ time ./build/ml -c '(include "../example.lisp") (print (fact 1000))'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Links
|
### Links
|
||||||
|
https://hyperpolyglot.org/lisp
|
||||||
https://www.tutorialspoint.com/lisp/index.htm
|
https://www.tutorialspoint.com/lisp/index.htm
|
||||||
https://github.com/adam-mcdaniel/wisp
|
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
|
#### 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
|
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/
|
||||||
|
|
|
||||||
9
ml.cpp
9
ml.cpp
|
|
@ -2,6 +2,7 @@
|
||||||
#include "ml.h"
|
#include "ml.h"
|
||||||
#include "ml_io.h"
|
#include "ml_io.h"
|
||||||
#include "ml_date.h"
|
#include "ml_date.h"
|
||||||
|
#include "ml_string.h"
|
||||||
|
|
||||||
#include "csvparser.h"
|
#include "csvparser.h"
|
||||||
#include "sslclient.h"
|
#include "sslclient.h"
|
||||||
|
|
@ -49,14 +50,6 @@
|
||||||
// Convert an object to a string using a string stream conveniently
|
// Convert an object to a string using a string stream conveniently
|
||||||
#define to_string(x) static_cast<std::ostringstream>((std::ostringstream() << std::dec << x )).str()
|
#define to_string(x) static_cast<std::ostringstream>((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
|
// Is this character a valid lisp symbol character
|
||||||
bool is_symbol(char ch) {
|
bool is_symbol(char ch) {
|
||||||
|
|
|
||||||
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ml.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue