Newb question about calling Scheme from Java

"Mike J. Bell" <[email protected]> Tue, 2 Sep 2008 15:15:59 -0400
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
--===============1182678893==
Content-Type: multipart/alternative; 
	boundary="----=_Part_13444_17959323.1220382959140"

------=_Part_13444_17959323.1220382959140
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I'm trying to integrate SISC as a Scheme interpreter into a larger,
established product written in Java.  Anybody else do this, open-source
like, so I might peek at the ways and means?  Any advice on trying to
"replicate" a Java "programmer's" API inside SISC?  (i.e., ways to automate
all the (->jstring ...) and wrap/unwrap code that must go on with s2j).

But I have specific questions to start out.  I need to pass a handle from
the "public" part of the Java API into the SISC interpreter so that I might
start tinkering.  (It's like a Java "environment").  I find my heap, and do
something like:

Context.execute(appContext, new SchemeCaller() {
    public Object execute(Interpreter interpreter) throws SchemeException {
        Symbol symbol = new Symbol("foobar");
        Value value = SchemeBoolean.TRUE;
        Symbol context = new Symbol("r5rs");

        interpreter.define(symbol, value, context);
        interpreter.eval("...my scheme code...");
...

The problem is that foobar isn't defined in my environment inside the eval
statement.  I'm guessing that context=>Symbol("r5rs") is wrong here, but the
API docs don't really point me in a good direction.

Can anybody help with this first bit; i.e., how can I pass things into my
Scheme environment properly?

Thanks in advance for any simple and/or complex hints!

-- 
Mike J. Bell on gmail

------=_Part_13444_17959323.1220382959140
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div dir="ltr">I&#39;m trying to integrate SISC as a Scheme interpreter into a larger, established product written in Java.&nbsp; Anybody else do this, open-source like, so I might peek at the ways and means?&nbsp; Any advice on trying to &quot;replicate&quot; a Java &quot;programmer&#39;s&quot; API inside SISC?&nbsp; (i.e., ways to automate all the (-&gt;jstring ...) and wrap/unwrap code that must go on with s2j).<br>
<br>But I have specific questions to start out.&nbsp; I need to pass a handle from the &quot;public&quot; part of the Java API into the SISC interpreter so that I might start tinkering.&nbsp; (It&#39;s like a Java &quot;environment&quot;).&nbsp; I find my heap, and do something like:<br>
<br>Context.execute(appContext, new SchemeCaller() {<br>&nbsp;&nbsp;&nbsp; public Object execute(Interpreter interpreter) throws SchemeException {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Symbol symbol = new Symbol(&quot;foobar&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Value value = SchemeBoolean.TRUE;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Symbol context = new Symbol(&quot;r5rs&quot;);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interpreter.define(symbol, value, context);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; interpreter.eval(&quot;...my scheme code...&quot;);<br>...<br><br>The problem is that foobar isn&#39;t defined in my environment inside the eval statement.&nbsp; I&#39;m guessing that context=&gt;Symbol(&quot;r5rs&quot;) is wrong here, but the API docs don&#39;t really point me in a good direction.<br>
<br>Can anybody help with this first bit; i.e., how can I pass things into my Scheme environment properly?<br><br>Thanks in advance for any simple and/or complex hints!<br clear="all"><br>-- <br>Mike J. Bell on gmail<br>
</div>

------=_Part_13444_17959323.1220382959140--


--===============1182678893==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
--===============1182678893==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Sisc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sisc-users

--===============1182678893==--