IRC channel logs

2017-08-27.log

back to list of logs

<stratotanker>Hello!
<stratotanker>Can someone help me with guile foreign structs? I'll describe a struct containing a field of struct type, is this supported?
<amz3`>stratotanker: yes, it supported via scheme-bytestructures?
<amz3`>stratotanker: are you using guix?
<amz3`>stratotanker: https://github.com/TaylanUB/scheme-bytestructures
<stratotanker>amz3` no, im usign system foreign
<amz3`>stratotanker: you need to install the above ^ scheme-bytestructures
<stratotanker>I'll look at.. thanks!
<amz3`>yw!
<manumanumanu>Good day, guilers
<amz3`>tx :)
<cmaloney>greets
<cmaloney>ACTION saves you all the half-hour slowly-scrolling-sinewave of seizure-inducing-text
<amz3``>mwette: ffi helper runtime it quiet slow to compile
<amz3``>wait
<amz3``>It's me
<amz3``>its the bindings that are taking time actually
<mwette>amz3
<mwette>once compiled it should be fine. There is a LOT of code to compile.
<mwette>if you are compiling the libgit2 file
<amz3``>indeed the file is 15K LOC
<mwette>libgit2.scm is 15000 lines, so probably at least 5 k lines of code
<mwette>I get compile time of libgit2 with guile22 4m44s and with guile20 1m7s.
<mwette>OTOH `guild22 compile -O0 libgit2.scm' takes 51s.
<amz3``>oh
<amz3``>I desactivated auto compilation for the time being
<amz3``>mwette: I get the following error: libgit2/raw.scm:477:0: libgit2/raw.scm:477:0: Unbound variable: wrap-git_transfer_progress_cb
<amz3``>raw.scm is the libgit2.scm file you gave me I renamed it
<amz3``>when I look at the definition of git_transfer_progress_cb I see there is a random number at the end of the definition, something like the following: wrap-git_transfer_progress_cb-63bd61d526e9f
<stratotanker>Hello, more help within guile and FFI please. I have a C function that returns a dynamically allocated string (char*). I don't know how to free this string. I'm thinking about make a foreign pointer to free and call it passing the string. I'ts right or there is a better way?
<mwette>hmm, something amiss. I get the undefined wrap also for guile22. I need to add the function wrappers. You could define that as identity for now.
<mwette>I don't know what the random number is: looks like an address.
<mwette>stratotanker: I don't know that one. Maybe you can make an ffi for free() and pass it the pointer
<stratotanker>mwette thanks for reply, I'll put a tag and continue, maybe there is a better clean way to do this :)
<mwette>jobs
<amz3``>mwette: what the difference between /p and other macros?
<amz3``>oh
<amz3``>it also defines pointer descriptors
<amz3``>I get it
<mwette>"with pointer"
<amz3``>there is something wrong with 'define-fh-function' macro
<amz3``>on my side at least
<mwette>here is what I currently have:
<mwette>(define-syntax define-fh-function
<mwette> (lambda (x)
<mwette> (define (stx->str stx)
<mwette> (symbol->string (syntax->datum stx)))
<mwette> (define (gen-id tmpl-id . args)
<mwette> (datum->syntax
<mwette> tmpl-id
<mwette> (string->symbol
<mwette> (syntax-case x ()
<mwette> ((_ name return-t args-t)
<mwette> (with-syntax ((desc (gen-id x #'name "-desc"))
<mwette>
<mwette>I have also added this to the libgit2.scm:
<mwette>(define void intptr_t) ;; no void in bytestructures
<mwette>
<amz3``>I have that
<amz3``>the problem is with 'export' and 'syntax-case' thing
<amz3``>I will try to make a small example
<dustyweb>hi #guile
<amz3``>o/
<mwette>I get the unbound wrap-git_transfer_progress_cb
<mwette>but not for any other function typedefs. so odd
<amz3``>now I have another behavior... seems like define-syntax doesn't behave correctly in front of 'export'
<amz3``>or I am mis-using define syntax
<amz3``> http://paste.lisp.org/display/354505
<amz3``>wait I made a mistake obv
<mwette>Now if I swap decl's of git_transfer_progress_cb and git_transport_message_cb I get error that wrap-git_transport_message_cb is undefined.
<amz3``>same here
<amz3``>I will paste the result of the macro expander on that expression
<amz3``> http://paste.lisp.org/display/354506
<amz3``>I changed a little the definition of define-fh-function to use define-public, the problem is the same
<amz3``>e.g. it define the following 'git_transfer_progress_cb-desc-11a3102235694990' and then try to export 'git_transfer_progress_cb-desc'
<mwette>Maybe my use of #'( (aka (syntax ) and the defined "desc" is not right.
<amz3``>I think there is an issue between 'wrap' syntax defined in `define-fh-function/p` and the `wrap` syntax defined in `define-fh-function` without the p
<amz3``>when you use define-fh-function alone it works
<amz3``>mergin both macro into a single macro solve the issue
<amz3``>I got a bunch a undefined symbols due to the fact that I use an old-ish libgit2 and things compiled fully
<amz3``>now let's add some sugar.
<mwette>I think you are onto something.
<janneke>a mescc-built tinycc: mes-tcc just compiled its first working executable
<ijp>gratz
<mwette>janneke: nice work.
<happy_gnu[m]>Hi :)
<happy_gnu[m]>I just want to invite you to #lgn
<happy_gnu[m]>Is a channel we have to play libre games
<janneke>mwette: thanks!
<happy_gnu[m]>We play each week a different game at a different time so every time zone can join
<happy_gnu[m]>We only play libre games :)
<happy_gnu[m]> http://libregamenight.xyz/schedule.html
<amz3``>mwette: I tested basic stuff and it seems to work
<amz3``>mwette: I am not sure yet what to do with the procedure generated with define-fh-compound
<amz3``>et al.
<mwette> https://github.com/TaylanUB/scheme-bytestructures
<mwette>bytestructures allows you to get/set structure field values
<mwette>you can make a structure with (make-foo_t <values>) where values is bytevector (there may be other choices -- can't look now)
<stratotanker>hello, I'd like to debug an error in a script. I tried to run guile with --debug but nothing happen, also using (debug) at the beginning of the wrong code does not help, please someone can help?
<manumanumanu>stratotanker: did you try starting it from the repl?
<manumanumanu>start guile and then use (load "your-file-here.scm")
<stratotanker>manumanumanu, sorry I'm pretty new to scheme, I didn't try this, please wait a sec...
<stratotanker>nothing changed
<manumanumanu>but now you can inspect the error
<manumanumanu>what error do you get btw?
<stratotanker>I cannot, I think because of my catch block
<manumanumanu>from the repl you can try it with different inputs to try to narrow down what the problem might be
<manumanumanu>stratotanker: I am probably not the right person to help though, since I do (display)-driven debugging
<stratotanker>Uh, I do it in the same way in C
<manumanumanu>Do you have any code I can look at?
<stratotanker>especially when working with cross compiled executable
<stratotanker>sure! pastebin?
<manumanumanu>yeah
<stratotanker>okay, whait a sec please
<stratotanker>manumanumanu https://pastebin.com/XS0c3Bu5
<stratotanker>I got: wrong-type-arg (#f Wrong type to apply: ~S (0) (0))
<manumanumanu>stratotanker: and you are sure that is where things break?
<stratotanker>but, apart from this case, there is a debug mode in guile? like gdb? Remember, I'm pretty new and this maybe a stupid question :\\
<manumanumanu>Most people debug in the repl. You can inspect the continuations and bound variables and such
<manumanumanu>in the repl you can type ,help debug and get more info
<stratotanker>removing catch blocks i get backtrace and some info
<manumanumanu>anyway, that error seems to imply that something is #f and you are trying to use it as a procedure
<stratotanker>sure I'm using catch in a wrong way
<stratotanker>always catch #t
<stratotanker>:\\
<manumanumanu>and btw: (while (not (eq? iterator #f)) is the same as (while iterator
<manumanumanu>since anything not #f is truthy
<stratotanker>also if iterator is not always a boolean?
<manumanumanu>stratotanker: yes
<stratotanker>it's a foreign pointer
<manumanumanu>truthy
<stratotanker>okay, many thank's, sorry for basic questions
<manumanumanu>I'm just glad I can be of any help.
<manumanumanu>anyway, what are you writing? it seems dangerous :D
<stratotanker>It's gnu fdisk, I'm restarting from scratch using scheme
<manumanumanu>:)
<stratotanker>anyway also backtrace is not helpful to me
<stratotanker>maybe this https://www.gnu.org/software/guile/docs/docs-1.8/guile-ref/Single-Stepping-through-a-Procedure_0027s-Code.html#Single-Stepping-through-a-Procedure_0027s-Code
<rekado>davexunit: do you know if there’s a usable guile-yaml library?