geri has joined #picolisp
<
geri>
do i gotta go into the code defining sockaddr_un and see the sizes of sun_family and sun_path to make a struct in pil?
<
geri>
that's what i did for AF_UNIX but i might be stupid :D
<
geri>
(also gotta check if i can reuse pil's network builtins with sockfd created like that)
<
geri>
(following native C calls docs but kinda poorly haha)
<
abu[7]>
Yeaa, it is tough ;)
<
geri>
it also trips me up that structs in pil seem to not indicate the name of the variable but be positional or somehting
<
abu[7]>
"what i've got so far" is wrong paste
<
abu[7]>
T, just offsets
<
geri>
(i forgot an 'I in socket call
<
abu[7]>
You are on the right way
<
geri>
now just gotta figure out the struct and connect() part
<
geri>
actually the struct is only used once, could say "only the connect() part"
<
abu[7]>
You could build a 'sysdefs' for the proper offsets
<
geri>
like write my own @lib/sysdefs? 🤔
<
abu[7]>
Not in @lib
<
geri>
like an ini-style file with definitions
<
abu[7]>
You can pass your own as the second arg to 'sysdefs'
<
abu[7]>
compile @src/sysdefs.c
<
abu[7]>
Unfortunately Makefile does not preserve it
<
abu[7]>
It should better keep it in @bin/sysdefs
<
geri>
oh, that's how lib/sysdefs comes to be?
<
geri>
so the idea is i declare my struct in a C file and extract it using builtins?
<
abu[7]>
I will change Makefile
<
geri>
nasty, but let's try
<
abu[7]>
It just needs a *.h file
<
abu[7]>
but this is not included by sysdefs.c then
<
abu[7]>
So a general sysdef is not possible this way
<
abu[7]>
You need your own sysdefs.c
<
abu[7]>
That's why Makefile removes it ;)
<
geri>
i'm confused but okay :D
<
abu[7]>
Yeah, overkill
<
abu[7]>
Your way with setq is OK
<
geri>
wait, there's a connect builtin
<
geri>
what does let do if you give it uneven amount of args?
<
geri>
like let in (vi 'connect)
<
abu[7]>
The last sym is bound to NIL
<
geri>
wouldn't it anyway be interned as nil?
<
geri>
i don't understand why it's getting "declared"
<
abu[7]>
Yes, but it may already be interned and bound
<
geri>
so you ensure its unset just in case?
<
abu[7]>
Not unset, but bound to NIL
<
geri>
i meant that yes
<
abu[7]>
You could use 'use' here
<
abu[7]>
The value NIL of Sd is never used here
<
abu[7]>
It is set in the loop
<
abu[7]>
But (use Sd ..) is longer ;)
<
geri>
how is use different from let
<
abu[7]>
(use X (setq X 7) is equivalent to (let X 7
<
abu[7]>
'let' saves AND binds
<
geri>
why does it exist then 🤔
<
abu[7]>
(use (A B C) is needed sometimes
<
abu[7]>
You often need use local variables which are bound later
<
geri>
so syntactic sugar, got it :D
<
abu[7]>
'let' is just a convenience
<
abu[7]>
'let' is syntactic sugar, yes
<
abu[7]>
'use' is the "real" thing
<
geri>
very bizzare :D
<
geri>
okay, brb in 10-30 minutes
beneroth_ has quit [Quit: Leaving]
beneroth has joined #picolisp
<
geri>
(or way more)
<
abu[7]>
No worries :)
<
geri>
okay so C says my struct's size is 110...
<
geri>
(of god knows what)
<
geri>
2 for the family and 108 for path...
<
geri>
doesn't do anything :D
<
geri>
msg has to end with newline to be processed, forgetting that is usually why my stuff breaks
<
geri>
but it seems to be there
<
abu[7]>
why not
*call* (msg ...)?
<
abu[7]>
or (out sockfd ...
<
geri>
im just translating literally
<
geri>
instead of write?
<
geri>
so probably something before then is still broken
mario-goulart has quit [Remote host closed the connection]
mario-goulart has joined #picolisp
geri has quit [Remote host closed the connection]
Iacob has quit [Quit: IRCNow and Forever!]
Iacob has joined #picolisp
Iacob has quit [Remote host closed the connection]
Iacob has joined #picolisp
Iacob has quit [Remote host closed the connection]
Iacob has joined #picolisp