From: Jugal Kolita
Subject: Running compiled Lisp code from command line; using LISP for CGI programming
Date: 
Message-ID: <61dk10$7kd$1@netnews.upenn.edu>
Re: Running compiled Lisp code from command line; using LISP for CGI programming

Hi!

I have two questions to ask. If you know the answer, kindly
post a message here or send me a private reply.

1) COMPILING AND RUNNING COMPILED CODE FROM COMMAND LINE IN
        UNIX: I guess the first question is simple. I want to compile 
	a Lisp function/a set
	of Lisp functions and call the compiled code from
	command line. I am on a Unix system and I am using
	GCL 1.1. 

	I see that if I compile a file, an
	object file  is written out, but when I compile a
	function, no object file is written out. 

	Anyway, I compiled a file into its object code
	(say file.o) and then  tried calling it from
	Unix using 
	%file.o

	This obviously is not correct since it core-dumped
	on me. 

	Can someone please tell me what's the way to go about
	doing this? How do I specify that the compiled file
	needs Lisp to run? How do I specify the name
	of the function from among the compiled functions to run?
	Please forgive me for my ignorance if these questions
	are not properly posed. 

2) USING LISP TO CREATE CGI SCRIPTS:
	I also want to use Lisp for CGI scripts. I have used
	Perl quite a bit for CGI programming, but I am not
	sure how to go about doing so with Lisp. I don't
	want to use the CL-HTTP server available from MIT. I just 
	want to use Lisp as a scripting language to a regular
	HTTP server and generate a virtual HTML file and
	send it back to the browser.

	If anyone knows how to go about doing this, kindly
	give me some pointers.

Thanks a lot in advance!

Jugal Kalita

From: Thomas A. Russ
Subject: Re: Running compiled Lisp code from command line; using LISP for CGI programming
Date: 
Message-ID: <ymig1qdttyt.fsf@sevak.isi.edu>
······@linc.cis.upenn.edu (Jugal Kolita) writes:
> 
> 2) USING LISP TO CREATE CGI SCRIPTS:
> 	I also want to use Lisp for CGI scripts. I have used
> 	Perl quite a bit for CGI programming, but I am not
> 	sure how to go about doing so with Lisp. I don't
> 	want to use the CL-HTTP server available from MIT. 

I'm curious why you don't want to use the MIT CL-HTTP server.  It
provides a nice integration of lisp with HTTP and has the bonus of being
faster than CGI scripts, in part because there is no process start-up
overhead in responding to computed pages.  That is because the functions
are already present in the server itself, rather than being invoked as
separate processes.  I imagine that this process start-up overhead will
be even worse for anything that first has to start up an entire lisp job
before processing.

In answer to your actual question, I would imagine that you should be
able accomplish your immediate goal once you get a command line
invocation of lisp code functional.  Unfortunately I don't know anything
about GCL, so I'll have to leave that to others.
From: Martin Cracauer
Subject: Re: Running compiled Lisp code from command line; using LISP for CGI programming
Date: 
Message-ID: <1997Oct9.083528.23007@wavehh.hanse.de>
······@linc.cis.upenn.edu (Jugal Kolita) writes:

>1) COMPILING AND RUNNING COMPILED CODE FROM COMMAND LINE IN
>        UNIX: I guess the first question is simple. I want to compile 
>	a Lisp function/a set
>	of Lisp functions and call the compiled code from
>	command line. I am on a Unix system and I am using
>	GCL 1.1. 

Pass Lisp expressions from the command line. Either your Lisp will
have a parameter "-eval" or esle use 
echo '(start-my-compile-frontend "foo")' | lisp

>	I see that if I compile a file, an
>	object file  is written out, but when I compile a
>	function, no object file is written out. 

That's how things work in Common Lisp.

>	Anyway, I compiled a file into its object code
>	(say file.o) and then  tried calling it from
>	Unix using 
>	%file.o

>	This obviously is not correct since it core-dumped
>	on me. 

In Gcl (and CMUCL), you can't run compiled files directly. You have to
load them into your Lisp image.

>2) USING LISP TO CREATE CGI SCRIPTS:
>	I also want to use Lisp for CGI scripts. I have used
>	Perl quite a bit for CGI programming, but I am not
>	sure how to go about doing so with Lisp. I don't
>	want to use the CL-HTTP server available from MIT. I just 
>	want to use Lisp as a scripting language to a regular
>	HTTP server and generate a virtual HTML file and
>	send it back to the browser.

The biggest issue is to make your Lisp shut up on stdout if you don't
want to use a wrapper that sends a files written from Lisp. By
default, all Common Lisp are pretty verbose. I have done this for
CMUCL, let me know if you want the code.

You'll still have to write functions to parse QUERY_STRING and friends
yourself.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
···············@wavehh.hanse.de http://www.cons.org/cracauer/
BSD User Group Hamburg/Germany  http://www.bsdhh.org/