Hello,
can anybody tell me if it is possible to start a clisp programm within a
C-program or how to execute clisp-programs without starting the
clisp-shell.
Now I always have to start clisp and load my programs and then, when I
am in the clisp-shell I can start them.
Thanks in advance
Matthias
From: Giuseppe Milasi
Subject: Re: Help: Executing lisp programs from C-programs?
Date:
Message-ID: <33A15011.5F1A@tin.it>
Matthias Seiferth wrote:
>
> Hello,
> can anybody tell me if it is possible to start a clisp programm within a
> C-program or how to execute clisp-programs without starting the
> clisp-shell.
> Now I always have to start clisp and load my programs and then, when I
> am in the clisp-shell I can start them.
> Thanks in advance
>
> Matthias
Sorry, I don't know. But, if someone know it, perhaps he know if it's
possible to start a Lisp program within a Visual Basic program.
Of course, if it's possible within C-program, it's possible within
Visual Basic program too, by creating a DLL or a OCX.
I'm a Visual Basic programmer, but I know other languages too, and I'd
like programmin in Lisp now, if I can make a integration of either
languages (like the SQL is integrated within Visual Basic by using the
Jet modules).
Thank you to all, advancing for your reply.
P.S.: Excuse my English, I'm studing it now (I'm from Italy)!
--
Giuseppe Milasi
In article <·············@tin.it>, ·······@tin.it wrote:
> Matthias Seiferth wrote:
> >
> > Hello,
> > can anybody tell me if it is possible to start a clisp programm within a
> > C-program or how to execute clisp-programs without starting the
> > clisp-shell.
> > Now I always have to start clisp and load my programs and then, when I
> > am in the clisp-shell I can start them.
> > Thanks in advance
> >
> > Matthias
> Sorry, I don't know. But, if someone know it, perhaps he know if it's
> possible to start a Lisp program within a Visual Basic program.
> Of course, if it's possible within C-program, it's possible within
> Visual Basic program too, by creating a DLL or a OCX.
> I'm a Visual Basic programmer, but I know other languages too, and I'd
> like programmin in Lisp now, if I can make a integration of either
> languages (like the SQL is integrated within Visual Basic by using the
> Jet modules).
> Thank you to all, advancing for your reply.
> P.S.: Excuse my English, I'm studing it now (I'm from Italy)!
> --
> Giuseppe Milasi
Some time ago (2 years?) I saw an advertisement in a newsgroup offering a
LISP implementation as a DLL. Unfortunately, it only covered most of CLtL1
(!)
In principle it it possibly to start any lisp program, but not within the
C program space.
You can start any windows program from within another windows program via
the WIN-API.
For example, if you are using ACL/W x.xx:
1.) make a Lisp image with your stuff in it.
2.) start the image from within the whatever-your-prefered-language-program.
Now you have three possibilities:
a.) having set up a DDE-server in the lisp programm (not so difficult) you
can now interact via DDE.
b.) Having built a DLL and mapping the dll-functions via callback to lisp,
you can communicate via that DLL.
c.) having had too much time (and a stress proved reset button) and
explored how to use OLE in lisp (my congratulations) you can use Lisp as
an ole-widget in your application.
now, it's your choice!
- stefan
--
University of Wuerzburg, GERMANY
·····@informatik.uni-wuerzburg.de
Matthias Seiferth wrote:
>
> Hello,
> can anybody tell me if it is possible to start a clisp programm within a
> C-program or how to execute clisp-programs without starting the
> clisp-shell.
You can do this in several ways. In your C program you either invoke the
system() call with a command line specifying the clips location and
arguments. Or (as I do) use fork() and exec(). This latter approach
allows you to talk to CLISP using stdin and stdout (providided you've
created a pipe and bound the filenos correctly. I suppose you could use
popen() instead, which would make things simpler.
Anyhow, you need load and invoke your own CLISP application. One way
is to use the -i initfile option,
clisp -i myapp
however, this is slower than the alternative of saving a memory image
which has already loaded your application. To do this, in clisp
>(load "myapp")
>(saveinitmem "myapp.mem")
and invoke this with
clisp -M myapp.mem
Now you need to invoke your application's main function. You can use the
-x form option
clisp -x (mymain)
tying this together you'd do
system("clisp -M myapp.mem -x (mymain)");
[you'd probably want to put explicit or configurable paths in for the
files, rather than relying on the invoking environment]
A batch mode I've found compatible between allegro CL and CLISP is not
to use the -x option, but to write the top level from to the lisp's
stdin. To prevent CLISP echoing prompts and evaluation results, use the
following boilerplate -x form [thanks to Bruno Haible for finding a
simpler solution to my original hack].
clisp -q -x (progn (sys::batchmode-errors (load (make-synonym-stream
(quote *terminal-io*)) :verbose nil)) (values))
this has the same effect as
acl -batch
with some stuff to change the prompt string and printer function, which
I (curently) forget.
hope this helps.
nathan
--
Dr Nathan Sidwell The wyndy road is more interesting
Chameleon Software Group at SGS-Thomson If lisp is a big ball of wax,
http://www.pact.srf.ac.uk/~nathan/ C++ is a really large briar patch
······@pact.srf.ac.uk ······@bristol.st.com Tel +44 117 9031101