IRC channel logs
2016-11-01.log
back to list of logs
<spk121>hi. I actually released something in Guile that used the FFI. First time giving the FFI a proper go. <daviid>spk121: I tought you were an expert in usig guile's ffi :) <spk121>Wrapping up C -> FFU all seems a bit manual. Has somebody scripted or made tools to do that automatically. <spk121>daviid: haha, the old school C style stuff. I'd never really used (system foreign) <daviid>spk121: not that I'm aware of, because you'll quiclky realize that it quicly need fine tuning, automatic wrapping is not necessary good <spk121>daviid: yeah, you are probably right. <daviid>ah, good, I did see the email, but did not looked at the code <kori>otherwise, looks pretty good <amz3>but there almost only white textures :/ <paroneayea>and amz3 fiiiinally responded to your feedback, thx for it <dsmith-work>paroneayea: What's this AvtivityPub thing for/about? <janneke>next syntax-case breakthrough with mes! <janneke>after annotating psyntax.ss and comparing guile and mes runs, i found <janneke>that worked nicely until now, but breaks portable syntax's define-syntax <janneke>so, i need two lambdas...the symbol and the...other thingy <janneke>grmbl...having [']*lambda be a symbol always broke many things <janneke>apparently (obviously), having [']*lambda never be a symbol also breaks things <janneke>i find it terribly difficult to distill such essential/minimal bits of `what is scheme' out of the r*rs stuff ;-) <janneke>dsmith-work: i'm trying to remove the need for bootstrap binaries in guix <janneke>dsmith-work: my strategy is to create a minimal scheme ~1000 lines of C and implement a minimal c compiler in Scheme <janneke>currently, mes can do most of r5rs, now i'm looking at syntax-case <janneke>hi wingo! i have rebased mark_weaver's reproducible-go patch onto master and found that all tests pass...but mark's + my patch onto 2.1.4 fail make check (so guix says) <janneke>so now i'm trying to build 2.1.4 + 15 patches on master + reproducible-go for guix <wingo>you are saying that master+patch works but 2.1.4+patch does not? ok <wingo>could be because of the precompiled .go files perhaps? <wingo>janneke: what if you take the latest tarball from hydra <wingo>the hydra tarballs have the prebuilt .go files <wingo>so in that way you can see whether it's prebuilt/ which is causing you problems or not <janneke>i'm now running make dist on master+patches and want to apply 2.1.4->master ... <janneke>hmm...guile-next in guix removes all .go files; i think i need that <wingo>if that's the case, then prebuilt/ is not the problem <wingo>there were some important bugfixes since 2.1.4, maybe your changes require them. not likely tho <janneke>it looks like that...stack overflow/thread stuff not sure <janneke>now that i'm talking to you...i tried to send kind of a bug report to -devel some time ago that ,break and ,break-at-source are broken in master <janneke>i kind of need those to test my Emacs GUD integration...but i fear that i' missing something as there were no replies <wingo>prolly just an oversight, i am behind on email again <wingo>& in a crunch time at work so i don't get much daytime to poke guile <janneke>wingo: thanks...there should be some way to get such info...i'm often terribly unsure whether to ping or to just wait and assume: X is busy <wingo>hoo, documenting terrible things is the worst <paroneayea>wingo: should I cherry-pick the stable-2.0 patch to provide against the http attack stuff to master and push that? <wingo>paroneayea: that would be great :) <wingo>also any other stable-2.0 patches <paroneayea>wingo: well I don't know what other stable-2.0 patches there are, but I guess "if I see 'em, I'll cherry pick 'em" <wingo>if you are able to cherry-pick any ancestor patches also <wingo>otherwise don't do it because then there's a risk that we don't do it <wingo>because we forget about unapplied older patches <wingo>also! let's do it only if the test is fixed <wingo>rlb reported a bug in the test <wingo>what modern distros support ia64? <daviid>wingo: for info, yesterday civodul resonded to rlb here, that he could not reproduce the bug upon running this test only <daviid>that was the day before actually, he wrote: '"while ./check-guile 00-repl-server.test ; do : ; done" seems to work for me'. but then I (daviid) did not read all logs since :) so maybe this info is outdated ... <daviid>I'm on debian, just pulled the latest and here I get an error as well: <daviid>guile: uncaught throw to misc-error: (dynamic-pointer Symbol not found: ~a (scm_init_ice_9_threads) #f) <daviid>Cannot exit gracefully when init is in progress; aborting. <daviid>I'm doing too many things at the same time! <daviid>and now, make -j4, I can cook an egg on my laptop :) <paroneayea>ACTION files a weird bug, maybe it's related to recent suspendable ports stuff, dunno what else it could be <daviid>folks, help! in order to call g_value_init, I need to initialize a pointer to a zero filled mem block, ana a gtype (which is a numerical value). guile-gnome is doing this: "GValue value = { 0, };" then calls g_value_init (&value, gtype) <daviid>(g-value-init (make-c-struct (list int) (list 0)) gtype) <daviid>so, 40 is the gtype numrical value for gfloat <daviid>(g-value-get-float (g-value-init (make-c-struct (list int) (list 0)) 40) <daviid>(process:20017): GLib-GObject-CRITICAL **: g_value_get_float: assertion 'G_VALUE_HOLDS_FLOAT (value)' failed <daviid>I have no idea why it triggers the warning and yet returns the proper value (which is expected) <wingo>you need to initialize the type of the value as well <wingo>ah you are saying 40 is the value; dunno <daviid>wingo: all happens as if (make-c-struct (list int) (list 0)) is not equivalent to &{0, } ? <daviid>returns a poiter to a 0 intialzed gfloat <daviid>unless (make-c-struct (list int) (list 0)) is 'missing' something <daviid>(g-golf-go-g-value-get-float $3) <daviid>(process:20017): GLib-GObject-CRITICAL **: g_value_get_float: assertion 'G_VALUE_HOLDS_FLOAT (value)' failed <daviid>I wonder if I should use glib mlloc instead what would happen? <daviid>but it is stranged to me that (make-c-struct (list int) (list 0)) does not seem equivalent to &{0, } is there a way to proove this or make me believe it is equivalent? :) <daviid>so, using 2.0.13.1-27247: while ./check-guile 00-repl-server.test ; do : ; done works fine <wingo>daviid: {0,} means initialize the value to 0 <wingo>but the value can have more than one field <wingo>so i think your prob is that you are allocating a value whose size doesn't match gvalue's size. <daviid>I don't see you are doing anything else, between these to lines, you do not 'further' affect value <daviid>hence, I thught, (make-c-struct (list int) (list 0)) should do the same <daviid>but it seems it is not the same: would it be an FFI 'problem' maybe? I confess I'm a bit lost here <wingo>it is ffi related but the problem is that you are not allocating the full structure <wingo>you are playing wild-west games with the ffi :) <daviid>ah, sur I'm :), but are you allocating the full strcture? I read this: GValue value = { 0, }; <daviid>what is the ffi correspondent call then? <daviid>ACTION is learning by doing here ... <wingo>you can't know from reading it <wingo>you need to look at the struct gvalue definition <daviid>wingo: they have a macro to initialize, which reads #define G_VALUE_INIT { 0, { { 0 } } } <daviid>so I guess I have to write e scheme version of this <dsmith-work>daviid: Wouldn't (make-c-struct (list int int) (list 0 0)) do? <daviid>dsmith-work: you tell me :), what the ffi call is for { 0, { { 0 } } }? <daviid>dsmith-work: that did not work, it still triggers a warning <daviid>I'm sure a C and ffi expert will kindly tell me how to write this { 0, { { 0 } } in guile <dsmith-work>Well that depends on what structure you are initializing <daviid>this fails: (make-c-struct (list int int) (list 0 0)) [(process:22801): GLib-GObject-CRITICAL **: g_value_get_float: assertion 'G_VALUE_HOLDS_FLOAT (value)' failed.. <wingo>you need to look at the gvalue type definition. <daviid>wingo: I don't understand, ebassy just wrote, on #introspection: <daviid>In C: GValue v = G_VALUE_INIT; g_value_init (&v, G_TYPE_FLOAT); float <daviid>I thought in scheme, (let ((v (make-c-struct (list int int) (list 0 0)))) ...) would do the same <daviid>so, in C, float f = g_value_init ... coerce the result to be a float, but how do i do that with the ffi? you mean I have to look at the gfloat gvalue (and all other gtype ...) ? of course guile-gnome did not have to do that, because that part is all in C ... <wingo>daviid! please go look where "struct GValue" is defined :) <paroneayea>*something* changed, I wasn't hitting this before, but now i'm hitting it with guile 2.0 too <paroneayea>considering switching my user and system profiles back a couple revisions and see if it's still happening there. <dsmith-work>daviid: Looks like it is struct _GValue in gobject/gvalue.h <daviid>dsmith-work: I just fail to understand how to define this in scheme <dsmith-work>So that struct has two memebers, a GType and an array of length 2 of a union. <daviid>dsmith-work: thanks, code please? <dsmith-work>GType is a gsize. Not sure how big that is, but I can't see why it would be anything other than a size_t <daviid>I read in the doc #define G_VALUE_INIT { 0, { { 0 } } } <dsmith-work>I'm guessing that struct is a total of 3 64bit things in size. <dsmith-work>daviid: So try (make-c-struct (list int64 int64 int64) (list 0 0 0)) <dsmith-work>daviid: See, C knows exactly how big that thing is, and if there is any padding and aligment. <daviid>scheme@(guile-user)> (g-golf-go-g-value-init 40) <dsmith-work>daviid: So when you are initializing a stuct with a literal, you don't have to provide all the details. That "{ 0, { { 0 } }" is not providing all the details. <dsmith-work>Probably should be more like {0,{{0},{0}}}, though {0,0,0} would work in old C (not sure about new C) <daviid>dsmith-work: what do you mean new/old C? {0,{{0},{0}}} would be what in schem then? <dsmith-work>daviid: I've been doing C for a long time. Since pre-ANSI <daviid>dsmith-work: all above my head for now <daviid>but i expect to 'just' query glib, gobject, or even our ffi ot do the right thing <daviid>so when you say it should be this instead, {0,{{0},{0}}}, i need to write the scheme code for this ... <dsmith-work>daviid: Ok, I was just saying that the size of that struct might be different on a 32bit system. <dsmith-work>daviid: And the C compilers handles that for you. But you are doing it by hand, so you might need to know. <daviid>dsmith-work: yes, but in C they don't 'take care' of this, so how do I do take care? <dsmith-work>daviid: In C, the compiler knows the size of that struct. You as a programmer don't know or care. But using the ffi you *do* need to know the size. <daviid>maybe I should query the system at init, like bytestructure does <dsmith-work>daviid: So (make-c-struct (list size_t int64 int64) (list 0 0 0)) <daviid>I just had a lbg talk with ebassy and he says 'impossible to write a binding whitout any C code <daviid>he said "... You cannot have *zero* C code ... At least, no other language binding does that ..." <daviid>but then with no C code how do I do this: (GTypeInstance *)(obj)->g_class <dsmith-work>Right, because you haev to know exactly how the C compiler lays out paddding and sizes. <daviid>dsmith-work: this size_t works fine as well, as expected I guess <sapientech>hi all, how would i change the name of define-module so that files can use that macro? <sapientech>for example, a file could start with (new-module-name (same-or-different-patterns-as-define-syntax ...)) <daviid>dsmith-work: thanks, beback later