[gambit-list] creating homogeneous vectors from the FFI

Marc Feeley feeley at iro.umontreal.ca
Sun Jan 13 09:31:30 EST 2008


On 13-Jan-08, at 5:38 AM, David Rush wrote:

> On Jan 13, 2008 3:37 AM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
>> On 12-Jan-08, at 8:07 PM, David Rush wrote:
>> If all you need is to interface to read(), why don't you use read-
>> subu8vector?  For example:
>
> Because as soon as you start in on FFI coding (read's not the only
> thing - but it is the main thing) you start to assume that that is
> where your answers will all lie?

Sorry but I don't follow.  I was under the impression that your  
problem was doing fast I/O, and for that you can use Gambit's bulk-I/O  
procedures.

> Thanks for the tip. As a side note where did you get the magic numbers
> in the code:
>
>> (define subtype-s8vector 20)
>> (define subtype-u8vector 21)
>
> Since they look like internal tag values, I'd be worried about using
> this mechanism in the general case...

You can get the tag values (and many other internal definitions) from  
the file ~~/lib/_gambit#.scm using the macros macro-subtype-u8vector,  
etc.  For example:

(include "~~/lib/_gambit#.scm")

(define subtype-s8vector (macro-subtype-s8vector))
(define subtype-u8vector (macro-subtype-u8vector))

Marc




More information about the Gambit-list mailing list