From: "Marco Maggi" <marco.maggi-ipsu@poste.it>
To: "guile-user" <guile-user@gnu.org>
Subject: Re: packed structures usefulness
Date: Tue, 6 Nov 2007 21:53:31 +0100 [thread overview]
Message-ID: <JR3RD7$7603C85782CEF29F02F5E3EDD30DA3A2@poste.it> (raw)
"ludo@gnu.org" wrote:
> "Marco Maggi" writes:
>> Remembering that, IMHO, there is no way to
>> mimic the C structure fields alignment from a
>> Scheme level inteface, I wonder if such a module
>> would be useful or not.
>
>I'm not convinced. :-)
>
>Most "modern" C libraries use opaque types,
>typically pointers to structs, so you rarely get
>to access the fields directly.
"Thien-Thi Nguyen" wrote:
>> I wonder if such a module would be useful or not.
>
>i think so, if it can handle char, short, and
>bitfields. presuming it has length and signedness
>checks, it would be nice to have those
>configurable, as well (ie., error vs warn vs
>auto-normalize).
"Neil Jerram" wrote:
>I implemented something like this for an
>application whose basic control mechanism is
>message passing using flat C structures ("flat" =>
>no pointers), because I wanted to be able to build
>and manipulate the structures from Scheme.
>[...]
>So to answer your actual question: yes, I think
>this is useful, but only in a rather specific kind
>of application context.
(Thanks (expt 10 3)). I have decided to enqueue it
in my to do list. I will write it as an
independent module, but with the specific purpose
of having a tool to write an interface to Ralf
Engelschall's OSSP MM: a library for shared memory
usage [1].
It is a small project that I started one year ago
and then put aside, because I had no clear idea
about how to define a "mask" of data fields
through which "look" at the allocated shared
memory.
I will use (sub)SMOBs and define the struct format
from the Scheme level only, I do not want to make
it a way to "see" a foreign C struct from the
Scheme level. There should be no problem to
register an assertion function and set/get
conversion functions.
But... ahem... bitfields? These are *boring* to
code... ;-)
[1] <http://www.ossp.org/pkg/lib/mm/>
--
Marco Maggi
"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"
_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user
next reply other threads:[~2007-11-06 20:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-06 20:53 Marco Maggi [this message]
2007-11-07 13:16 ` packed structures usefulness Thien-Thi Nguyen
-- strict thread matches above, loose matches on Subject: below --
2007-11-02 8:12 Marco Maggi
2007-11-02 10:42 ` Ludovic Courtès
2007-11-02 12:18 ` Thien-Thi Nguyen
2007-11-03 10:43 ` Neil Jerram
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='JR3RD7$7603C85782CEF29F02F5E3EDD30DA3A2@poste.it' \
--to=marco.maggi-ipsu@poste.it \
--cc=guile-user@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).