Re: Java from Scheme from Java

Norman Gray <[email protected]> Fri, 28 May 2010 10:41:45 +0100
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
Mario, hello.

On 2010 May 28, at 02:05, Mario Domenech Goulart wrote:

> I'm working on a Java application which I intend to extend in
> Scheme.  The application would load a Scheme file, evaluate it
> and get the result from Scheme to be used by the Java code.  The
> Scheme code has to be able to call Java code from the
> application.
> 
> I'm having problems to call my Java code from the Scheme code.

I have some code which you might find useful here.  See http://code.google.com/p/quaestor/source/browse/#svn/trunk/src/main/org/eurovotech/quaestor

This is an implementation of a web service which can run inside Jetty or Tomcat.  That is, it's a Java application which is calling SISC, which can in turn (of course) call Java objects.

JettySchemeServer.java and TomcatSchemeServlet.java are the topmost, java-facing classes, and SchemeWrapper.java is the bit which joins both of those to SISC.  The latter is essentially a number of eval methods which can be called from Java to do Scheme work.

> Basically, I want Foo to load bar.scm. bar.scm calls the public
> `hello' method from Foo.

That's covered.  See the processing of mainScriptName in JettySchemeServer.run()

Good luck,

Norman


-- 
Norman Gray  :  http://nxg.me.uk


------------------------------------------------------------------------------