Recent posts

#21
newLISP in the real world / Re: Can't load sqlite library ...
Last post by rrq - January 20, 2025, 02:16:04 PM
At a guess libm is missing in the chroot. Check library dependencies with ldd.
#22
newLISP in the real world / Can't load sqlite library in c...
Last post by vetelko - January 20, 2025, 11:53:00 AM
Hi guys,

I can load libsqlite3 in normal environment but NOT while in chroot. It is interesting that other libraries like libc can be loaded as you can see in the following example:

gringo: ~ $: newlisp
newLISP v.10.7.6 64-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h

> (import "/var/www/usr/lib/libsqlite3.so.8.6")
true

Now chroot, the same library file with different path of course:

gringo: ~ $: doas chroot -u www -g www /var/www /usr/bin/newlisp
newLISP v.10.7.6 64-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h

> (import "/usr/lib/libsqlite3.so.8.6")

ERR: problem loading library in function import : "Cannot load specified object"

> (import "/usr/lib/libc.so.100.3" "printf")
printf@D5CDE4B7A40
>
gringo: ~ $:

ANY idea?
#23
newLISP in the real world / fuzzylisp
Last post by vashushpanov - January 19, 2025, 08:04:15 PM
At 2006 was alive site http://www.fuzzylisp.com where I may find file fuzzylisp.lsp. It was written on newlisp. And now it not working. I was search this file on internet, but find nothing. Anybody may help me? And send fuzzylisp.zip to vashushpanov@gmail.com. Thanks!
#24
newLISP in the real world / Re: How to compile static sing...
Last post by vetelko - January 17, 2025, 12:04:23 AM
Thank you rrq .. will try it :)
#25
newLISP in the real world / Re: How to compile static sing...
Last post by rrq - January 15, 2025, 02:22:19 AM
The steps I take are basically to
1. first create the makefile_build the normal way and then
2. copy that to a makefile_static file which I hand-edit:
3. remove -DFFI -DREADLINE (see below) from the CFLAGS setup
4. change the "default:" target action to be the two steps
  $(CC) $(OBJS) -m64 -o newlisp -static -Wl,-Bstatic -lm -lc
  strip newlisp

That's with gcc on a linux amd64 (devuan). I've got libc.a and libm.a from the libc6-dev package, and I don't include the FFI and READLINE options for it. Thoug I think you can find .a libraries for them too (libreadline-dev and libffi-dev packages)

EDIT: digging up that old project, I realized it needed musl-gcc as well; gcc doesn't seem to be capable of static binaries.

EDIT: maybe I confused myself; it seems gcc does it well too, and then you may also include ffi and readline (+termcap).
#26
newLISP in the real world / How to compile static single f...
Last post by vetelko - January 15, 2025, 01:51:33 AM
Hi guys, can anyone help me out? Is it possible to compile newlisp statically so I don't have to copy all dependency libraries from /usr/lib/... into the chroot? I need single big fat binary :)

I think Ted Walther mentioned in one of his posts that he managed to do it on OpenBSD (which is also my system). But he doesn't explain how :)
#27
newLISP in the real world / Re: replace help
Last post by joejoe - November 14, 2024, 04:49:02 PM
Ok roger that, rrq.

I did not realize the interactive mode would display differently.

And thanks for the println tip, makes it much prettier.

Thanks again for clarification and detailed explanation!

Much appreciated.
#28
newLISP in the real world / Re: replace help
Last post by rrq - November 13, 2024, 04:38:35 PM
Yes it can be a bit confusing. The string returned by replace does have single-quotes replaced by double-quotes, but the interactive result output presents the double-quotes prefixed by backslash.

Thus, when the string has a double quote, the result printing of that string shows \" so as to indicated that the double-quote is not ending the string. Likewise, the result printing adds the double-quotes before and after printing the string content, and those double-quotes are not characters in the string.

If you make it be
(print (replace ....))then the string will be printed without extras before double-quotes, but the interactive output coming after will still show the string with that meta-character wrapping.

In short, a string of a single double-quote characters is written "\"", and it will be taken as such if input and printed as such by the interactive output. The print function doesn't add meta-characters. Here's an illustration example:
> (println "\"")
"
"\""
>
The first line is what the println function prints (which is the "raw" string content with a newline added at end), and the second line is the interactive output of the value returned by the println function (the same string but with meta-characters to make it be the character sequence the input reader would need).
#29
newLISP in the real world / Re: replace help
Last post by joejoe - November 13, 2024, 10:04:40 AM
Side note, I managed to get a json output from the python file, which feeds nicely into
json-parse.

Of course, I am still curious how I should correctly swap the ' for a " in the
replace function.
#30
newLISP in the real world / Re: replace help
Last post by joejoe - November 13, 2024, 09:49:59 AM
Thanks Ralph,

I am using this to get data from a python script:

(set 'a (exec "python3 go.py"))
So when it arrives to my nL script, it is a string inside of a list.

With your suggestion, I managed to get it to the string with this:

(set 'b (a 0))
and can then run this:

(replace "\'" b "\"")
Which returns this:

"{\"symbol\": \"BURT/USDT\", \"timestamp\": None, \"datetime\": None, \"high\": 0.002463, \"low\": 0.001605, \"bid\": None, \"bidVolume\": 1731397.09898224, \"ask\": None, \"askVolume\": 2732456.21823022, \"vwap\": None, \"open\": 0.002136, \"close\": 0.002051, \"last\": 0.002051, \"previousClose\": None, \"change\": -8.5e-05, \"percentage\": -3.9794007490636703, \"average\": 0.002093, \"baseVolume\": 10255192.67905658, \"quoteVolume\": None, \"markPrice\": None, \"indexPrice\": None, \"info\": {\"close\": \"0.002051\", \"high\": \"0.002463\", \"last\": \"0.002051\", \"low\": \"0.001605\", \"market\": \"BURTUSDT\", \"open\": \"0.002136\", \"period\": \"86400\", \"value\": \"21214.1562025586145\", \"volume\": \"10255192.67905658\", \"volume_buy\": \"1731397.09898224\", \"volume_sell\": \"2732456.21823022\"}}"
Is there an way to keep the "\" from appearing, as I was trying to escape the middle " ?

Much appreciated again!