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
<daviid>need/needs
<spk121>daviid: yeah, you are probably right.
<daviid>spk121: what did you release?
<spk121>daviid: bindings for aspell
<daviid>ah, good, I did see the email, but did not looked at the code
<amz3>OrangeShark: check this out http://i.imgur.com/aLrd0Ly.png
<kori>amz3: is this yours
<amz3>yes
<kori>you misspelled personal
<amz3>why?
<kori>otherwise, looks pretty good
<amz3>thx
<amz3>:)
<kori>I like the background
<amz3>it comes from http://www.noisetexturegenerator.com/
<amz3>generated with ^
<kori>nice
<kori>thanks
<amz3>I like this textures also https://www.transparenttextures.com/
<amz3>but there almost only white textures :/
<paroneayea>whee
<paroneayea>ActivityPub CR, hopefully tomorrow
<paroneayea>and amz3 fiiiinally responded to your feedback, thx for it
<paroneayea>now, bedtime! :)
<wingo>morning :)
<amz3>o/
<dsmith-work>Morning Greetings, Guilers
<paroneayea>amz3: ping
<paroneayea>amz3: ok for me to put your activitypub feedback on https://www.w3.org/wiki/Socialwg/ActivityPub_wide_review ?
<dsmith-work>paroneayea: What's this AvtivityPub thing for/about?
<paroneayea>dsmith-work: https://www.w3.org/TR/activitypub/ federation standard
<paroneayea>I'm very actively involved
<paroneayea> http://mediagoblin.org/news/tpac-2016-and-review-activitypub.html we intend to use for mediagoblin
<janneke>next syntax-case breakthrough with mes!
<janneke>after annotating psyntax.ss and comparing guile and mes runs, i found
<janneke>mes> (symbol? 'lambda)
<janneke>$1 = #f
<janneke>
<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
<paroneayea>lambda, the ultimate lambda
<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 ;-)
<dsmith-work>janneke: What are you doing?
<wingo>evening
<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>that project is called Mes: https://gitlab.com/janneke/mes
<janneke>currently, mes can do most of r5rs, now i'm looking at syntax-case
<janneke>aiui, the meat of r6rs
<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>weird tho
<wingo>could be because of the precompiled .go files perhaps?
<janneke>yes...confuses me too
<wingo>janneke: what if you take the latest tarball from hydra
<wingo>and apply the patch
<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 ...
<wingo>will be faster anyway
<janneke>hmm...guile-next in guix removes all .go files; i think i need that
<wingo>ah
<janneke>at least for psyntax and boot-9
<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>and working on other things
<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>pinging is fine
<wingo>:)
<janneke>okay! :-)
<wingo>hoo, documenting terrible things is the worst
<paroneayea>hm
<paroneayea>wingo: should I cherry-pick the stable-2.0 patch to provide against the http attack stuff to master and push that?
<paroneayea>it doesn't look like guile master has it.
<wingo>paroneayea: that would be great :)
<wingo>well
<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
<paroneayea>ah
<wingo>also! let's do it only if the test is fixed
<paroneayea>wingo: ok, maybe I'm not qualified to do this.
<wingo>(is it?)
<paroneayea>oh
<paroneayea>I don't know!
<wingo>rlb reported a bug in the test
<wingo>on debian
<paroneayea>oops, ok
<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
<wingo>ACTION nod
<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>Aborted
<daviid>
<wingo>did you rebuild libguile?
<daviid>wingo: no, I'm doing it know
<daviid>sorry!
<wingo>:)
<daviid>I'm doing too many things at the same time!
<daviid>and now, make -j4, I can cook an egg on my laptop :)
<wingo>:)
<paroneayea>ACTION files a weird bug, maybe it's related to recent suspendable ports stuff, dunno what else it could be
<paroneayea>hm
<paroneayea>maybe it's something else
<paroneayea>brb
<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>I do this:
<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>$4 = 0.0
<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
<wingo>dunno :)
<daviid>wingo: no, 40 is the gtype
<daviid>wingo: all happens as if (make-c-struct (list int) (list 0)) is not equivalent to &{0, } ?
<daviid>(g-golf-go-g-value-init 40)
<daviid>$3 = #<pointer 0x17b5530>
<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>
<daviid>(process:20017): GLib-GObject-CRITICAL **: g_value_get_float: assertion 'G_VALUE_HOLDS_FLOAT (value)' failed
<daviid>$4 = 0.0
<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? :)
<amz3>paroneayea: yes
<daviid>so, using 2.0.13.1-27247: while ./check-guile 00-repl-server.test ; do : ; done works fine
<daviid>rlb: ^^
<daviid>I'm on debian testing
<wingo>daviid: {0,} means initialize the value to 0
<wingo>but the value can have more than one field
<wingo>depends on the type
<wingo>so i think your prob is that you are allocating a value whose size doesn't match gvalue's size.
<daviid>wingo, here is what you do: http://git.savannah.gnu.org/cgit/guile-gnome.git/tree/glib/gnome/gobject/gobject.c, line 529 and 544
<daviid>I beleive I do the 'same'
<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>ah, I see
<daviid>let me dig in more then, thanks
<daviid>wingo: they have a macro to initialize, which reads #define G_VALUE_INIT { 0, { { 0 } } }
<daviid> https://developer.gnome.org/gobject/stable/gobject-Generic-values.html#GValue
<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
<dsmith-work>I'm guessing a struture that is two words in size
<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.
<wingo>good evening civodul :)
<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
<civodul>hello!
<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 :)
<wingo>it is bigger than two ints
<daviid>wingo: ok tx
<paroneayea>well, looks like I was wrong about my last bug
<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.
<dsmith-work>The largest thing in the union is 64bits
<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>dsmith-work: they do this in C: https://paste.gnome.org/pd8k8deqc#line-5
<daviid>I read in the doc #define G_VALUE_INIT { 0, { { 0 } } }
<dsmith-work>daviid: C fills in the blanks for you..
<dsmith-work>SO
<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))
<daviid>ok thanks! trying
<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)
<daviid>ERROR: In procedure scm-error:
<daviid>ERROR: too many values (0)
<daviid>
<dsmith-work>Heh
<dsmith-work>Oh well.
<daviid>oh wait
<daviid>my bad
<daviid>dsmith-work: bingo! thanks
<dsmith-work>np!
<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?
<daviid>I'd rather get it 'new' :)
<dsmith-work>daviid: I've been doing C for a long time. Since pre-ANSI
<dsmith-work>Some of the rules have changed along the way.
<dsmith-work>(which means I no longer rememebr the details)
<dsmith-work>I think I wrote my first C prog around 1983-1984
<dsmith-work>daviid: https://groups.google.com/forum/#!msg/comp.lang.c/kic8hJDWQGU/vEH4bPqre44J
<dsmith-work>That's why wingo's {0,} works.
<dsmith-work>Ah.. gsize is unsigned long
<dsmith-work>But then it also says size_t
<dsmith-work> https://developer.gnome.org/glib/stable/glib-Basic-Types.html#gsize
<dsmith-work>daviid: You are on 64bit ?
<dsmith-work>daviid: That might be wrong for 32bit
<daviid>dsmith-work: all above my head for now
<daviid>i'm on 64
<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.
<dsmith-work>(sorry, not trying to confuse things)
<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>s/as a/as a C/
<dsmith-work>Ah!
<dsmith-work>daviid: instead of that first int64, use size_t
<dsmith-work>daviid: So (make-c-struct (list size_t int64 int64) (list 0 0 0))
<daviid>dsmith-work: great, let me try
<daviid>I just had a lbg talk with ebassy and he says 'impossible to write a binding whitout any C code
<daviid>:(:(
<daviid>I don't want any C code
<daviid>in our binding
<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
<daviid>at run tje?
<daviid>time
<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