compile on linux

This commit is contained in:
VaclavT 2021-03-29 23:18:29 +02:00
parent a92020ac1e
commit 5afa7dd69f
4 changed files with 11 additions and 5 deletions

View File

@ -7,7 +7,7 @@
### TODO ### TODO
- add total tuntime into -p - replace to_string macro in ml.cpp
- add debug support, at least call stack - add debug support, at least call stack
- documentation - documentation
- add url of source/inspiration to clib/*.cpp - add url of source/inspiration to clib/*.cpp
@ -20,7 +20,7 @@
- file functions - file functions
- name it here - name it here
- string functions - string functions
- compare - needed for sorting - compare - needed for sorting, cmp ignore case
- regexp functions - regexp functions
- date support - date support
- decode-universal-time - decode-universal-time
@ -34,10 +34,11 @@
- create pastebin like web using ml - create pastebin like web using ml
#### Performance #### Performance
- define is one of most frequent callee, when in scope with very few vars, lookup sequentially
- push_back - repeatedly without reserving size - push_back - repeatedly without reserving size
- range - with for(int i...) and reserving result size can be 3times faster on (range 1 10000) - 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 - mini_sprintf - unnecesary copying between vector and list
- (do ..) repeatedly assign to acc, maybe somewhere else - (do, scope ..) repeatedly assign to acc
#### Install #### Install
``` ```

View File

@ -1,5 +1,6 @@
#include "csvparser.h" #include "csvparser.h"
#include <climits>
CsvParser::CsvParser(bool skip_hdr, char field_sep, char quote_ch, char line_sep, char line_sep2) { 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 (errno == ERANGE && (val == HUGE_VAL || val == -HUGE_VAL)) return false;
if (val == 0 && errno != 0) return false; if (val == 0 && errno != 0) return false;
return true; return true;
} }

5
ml.cpp
View File

@ -51,8 +51,11 @@
// Convert an object to a string using a string stream conveniently // Convert an object to a string using a string stream conveniently
#if __APPLE_
#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()
#elif __linux
#define to_string(x) static_cast<std::ostringstream&>((std::ostringstream() << std::dec << x )).str()
#endif
// 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) {

View File

@ -4,6 +4,7 @@
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <numeric> #include <numeric>
#include <algorithm>
using namespace std::chrono; using namespace std::chrono;