IRC channel logs
2014-05-21.log
back to list of logs
<lloda>bhattigurjot: show us the call and the types of the arguments you're passing to scm_internal_catch <lloda>you're calling scm_internal_catch with two arguments, but it requires five. <lloda>that seems a better fit, I'd say, if you don't need the extra data fields <lloda>standard_handler is clear enough, but I don't know what tmp1 is... <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>(just an explanation; I actually don't know what's in 'gchar' so you have to fix the scm_eval_string call). <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>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>but do you see how the call works? <bhattigurjot>scm_internal_catch(SCM_BOOL_T, thunk, (void *)tmp1, standard_handler, NULL); <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) <lloda>sorry, scm_c_eval_string instead of scm_eval_string. <bhattigurjot>too many arguments to function char* scm_to_locale_string(SCM) <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>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' <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>sorry, gv[i] = scm_to_double(scm_c_array_ref(v, i)); <lloda>bhattigurjot: scm_c_array_ref_1 instead of scm_c_array_ref <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 <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] <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 <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 drgen_script.cc 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 drgenius_mdi.cc file <lloda>whichever is included in the other <lloda>and include that one in the other <lloda>or put the decl in a new .h, rather <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. <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>but I can't seem to solve this multiple declaration error >.< <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. <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 drgenius_mdi.cc and drgeo_script.cc <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 drgenius_mdi.cc, 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 *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 drgenius_mdi.cc, thunk is in class scope, but in drgeo_script.cc, it isn't. <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 <ft>It's probably written in elm. <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>the code is very haskellish, so it could use subtitles in some places... <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>davexunit: what about "Grolic", like G + "frolic"? :-) <civodul>(looking at WordNet, but i'm not sure how it really sounds to native speakers) <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>when I run ./configure --includedir=/usr/local/include/guile/2.0/ <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 <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>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>I am talking about my my own software that I am configuring <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? <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 <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. <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>drgeoLatexDrawable::drgeoLatexDrawable (drgeoFigure * figure, FILE * fileHandle, drgeoPoint origin, drgeoPoint size, gdouble scale) <bhattigurjot>drgeo_latexdrawable.cc:32:55: 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>dje42: instead of " scm_make_real(double) " what should I use? <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. <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>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... <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 <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>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.