From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oleg Parashchenko Newsgroups: gmane.lisp.guile.devel Subject: Re: scm_init_guile when null threads Date: Sun, 2 Apr 2006 19:29:23 +0400 Organization: xmlhack.ru Message-ID: <20060402192923.081189b9.olpa@xmlhack.ru> References: <20060401092404.0176a77b.olpa@xmlhack.ru> <871wwhwtyh.fsf@ossau.uklinux.net> <20060402064812.1191cb0c.olpa@xmlhack.ru> <85D0035F-4B28-472D-A275-7BF0950B5256@raeburn.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1143991798 12100 80.91.229.2 (2 Apr 2006 15:29:58 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 2 Apr 2006 15:29:58 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Apr 02 17:29:56 2006 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FQ4WW-0006Ef-Dk for guile-devel@m.gmane.org; Sun, 02 Apr 2006 17:29:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQ4WV-0003J5-Lu for guile-devel@m.gmane.org; Sun, 02 Apr 2006 11:29:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FQ4WS-0003IH-4H for guile-devel@gnu.org; Sun, 02 Apr 2006 11:29:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FQ4WQ-0003HH-DJ for guile-devel@gnu.org; Sun, 02 Apr 2006 11:29:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FQ4WQ-0003HE-8F for guile-devel@gnu.org; Sun, 02 Apr 2006 11:29:46 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FQ4ZH-0004pk-DB for guile-devel@gnu.org; Sun, 02 Apr 2006 11:32:43 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FQ4WH-0006Dd-Rh for guile-devel@gnu.org; Sun, 02 Apr 2006 17:29:37 +0200 Original-Received: from pd9542abb.dip.t-dialin.net ([217.84.42.187]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 02 Apr 2006 17:29:37 +0200 Original-Received: from olpa by pd9542abb.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 02 Apr 2006 17:29:37 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: guile-devel@gnu.org Original-Lines: 49 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: pd9542abb.dip.t-dialin.net X-Newsreader: Sylpheed version 1.0.4 (GTK+ 1.2.10; i586-alt-linux-gnu) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5837 Archived-At: Hello Ken, On Sun, 2 Apr 2006 00:50:20 -0500 Ken Raeburn wrote: ... > > You call scm_with_guile, and give it a function to call that > manipulates Guile objects or calls Guile functions; it causes the > thread to enter "guile mode", calls the function, leaves "guile mode" > and returns to the caller. (You can also pass a pointer to whatever > associated data you want, so you don't have to make your function > rely on global variables.) Thank you for explaining the interface. > > Since it controls entry and exit to your function, its ability to > figure out where the "guile part" of the stack of that thread (needed > for garbage collection) starts is much greater than with > scm_init_guile. If you use scm_init_guile, it needs to figure out > where the thread's stack's base is (yes, this may be easier on some > platforms when configured for null threads), because under that > interface, you could pop back up a few stack frames before invoking > some Guile routines and storing objects into stack slots. Using > scm_with_guile, your automatic variables with SCM objects won't get > stored on the "wrong" side of the stack pointer that scm_with_guile > has recorded. I have two questions about scm_with_guile related to initialization and nesting. I have impression that before using Guile, one has to initialize Guile using scm_init_gsubr(), scm_init_procprop() etc, but scm_with_guile doesn't do it. Am I wrong? Now about nesting. Let's suppose my program switches to Guile using scm_with_guile (stack base "A"). Guile runs, at some moments executes an extension function, and switches back to the program. The code needs some Guile and calls scm_with_guile again (stack base "B"). The question: does garbage collector work correctly, not missing the Scheme values between "A" and "B"? > > Ken -- Oleg Parashchenko olpa@ http://xmlhack.ru/ XML news in Russian http://uucode.com/blog/ Generative Programming, XML, TeX, Scheme _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel