This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: produce ".EXE"


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]