damonkohler / sl4a

SL4A brings scripting languages to Android by allowing you to edit and execute scripts and interactive interpreters directly on the Android device.
Apache License 2.0
2.42k stars 803 forks source link

Add Squirrel support #115

Open damonkohler opened 9 years ago

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

I found a Squirrel package for SL4A.
How about supporting this officially.

http://forum.squirrel-lang.org/mainsite/forums/default.aspx?g=posts&t=2098

Original issue reported on code.google.com by tomcatalbino on 26 Jan 2012 at 12:58

Copied from original issue: damonkohler/android-scripting#594

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

I installed it into my android phone.
It seems the install succeed.
But when I selected the "Add" menu it falls.
So I wrote a Squireel code from an editor and named it "Hello.nut"
Write this code.

print("Hello\n");

It gets some rpc error message but it seems the output works !

Original comment by tomcatalbino on 26 Jan 2012 at 4:32

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

[deleted comment]
damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

>It gets some rpc error message but it seems the output works !
It wasn't an error. It was only print messages for debug.
I tried these kind of codes and it worked nice !

dofile("/sdcard/com.googlecode.squirrelforandroid/init.nut");
android.makeToast("Toast using Squirrel");
android.webViewShow("http://www.google.com");
android.launch("com.android.calculator2.Calculator");
android.notify("Notify using Squirrel","Message");
android.ttsSpeak("Speak using Squirrel");
android.vibrate();

By the way, What's the difference with the Issues list and the forum site ?
It seems that some messages are hide (or maybe post failed or maybe not 
permitted).

Original comment by tomcatalbino on 4 Feb 2012 at 4:33

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

I investigated what is required to support Squirrel.

1. Add SquirrelLanguage.java to 
http://code.google.com/p/android-scripting/source/browse/android/Common/src/com/
googlecode/android_scripting/language/

It needs at least these codes.

///////////////////////////////
package com.googlecode.android_scripting.language;
public class SquirrelLanguage extends Language {}
///////////////////////////////

2. Fix the class SupportedLanguages at enum KnownLanugage in 
http://code.google.com/p/android-scripting/source/browse/android/Common/src/com/
googlecode/android_scripting/language/SupportedLanguages.java

It needs this code below between [PHP(".php", PhpLanguage.class)] and [;].

///////////////////////////////
SQUIRREL(".nut", SquirrelLanguage.class)
///////////////////////////////

3. Add an icon named "nut_icon.png" in 
http://code.google.com/p/android-scripting/source/browse/android/ScriptingLayerF
orAndroid/res/drawable/
(It means all support languages icon have to be in the SL4A's apk.)
The name must be "nut_icon.png". It seems to be a rule.
See more information in 
http://code.google.com/p/android-scripting/source/browse/android/Common/src/com/
googlecode/android_scripting/FeaturedInterpreters.java
"getInterpreterIcon" decides the icon name.

(4.Optional) If SL4A supports "Squirrel" officially it should have an apk path 
to download.
It's also in FeaturedInterpreters.java.

Perhaps only these procedures. If there is some other things to be done please 
reply to this.

Original comment by tomcatalbino on 7 Feb 2012 at 11:42

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

working on the changes you suggested, in order to make Squirrel officially 
supported

Original comment by licheng...@gmail.com on 2 Apr 2012 at 2:28

damonkohler commented 9 years ago

From @GoogleCodeExporter on May 31, 2015 11:30

A new Squirrel for Android is released; see 
http://forum.squirrel-lang.org/default.aspx?g=posts&t=2225

Will see how to make it part of the offical SL4A release...

Original comment by licheng...@gmail.com on 6 Apr 2012 at 5:43