unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Alexei Matveev <alexei.matveev@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: Guile API for foreign languages: proposing SCM scm_list_0(void)
Date: Thu, 31 Jan 2013 12:45:42 +0100	[thread overview]
Message-ID: <87sj5htw2h.fsf@pobox.com> (raw)
In-Reply-To: <871ud1vbgo.fsf@pobox.com> (Andy Wingo's message of "Thu, 31 Jan 2013 12:27:51 +0100")

On Thu 31 Jan 2013 12:27, Andy Wingo <wingo@pobox.com> writes:

> On Tue 22 Jan 2013 11:55, Andy Wingo <wingo@pobox.com> writes:
>
>>      SCM_BOOL_F
>>      SCM_BOOL_T
>>      SCM_ELISP_NIL
>>      SCM_EOF_VAL
>>      SCM_EOL
>>      SCM_UNBOUND
>>      SCM_UNDEFINED
>>      SCM_UNSPECIFIED
>>
> Instead, users should just keep a table of what the values of these
> constants are for a given Guile major series.  Defining them as
> enumerated values doesn't help e.g. an Ada compiler.  The particular
> language should make this list in their own source code format, perhaps
> generated by a small C program linked to libguile.

Or by Scheme:

   (for-each
     (lambda (pair)
       (format #t "static const scm_t_bits my_~A = 0x~X;\n"
                  (car pair) (object-address (cdr pair))))
     `(("false" . #f)
       ("true" . #t)
       ("nil" . #nil)
       ("eof" . ,the-eof-object)
       ("eol" . ())
       ("unspecified" . ,*unspecified*)))

   static const scm_t_bits my_false = 0x4;
   static const scm_t_bits my_true = 0x404;
   static const scm_t_bits my_nil = 0x104;
   static const scm_t_bits my_eof = 0xa04;
   static const scm_t_bits my_eol = 0x304;
   static const scm_t_bits my_unspecified = 0x804;

Unbound and undefined are a little trickier.

Andy
-- 
http://wingolog.org/



  reply	other threads:[~2013-01-31 11:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-02 11:11 Guile API for foreign languages: proposing SCM scm_list_0(void) Alexei Matveev
2013-01-12 15:16 ` Andy Wingo
2013-01-14 22:44   ` Alexei Matveev
2013-01-15  9:06     ` Andy Wingo
2013-01-15  9:20       ` Ludovic Courtès
2013-01-22 10:55   ` Andy Wingo
2013-01-31 11:27     ` Andy Wingo
2013-01-31 11:45       ` Andy Wingo [this message]
2013-01-31 13:37         ` Noah Lavine
2013-01-31 14:13         ` Alexei Matveev
2013-01-31 16:57         ` Alexei Matveev
2013-01-31 17:23           ` Andy Wingo

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=87sj5htw2h.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=alexei.matveev@gmail.com \
    --cc=guile-devel@gnu.org \
    /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).