From: Klaus Schilling
Subject: C API of Lisp interpreters
Date: 
Message-ID: <8767envgvr.fsf@ivm.de>
Which Free (in the sense of Stallman!) Lisp interpreter has the cleanest C API
for writing wrappers for system libs written in C?

Klaus Schilling

From: Pierre Mai
Subject: Re: C API of Lisp interpreters
Date: 
Message-ID: <87emtbfvjj.fsf@dent.isdn.cs.tu-berlin.de>
Klaus Schilling <···············@home.ivm.de> writes:

> Which Free (in the sense of Stallman!) Lisp interpreter has the cleanest C API
> for writing wrappers for system libs written in C?

If we interpret Lisp to mean Common Lisp (or at least not to encompass
Scheme, because otherwise you'd have posted to comp.lang.scheme), and if
we follow your interpretation of "Free", which excludes public domain,
BSD-style, any most other sorts of licences, only CLISP and GCL will
likely remain (KCL and AKCL, the ancestors of GCL probably weren't under
the GPL, so they both don't count) as maintained versions.  Now if you're
using either Linux or Hurd, as any good GPL-disciple should[1], both
should be available.

Since cleanliness is often also in the eye of the beholder, you should 
try them out, and see for yourself...

Regs, Pierre.

Footnotes: 
[1]  Beware of the evil *BSDs, 'cause they have strayed from the path
of the righteous, and believeth in much too much freedom... ;->

-- 
Pierre Mai <····@cs.tu-berlin.de>	http://home.pages.de/~trillian/
  "Such is life." -- Fiona in "Four Weddings and a Funeral" (UK/1994)
From: Klaus Schilling
Subject: Re: C API of Lisp interpreters
Date: 
Message-ID: <87n27zp3a1.fsf@ivm.de>
Pierre Mai <····@acm.org> writes:

> Klaus Schilling <···············@home.ivm.de> writes:
> 
> > Which Free (in the sense of Stallman!) Lisp interpreter has the cleanest C API
> > for writing wrappers for system libs written in C?
> 
> If we interpret Lisp to mean Common Lisp (or at least not to encompass
> Scheme, because otherwise you'd have posted to comp.lang.scheme), and if
> we follow your interpretation of "Free", which excludes public domain,
> BSD-style, any most other sorts of licences, only CLISP and GCL will
> likely remain (KCL and AKCL, the ancestors of GCL probably weren't under
> the GPL, so they both don't count) as maintained versions.  Now if you're
> using either Linux or Hurd, as any good GPL-disciple should[1], both
> should be available.
>
 
I sure know that they are available ... but there could be more that I don't
know about.

> Since cleanliness is often also in the eye of the beholder, you should 
> try them out, and see for yourself...
>

Implementations with some base stuff written in assembly and then completely
written in Lisp (like many ML implementations) would not qualify for having a 
clean C API, nor do compilers qualify for being interpreters.


> Regs, Pierre.
> 
> Footnotes: 
> [1]  Beware of the evil *BSDs, 'cause they have strayed from the path
> of the righteous, and believeth in much too much freedom... ;->
>

FreeBSD licensed software is free in the sense of Stallman.
Non-free BSD software exists also, like vi or rogue. 

 Klaus Schilling
From: Steve Gonedes
Subject: Re: C API of Lisp interpreters
Date: 
Message-ID: <m2k9323a99.fsf@KludgeUnix.com>
Klaus Schilling <···············@home.ivm.de> writes:

< 
< Pierre Mai <····@acm.org> writes:
< 
< > Klaus Schilling <···············@home.ivm.de> writes:
< > 
< > > Which Free (in the sense of Stallman!) Lisp interpreter has the
< > > cleanest C API for writing wrappers for system libs written in
< > > C?

 
< Implementations with some base stuff written in assembly and then
< completely written in Lisp (like many ML implementations) would not
< qualify for having a

CMUCL is written almost entirely in lisp and from what I remember has
a "clean" c interface (if such a thing exists). You mention for
systems library interface; if that system is unix then CMUCL has a
great interface for the "standard" unix library built in.
From: Steven D. Majewski
Subject: Re: C API of Lisp interpreters
Date: 
Message-ID: <6tpn3n$ama$1@murdoch.acc.Virginia.EDU>
In article <··············@ivm.de>,
Klaus Schilling  <···············@home.ivm.de> wrote:
>
>Which Free (in the sense of Stallman!) Lisp interpreter has the cleanest C API
>for writing wrappers for system libs written in C?
>

Take a look at XlispStat's functions for producing c-wrappers:

http://www.stat.umn.edu/~luke/xls/projects/wrappers/wrappers.html

On the projects page:
http://www.stat.umn.edu/~luke/xls/projects/projects.html
are links to related project, for example, a lisp callable socket
library written using the c-wrapper functions.  


This method of generating wrapper code from a template description 
of the C function is similar to SWIG, but LISP only and simpler. 
( Guile is supported by SWIG, BTW. )

I've used both XlispStat wrappers and SWIG (with Python & tcl, not
Lisp) and both make the easy stuff easy, but have limitations where
you want the interpreter end to be a little smarter. In both cases,
I wanted a little smarter data conversion -- for example, to get 
buffer/string length on output  functions, and to allocate storage
for return strings, and to coerce "strings" ( i.e. pointers to 
memory ) into char strings or various typed vectors depending on 
other args -- neither SWIG or XLS-wrappers are smart enough to do
what I wanted, and I had to write in the raw C API. However, in both
cases, this was not difficult, and the automatic wrapper generation
makes a good starting point if you are just learning to interface
to foreign functions. 



---|  Steven D. Majewski   (804-982-0831)  <·····@Virginia.EDU>  |---
---|  Department of Molecular Physiology and Biological Physics  |---
---|  University of Virginia             Health Sciences Center  |---
---|  P.O. Box 10011            Charlottesville, VA  22906-0011  |---
                    UVA -- The BABY SWAP University! 

"I'm not as big a fool as I used to be, I'm a smaller fool." - Jack Kerouac
Some of the Dharma  <http://members.aol.com/kerouacsis/SomeDharma.html>