From: Andrei
Subject: Importing system header files in lisp
Date: 
Message-ID: <2e04fd43.0409161343.7d4d0c66@posting.google.com>
Hi,

Does it sound completely crazy if I ask if there is a way to import
defines from some system (Linux) c-header files to lisp code? I use
CMUCL and try to access Video for Linux interface of some ATI capture
cards.
I saw a very nice implementation of the idea in lush when they use
(cpheader "#include <linux/videodev.h>) expression for this. Is there
any support for Video for Linux in Common Lisp implementations?
In general, is it a good idea to control a system driver directly from
lisp code (using unix:unix-ioctl calls) without compiling all the
system calls to c object files and then using alien calls to the
c-function from lisp code?
I just have the task at hand and thought I'd make an entry into lisp
programming with it.

Any feedback is greatly appreciated,
Andrew
From: Andreas Thiele
Subject: Re: Importing system header files in lisp
Date: 
Message-ID: <cin492$e4o$01$1@news.t-online.com>
"Andrei" <·········@yahoo.com> schrieb im Newsbeitrag
·································@posting.google.com...
> Hi,
>
> Does it sound completely crazy if I ask if there is a way to import
> defines from some system (Linux) c-header files to lisp code? I use
> CMUCL and try to access Video for Linux interface of some ATI capture
> cards.
> I saw a very nice implementation of the idea in lush when they use
> (cpheader "#include <linux/videodev.h>) expression for this. Is there
> any support for Video for Linux in Common Lisp implementations?
> In general, is it a good idea to control a system driver directly from
> lisp code (using unix:unix-ioctl calls) without compiling all the
> system calls to c object files and then using alien calls to the
> c-function from lisp code?
> I just have the task at hand and thought I'd make an entry into lisp
> programming with it.
>
> Any feedback is greatly appreciated,
> Andrew

Lispworks supports this. You might download their evaluation version of
Lispworks and use it for this purpose (www.lispworks.com). It cannot resolve
everything due to ambiguties in C/C++ (see 'FLI User Guide and Reference
Manual' chapter '7 The Foreign Parser'. I did not use it because I think you
typically only need a few of the defines. I wrote my own ODBC functions in
Lispworks and Clisp and did everything from within Lisp. I do not need any
supporting C code. This might be different in your situation because timing
might be critical. In this case you have to consider garbage collection,
which might lock the Lisp for some hundred milliseconds. I think this
depends on the architecture (CMUCL, Video for Linux, how are threads handled
etc.) and what you want to do.

Andreas