From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: Using Guile in a wxWidgets app Date: Sun, 05 Feb 2006 09:42:22 +0000 Message-ID: <87mzh6jg5d.fsf@ossau.uklinux.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1139132764 28401 80.91.229.2 (5 Feb 2006 09:46:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 5 Feb 2006 09:46:04 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sun Feb 05 10:45:57 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F5gSz-00040q-1Z for guile-user@m.gmane.org; Sun, 05 Feb 2006 10:45:57 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F5gWE-0008BF-2Y for guile-user@m.gmane.org; Sun, 05 Feb 2006 04:49:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F5gVh-00084g-Im for guile-user@gnu.org; Sun, 05 Feb 2006 04:48:46 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F5gVe-00083I-Qm for guile-user@gnu.org; Sun, 05 Feb 2006 04:48:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F5gVc-000822-S8 for guile-user@gnu.org; Sun, 05 Feb 2006 04:48:41 -0500 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F5gUy-0006tb-LX for guile-user@gnu.org; Sun, 05 Feb 2006 04:48:00 -0500 Original-Received: from laruns (host86-129-147-232.range86-129.btcentralplus.com [86.129.147.232]) by mail3.uklinux.net (Postfix) with ESMTP id 1E786409FB6; Sun, 5 Feb 2006 09:45:18 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 290649F92B; Sun, 5 Feb 2006 09:42:22 +0000 (GMT) Original-To: John Steele Scott In-Reply-To: (John Steele Scott's message of "Sun, 05 Feb 2006 10:26:16 +1030") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5131 Archived-At: John Steele Scott writes: > I have written a small piece about embedding Guile in wxWidgets GUI program. > You can read it at: > > > Does anyone have any comments about it? Overall it looks like a great tutorial to me. (Although I'm not familiar with wxWidgets code.) Some detailed comments... "if (modifiers == NULL)" The constant indicating an empty list is SCM_EOL, not NULL, so this should at least be (modifiers == SCM_EOL). Even better, though, would be "if (SCM_NULLP (modifiers))". > In particular, I would appreciate feedback on the way I have wrapped the > wxWidgets MessageBox() function. I used symbols instead of ORing bits for > the modifier parameter, so that > (message-box "Really quit?" "Quit?" 'yes/no 'question) > is equivalent to > wxMessageBox("Really quit?", "Quit?", wxYES_NO|wxICON_QUESTION). IMO this is a nice schemely touch. You could of course compute the symbols ahead of time, and store them, rather than constructing them every time message_box is called, but it doesn't matter that much. > Also, in my MyFrame::OnQuit method, I create a variable in the Guile world, > and then look it up again after calling the hook. Is this really necessary, > or can I somehow bind *quit-do-close* directly to a SCM in > MyFrame::OnQuit's stack frame, which Guile will modify directly, removing > the need for the call to scm_variable_ref(scm_c_lookup("*quit-do-close*"))? Well you could do this, which feels a bit more natural (and closer to what you have requested): SCM qdcvar = scm_c_lookup("*quit-do-close*"); scm_variable_set_x(qdcvar, SCM_BOOL_T); scm_c_run_hook(quit_hook, SCM_EOL); if (SCM_NFALSEP(scm_variable_ref(qdcvar))) Close(true); (Alternatively, you could question whether quit-hook really needs to be a hook, rather than a single function. If it was a single function, you could call it from C directly and use its return value instead of the global *quit-do-close*.) Regards, Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user