SISC Scheme in an Android App - Source Code Release

Chad Albers <[email protected]> Mon, 22 Feb 2010 22:04:57 -0500
Newsgroups gmane.comp.java.sisc.user
Message-ID <[email protected]>
--===============5213077293177113347==
Content-Type: multipart/alternative; boundary=000feaea7805996f9504803bd0de

--000feaea7805996f9504803bd0de
Content-Type: text/plain; charset=UTF-8

Hi,

I've achieved some success at getting SISC to interpret scheme code inside
an Android App (not just using the dalivkvm command line).  I'm
releasing the Eclipse project and the source code on github to encourage
experimentation.  It's available here:
http://github.com/neomantic/Android-SISC-Scheme-Eval.  The source code is
released under the GPL v2 license - like SISC, and the Java Source code that
I needed to use.

To get it to run,  I have managed to extract out the java.beans classes that
are minimally necessary to get SISC to compile under Android.  Since they
are under GPL, I can distribute them with my source.

I've also removed any connection to the ASM bytecode libraries.

Finally, I had to make one source code change to SISC to get it to work
inside an Android App. The patch works around some deep magic involving
threading and dynamically loading the sisc.modules.s2j.JavaObject class,
which SISC apparently dynamically loads when it attempts to instantiate a
java object.  Inside the Android app, SISC loses the ClassLoader associated
with the jar the App is contained in, and thus cannot dynamically load the
JavaObject class.  (This does not occur in the command line version).  I'm
not sure what causes this, but my patch 'fixes' this problem, but it may
break something else.

Currently, the application does everything the command line could in the
tutorial works.  It can instantiate a class distributed with the Android
SDK. In this case, it instantiates a JSONArray and queries it's length.
 Since it's empty, it returns 0 in the Android TextView.  In this case, the
app can run scheme scripts that have been included inside the app.   Further
instructions are in the README.

Most of my debugging has been devoted to working around the ClassLoader
problem.  I have not managed to focus on getting recursion to work.  I'm
still working towards pulling a full REPL Android App.  We I have something
to show for it, I'll release that on github too.

Hope someone find this helpful.  If anyone has any questions, feel free to
contact me.

Chad
--

Chad Albers
http://www.neomantic.com
(pgp signature available on request)

--000feaea7805996f9504803bd0de
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div>Hi,</div><div><br></div><div>I&#39;ve achieved some success at getting=
 SISC to interpret=C2=A0scheme code inside an Android App (not just using t=
he dalivkvm command line). =C2=A0I&#39;m releasing=C2=A0the Eclipse project=
 and the source code on github to encourage experimentation. =C2=A0It&#39;s=
 available here: =C2=A0<a href=3D"http://github.com/neomantic/Android-SISC-=
Scheme-Eval" target=3D"_blank">http://github.com/neomantic/Android-SISC-Sch=
eme-Eval</a>. =C2=A0The source code is released under the GPL v2 license - =
like SISC, and the Java Source code that I needed to use.</div>

<div><br></div><div>To get it to run, =C2=A0I have managed to extract out t=
he java.beans classes that are minimally necessary to get SISC to compile u=
nder Android. =C2=A0Since they are under GPL, I can distribute them with my=
 source.</div>

<div><br></div><div>I&#39;ve also removed any connection to the ASM bytecod=
e libraries.</div><div><br></div><div>Finally, I had to make one source cod=
e change to SISC to get it to work inside an Android App. The patch works a=
round some deep magic involving threading and dynamically loading the sisc.=
modules.s2j.JavaObject class, which SISC apparently dynamically loads when =
it attempts to instantiate a java object. =C2=A0Inside the Android app, SIS=
C loses the ClassLoader associated with the jar the App is contained in, an=
d thus cannot dynamically load the JavaObject class. =C2=A0(This does not o=
ccur in the command line version). =C2=A0I&#39;m not sure what causes this,=
 but my patch &#39;fixes&#39; this problem, but it may break something else=
.</div>

<div><br></div><div>Currently, the application does everything the command =
line could in the tutorial works. =C2=A0It can instantiate a class distribu=
ted with the Android SDK. In this case, it instantiates a JSONArray and que=
ries it&#39;s length. =C2=A0Since it&#39;s empty, it returns 0 in the Andro=
id TextView. =C2=A0In this case, the app can run scheme scripts that have b=
een included inside the app. =C2=A0 Further instructions are in the README.=
</div>

<div><br></div><div>Most of my debugging has been devoted to working around=
 the ClassLoader problem. =C2=A0I have not managed to focus on getting recu=
rsion to work. =C2=A0I&#39;m still working towards pulling a full REPL Andr=
oid App. =C2=A0We I have something to show for it, I&#39;ll release that on=
 github too.</div>
<div><br></div><div>Hope someone find this helpful. =C2=A0If anyone has any=
 questions, feel free to contact me.</div><div><br></div>Chad<div>--<div><b=
r>Chad Albers<br><a href=3D"http://www.neomantic.com" target=3D"_blank">htt=
p://www.neomantic.com</a><br>

(pgp signature available on request)<br>
</div>
</div>

--000feaea7805996f9504803bd0de--


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

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
--===============5213077293177113347==
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

--===============5213077293177113347==--