From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: C Struct Interface Date: Tue, 13 Jul 2010 23:18:31 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1279055756 26379 80.91.229.12 (13 Jul 2010 21:15:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 13 Jul 2010 21:15:56 +0000 (UTC) Cc: guile-devel@gnu.org To: Noah Lavine Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jul 13 23:15:54 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OYmpT-0002f4-Mq for guile-devel@m.gmane.org; Tue, 13 Jul 2010 23:15:52 +0200 Original-Received: from localhost ([127.0.0.1]:52781 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYmpS-0000BO-VS for guile-devel@m.gmane.org; Tue, 13 Jul 2010 17:15:51 -0400 Original-Received: from [140.186.70.92] (port=56908 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OYmpN-0000AW-Lc for guile-devel@gnu.org; Tue, 13 Jul 2010 17:15:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OYmpM-0001Fw-F0 for guile-devel@gnu.org; Tue, 13 Jul 2010 17:15:45 -0400 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:52761 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OYmpM-0001Fs-Ct for guile-devel@gnu.org; Tue, 13 Jul 2010 17:15:44 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id F1340C45BD; Tue, 13 Jul 2010 17:15:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=CORPenFOyMuyCj374wjZgM+/c04=; b=ChE6s7 zHfNpM0AhKqbe/hFLg0+2l75dHiKtfUmP8V/8tBuHQjC1zjmL4YuGO/rwX1WjEBJ bk+E0GKEorm9aBXuaTvJE0Doy540BrRZ2jlNWINDhwWjlLHtmypKWVoTILD19rHx bCHfslV5dTQceNaWe96E3IQZi3+e5bxNqHO6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=BIRvmTr4U167qSof9wI8FHCfGsN/MQJn QhJK2R0ZFb4h1C9z2UGN8hzwl/jrWIgIvB4NAlbboG/6MRv7gXm0Zp2v51k8JpRB Oa2OyHGzy/tdxBCitYswvEkqInv1k8goM0JeMZfMqx3LF9zqn+49+9GEJIVxmQnT sdULEoW/pV8= Original-Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id CF4D7C45BB; Tue, 13 Jul 2010 17:15:42 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [83.44.191.132]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 2E41AC45B8; Tue, 13 Jul 2010 17:15:40 -0400 (EDT) In-Reply-To: (Noah Lavine's message of "Sun, 11 Jul 2010 22:20:33 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: CB7D29D2-8EC3-11DF-95E9-9056EE7EF46B-02397024!a-pb-sasl-quonix.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) 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:10655 Archived-At: Hello, On Mon 12 Jul 2010 04:20, Noah Lavine writes: > It seems from the code that scm_c_make_structv(vtable, ntail, ninit, > inits) is the main function for creating structs. I'm assuming that > ntail is the number of elements in the tail array of the struct Yes. Avoid tail arrays if you can, they are confusing and a bad interface. > ninit > is the total number of elements I want to init, and inits is an array > containing the initial values. Is this correct? Yep. > Also, if I make a struct in this way, can I then do > SCM_STRUCT_SLOT_REF(struct, n) to get at it, where n=0 is the first > slot? You can indeed, though this does no bounds checking. Sorry for the undocumented state of things; patches to fix that most welcome! ;) Andy -- http://wingolog.org/