From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: CDDP Newsgroups: gmane.lisp.guile.user Subject: C++ application linked with guile dos not quite Date: 17 Jun 2002 15:23:39 +0200 Sender: guile-user-admin@gnu.org Message-ID: <1024320220.17552.138.camel@tice> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: main.gmane.org 1024319971 24888 127.0.0.1 (17 Jun 2002 13:19:31 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 17 Jun 2002 13:19:31 +0000 (UTC) Return-path: Original-Received: from fencepost.gnu.org ([199.232.76.164]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 17JwPq-0006TJ-00 for ; Mon, 17 Jun 2002 15:19:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17JwOl-000404-00; Mon, 17 Jun 2002 09:18:23 -0400 Original-Received: from smtp-out-3.wanadoo.fr ([193.252.19.233] helo=mel-rto3.wanadoo.fr) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 17JwNP-0003ve-00 for ; Mon, 17 Jun 2002 09:16:59 -0400 Original-Received: from mel-rta10.wanadoo.fr (193.252.19.193) by mel-rto3.wanadoo.fr (6.5.007) id 3D09BEC80019FE08 for guile-user@gnu.org; Mon, 17 Jun 2002 15:16:58 +0200 Original-Received: from localhost.localdomain (80.14.155.118) by mel-rta10.wanadoo.fr (6.5.007) id 3CFB2CF9008A82C2 for guile-user@gnu.org; Mon, 17 Jun 2002 15:16:58 +0200 Original-To: guile-user@gnu.org X-Mailer: Ximian Evolution 1.0.5 Errors-To: guile-user-admin@gnu.org X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.lisp.guile.user:599 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:599 Hi, In DrGenius (guile aware), when I quite, all the application is hanging. This happens when there is a user defined guile procedure. If the user does not define procedure this does not happen. If I run it under GDB then the application quite normaly. I am not very confortable with guile, so there is probably something wrong in my code. I use Libguile 1.4 Hilaire For information, the related piece of code are: I initialise the guile interprertor as: int main(int argc, char* argv[]) { gh_enter(argc, argv, main_prog); return 0; } In main_prog, I record some procedures: /* declare drgeo interface in guile */ gh_new_procedure ("move", drgeo_scm_move, 2, 0, 0); gh_new_procedure ("getAbscissa", drgeo_scm_getAbscissa, 1, 0, 0); gh_new_procedure ("getCoordinates", drgeo_scm_getCoordinates, 1, 0, 0); gh_new_procedure ("getValue", drgeo_scm_getValue, 1, 0, 0); [...] gtk_main(); } The GTK+ application is started with gtk_main() User script are recorded in the guile interpreter as: void script:: setScript (gchar *scriptCode) { gchar *tmpScript, *tmp1, *tmp2; gint nb; g_free (this->scriptCode); this->scriptCode = g_strdup (scriptCode); /* define a scm procedure to hold the user script */ tmpScript = g_strdup_printf ("(define (script%d",this); for (nb = 1; nb <= g_list_length (parentList); nb++) { tmp1 = g_strdup_printf (" a%d", nb); tmp2 = g_strconcat (tmpScript, tmp1, NULL); g_free (tmp1); g_free (tmpScript); tmpScript = tmp2; } tmp1 = g_strconcat (tmpScript, ")", scriptCode, ")", NULL); g_free(tmpScript); /* define the procedure in the Guile interpretor */ gh_eval_str_with_catch(tmp1, standard_handler); g_free (tmp1); } Basicly the user script is embedded in a procedure so the code is looking like: (define (scriptOBJECT_ADRESS a1 a2 ...) CODE PROVIDED BY THE USER ) Then in the geometric engine, this procedure is called as: /* build the call sequence */ tmpScript = g_strdup_printf ("(script%d", this); for (nb = 0; nb < g_list_length (parentList); nb++) { tmp1 = g_strdup_printf (" %d", g_list_nth_data (parentList, nb)); tmp2 = g_strconcat (tmpScript, tmp1, NULL); g_free (tmpScript); g_free (tmp1); tmpScript = tmp2; } tmp1 = g_strconcat (tmpScript, ")", NULL); g_free (tmpScript); ret = gh_eval_str_with_catch(tmp1, standard_handler); g_free (tmp1); if (gh_number_p (ret)) { val = gh_scm2double (ret); str = g_strdup_printf ("%.2f", val); } else if (gh_string_p (ret)) { str = gh_scm2newstr (ret, NULL); } else str = g_strdup (_("Unprintable result")); } When the script object is deleted I undefine the function. _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://mail.gnu.org/mailman/listinfo/guile-user