load stdlib code bit simplyfied

This commit is contained in:
VaclavT 2021-03-22 06:52:10 +01:00
parent 48ad953648
commit f0fab9a9ec
2 changed files with 12 additions and 13 deletions

View File

@ -1,17 +1,18 @@
### BUGS
- (read-file "nonexisting/file.csv") shows only "could not open file" - should print filename
- error: the expression `("/usr/local/var/mlisp")` with message "cannot cast" - should add to what is casting
- better error reporting..for example ls_dir on non existing dir should prind `pwd` dir
### TODO
- documentation
- add url of source/inspiration to clib/*.cpp
- add stdtest - to test every functionality
- add -l option (no linenoise)
- rename ivaluize
- add -sb option to remove sheebang line
- add instrumentation (time, nr of evals, num of atoms, debug info, debug environment etc)
- add -p (profile/performance option)
- add debug support function call could keep call stack
- add better print (coloring output)
- multiline editting (kilo editor)
- execute system command should capture stderr
- add built in for and, or
@ -51,7 +52,7 @@ cp stdlib/*.lsp /usr/local/var/mlisp/
#### Compile
```
gcc -std=c99 -c -O2 -o linenoise.o clib/linenoise.c
c++ -c -O2 -I/usr/local/opt/openssl/include -Iclib --std=c++17 ml.cpp ml_io.cpp ml_date.cpp ml_string.cpp ml_util.cpp clib/json11.cpp clib/csvparser.cpp clib/sslclient.cpp clib/printf.cpp
c++ -c -O2 -I/usr/local/opt/openssl/include -Iclib --std=c++17 ml.cpp ml_io.cpp ml_date.cpp ml_string.cpp ml_util.cpp ml_profiler.cpp clib/json11.cpp clib/csvparser.cpp clib/sslclient.cpp clib/printf.cpp
c++ -o ml -O2 -L/usr/local/lib -L/usr/local/opt/openssl/lib -lm -lstdc++ -lcrypto -lssl -Wl,-stack_size -Wl,0x1000000 *.o
```
or

18
ml.h
View File

@ -10,16 +10,14 @@
const std::string VERSION = "mi 0.1 (" __DATE__ " " __TIME__ ")";
const std::string STDLIB_LOADER =
R"( (define ___lib_path '("/usr/local/var/mlisp"))
(for d ___lib_path
(if (is-dir? d)
(for f (ls-dir d)
(if (string-regex? f "^.*\.l(i)?sp$")
(include (+ d "/" f))
'())
)
'()))
)";
R"(
(do (define ___lib_path "/usr/local/var/mlisp")
(if (is-dir? ___lib_path)
(for file (ls-dir ___lib_path)
(if (string-regex? file "^.*\.l(i)?sp$")
(include (+ ___lib_path "/" file)))
)))
)";
// Forward declaration for MlEnvironment class definition