This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: produce ".EXE"
- From: Per Bothner <per at bothner dot com>
- To: Ajay Sharma <ajksharma at gmail dot com>
- Cc: kawa at sources dot redhat dot com
- Date: Fri, 31 Mar 2006 20:55:40 -0800
- Subject: Re: produce ".EXE"
- References: <BAY109-F366476E6FF94F67B185BE9E1D00@phx.gbl> <442AA4E8.4090401@bothner.com> <1484682d0603310437sf8984fepc71ae9ca34165cf@mail.gmail.com>
Ajay Sharma wrote:
Can anybody point an example to load a *.scm or class file( or calling a
specified scheme procedure) from java and getting the results back?
First, I'll point out that standard Scheme doesn't have the concept
of the "result" of a file. For example, the 'load' function doesn't
return a defined value. A reason is that a module may contain a
*sequence* of one-or-more declarations and expressions.
Now I want to load a *.scm file or class file and evaluate its code.
I would look at the various 'eval' methods in gnu.expr.Language.
Some of these take an input file (a Reader or InPort). The tricky
part is getting the result back. The resulting values are written
to a Writer (which is presumably not what you want) or a Consumer.
I'd create an instance of gnu.mapping.Values to old the result.
That class implements Consumer, so you can pass it to eval.
Then after eval finishes, you can extract the results from the Values
object.
--
--Per Bothner
per@bothner.com http://per.bothner.com/