Let's get this finished
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Sun Jan 7 06:47:49 EST 2001
Sun, 07 Jan 2001 12:16:15 +1100, Manuel M. T. Chakravarty <chak at cse.unsw.edu.au> pisze:
> I think, we need the alloca and realloc versions, too.
We can't have malloc, alloca, realloc or poke. Only peek, with and new.
We can't have poke because in general the space needed for the
converted string is not known. Well, we could have poke with a
parameter saying how long the buffer is, so the function never writes
more. Is that functionality needed? Then OK for it.
mallocCString and allocaCString would be exactly the same functions as
mallocArray0 and allocaArray0, only with a more specific type. There
is a little point in providing the same function under multiple names,
unless it really makes things consistent, or unless they can diverge in
future. But nobody has proposed freeArray, freeArray0 and freeCString
(equivalent to free).
Wait, in the Sven's message I see that mallocCString with String as
the parameter. Then how it is different from newCString?
For handling parts of C strings manually, reallocation of CString
buffers and converting them to Haskell's lists in terms of C characters
there are always *Array0 functions. *CString functions work on whole
strings, and do some conversion to translate between CChar and Char.
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
^^ SYGNATURA ZASTÊPCZA
More information about the FFI