ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Picolisp latest found at http://www.software-lab.de/down.html | check also http://www.picolisp.com for more information
aw- has joined #picolisp
rob_w has joined #picolisp
orivej has joined #picolisp
aw- has quit [Quit: Leaving.]
yunfan has quit [Ping timeout: 268 seconds]
mtsd has joined #picolisp
karswell_ has quit [Remote host closed the connection]
karswell_ has joined #picolisp
<Nistur> Regenaxer: this may be a bit of a silly question, but if I'm writing a C<-->pil wrapper for imagemagick, would you like for me to pull it out as a standalone pil library, so other people might be able to use it? Would anyone be interested in it?
<Regenaxer> Not sure. In my view, pil32 is quite obsolete, so I would not waste too much effort on it
<Nistur> well... my intention is that I'll get my program working in pil32 because that's what I have working now... then I'll extend the native wrapper to support pil64... it will mean rewriting a bunch of stuff, sure, but I will have a test case then to make sure it all works fine
<Regenaxer> For pil64 we need no wrapper
<Nistur> hmmm, so it will just be a (de im:genesis () (native "libMagickWand.so" "MagickWandGenesis")) :P
<Nistur> but having a look at the MagickWand stuff, there are a few things which might make sense to be more lispified, rather than just exposing everything directly
<Regenaxer> Yes, but still it is a completely different glue. Basically just one-liners I would think
<Nistur> also, pil32 works on all my systems without problem, even the 64 bit computers I have have more issues with pil64... I will admit to not having tried particularly hard on my linux x64 system, but as I said, it's the computer I use least frequently, so even if that does work, it doesn't help my development overly much... I couldn't get pil64 running natively on macOS, or as emu on any machine... so even
<Nistur> if pil32 is obsolete, it's the solution I have that works :P
<Regenaxer> Perhaps not completely obsolete :)
<Regenaxer> But all new things went into pil64
<Nistur> like native :P
<Regenaxer> I definitely would go with emu
<Regenaxer> yes
<Regenaxer> or coroutines and namespaces
<Nistur> is there a reason they couldn't be backported to pil32? If I decided I needed one of them _could_ I make them work do you think?I am not sure I do, I'm just curious :)
<Regenaxer> also some debug things and DB acceses
<Regenaxer> yes
<Regenaxer> It needs assembly in most cases
<Regenaxer> well, coroutines need it
<Regenaxer> namespaces could be implemented, but it is a lot of work
<Regenaxer> pil32 uses a different hashing internally
<Nistur> I don't think that I will need any of those things for my current project... buuuuuuuuuuuuuuut it may be something which would interest me to do in future, to try and get more feature parity... as a learning exercise the same as all my other projects :) I tend to pick projects which are barely useful just to see how they'd work
<Regenaxer> yes, good thing :)
<Regenaxer> Even mobile devices are mainly 64-bit these days
<Regenaxer> And Apple prohibits 32-bit Apps
<Nistur> I am not saying I'm normal by any means, but I own more 32 bit devices than 64 bit ones
<Regenaxer> yes, you said
<Nistur> I probably have approaching the same amount of 16 bit ones too :P
<Nistur> and a couple of 8 bit ones
<Nistur> apparently I also own a device with a hybrid 64-bit/20-bit CPU, that acts like a 4-bit processor
<Nistur> my beloved HP-48G calculator :P
<Regenaxer> cool :)
<Nistur> I'm not saying that I'll get pil working on my calculator... but if I had some time off work, it would be quite high on my list of things to try to do for the hell of it :P
<Regenaxer> yep, but the 'emu' ;)
<Regenaxer> s/the/then
<Nistur> Regenaxer: as you weren't aware of the compiling sword fighting, do you know xkcd at all?
<Regenaxer> sure
<Nistur> ahh, so you know the two comics I was going to link then :P
<Regenaxer> I even have a (paper) book
<Regenaxer> which ones?
<Regenaxer> The first one yes, but not the second :)
<Nistur> :)
<Regenaxer> The first one I found (and saved the image) even before I knew xkcd
<Nistur> if you save the image, you lose the alt text though!
<Regenaxer> Anyway, don't you give 'emu' another try on your systems?
<Regenaxer> As I understand it, the problem yesterday had to do with -fpic
<Regenaxer> Position-independent code
<Nistur> well, for my Asus transformer (x64 CPU, but running x86 OS because of reasons) emu builds
<Regenaxer> ok, good to know
<Regenaxer> iirc it complained about symtab
<Regenaxer> *FPic (bool (opt)) in src64/mkAsm.l
<Nistur> I think I've changed the source folders since I've tried last time... I THINK I got the previous attempts from the website directly, but now everything's pointing to the bitbucket I was linked to the other day
<Regenaxer> (if *FPic
<Regenaxer> (in "emu.symtab"
<Regenaxer> (setq
<Nistur> this version builds on my pi as well
<Regenaxer> is it the newest?
<Nistur> from bitbucket, yes, as of yesterday
<Nistur> I didn't pull today
<Regenaxer> good
<Regenaxer> Latest is from 10th
<Nistur> ok, macOS still complains
<Regenaxer> But these things did not change anyway
<Regenaxer> "emu.symtab" thing?
<Nistur> yup
<Regenaxer> It must be this *FPic issue
<Regenaxer> in Makefile:
<Regenaxer> ./mkAsm $(ARCH) "$(SYS)" $(FMT) $(OS) base "" ...
<Regenaxer> the "" corresponds to *FPic in mkAsm.l
<Regenaxer> So strange, it must be NIL (ie. "")
<Regenaxer> Perhaps it needs a 'make clean' first? Some old stuff lying around?
<Nistur> wat
<Nistur> no
<Nistur> that pasted the wrong thing
<Regenaxer> :)
<Nistur> ahh
<Nistur> I got lazy with autocomplete
<Nistur> I pasted err.l rather than err.log
<Nistur> make clean first doesn't make any difference
<Nistur> I get the same error if I just call make in there
<Regenaxer> Strange
<Regenaxer> ah
<Regenaxer> "$(SYS)" is empty
<Regenaxer> that's the reason
<Nistur> the makefile doesn't appear to have an entry for Darwin
<Regenaxer> right
<Nistur> I will fork the repo at lunch and try and add one myself, then I can supply a PR and feel like I've been helpful :P
<Regenaxer> Perfect!
<Regenaxer> I hope there is not another obstacle on Darwin
<Nistur> is that repo (mmamkin/picolisp) the right one to send a PR to? There's a picolisp/picolisp on github...
<Regenaxer> No, send it to me
<Regenaxer> The repos are fed from my releases
<tankf33der> you dont need fork repo, just download latest picoLisp.tgz
<Nistur> ok
<Regenaxer> yeah, the repo is to better track the changes
<tankf33der> the only way for humans.
<Regenaxer> :)
<Nistur> I'm just used to forking and sending pull requests with changes :P
<Regenaxer> yeah, sorry, I have my own style of source maintenance
<Regenaxer> Historically grown that way
<Nistur> that's fine :)
<Regenaxer> Oohh, Fuchsia will not be Linux
<Regenaxer> Seems I have a problem then with PilBox
<Nistur> ?
<Nistur> oh.
<Nistur> interesting
<Nistur> I'd forgotten about that
<Regenaxer> Almost all my work goes into PilBox since months. It will probably not work any more
<Regenaxer> 4 commercial projects for me :(
<Nistur> :(
<Regenaxer> I totally depend on it
<Nistur> and it wouldn't work to port pil/pilbox to fuschia/Zircon?
<Nistur> also, I'm curious... do you mind sharing what commercial projects you have running on pil? I'm interested to know what it's used for :)
<Regenaxer> I don't know
<Regenaxer> Currently it is just Linux below
<Regenaxer> Three of them are logistics programs
<Regenaxer> in two of them I use distributed databases server/mobiles
<Regenaxer> One is for fire brigades, also distribute DB
grp has joined #picolisp
mtsd has quit [Quit: Leaving]
<Nistur> Regenaxer: nice :)
<Nistur> Regenaxer: it wasn't so simple :P
<Regenaxer> Makefile?
<Nistur> yeah, that wanted a sys/x86-64.darwin.{code,defs}.l
<Regenaxer> oops, yes
<Nistur> I have tried copying the linux one (maybe openBSD would be better?)
<Nistur> and then I get...
<Nistur> just a sec
<Regenaxer> hmm, but emu should not need this (?)
<Nistur> this is make emu
<Regenaxer> It should use only src64/sys/emu.code.l
<Regenaxer> etc.
<Regenaxer> And the system dependent constants are generated on the fly by sysdefs
<Nistur> ahh wait
<Regenaxer> from sysdefs.c
<Nistur> I think I missed a bit from the Makefile
<Regenaxer> I don't remember well at the moment ;)
<Nistur> nope, still same error
<Regenaxer> Did it build the 'sysdefs' binary?
<Nistur> yup
<Regenaxer> sysdefs: sysdefs.c
<Regenaxer> I$(CC) -o sysdefs -D_FILE_OFFSET_BITS=64 sysdefs.c
<Regenaxer> emu.base.o: sysdefs emu.base.c
<Regenaxer> I$(STRIP) sysdefs
<Regenaxer> I$(CC) -c -O -fomit-frame-pointer -D_FILE_OFFSET_BITS=64 emu.base.c
<Regenaxer> This is strange: as -o x86-64.darwin.base.o x86-64.darwin.base.s
<Regenaxer> It should compile C not asm
<Regenaxer> emu.base.c
<Regenaxer> was emu.base.c generated?
<Regenaxer> This is assembly: .globl Led
<Nistur> I don't see it
<Regenaxer> Makefile says emu.base.o: sysdefs emu.base.c
<Regenaxer> $(bin)/picolisp: $(ARCH)$(SYS).base.o
<Regenaxer> Hmm, so it is *correct* if SYS is empty!!
<Regenaxer> grr, I hate Makefile
<Regenaxer> Better make a 4-line script
<Nistur> yeah, I'm particularly useless at debugging makefiles :P
<Nistur> I've taken to using a makefile generator, as I can debug that easier, and I (usually) trust it to generate the makefile I want
<Regenaxer> Let me fiddle out a script
<Nistur> yessir
<Regenaxer> Sorry, was distracted
<Regenaxer> I think I got it now, clean up a little
<Nistur> it's fine, I'm meant to be working anyway ;)
<Regenaxer> :)
<Regenaxer> OK, works here:
<Regenaxer> I like such scripts *really* a lot more than an involved Makefile
<Regenaxer> Can you see if this can be adjusted to your Darwin system?
* Nistur M-x replace-string gcc ${CC}
* Nistur whisles
<Regenaxer> yep
<Regenaxer> such things
Regenaxer has left #picolisp [#picolisp]
rob_w has quit [Quit: Leaving]
Regenaxer has joined #picolisp
Regenaxer has quit [Remote host closed the connection]
Regenaxer has joined #picolisp
<Regenaxer> I add CC again
<Nistur> ld: unknown option: --no-as-needed
<Nistur> ld: unknown option: -export-dynamic
<Regenaxer> ok
<Regenaxer> yes, this is system dependent
<Nistur> Undefined symbols
<Regenaxer> sigh
<Nistur> all referenced from _opcodes in emu.ht.o
<Nistur> _A _C _Carry _Code _Data _E _FirstLib _L _PC _Result _S _X _Y
<Regenaxer> No idea
<Nistur> I'll take a looksee in a bit. I'm just hunting down why some pickups are respawning :P
<Regenaxer> Perhaps you need PIE
<Regenaxer> MacOS is pos independent
<Regenaxer> That's why pil x86-64 won't work
<Nistur> hmm
<Regenaxer> Anyway, I cleaned up my version: https://pastebin.com/x6BXWV27
<Nistur> I _do_ like the OS="Disneyland" :P
<Regenaxer> :)
<cess11_> I think Fuchsia will be weird.
<cess11_> At least from a programmers perspective, most people will like the shiny surfaces.
<Regenaxer> Let's see
<Nistur> Regenaxer: I got it to compile btw... the issue was that you have marked a bunch of things as extern, but then when you link it, you don't have emu.base.o in that library, so it cannot find it... if I add emu.base.o to all 3 targets it compiles...
<Nistur> doesn't run of course :D segfault :P
<Regenaxer> hmm, so it is a different handling of the extern directive in the C compiler?
<Regenaxer> Strange indeed
<Regenaxer> And why "of course" crashing?
<Nistur> because nothing is going right for me :D
<Regenaxer> oh ;)
<Regenaxer> It is that stupid Apple/Clang stuff
<Nistur> wasn't meant to be a statement of your code, don't worry :P
<Nistur> it shouldn't be, I'm using gcc
<Regenaxer> ah, even more strange
<Regenaxer> Then why these 'extern' issues?
<Regenaxer> "add emu.base.o" is no good idea
<Regenaxer> You duplicate all the code
<Nistur> yup, I thought so
<Regenaxer> and it is not clear what is called
<Nistur> http://ix.io/17B6 but that's what I have to make it compile and link so far
<Regenaxer> So the shared libs should not contain the base system
<Regenaxer> Marking as extern in C is fine
<Nistur> I don't disagree. I was just seeing if it would solve that error
<Regenaxer> The linker must take care of it
<Regenaxer> ok, yeah
<Regenaxer> It must be some linker option
<Regenaxer> The SHARED options
<Regenaxer> ah, because you removed the xx-dynamic-yy thingy ;)
<Nistur> I have a mac mini set up at home... I also have a cisco switch in my attic... not that I don't trust you, but if I get around to it, I can set it up so it's on a separate network than my home network, and you can use it to test on :P
<Regenaxer> Something is needed to link it as a shared lib
eeproks has quit [Remote host closed the connection]
<Regenaxer> We must find out why "-export-dynamic" cannot be used
<Regenaxer> or what to use instead
<Regenaxer> afp for a while, bbl
<Regenaxer> cu! :)
<Nistur> laters
<Nistur> I'm compiling with gcc-7 not clang
<Nistur> I have it compiling nicer now, I copied some flags from the 32 bit makefile :P
<Nistur> it's still segfaulting
<Nistur> so I'm checking out what gdb says
<Nistur> I assume, even when running picolisp without any files (ie not through pil) then it still loads and parses some lisp, based on what it's doing here...
<Regenaxer> ret
<Nistur> wb
<Nistur> Regenaxer: compilation works now
<Nistur> MAIN="-rdynamic -lc -lm -ldl" | PICOLISP-FLAGS = ${M32} -rdynamic
<Nistur> SHARED="-shared -rdynamic -undefined dynamic_lookup"
<Nistur> ... oops
<Nistur> well, I guess ignore the right hand side, the left is what seems to be correct... I didn't mean to paste in here
<Nistur> it still segfaults
<Regenaxer> But build passes without error now?
<Nistur> yes
<Regenaxer> Very good
<Nistur> I don't know what the -Wl,--no-as-needed was, but it wasn't in pil32
<Regenaxer> Let's see *where* it crashes
<Regenaxer> Can you start only bin/picolisp ?
<Nistur> I tried running it gdb and asking for a backtrace and it said nothing :(
<Nistur> no stack.
<Regenaxer> I see
<Regenaxer> So only the binary bin/picolisp crashes?
<Nistur> yes
<Regenaxer> ie. no files loaded
<Regenaxer> How about $ strace bin/picolisp
<Nistur> this one I have also not built with -O or -fomit-frame-pointer, but with -g
<Nistur> I as trying to get some debug output from it
<Regenaxer> Good
<Nistur> strace isn't installed, seeing if it's in homebrew now
<Regenaxer> Well, gdb should be fine
<Regenaxer> It does not even say "in ..." something?
<Nistur> Bad instruction
<Nistur> is all I get
<Nistur> (gdb) r
<Nistur> Bad instruction
<Nistur> warning: unhandled dyld version (15)
<Nistur> [New Thread 0x1403 of process 96636]
<Nistur> Starting program: /opt/picolisp/bin/picolisp
<Nistur> [Inferior 1 (process 96636) exited with code 0160]
<Nistur> (gdb) bt
<Nistur> No stack.
<Nistur> (gdb)
<Regenaxer> Looks like at the very beginning
<Nistur> I can put a breakpoint in main and step though it
<Regenaxer> ok
<Nistur> but it seems to loop for a long time
<Regenaxer> just 'ni' and keep Enter pressed ;)
<Nistur> well, I was using s
<Nistur> but yes, that's what I was doing :P
<Regenaxer> Yep, 's' is fine here
<Regenaxer> as we compiled from C
<Nistur> the regular pattern in the lengths of the lines suggests this is looping indefinitely
<Regenaxer> Initializing perhaps
<Nistur> maybe
<Nistur> I have my wallet weighing down enter for now
<Regenaxer> haha :)
<Regenaxer> In the beginning the heap is filled with a "avail" list of free cells
<Nistur> every 3rd line is switch(*PC++)
<Nistur> then something, then obviously a break;
<Regenaxer> yes, the internal interpreter
<Regenaxer> bytecode, not bytes however
<Regenaxer> it is 16 bit words
abel-normand has joined #picolisp
<Regenaxer> in run() in emu.base.c
<Nistur> that seems correct
<Regenaxer> yes, is run()ning ;)
<Nistur> it's still going
<Nistur> presumably this should segfault at some point... or magically work while we're looking at it and hit a prompt
<Regenaxer> T, heisenbug
<Regenaxer> I just remember emu has a debug mode for such cases
<Regenaxer> some trace, let me find out
<Regenaxer> yes
<Regenaxer> just build it in debug mode
<Regenaxer> with +
<Nistur> hmm? how?
<Regenaxer> Stop gdb, it wont help much
<Regenaxer> as it just loops in run()
<Nistur> done
<Regenaxer> ok
<Regenaxer> in mkAsm
<Regenaxer> put a + at the "right" line
<Regenaxer> /usr/bin/pil mkAsm.l "$@" +
<Regenaxer> But which one is executed?
<Regenaxer> You don't have a global istall, right?
<Regenaxer> Whlch line in mkAsm was called?
<Nistur> the local one I guess
<Regenaxer> ../pil ?
<Regenaxer> It is overwritten by now
<Regenaxer> or do you have Java installed?
<Nistur> nope
<Nistur> or, I might do
<Regenaxer> ../bin/picolisp is overwritten by now ;)
<Nistur> it's not the first because I cannot write to /usr/bin without turning off something, which requires several reboots
<Nistur> I keep rebuilding it :P
<Nistur> my current build is... cd ../src && make -B && cd ../src64 && ./build-mac.sh
<Regenaxer> Perfect! Then with + at the end of the line it generates debug output
<Regenaxer> Prints each instruction of the pil VM at runtime
<Nistur> the log is 36MB
<Nistur> ix.io apparently doesn't support something that big :P
<Regenaxer> you dumped to a file?
<Nistur> yes
<Regenaxer> You can simply dump to the console and see when it stops
<Nistur> I mean, I can tell you what the last entry is, but I'm not sure if it makes sense without context
<Nistur> the last one is a ret
<Regenaxer> We see the VM assembly then
<Regenaxer> should correspond to code in main.l probably
<Nistur> I guess?
<Regenaxer> You could pastebin the last few hundred lines
<Nistur> http://ix.io/17BD (I use ix.io because I can easily use it from command line, you just pipe it to curl)
<Regenaxer> I see
<Regenaxer> cc realloc (A E)
<Regenaxer> it is in realloc then
<Regenaxer> no
<Nistur> no?
<Regenaxer> The code is
<Regenaxer> (code 'iSignalCE)
<Regenaxer> sub S (%% SIGACTION) # 'sigaction' and 'oldact'
<Regenaxer> ld (S SA_HANDLER) E # Function pointer
<Regenaxer> cc sigemptyset(&(S SA_MASK))
<Regenaxer> ld (S SA_FLAGS) 0
<Regenaxer> cc sigaction(C S 0) # Install handler
<Regenaxer> add S (%% SIGACTION)
<Regenaxer> ret
<Regenaxer> the last ret
<Nistur> that suggests that the stack may be broken, so ret is returning to somewhere incorrect?
<Regenaxer> Called from line 131 in main.l
<Regenaxer> I won't believe so, as this is not the "real" stack
<Regenaxer> It is a memory array maintained by emu as its stack
<Nistur> but if it's failing with a Bad Instruction immediately after a ret...
<Regenaxer> yeah
<Regenaxer> it is the first time iSignalCE is called
<Regenaxer> Perhaps it overwrote some memory as a side-effect?
<Regenaxer> eg the size of the signal struct is wrong
<Regenaxer> sub S (%% SIGACTION)
<Regenaxer> it allocates space
<Regenaxer> if the constant SIGACTION is too small, the system call overwrites the stack
<Regenaxer> (equ SIGACTION 152) generated by ./sysdefs
<Regenaxer> Perhaps ./sysdefs was built with the wrong environment?
<Regenaxer> 152 is here on Linux
<Nistur> my knowledge of x86/x86-64 assembler is near nil, so I don't have a clue what's going on :)
<Regenaxer> not assembler but system structures
<Nistur> ok
<Regenaxer> sysdefs.c prints all kinds of sizes and constants
<Regenaxer> So it must be compiled on the target system with the correct includes
<Nistur> (equ SIGACTION 16)
<Regenaxer> uh, that seems too small
<Regenaxer> A grep in the other systems:
<Regenaxer> arm64.android.defs.l:(equ SIGACTION 32) # Sigaction structure
<Regenaxer> arm64.linux.defs.l:(equ SIGACTION 152) # Sigaction structure
<Regenaxer> ppc64.linux.defs.l:(equ SIGACTION 152) # Sigaction structure
<Regenaxer> x86-64.freeBsd.defs.l:(equ SIGACTION 32)
<Regenaxer> x86-64.linux.defs.l:(equ SIGACTION 152) # Sigaction structure
<Regenaxer> x86-64.openBsd.defs.l:(equ SIGACTION 32)
<Regenaxer> x86-64.sunOs.defs.l:(equ SIGACTION 32) # Sigaction structure
<Regenaxer>
<Regenaxer> So some are quite small indeed
<Regenaxer> but not 16
<Regenaxer> We can see this 16 also in your debug output:
<Regenaxer> 137: call iSignalCE
<Regenaxer> FF 1 100E42523 7064752 100F46F70 100F46F58 000 0 1017A3FF8
<Regenaxer> 191: sub S 16
<Regenaxer> The first instruction in iSignalCE
<Regenaxer> hmm
<Regenaxer> Sigh, really not a lucky day today ;)
<Nistur> my stuff is really not important at all :P I can use pil32 quite happily :P
<Regenaxer> Would be nice to have emu running on Darwin though
<Regenaxer> I think Jon Kleiser (Mailing list) got it running there some time ago
<Nistur> I should probably sign up for the mailing list
<Regenaxer> yes, but you can also browse the archive
<Nistur> I just meant in general :)
<Regenaxer> yes, good idea
<Nistur> how much of pil32 is portable, d'you think? I mean, if I actually tried to build it on my PS2, which has the linux kit on it, so I've got a proper POSIX environment, with a(n albeit ancient) Linux kernel and a gcc toolchain...
<Regenaxer> Is quite portable then I think. More than pil64
<Nistur> sounds fun :D
abel-normand has quit [Ping timeout: 260 seconds]
<beneroth> hi all
<Regenaxer> Hi beneroth!
<beneroth> Regenaxer, will look into this Fuchsia news. though new Google OS does not necessarily mean that android mobiles will be a thing of the past. maybe some other company continues to develop and support it (e.g. Samsung or so?)
<Regenaxer> Yeah, I expected that too. There is a huge Android code base meanwhile
<beneroth> but yeah, so it comes as expected: Google goes opensource path to get support & gratis work by community, and then when the platform captured the market they go EEE. seems it was too hard to get the EEE fully through via proprietary pre-installed apps :/
<beneroth> similar story as with Google+ (XMPP/Jabber bridge) and other stuff
<cess11_> I think so too.
orivej has quit [Ping timeout: 268 seconds]
<Nistur> Regenaxer: ok, so using pil64 native, say I have a pair of functions in the .so which are: SomeContext* CreateContext(void); SomeContext* DestroyContext( SomeContext* ctx );... and let's say that I want to have two glue functions which for testing purposes do (destroy_context (create_context))... how would I pass things between them?
<Nistur> (native libname "CreateContext" 'N) I _think_ is the first one, but the second appears to be incorrect somehow
<Nistur> oh wait
<Nistur> ignore me
<Nistur> I forgot to put the return type in the native call
<Nistur> :D
<Nistur> I have no idea whether it's right yet, but I've hit some error reporting in the .so, so the fact it's NOT complaining now makes me happy
orivej has joined #picolisp
grp has quit [Ping timeout: 265 seconds]
alexshendi has joined #picolisp
alexshendi has quit [Ping timeout: 256 seconds]
orivej has quit [Ping timeout: 260 seconds]