unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Noah Lavine <noah.b.lavine@gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: C Struct Interface
Date: Tue, 13 Jul 2010 23:18:31 +0200	[thread overview]
Message-ID: <m3iq4jaxnc.fsf@unquote.localdomain> (raw)
In-Reply-To: <AANLkTile2rZbZQSuJiFVFLiY_vHcq59hq-y-yWYSEn_F@mail.gmail.com> (Noah Lavine's message of "Sun, 11 Jul 2010 22:20:33 -0400")

Hello,

On Mon 12 Jul 2010 04:20, Noah Lavine <noah.b.lavine@gmail.com> 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/



      reply	other threads:[~2010-07-13 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-12  2:20 C Struct Interface Noah Lavine
2010-07-13 21:18 ` Andy Wingo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3iq4jaxnc.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=noah.b.lavine@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).