From: Patrick Cheng S Teo
Subject: C/Lisp interface
Date: 
Message-ID: <1991Sep10.023339.10176@Times.Stanford.EDU>
I'll be implementing a server program in C which uses X windows.  I need to
allow LISP programs to communicate with this server, i.e.  I should be able
to pass messages between the LISP program and the server.  Does anyone
know how to do it?

I'll be using AKCL or IBCL. So, I may not have all the fancy stuff which other
commercially available LISP interpreters have.

Any suggestions are most welcomed.  I'll compile all the suggestions I receive
if I get enough.

Thanks
Patrick 

------------------------------------------------------------------------------
Patrick Teo
···@cs.stanford.edu
Computer Science Dept
Stanford University
From: Niels P. Mayer
Subject: Re: C/Lisp interface
Date: 
Message-ID: <MAYER.91Sep11180056@hplnpm.hpl.hp.com>
In article <······················@Times.Stanford.EDU> ···@Neon.Stanford.EDU (Patrick Cheng S Teo) writes:
   I'll be implementing a server program in C which uses X windows.  I need to
   allow LISP programs to communicate with this server, i.e.  I should be able
   to pass messages between the LISP program and the server.  Does anyone
   know how to do it?

If the messages are more than simple strings, have you considered adding a
small C-implemented Lisp interpreter to your C server program? With the
interpreter listening on a network socket, you can use the interpreter to
parse and read more-or-less-arbitrary lisp s-expressions and then pass the
data on to the appropriate function(s) in the server which are implemented
in C.  This basically gives you the code to read/parse the output sent
across the network by your main Lisp program for "free". I've found the
ability to use print/read to portably serialize and deserialize lisp data
quite useful.

For an example of doing that with David Betz's XLISP 2.1, you may want to
take a look at WINTERP, the OSF/Motif Widget INTERPreter. Although WINTERP
is highly intertwined with the Xtoolkit and Motif, it has the feature of
the Lisp listener being accessible through a socket (either inet or unix
domain). You could rip out all the Motif stuff and replace my Xtoolkit
event loop with a select(2) listening in on the socket input. Or just rip
out Motif and use the existing Xtoolkit calls in WINTERP to do your event
handling.

WINTERP is available via anonymous ftp from export.lcs.mit.edu, directory
contrib/winterp, the compressed tar file is winterp-1.12.tar.Z.

You may also want to look at CLM/Gina, which uses a C-based server to run
the X/Motif GUI while the application itself is running in a separate
Common Lisp process. I think it is also available via anon ftp from
export.lcs.mit.edu, in directory contrib. The name of the compressed tar
file is something along the lines of CLM.tar.Z....


-------------------------------------------------------------------------------
	    Niels Mayer -- hplabs!mayer -- ·····@hplabs.hp.com
		  Human-Computer Interaction Department
		       Hewlett-Packard Laboratories
			      Palo Alto, CA.
				   *