Good day, I would like to announce a small project of mine, which I started out of boredom but figured could be useful in a couple of FFI situations. Just throwing it out there.
https://github.com/TaylanUB/scheme-bytestructures/ You know how C's weak type-system basically just provides "views" on top of raw bytes, and you can always just cast to char[] to access the raw bytes? Well in Scheme we have the char[], i.e. bytevectors, but we don't have that structured way for making sense of the contents of a bytevector. This project provides exactly that. Numeric types (float, double, (u)int(8,16,32,54)) and vectors, structs, and unions are pre-provided, but it's flexible such that you can implement more than that. The current state of the code could probably be ported to other Schemes rather easily; I might want to separate those parts some time, but on the other hand this could be hooked with Guile's FFI libraries more tightly, or (I can dream) made to be an official part of them. Currently only the procedural implementation exists; I'm a bit stuck on how to best make a syntactic version. The documentation is fairly complete for the current state of the code, although some design decisions of the internals might be non-obvious, should you decide to look into the code. Questions welcome, of course. The code hasn't been tested extensively, although it isn't much. My test.scm might or might not be embarrassing. FWIW, the project was originally inspired by: http://trac.sacrideo.us/wg/wiki/StructuresCowan And thanks to Mark Weaver for having helped with a couple points on how to make the implementation more efficient, back when I started this project (there was a large time-gap until I picked it up again a week or two ago). I hope I managed to follow their suggestions the right way. :) Regards, Taylan
