Hi,
"Marco Maggi" <[EMAIL PROTECTED]> writes:
> I am in the position to add, with relatively
> little effort, a module to GEE to handle
> packed data structures. This means that,
> as example of a still unimplemented API, doing:
>
> (define *triplet*
> (make-gstruct-type '((one . int)
> (two . double)
> (three . (int64 . 3)))))
>
> (define S (make-gstruct *triplet*))
>
> (set! (one S) 123)
> (set! (two S) 1.2)
> (set! (three S 2) 44)
>
> one can define a SMOB whose internal
> representation is equivalent to the C language
> type:
>
> struct triplet {
> int one;
> double two;
> int64_t three[3];
> };
>
> and then access its fields.
>
> 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.
(BTW, note that Guile's structs have a specified C layout in terms of
`SCM' fields, though.)
Thanks,
Ludovic.
_______________________________________________
Guile-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/guile-user