[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile initialization and string evaluation with C++

From: Eduardo Acuña
Subject: Re: Guile initialization and string evaluation with C++
Date: Thu, 27 Mar 2014 21:03:25 -0700

I uploaded the code to a github repository and added a Makefile using pkg-config (you are right about the .zip, it looks weird):

>Can you explain why you want to `send' scm_boot_guile'? I can't figure
>it out from your description and your code.

English is not my native language and my translation from my spanish programming jargon doesn't make my question clear. I'll try to explain myself better:

The scm_boot_guile receives the following arguments: (int argc , char ** argv , void (* main_func )(void * data , int argc , char ** argv ), void * data ).

My program calls scm_boot_guile from the member function init() of the GuileApplication class. There is no problem passing the argc and argv to scm_boot_guile, however i want to pass the member function guileMain as the third argument of scm_boot_guile like a void function pointer (i can't cast the member function as a function pointer). The current way i'm avoiding this problem is passing as the third argument a function outside of the GuileApplication class, and passing the address of the instance of the GuileApplication as the fourth argument for dereferencing the object and calling the guileMain member function from there, so i had to make this non-member function a friend of GuileApplication. This method works but it doesn't seem to be a clean way of doing things. I'm not proficient in C++ or Guile and there might be a better way of initializing Guile from C++.

>I'm not sure what you mean. If you don't want to exit while exceptions
>occur, you can just catch them all with #t and print the error message,
>then call your main loop again.
>My solution is not a good one, just one of the possible way, maybe not
>suit for your code. I suggest you elaborate your problem.

It's my first time programming using guile exceptions, so i don't know if i'm doing things correctly.

When i'm evaluating an scheme _expression_ from C++ i call:
result = scm_internal_catch(SCM_BOOL_T, guileEvalBody, (void *)buffer, guileEvalHandler, NULL);

where result is an SCM, guileEvalBody is a function that just calls scm_c_eval_string, buffer is a char *. The guileEvalHandler function is just a cheap copy of the scm_handle_by_message_noexit function (from the guile sourcecode in /libguile/throw.c) but it doesn't return #f.

I want to be able to print the error message, but the handler_message function is only aviable from the throw.c file (because it is static) so i had to copy the code in my file. Is there a way to print the error messages without having to do this?

By the way, I thought that it is curious that this functions are not documented in the reference manual.

>Your scmToString is too complicated for its function I understand.
>Maybe you just need scm_object_to_string

I'll try to improve my code with this recomendation, thanks :)

On Thu, Mar 27, 2014 at 9:02 PM, Eduardo Acuña <address@hidden> wrote:
i just hit reply on gmail O:
i'll send the same replay, thank you

On Thu, Mar 27, 2014 at 8:12 PM, Nala Ginrut <address@hidden> wrote:
Please reply to all to make sure the people in the mailing-list can see
your post, which may increase the possibility of help. ;-)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]