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
groovy2shoes has joined #picolisp
orivej has quit [Ping timeout: 252 seconds]
shpx has joined #picolisp
<Regenaxer> freeemint__, rob_w (not here atm) with my help did some things for HAGL Biogas and Mibtec.de
rob_w has joined #picolisp
<Regenaxer> Hi rob_w! freeemint__ asked for HAGL Biogas and Mibtec.de yesterday. You are famous! :)
<rob_w> ??
<rob_w> wtf
<rob_w> so is he related ?
<Regenaxer> yeah, I'm wondering too where he found it
<Regenaxer> No idea
<Regenaxer> oops
shpx has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shpx has joined #picolisp
<Regenaxer> bbl
orivej has joined #picolisp
<cess11_> I would guess he saw the Github repos.
<Regenaxer> ret
<Regenaxer> Github for Hagl or Mibtec? I don't think so
shpx has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
aw- has quit [Quit: Leaving.]
orivej has quit [Ping timeout: 256 seconds]
<tankf33der> Regenaxer: here ?
<Regenaxer> yip
<tankf33der> back to getaddrinfo
<tankf33der> getaddrinfo(NULL, MYPORT, &hints, &servinfo)
<tankf33der> last argument address to address
<Regenaxer> ok
<Regenaxer> So you must pass a struct with a single pointer in it
<Regenaxer> (list NIL (8) P)
<tankf33der> sizeof servinfo is 48
<tankf33der> struct size 44
<Regenaxer> (setq p (native ... malloc 44))
<Regenaxer> (setq P (native ... malloc 44))
<Regenaxer> no
<Regenaxer> positive number, stored as an unsigned byte value
<Regenaxer> so above is wrong
<tankf33der> stuck
<Regenaxer> (list NIL (8) (cons P 8))
<Regenaxer> a pair (num . cnt) where 'num' is stored in a field of 'cnt' bytes
<Regenaxer> ie you pass a struct of size 8, no return value
<Regenaxer> it contains a single pointer
<Regenaxer> P of size 8
<tankf33der> I I I I I N N N in struct ?
<tankf33der> right?
<Regenaxer> one more N
<tankf33der> socklen_t ai_addrlen; is 5
<tankf33der> socklen_t ai_addrlen; is 4
<Regenaxer> 4 Is and 4 Ns
<tankf33der> checked this
<Regenaxer> ok
<Regenaxer> I see
<Regenaxer> So should be OK
<tankf33der> no :(
<Regenaxer> if P is your struct
<tankf33der> current code
<tankf33der> P is R anyway
<Regenaxer> You pass (list NIL (8) (cons P 8)) as last arg to getaddrinfo(NULL, MYPORT, &hints, &servinfo)
<Regenaxer> looks good. What goes wrong?
<tankf33der> (1174247480 32524 1174247480 32524 0 0 0 0)
<Regenaxer> You don't need malloc() for the hints
<tankf33der> output from struct is wrong
<Regenaxer> just pass directly
<tankf33der> i will later change hints
<Regenaxer> Maybe the struct is padded?
<tankf33der> like this
<Regenaxer> ok, hints are not the problem, yes
<tankf33der> this is struct
<Regenaxer> Are you sure your lib does not used aligned structs?
<Regenaxer> so that ai_addrlen is 8 instead of 4?
<beneroth> hi all
<Regenaxer> Hi beneroth
<beneroth> Hi Regenaxe, tankf33der :)
<tankf33der> i've check size of every member of structure
<Regenaxer> in include only, or in C code?
<tankf33der> in c code
<Regenaxer> printing the real struct offsets
<Regenaxer> ok, good
<tankf33der> manually
<Regenaxer> perfect
<Regenaxer> hmm, so what goes wrong?
<Regenaxer> Are *all* values wrong in (1174247480 32524 1174247480 32524 0 0 0 0)?
<tankf33der> should be (0 2 0 16 ....)
<Regenaxer> ok
<Regenaxer> I cannot see a simple error
<Regenaxer> no
<Regenaxer> not sizeof the elements
<Regenaxer> but the offsets of the addresses
<Regenaxer> might be padded to be aligned
<tankf33der> let me check then
<Regenaxer> Like in sysdefs.c
<Regenaxer> (char*)&act.sa_handler - (char*)&act)
<Regenaxer> always the offset from an element
<Regenaxer> hmm, but can't be the problem
<Regenaxer> : (hex 1174247480)
<Regenaxer> -> "45FD9838"
<Regenaxer> this never gives (0 2 0 16 ....)
<Regenaxer> Something else must be wrong
<tankf33der> maybe because of nil
<Regenaxer> a null pointer gives 0 in pil
<tankf33der> next:
<tankf33der> if i use
<tankf33der> #(list NIL (8) (cons R 8))
<tankf33der> '(R (8 . I))
<tankf33der> if i use '(R (8 . I)) instead of (list NIL (8) (cons R 8))
<tankf33der> then struct prints:
<tankf33der> (0 2 1 6 16 54053847047340032 0 54053984486293504)
<tankf33der> even canonname is 0
<tankf33der> next:
<tankf33der> if i use '(I I I I N N N N) instead of (I I I I I N N N)
<tankf33der> struct prints:
<tankf33der> (0 2 1 6 16 38963632 0 38963664)
<Regenaxer> I'm lost ... ;)
<tankf33der> addresses in the same range of R
<Regenaxer> So many versions
<Regenaxer> But you are very close!
<tankf33der> i get (0 10 1 6 28 27482544 0 27482592)
<tankf33der> should be (0 10 1 6 16 ...)
<tankf33der> so all above is wrong too.
<tankf33der> but close.
<Regenaxer> yeah
<tankf33der> offset is 4 4 4 4 4 8 8 8
<Regenaxer> Isn't the first offset always zero?
<tankf33der> as i see always zero
<Regenaxer> what you printed was *sizes*, right
<Regenaxer> freeemint__, cess11_: SSE works flawlessly now. I released it in new pil version
<cess11_> Awesome.
<Regenaxer> So the problem was really only the Chunked format
<cess11_> And rob_w has some Mibtec-related stuff in his Github, that's what I meant.
<Regenaxer> Wait delays are not necessary
<Regenaxer> ah
<beneroth> SSE?
<Regenaxer> beneroth, see chat log
<Regenaxer> Lot of work over the weekend, 100% busy Sat and Sun
<beneroth> so you get some free time now, Regenaxer ?
<cess11_> Ah, so the chunking was the problem.
<Regenaxer> yes
<Regenaxer> beneroth, why free time?
<beneroth> for yourself, after working the weekend ^^
<beneroth> hu I didn't even know about SSE :O nice thing
<Regenaxer> cess11_: and *only* the chunking. I did the wrong test ;)
<beneroth> chunking is tricky
<Regenaxer> beneroth, yes, me too. Stumbled across it
<Regenaxer> sse is much better than web sockets for some applications
<Regenaxer> or even better for all
<beneroth> unfortunately its turned of in browsers by default for whatever reasons
<cess11_> sc
<beneroth> Google wants to push HTTP2 instead. though I don't see the value of HTTP2 over HTTP1 with TLS and pipelining
<Regenaxer> indeed
<Regenaxer> Speed is not a problem I have currently anyway
<cess11_> Same. HTTP2 mainly matters to the big companies handling lots of data that isn't their own, ISP:s and the like, as I understand it.
<Regenaxer> T
<freeemint__> Regenaxer: https://pastebin.com/mwXfUX8v why does that code does not end up in an endless "blamming"
<Regenaxer> Some indented code would be nice ;)
<freeemint__> should i indent it?
<freeemint__> the three lines
<Regenaxer> One line is truncated
<Regenaxer> (de er_angefangen (PID)
<Regenaxer> (wait 200)
<Regenaxer> (prinl *Pid " sagt: " PID " war Schuld")
<Regenaxer> (tell PID 'er_schuld *Pid)
<Regenaxer> (tell) )
<Regenaxer> (unless (setq *der_andere (fork))
<Regenaxer> (setq er_angefangen NIL)
<Regenaxer> (de er_schuld (PID)
<Regenaxer> (prinl *Pid " sagt: Aber " PID " hat angefangen")
<Regenaxer> (tell PID 'er_angefangen *Pid) (tell)) (w$
<Regenaxer> But what do you mean?
<freeemint__> sorry a part of the line was cut of
<freeemint__> now indented too
<Regenaxer> good
<Regenaxer> thx
<freeemint__> 25342 sagt: 25344 war Schuld
<freeemint__> 25344 sagt: Aber 25342 hat angefangen
<freeemint__> and then it stops
<freeemint__> i wanted to figure out 'tell
<Regenaxer> yes, good
<freeemint__> and this was one testcase
<freeemint__> Why does'nt the "discussion" go on forever?
<Regenaxer> you can send 'tell' only to children and sisters
<Regenaxer> but one process is parent
<Regenaxer> you must (fork) twice
<freeemint__> how do you talk with a parent?
<freeemint__> i see
<freeemint__> then i can implement a ruhe_is message
<Regenaxer> Parent is possible via 'boss'
<freeemint__> "Ruhe is"
<freeemint__> why not with tell?
<freeemint__> for what reason?
<Regenaxer> Because the messages are handled by the parent
<Regenaxer> Doesnt look for a message to itself
<freeemint__> and how does boss work then?
<Regenaxer> The idea is that the parent does no real work, to keep it free
<Regenaxer> boss goes via a named pipe
<Regenaxer> @lib/boss.l
<freeemint__> ah
<Regenaxer> Only for top-level parent
<freeemint__> could you make it more explicit in the doc?
<Regenaxer> Recommended is to make two children
<freeemint__> yes
<freeemint__> i see
<Regenaxer> Which part more explicit?
<freeemint__> to all children of this process and to all childrens of the parent process (but not the parent which handles the message) (doc 'tell)
<freeemint__> Was ist mit Neffen?
<Regenaxer> also not
<Regenaxer> only these two steps
<freeemint__> i see
<freeemint__> does oss allow to reach Neffen
<freeemint__> 'boss
<Regenaxer> No, only to the parent
<Regenaxer> you could use (udp) to get arbitrary other processes
<freeemint__> how would that work?
<Regenaxer> or (tell Pid 'tell ...
<Regenaxer> one process could listen in a task with udp
<freeemint__> so the other process open (port T)
<Regenaxer> But by far the easiest is one level of siblings
<Regenaxer> The DB is also only communicated between these
<Regenaxer> as it uses tell
<freeemint__> or (tell 'route_to goal 'Content
<Regenaxer> yes, possibly
<Regenaxer> or just modify some DB objects
<Regenaxer> then everybody can pick what it is interested in
<freeemint__> Does it mean that you can break something in the db if you have Neffen and großenkel access the db which not share a parent?
<Regenaxer> yes, this can break something if they commit data which are out of date
<Regenaxer> For the most general case set up a TCP connection
<freeemint__> Is that sufficently documented?
<Regenaxer> then the processes may be even on different machines
<Regenaxer> Sure! :)
<Regenaxer> If not, you are welcome to write a Wiki article ;)
<freeemint__> ok
<Regenaxer> The above restrictions are there for efficiency
<Regenaxer> to make life for the parent easier
<freeemint__> Regenaxer: You use irc on a phone alot
<Regenaxer> it is a tablet
<freeemint__> can you recommend any app (that may deal well with interupted connection)
<freeemint__> Why do you write afp then?
<Regenaxer> away from penti?
<freeemint__> ahh
<freeemint__> lachflash
<Regenaxer> I have this irc process running on a server in my basement
<Regenaxer> Then connect with ssh -> tmux -> ircd to that server
<freeemint__> but no man in the middle srever written in pil?
<Regenaxer> It the tablet is off, the irc daemon continues
<Regenaxer> man in the middle between what?
<freeemint__> ... does ot matter
<freeemint__> apa
<freeemint__> *afa
<freeemint__> (away from acer)
<Regenaxer> haha
<tankf33der> Regenaxer: here ?
<tankf33der> it prints "after NIL"
<tankf33der> are you sure (list NIL (8) (cons R 8)) is correct ?
<Regenaxer> 'R' is not set anywhere?
<tankf33der> it should ?
<tankf33der> or not
<Regenaxer> R is NIL if not set
<Regenaxer> (setq R (native .. malloc ?
<tankf33der> (setq R (native "@" "malloc" 'N 48))
<Regenaxer> (list NIL (8) (cons R 8)) passes the *value* of R
<Regenaxer> (list NIL (8) (cons R 8)) should be (NIL (8) (123456789 . 8))
<Regenaxer> a struct which is not *read* after calling native
<Regenaxer> Not read, because the pointer is not changed, right?
<tankf33der> not changed
<Regenaxer> ok
<Regenaxer> "getaddrinfo" does not change the location this arg points to
<tankf33der> but struct after native prints garbage.
<Regenaxer> So R is not NIL?
<tankf33der> not NIL
<Regenaxer> ok
<Regenaxer> let me check the "getaddrinfo" man page
<Regenaxer> Why does it need a pointer to a pointer?
<tankf33der> int getaddrinfo(const char *node, const char *service,
<Regenaxer> and not simply a pointer to a struct?
<tankf33der> struct addrinfo **res);
<tankf33der> const struct addrinfo *hints,
<Regenaxer> yes
<Regenaxer> why?
<tankf33der> it creates a list inside getaddrinfo
<Regenaxer> ahh
<tankf33der> a list!
<tankf33der> yes.
<Regenaxer> then the value *is* changed!
<Regenaxer> realloc()
<Regenaxer> makes sense then
<Regenaxer> then you must get the value back
<Regenaxer> (list 'R (8) (cons R 8))
<Regenaxer> you get then (123456789) in R
<Regenaxer> or a new pointer
<tankf33der> after NIL
<Regenaxer> or always a new pointer?
<Regenaxer> if always new, then you don't need to malloc yourself
<Regenaxer> just (free) afterwards
<tankf33der> i dont do malloc and R is NIL after:
<tankf33der> (list 'R (8) (cons R 8))
<Regenaxer> yes, sorry
<Regenaxer> a cons pair for the size and result specification in the CADR
<Regenaxer> then you need (list 'R (8 . N) (cons R 8))
<Regenaxer> you get back the 123456789
<tankf33der> 8 . N is 8*8?
<Regenaxer> and if you dont alloc, then just
<Regenaxer> '(R (8 . N) (0 . 8))
<Regenaxer> ie pass zero for the pointer
<Regenaxer> legal?
<Regenaxer> *if* it always returns a new pointer
<Regenaxer> (sorry, did not read the man page)
<Regenaxer> So it all depends what getaddrinfo expects, and what it does and returns
<Regenaxer> ☆ a variable in the CAR (to receive the returned structure data, ignored
<Regenaxer> when the CAR is NIL)
<Regenaxer> ☆ a cons pair for the size and result specification in the CADR (see
<Regenaxer> above), and
<Regenaxer> ☆ an optional sequence of initialization items in the CDDR
<Regenaxer> I always also have to look this up ;)
<tankf33der> is it from reference?
<Regenaxer> exactly
<Regenaxer> I thought you know
<Regenaxer> Without this it is impossible to use 'native' :)
<Regenaxer> Can't remember
<tankf33der> ive read it a million times
<tankf33der> nothing without real practise
<Regenaxer> Whenever you ask me for native, I look it up there
<Regenaxer> I can't do it out of my head
<Regenaxer> But it is a complete description I think
<Regenaxer> All there what is needed
<tankf33der> doest work
<tankf33der> doesnt work
<tankf33der> it returns 4 items list
<tankf33der> wrong on third item
<tankf33der> first two is correct :)
<Regenaxer> In 'R'?
<Regenaxer> R should be a pointer
<tankf33der> after 38331248
<tankf33der> R 38332880
<tankf33der> (0 2 2 17 16 38332848 0 38332880)
<tankf33der> R 38332800
<tankf33der> (0 2 1 6 16 38331296 0 38332800)
<tankf33der> (0 2 3 0 2891346282582900752 38332928 0 0)
<tankf33der> i do (setq R (last ...))
<tankf33der> to move to next struct in list from getaddrinfo
<tankf33der> third list should be (0 2 1 132 16 ....)
<Regenaxer> Check hard all arguments again
<Regenaxer> You talk about the struct pointed to by the return value in R?
<tankf33der> let me show latest code again
<tankf33der> again and again
<tankf33der> :
<Regenaxer> good :)
<Regenaxer> Why do you use @@ here?
<Regenaxer> It is in a 'load'ed file?
<Regenaxer> @@ is set only in a console repl
<tankf33der> i always do it for temp variable.
<Regenaxer> ok
<Regenaxer> Let me try it in a single line
<Regenaxer> Hints is just '(NIL (48) . 0), right?
<Regenaxer> So what we want to test is only:
<Regenaxer> (native "@" "getaddrinfo" 'I "127.0.0.1" "80" '(NIL (48) . 0)
<Regenaxer> '(R (8 . N) (0 . 8)) )
<Regenaxer> ?
<Regenaxer> "80" : Not a number?
<Regenaxer> After the above line, I do
<Regenaxer> : (struct R '(I I I I I N N N))
<Regenaxer> -> (0 2 2 17 16 0 2378252653130940416 2378252721850417276)
<Regenaxer> (here on my tablet, no idea what is expected)
<tankf33der> trying on archlinux
<Regenaxer> Hints all zero is OK?
<Regenaxer> (NIL (48) . 0)
<Regenaxer> 48 bytes zero
<Regenaxer> I think the above native call is correct
<Regenaxer> it is the 'struct' perhaps
<tankf33der> 130244642733031424 and 130244780171984896 are not address like in R
<tankf33der> 30324896
<Regenaxer> yeah
<Regenaxer> (0 2 1 6 16 is correct?
<Regenaxer> or (0 2 2 17 16 0 in my case?
<tankf33der> YES!
<tankf33der> yes, correct!
<tankf33der> third is (0 2 1 132 16 ...)
<tankf33der> last (0 2 5 132 16 ...)
<Regenaxer> (I I I I I N N N)) must be wrong
<tankf33der> i've check sizes and offsets
<tankf33der> i think so :/
<Regenaxer> This looks better here:
<Regenaxer> : (struct R '(I I I I N N N N))
<Regenaxer> -> (0 2 2 17 16 0 533129674800 533129674816)
<Regenaxer> : R
<Regenaxer> -> 533129674752
<Regenaxer> All pointers it seems
<Regenaxer> So at least on my machine the struct is (I I I I N N N N)
<Regenaxer> Thus, socklen_t ai_addrlen; must be 8 bytes
<Regenaxer> on Android at least
<tankf33der> try take next
<tankf33der> and third
<Regenaxer> ?
<tankf33der> like this
<tankf33der> now trying the same steps on centos7
<tankf33der> this is centos7:
<tankf33der> eh.
<tankf33der> much better.
<tankf33der> three items in the list
<tankf33der> c code shows 4 :)
<Regenaxer> yeah
<Regenaxer> :)
<tankf33der> i will look at this again then.
<tankf33der> it works
<tankf33der> issue closed.
<tankf33der> getaddrinfo(argv[1], "http", &hints, &res)
<tankf33der> getaddrinfo(argv[1], "80", &hints, &res)
<tankf33der> returns different results and i compare wrong way.
<tankf33der> huge step forward.
<Regenaxer> great! :)
<tankf33der> out
<beneroth> wow nice work
orivej has joined #picolisp
rob_w has quit [Quit: Leaving]
shpx has joined #picolisp
<cess11_> Yeah, quite interesting.
alexshendi_ has joined #picolisp
freeemint__ has quit [Ping timeout: 260 seconds]
freemint_ has joined #picolisp
<rick42> hi folks! hope you all are doing well
<Regenaxer> Di rick42! Sure we do! :)
tankf33der has quit [Quit: Connection closed for inactivity]
<rick42> :)
<freemint_> rick42: i do to
nonlinear has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]