Article View: comp.lang.lisp.x
Article #247Re: Calling X-Lisp from C.
From: Tony Olekshy
Date: Mon, 28 Jan 1991 06:55
Date: Mon, 28 Jan 1991 06:55
30 lines
1956 bytes
1956 bytes
In message <1218@prlhp1.prl.philips.co.uk>, colers@prlhp1.prl.philips.co.uk
(Richard Cole) writes:
>
> we are trying to make a version of XLISP that can be called
> from a C program as a function call
WARNING -- the following design has not be validated, by me, yet.
Start with the following empirical result, using "(1+ 1)" as our sample c
string containing the text representation of a lisp expression. In xlisp:
(= 2 (eval (read (make-string-input-stream "(1+ 1)"))))
Now, start the c process with cvstring("(1+ 1)") and pass the result through
the xlisp code that implements make-string-input-stream, read, and eval.
First, you need the code from xmkstrinput() (mainly the newustream() and
xlputc()), then you pass the result through xlread(), and give it to xleval().
The result will be the LVAL of the evaluated expression, so you can use things
like getstring() to pull the result back into c.
I've been planning to add this as a command line option, but I haven't had
time yet and this message has been in my to-reply-to queue for too long.
If I'm way off base, I'd be glad to know.
--
Yours etc., Tony Olekshy. Internet: tony%oha@CS.UAlberta.CA
BITNET: tony%oha.uucp@UALTAMTS.BITNET
uucp: alberta!oha!tony
He who pretends to be either painter or engraver
without being a master of drawing is an imposter. --Blake
Technical Details
Message-ID:
<469@oha.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!spool2.mu.edu!uunet!van-bc!ubc-cs!alberta!oha!tonyReferences:
<1218@prlhp1.prl.philips.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!nstn.ns.ca!news.cs.indiana.edu!samsung!zaphod.mps.ohio-state.edu!sdd.hp.com!spool2.mu.edu!uunet!van-bc!ubc-cs!alberta!oha!tony From: tony@oha.UUCP (Tony Olekshy) Newsgroups: comp.lang.lisp.x Subject: Re: Calling X-Lisp from C. Message-ID: <469@oha.UUCP> Date: 28 Jan 91 06:55:45 GMT References: <1218@prlhp1.prl.philips.co.uk> Organization: Olekshy Hoover & Associates Ltd., Edmonton, Alberta, Canada. Lines: 30 In-Reply-To: Message <1218@prlhp1.prl.philips.co.uk> dated 22 Jan 91 10:28:55 GMT