IRC channel logs

2016-08-21.log

back to list of logs

<sethalves>is define-public after a (define-module ...) the same as define followed by export?
<mark_weaver>yes
<sethalves>I'm messing around with this ao project, and if I apt-get install guile-2.0, I get 2.0.11+1-10 and it largely works. If I build guile from git, it fails with Unbound variable: ao-init-guile
<mark_weaver> http://git.savannah.gnu.org/cgit/guile.git/tree/module/ice-9/boot-9.scm#n3428
<mark_weaver>sethalves: the 'master' branch from git is what will become guile-2.2.x. I guess there's some incompatibility there, it would require some investigation
<sethalves>maybe I would get that error if anything failed inside the "(ao bind)" library
<sethalves>yeah I would stick with a released version, but I'm trying to see if another problem I'm having is fixed with newer guile
<amz3`>sethalves: I used 2.1.3 and it kind of works, except you can not (ao-watch "/path/to/some/file")
<sethalves>exactly -- that's why I was trying newer guile
<sethalves>though I can't get the dynamic-link to work with 2.1.3
<amz3`>IMO it has a performance issue, during my tests to develop an lsystem for ao, they was some instances of my solutions that could not be rendered
<sethalves>oh, I've no doubt there's a lot of room for improvement, but openscad's input language is enraging
<amz3`>sethalves: I am amirouche from github
<amz3`>I should be sleeping now, see you later
<sethalves>ah, ok I'm ... uh nevermind
<amz3`>I should be sleeping, see later
<amz3`>ACTION sleeps...
***micro` is now known as Guest55518
<amz3`>héllo #guile
<artyom-poptsov>Hello amz3`
<amz3`>artyom-poptsov: kudoz for the release of guile-ssh
<artyom-poptsov>amz3`: Thanks!
<paroneayea>greets
***holomorp1 is now known as holomorph
<paroneayea>o/
<stis>heya
<paroneayea>ACTION reads through the "Programming in C" docs to find out why two of the tests e ported for custom input/output port don't work
<roelj>I have a rather large char* in C (~1GB) that I would like to use as a string in Guile Scheme. What's an efficient way to expose it? (I now use scm_from_locale_string(), but I think it's allocating the string inside that function..)
<sneek>roelj, you have 1 message.
<sneek>roelj, ng0 says: If you have been working on gparted in may this year, is this still being worked on or should the email thread be bumped to attention again?
<spauldo>OK, I'm reading in the docs and trying to figure out the best way to represent a C struct from a system library in guile.
<spauldo>(I'm trying to add drawing support to guile-sdl2)
<spauldo>Anyway, what I'm seeing here is make-foreign-object-type and friends, but apparently they create GOOPS classes, which would add a dependency. I want to be able to create SDL_Rect structures and pass pointers to them to C functions.
<roelj>spauldo: There's probably a better way, but I just pass pointers using scm_from_pointer() and scm_to_pointer() in C.
<spauldo>Am I missing something, or am I going to have to add GOOPS?
<roelj>spauldo: Then scm_from_pointer() and scm_to_pointer() might be just what you are looking for :)
<spauldo>I saw those, but I need to actually create the objects from scheme and send the pointers from there. I'm not seeing how to do that.
<roelj>Oh
<spauldo>there's no C function that I can pass parameters to and get a pointer to an SDL_Struct
<spauldo>yeah, that's what's got me confused
<spauldo>The way davexunit has written things, there's no C code at all, so I can't just make a C function to do it for me.
<roelj>Actually.. what about writing a C wrapper function and return a scm_from_pointer() with the SDL_Struct pointer?
<spauldo>I thought about that, but that'd add C code to his library. I've been trying to figure out how to do it without adding any dependencies.
<roelj>Oh, right.. Using the foreign function interface..
<roelj>Sorry, I don't have any experience with that.
<spauldo>Yeah, I don't either. Thanks anyway, though. I'll probably just have to wait for davexunit to get on and ask him, since it's his code.
<spauldo>hrm, can you do pointer arithmetic in scheme with that dynamic-pointer?
<fantazo>why is there actually a treeIL, a GLIL and the actual assembly representation? partly I understand why it's needed partly I don't.
<spauldo>was thinking if you could do pointer arithmetic, it'd be a (admittedly hacky) way for you to access that 1G char* you were talking about without allocating a 1G scheme object.
<spauldo>ACTION is wondering if he'll be shot for suggesting pointer arithmetic for scheme :)
<roelj>I hoped there was some way to construct a SCM string and set the value pointer to the string (avoiding allocation)..
<roelj>spauldo: That's actually a nice thought.. :P
<spauldo>the pointer arithmetic or shooting me for blasphemy?
<roelj>the pointer arithmetic
<roelj>haha
<amz3`>spauldo: there is already guile-bytestructures
<amz3`>roelj: what does the string contain?
<amz3`>roelj: did you have a look at pointer->bytevector?
<amz3`>you need something similar to this but for string... I am not sure how pointer->string works, maybe it makes copy... dunno
<roelj>amz3`: It contains a DNA sequence.
<roelj>amz3`: Thanks for pointing that out.. I will have to try and see what my memory usage does.. :)
<spauldo>amz3`: looks interesting, but it'd be another dependency. I'm just wanting to create structs in guile (as defined in a C header file) and pass pointers to them to C functions. Does scheme-bytestructres offer me anything there that I can't get from the FFI?
<amz3`>spauldo: guile bs is candidate for inclusion in guile
<amz3`>spauldo: for wiredtiger i had to deal with structs too, but those were simple, all structs contained only pointers so the arthythmetique was simple
<amz3`>spauldo: can you give an example of struct you want to access from guile?
<amz3`>spauldo: basically the idea, is to do (pointer->bytevector ...) and (bytevector->pointer ...) and then use some bytevector ref procedure to access the fields
<spauldo>sure. I need to pass SDL_Rect and various similar structs to drawing functions in SDL's renderer. They only contain ints. Here's SDL_Rect: https://wiki.libsdl.org/SDL_Rect
<amz3`>if it sound scary it's because it is ;)
<amz3`>this one looks simple tho
<spauldo>well, it's just that a) it's not my codebase so I don't want to add dependencies that aren't strictly necessary and b) I'm a guile noob so I don't want to send davexunit unacceptable patches
<spauldo>yeah, it looks pretty simple, I'm just trying to figure out of there's a way to do it in the FFI without adding GOOPS or any other dependencies.
<amz3`>goops why goops?
<amz3`>spauldo: you'd rather ask davexunit whether guile-bs can be added as dependency first. That's for SDL_Rect it doesn't seem necessary
<spauldo>well, I lost the page (I've got a million tabs open) but the functions I was looking for created C structs, but they were GOOPS objects
<amz3`>spauldo: basically you need to fiddle with (make-bytevector ...), (pointer->bytevector ...) and (bytevector->pointer ...) from (rnrs bytevectors)
<amz3`>you look for this https://wiki.libsdl.org/SDL_BlitSurface?
<amz3`>ACTION goes to sleep
<spauldo>I'll check into that, thanks for the advice
<spauldo>Actually, make-c-struct might be what I was looking for.
<stis>evening folks!, Ahh, been family focused today, lot's of time wiht the kids, fantastic! Their sleeping so no over to an hour of guile coding to have some adult fun as well!
<spauldo>an hour of guile coding would be nice. I just wish I was past the point where an hour of guile coding wasn't interspersed with three hours in the guile manual :)
<stis>lol, it will come, it will come ;)
<zv>hey guys, i'm having trouble getting `scm_gc` to work on my MIPS router.
<zv>it just crashes with a segfault
<zv>along with a few other issues
<spauldo>OK, so I want to pass an array of pointers to a C function. Is there a cleaner way than using bytevectors?
<spauldo>I'm using the FFI here.
<roelj>So, I malloc() a structure in C and then expose a pointer to Scheme for it, then when I free() the structure in C Guile spikes to 100% CPU and eventually crashes.. What am I suppose to do to clean up without Guile CPU-spiking or crashing?
<random-nick>roelj: I think you need to register a finalizer from C for your pointer
<random-nick>roelj: see https://www.gnu.org/software/guile/manual/html_node/Garbage-Collecting-Smobs.html#Garbage-Collecting-Smobs and https://www.gnu.org/software/guile/manual/html_node/Garbage-Collection.html#Garbage-Collection
<roelj>random-nick: Thanks. I am going to try that.