IRC channel logs


back to list of logs

<nalaginrut>morning guilers~
<lloda>bhattigurjot: show us the call and the types of the arguments you're passing to scm_internal_catch
<bhattigurjot>lloda: here
<lloda>Have you seen ?
<lloda>you're calling scm_internal_catch with two arguments, but it requires five.
<lloda>also look here
<bhattigurjot>and if I use scm_catch instead?
<bhattigurjot>gh_catch and scm_catch both have 3 args..
<bhattigurjot>key, thunk, handler
<lloda>that seems a better fit, I'd say, if you don't need the extra data fields
<bhattigurjot>but still I'm getting error:
<lloda>standard_handler is clear enough, but I don't know what tmp1 is...
<bhattigurjot>me neither :P
<bhattigurjot>btw this the error error: cannot convert ‘gchar* {aka char*}’ to ‘SCM {aka scm_unused_struct*}’ for argument ‘1’ to ‘scm_unused_struct* scm_catch(SCM, SCM, SCM)’
<lloda>scheme code in a string? maybe you can wrap that in eval and pass that as a body, and use SCM_BOOL_T for key if you just want to catch everything.
<lloda>sure, scm_catch is expecting a symbol, not a C string.
<lloda>the first argument should be SCM_BOOL_T.
<lloda>The second should be the thunk, the last standard_handler (guessing for that one).
<lloda>but you don't have the thunk as an SCM object, rather as a string with Scheme code, so you need to wrap that in some type of eval.
<lloda>also the difference between scm_catch & scm_internal_catch is that the first takes SCM arguments, the second takes C arguments, so it's possibly easier to use.
<lloda>see here scm_eval_string(): (never used it myself)
<lloda>look here:
<lloda>(just an explanation; I actually don't know what's in 'gchar' so you have to fix the scm_eval_string call).
<lloda>hope that helps anyway
<bhattigurjot>feeling helpless :( here is the complete code if you wish to see:
<lloda>I've looked it up and gchar is just char, so the thunk should be good.
<lloda>can you locate the definition of standard_handler for me?
<lloda>ok, I have it, it's good.
<lloda>put the thunk() routine in your code before void
<lloda>and replace the scm_internal_catch line by this:
<lloda>scm_internal_catch(SCM_BOOL_T, thunk, (void *)tmp1, handler, NULL);
<lloda>standard_handler doesn't use handler_data so you can pass NULL there.
<lloda>hm, I
<lloda>guess that last one.
<lloda>but do you see how the call works?
<lloda>the thunk() I put in
<bhattigurjot>scm_internal_catch(SCM_BOOL_T, thunk, (void *)tmp1, standard_handler, NULL);
<bhattigurjot>should it be like this?
<lloda>try that. Did you also add the thunk() before?
<bhattigurjot>error: cannot convert ‘char*’ to ‘SCM {aka scm_unused_struct*}’ for argument ‘1’ to ‘scm_unused_struct* scm_eval_string(SCM)’
<bhattigurjot>in thunk code.. :\\
<lloda>sorry, scm_c_eval_string instead of scm_eval_string.
<bhattigurjot>that works but
<bhattigurjot>setString (scm_to_locale_string (ret, NULL));
<bhattigurjot>error is here now
<bhattigurjot>too many arguments to function ‘char* scm_to_locale_string(SCM)’
<bhattigurjot>let me check
<bhattigurjot>yeah I changed it to setString (scm_to_locale_string (ret));
<bhattigurjot>:D thankyou I had to change some other values too to make the whole code work... no error in this file now :)
<lloda>you're welcome
<bhattigurjot>what is the new syntax for gh_scm2doubles ?
<bhattigurjot>in my code it was gh_scm2doubles (v, gv);
<bhattigurjot>but if I use scm_to_double() it only takes one argument
<lloda>that function seems to be gone, you need a loop there
<bhattigurjot>from the reference manual I can see this 'scm_to_double' is used 'gh_scm2double' and not for 'gh_scm2doubles'
<bhattigurjot>what kind of loop? like this
<lloda>uf, that's too much, no. I mean
<lloda>for (int i=0, n=scm_c_array_length(v); i<n; ++i) { gv[i] = scm_c_array_ref(v, i); }
<lloda>that should work I guess
<lloda>sorry, gv[i] = scm_to_double(scm_c_array_ref(v, i));
<lloda>that's how I'd do it.
<bhattigurjot>ok.. lemme try that
<bhattigurjot>scm_c_array_ref is not declared in the scope
<bhattigurjot>I don't there's any function like that
<lloda>try scm_c_array_ref_1
<lloda>bhattigurjot: scm_c_array_ref_1 instead of scm_c_array_ref
<bhattigurjot>oh! yeah
<bhattigurjot>Instead of gh_new_procedure ("move", (SCM (*) ()) drgeo_scm_move, 2, 0, 0), should it be scm_c_define_gsubr("move", 2, 0, 0, (SCM (*) ()) drgeo_scm_move) ?
<lloda>looks ok, it may be (void *)drgeo_scm_move instead
<lloda>the compiler will tell you
<bhattigurjot>I changed that gh_new_procedure to scm_c_define_gsubr
<bhattigurjot>I'm now getting the error:
<bhattigurjot> from
<bhattigurjot>/usr/local/include/guile/2.0/libguile/gsubr.h:68:13: error: initializing argument 5 of ‘scm_unused_struct* scm_c_define_gsubr(const char*, int, int, int, scm_t_subr)’ [-fpermissive]
<bhattigurjot>P.S: sorry for error pasting
<bhattigurjot>ok changed to (void *), it works now
<bhattigurjot1>lloda: if I want to declare that thunk in a .h file, what should be the datatype?
<lloda>you declare like so: SCM thunk(void * data);
<lloda>sneek: later tell bhattigurjot you declare like so: SCM thunk(void * data);
<bhattigurjot>lloda: that gives an error: /drgenius_mdi.h:42:3: error: ‘SCM’ does not name a type
<bhattigurjot>I am doing this because another .cc also need to have thunk, so I thought if I could include this in a .h file
<bhattigurjot>else it results in multiple declaration
<lloda>ah, you need extern
<lloda>extern SCM thunk(void * data); in the .h
<lloda>if SCM does not name a type yo need to #include "libguile.h" maybe
<bhattigurjot>ok, since is the file that says "‘thunk’ was not declared in this scope" and if I declare it says "multiple declaration", 'cause I already have thunk in file
<bhattigurjot>so this declaration should be in which .h file?
<bhattigurjot>_mdi.h or _script.h?
<lloda>whichever is included in the other
<lloda>then pick one
<lloda>and include that one in the other
<lloda>or put the decl in a new .h, rather
<bhattigurjot>lloda: I changed the files but I'm getting the error:
<bhattigurjot>error: cannot convert ‘drgeniusMDI::thunk’
<bhattigurjot>here is the code:
<lloda>is drgeniusMDI a namespace?
<lloda>why is it drgeniusMDI::thunk and not just thunk? I don't see that in your paste. if drgeniusMDI is a class and you declared thunk inside, it needs to be static.
<bhattigurjot>'cause I've declared this thunk in _mdi.h
<lloda>also you shouldn't pass a filename as the data argument, scm_c_eval_string takes Scheme code, not filenames.
<lloda>can you post the full error? cannot convert to what?
<bhattigurjot>it's working now
<bhattigurjot>but I can't seem to solve this multiple declaration error >.<
<civodul>Hello Guilers!
<lloda>bhattigurjot: This is C++, right? just put the full thunk on the .h as inline: inline SCM thunk(...) { ...} and remove it from all the .cc files.
<lloda>hi civodul
<bhattigurjot>here is what I've done, I have declared "static SCM thunk(void *data);" in drgenius_mdi.h file. I defined this function in 2 files and
<davexunit>hey civodul
<lloda>yeah, no. You declare it on the .h with extern (no body, just the header) and then define once in one of the .cc.
<bhattigurjot>just once in 1 file, say, and not the other file.
<lloda>and in the .h, the header with extern. extern SCM thunk(...);
<lloda>and you include that .h wherever you use the thunk.
<bhattigurjot>doesn't seem to work, gives: /drgenius_mdi.h:42:30: error: storage class specified for ‘thunk’
<lloda>post the declaration and the definition as you've written them
*civodul just read the excellent
*ft reads wingo's blog via gwene in gnus. :)
<ft>Although it's sometimes a little over my head. ;)
<lloda>You can do one of two things, 1. take the thunk declaration out of the class. It needs to be a out of class scope to be declared extern.
<lloda>2. leave it in the class, replace extern by static, and use it as drgeniusMDI::thunk. You need to do this because in, thunk is in class scope, but in, it isn't.
<lloda>I recommend 1.
<bhattigurjot>ok followed 1. Such silly mistakes :\\
<davexunit>have you guys checked out Elm?
<davexunit>I've lifted heavily from Elm in my own work, and they just made a new release with a functional 3D graphics API. it's really cool.
<ft>Wasn't elm a mail client? :)
<civodul>davexunit: this is crazy, the page above is all rendered by JS code
<civodul>so nothing shows up in w3m
<ft>It's probably written in elm.
<civodul>that's no excuse ;-)
<civodul>that said, elm does look pretty cool
<davexunit>civodul: oh sorry, I should note that Elm runs in the browser.
<davexunit>but it's sad that *nothing* renders without javascript
<davexunit>I would've just expected the webgl demo to not work
<davexunit>guile-2d needs a new name. I want to handle 3D graphics at some point, too.
<davexunit>I'm accepting all name suggestions! preferably a short name. ;)
<civodul>guile-3d? :-)
<civodul>the elm demos are really impressive
<civodul>the code is very haskellish, so it could use subtitles in some places...
<davexunit>yeah, Elm is a haskell DSL.
<davexunit>I don't know if I want "guile" in the final name. I like how "guix" stands alone.
<civodul>yeah i think we've used guile-* too much in the past
<davexunit>I like guile-* for wrappers for C libraries and such.
<civodul>for bindings, yeah
<civodul>davexunit: what about "Grolic", like G + "frolic"? :-)
<civodul>(looking at WordNet, but i'm not sure how it really sounds to native speakers)
<davexunit>what's wordnet?
<civodul>lexical database:
<civodul>guix package -i wordnet ;-)
<davexunit>oh, neat resource. thanks!
<davexunit>at work now, will do at home :)
<bhattigurjot>hi this is the path for guile.m4 file when I installed guile 2.0.11, now my software needs GUILE_PROGS and GUILE_FLAGS but it can't seem to find it
<bhattigurjot>and when I run "aclocal --print-ac-dir"
<bhattigurjot>it gives /usr/share/aclocal
<bhattigurjot>so my software can't seem to find it
<bhattigurjot>what shall I do?
<bhattigurjot>when I run ./configure --includedir=/usr/local/include/guile/2.0/
<bhattigurjot>it gives
<bhattigurjot>./configure: line 16703: GUILE_PROGS: command not found
<bhattigurjot>./configure: line 16706: GUILE_FLAGS: command not found
<dje42>bhattigurjot: Those are autoconf macros, they get expanded when configure is generated. Did you regenerate the configure script? configure works fine for me in guile 2.0.11.
<bhattigurjot>dje42: I had to manually copy it, sudo cp /usr/local/share/aclocal/guile.m4 /usr/share/aclocal
<bhattigurjot>now it works
<bhattigurjot>and btw guile 2.0.11 is it stable?
<dje42>What works? guile.m4 isn't something you need to build or use guile (unless you're hacking on it yourself)
<bhattigurjot>like I said earlier "GUILE_PROGS and GUILE_FLAGS" were not being set
<bhattigurjot>whenever I ran ./configure
<bhattigurjot>so after manually copying guile.m4 to /usr/share/aclocal
<dje42>In a properly generated configure script those symbols do not exist in the script. I don't see them in my guile 2.0.11 configure script.
<bhattigurjot>and running 'aclocal' in my software folder
<bhattigurjot>I think there is a confusion here
<bhattigurjot>I am talking about my my own software that I am configuring
<bhattigurjot>guile is already installed
<dje42>Ah. So this isn't the configure script for guile 2.0.11, it's the configure script for your software.
<dje42>You ran aclocal, but did you run autoconf?
<bhattigurjot>is deb package available yet for 2.0.11?
<bhattigurjot>P.S: I am using Mint 15
<dje42>I think(!) passing -I /usr/local/share/aclocal to aclocal would have also worked (instead of copying guile.m4 to /usr/share/aclocal).
<bhattigurjot>dje42: I am upgrading guile library from version 1.6 to the latest
<bhattigurjot>for my software
<bhattigurjot>passing that during ./configure?
<dje42>guile.m4 is needed to build configure, it's not used by configure.
<dje42>Pass that to aclocal, and then afterwards rerun autoconf of course.
<bhattigurjot>that might work
<dje42>['that" being -I /usr/local/share/aclocal] If you want to do the experiment right, remember to first remove guile.m4 from /usr/share/aclocal. :-)
<bhattigurjot>yeah :0
<bhattigurjot>drgeoLatexDrawable::drgeoLatexDrawable (drgeoFigure * figure, FILE * fileHandle, drgeoPoint origin, drgeoPoint size, gdouble scale)
<bhattigurjot>this is my function in one of the file
<bhattigurjot>while make command
<bhattigurjot>it gives
<bhattigurjot> warning: deprecated conversion from string constant to ‘gchar* {aka char*}’ [-Wwrite-strings]
<bhattigurjot>sorry if it is not guile related, there are other errors there related to guile
<bhattigurjot>I just thought to ask :-D
<bhattigurjot>dje42: instead of " scm_make_real(double) " what should I use?
<bhattigurjot>ok I changed it to " scm_from_double "
<davexunit>hey guilers, I have a question about how to handle additional data files that are installed with guile packages. guile-2d has a few things that get installed to /usr/share that it needs to load at runtime, but when developing I want it to use the data files in my git repository. Right now, I have to install guile-2d first before developing.
<davexunit>how does one handle this situation?
<daviid>davexunit: if you have you git repo(s) being fifo in your %load-path, it will do it no?
<davexunit>daviid: it's not the source code that's the issue.
<davexunit>it's the extra data files I have.
<davexunit>I have a config.scm file that the configure script generates to store the paths to where the data files are installed.
<davexunit>but for development, I have to manually edit that file to point to the data file directories within my repo.
<davexunit>I need something automated. I'm wondering how other people handle this problem.
<daviid>yes, I've seen your code actually [a while ago]. i think if i was you, that i'd define an env var and check it, if devel, data are in git, if not...
<daviid>my 2c
<davexunit>yeah an env var could do it. I guess it could override what's in config? I dunno.
<daviid>env var must be set before guile is launched iirc
<davexunit>a quick script takes care of that.
<daviid>yes, that's what i do for my app(s) too. for kisê, I install a user .config/kise.conf where thatdata path is stored...
<daviid>among other things of course
<daviid>user's last session window size, pos...
<ArneBab>davexunit: you could also use your working directory (PWD)
<ArneBab>davexunit: env vars are not that nice for new developers coming in (many scientific libraries rely on them…)
<ArneBab>the number of env vars to set then quickly inflates.
<davexunit>ArneBab: I'm not sure how the working directory could help. I think that I would need some script that configures things correctly for working with the development environment.
<davexunit>and I don't know what test I could do on the working directory that would be of value.
<davexunit>okay, I took a lot at guix for inspiration. when in the pre-install environment, a env var called GUIX_UNINSTALLED is set.
<davexunit>I will do something similar. When the env var is set, the path prefix for data files will be the project root, otherwise it will be the value that the configure script generated.