[Ecls-list] FILE* -> Lisp stream?

Mark Hoemmen mark.hoemmen at gmail.com
Mon Jul 14 15:37:07 UTC 2008

On Sun, Jul 13, 2008 at 1:48 AM, Juan Jose Garcia-Ripoll
<juanjose.garciaripoll at googlemail.com> wrote:
> On Sun, Jul 13, 2008 at 3:31 AM, Mark Hoemmen <mark.hoemmen at gmail.com> wrote:
>> My motivation for such a function is that I'd like to to pass an open
>> input stream from the C world into Lisp space for Lisp to read from it.
> Ok, since it involves absolutely no code at all, I have factored out a function
> cl_object ecl_make_stream_from_FILE(cl_object fname, void *fp, enum
> ecl_smmode smm)
> which implements what was in the second half of ecl_make*_from_fd().

That's fabulous, many thanks!!!

> The code for guessing the mode, though, would not be easily ported to
> Windows and hence I have left it out. I hope it suits your needs.

*nods* Guessing the mode in the POSIX world requires going into
fcntl() territory.  It's not hard, but it's definitely not portable.
I wouldn't mind figuring out how to do it in Windows, but I don't have
a Windows box on which to test it, so it wouldn't be fair for me to
call for that feature.  Anyway, I'm a POSIX-world person so I could
easily write my own wrapper for your new function that invokes fcntl()
on the fd.

Many many thanks!

More information about the ecl-devel mailing list