guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data conversion


From: Marius Vollmer
Subject: Re: data conversion
Date: 11 Mar 2002 13:20:45 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1

stefan <address@hidden> writes:

>   I just added the `convert.*' files which contain the "be spoken"
> conversion routines between C and Scheme and the other way around.

Thanks!  Nice work!

The interface is fine.  Could you write the reference documentation
for the various functions?  Preferably as one general section that
documents the common behavior, and then a list of available functions.
It should be noted what happens in the case of type errors, i.e, that
the function can "throw".

Given that the functions can throw anyway, we can use scm_malloc in
place of malloc.  This will make the functions integrate better with
the GC and spare the user the check for NULL.  Please make that
change (and reflect it in the docs).

We should not provide functions that expose our old uniform vectors,
like scm_c_chars2byvect, scm_c_shorts2svect, etc.  We need to
integrate SRFI-4 into the core instead.  Please remove these
functions.

I have removed your FIXME comment about providing hooks for
malloc/free. We should not provide these hooks.  If a DLL needs them,
they should be provided at a layer below of libguile, in the equivalent
of libc.


As to the implementation of the conversion functions, I think they can
be improved and made more compact.  We should use the various
scm_num2short, etc functions for converting Scheme numbers to C types
instead of explicitely checking for bignums etc.  Also, the conversion
functions could be split into a 'control' function that is only
compiled once and walks the various Scheme object, and 'worker'
functions that exist for every target type and know how to convert a
Scheme number and stuff it into naked memory.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]