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: marking SCM values in client data of port structure Date: Sat, 11 Mar 2006 09:42:39 +0000 Message-ID: <87zmjxtj00.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 1142070411 22278 80.91.229.2 (11 Mar 2006 09:46:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Mar 2006 09:46:51 +0000 (UTC) Cc: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Sat Mar 11 10:46:49 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 1FI0gL-00018n-09 for guile-user@m.gmane.org; Sat, 11 Mar 2006 10:46:42 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FI0gK-0004bS-98 for guile-user@m.gmane.org; Sat, 11 Mar 2006 04:46:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FI0gG-0004bL-I1 for guile-user@gnu.org; Sat, 11 Mar 2006 04:46:36 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FI0gE-0004b9-Vg for guile-user@gnu.org; Sat, 11 Mar 2006 04:46:36 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FI0gE-0004b6-SX for guile-user@gnu.org; Sat, 11 Mar 2006 04:46:34 -0500 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FI0jj-0003Y1-4l for guile-user@gnu.org; Sat, 11 Mar 2006 04:50:11 -0500 Original-Received: from laruns (host86-129-144-246.range86-129.btcentralplus.com [86.129.144.246]) by mail3.uklinux.net (Postfix) with ESMTP id EB470409FB6; Sat, 11 Mar 2006 09:46:33 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 043349F8A0; Sat, 11 Mar 2006 09:42:39 +0000 (GMT) Original-To: "Marco Maggi" In-Reply-To: (Marco Maggi's message of "Sat, 11 Mar 2006 08:47:35 +0100") 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:5218 Archived-At: "Marco Maggi" writes: > So: is it mandatory to organise SCM values in the > client data in a list and write the mark function to > return the cons cells? That is the at the first invocation > of the mark function we return the first cell and at > subsequent invocations we return the cdr? No. If your client structure has n SCM slots, e.g. struct client_data { int a; SCM b; char *c; SCM d; SCM e; float f[4]; ... } your mark function just needs to call scm_gc_mark for each SCM: client_mark (...) { /* get client data pointer, then ... */ scm_gc_mark (data->b); scm_gc_mark (data->d); scm_gc_mark (data->e); return SCM_BOOL_F; } If any of these SCMs is a compound object, scm_gc_mark will do the recursion itself. Did you try the documentation on this? That should be easier than trying to work it out from the code! The relevant node is called "Garbage Collecting Smobs". Neil _______________________________________________ Guile-user mailing list Guile-user@gnu.org http://lists.gnu.org/mailman/listinfo/guile-user