B4A Library BasicLib interpreter and BasicIDE development IDE revisited

BasicIDE is now deprecated in favour of the newer BasicIDE Suite 3
BasicIDE Suite 3 - Now further improved | B4X Programming Forum


Nearly six years ago I posted the original B4A versions of this library and project that were in fact a port to Java from the original Basic4ppc .Net C# versions that I wrote even earlier. Shortly after that I gave up Android development out of disgust with Google and returned to playing with Basic4ppc and C# under Windows.

I now find myself back having to use Android for mobile work owing to the now almost total unavailability of small (seven and eight inch) Windows tablets with reasonable amounts of memory and decent performance. In fact even small (seven inch) Android tablets with a decent amount of memory and storage seem to have gone missing from the market :(

I like to be able to actually knock up small ad hoc programs on a mobile device but have found nothing in the Play Store appropriate for my use (apart from perhaps DroidScript but that’s a different discussion). So I got the Basic4Android trunk down from the attic and blew the dust off it.

So in case anyone is interested in playing with it here we have an updated, polished and reasonably documented version of my mobile development environment that is easily customized with your own additions. Download the zip and before extracting it unblock it by right clicking on it in File Explorer, selecting Properties and checking Unblock at the lower right of the General tab otherwise the CHM help files will need to be individually unblocked.

At the top level of the zip you will find a Readme.txt file so I suggest you do just that!

NOTE: This project will not work when run in Release(Obfuscated) mode without renaming all the extension Subs in the Script module to contain underscores. It will also not run with the rapid debugger for reasons described in the help.

NOTE: If on Android 8.1 or later you are getting unwanted underlining in the editor try adding the following two lines to Main.Activity_Create after the other edtSource property assignments.
B4X:
edtSource.InputType = 0x00080000 ' TYPE_TEXT_FLAG_NO_SUGGESTIONS
edtSource.SingleLine = False

I have posted a complementary B4J BalToBasicIDE project which can use the .bal layout file from a B4A project to provide a control layout for a BasicIDE project.

********************************************************************
NOTE THAT THIS VERSION OF BASICIDE IS SUPERSEDED BY BASICIDE SUITE HERE
https://www.b4x.com/android/forum/threads/basicide-suite-on-device-development-ide.107975/
*********************************************************************
 

Attachments

  • BasicIDE_v2.0.zip
    328.2 KB · Views: 779
Last edited:

JohnC

Expert
Licensed User
Longtime User
Am I correct in my initial understanding that this allows us to embed a basic-like scripting language in our apps that would allow end-users to customize our apps (if our apps expose methods and objects of the app)?
 

JohnC

Expert
Licensed User
Longtime User
Cool! I remember a company called Sax that did something similar with VB.
 

agraham

Expert
Licensed User
Longtime User
your libs can be used with B4J?
I've just tried and can see that BasicLib needs some minor changes to run in B4J - interestingly against my expectation the event mechanism does seem to work. I guess Erel kept it compatible in B4J with B4A.

I've got the library running by knocking some out colour related stuff that I will need to rewrite. Although colors are probably of little interest in B4J I may as well try to keep what will be jBasicLib fully aligned with BasicLib. I'll try and post a B4J version in a few days.
 

agraham

Expert
Licensed User
Longtime User
About the colors, the correct approach is to leave them as integers
Actually they were, and are, but I was using android.graphics.Color for parsing and combining the A, R, G and B colour components so I need to replace that with some bitwise logic.
 

Adie

Member
Licensed User
Longtime User
There is life again. :)

From here https://www.b4x.com/android/forum/threads/b4a-interpreter.84167/#post-533656

I finally developed a complete ready mix management system with B4A and BasicLib 1.98 in 2017. All processing programming was done in BasicLib 'format' and run with the interpreter. Speed and robustness was 100%. Basically a VERY high end PLC interfacing with the plant. :D Lots and lots changed and the system was tested on a Raspberry Pi with Android Things. As we went from C++ development to Pascal (Lazarus) the urgent need for Android was pushed to the back of the list. December 2018 we decided to re-evaluate B4A and the Pi for entry level plants. We are porting applicable parts of the Quote and Order systems to Android and B4A. It will only run on 7" systems to accommodate all the on screen data and simplify programming.

We only used the BasicLib interpeter in our app. Now with the 'upgrade' we will be more 'at ease' with the long term sustainability of the Lib.

Thanks.

Adie
 

agraham

Expert
Licensed User
Longtime User
Now with the 'upgrade' we will be more 'at ease' with the long term sustainability of the Lib
Interesting use case. The source is pure Java, compilable with SLC and available for purchase at the right price if you really want long term assurance. ;)
 

johndb

Active Member
Licensed User
Longtime User
I am testing the interpreter (B4A Version) but I am getting the following error when running the sample script "IdeTest". It would appear that the subs in the script activity are not recognized. I am testing the sample code as-is.

Error.png
 
Last edited:

agraham

Expert
Licensed User
Longtime User
I downloaded the project from the first post above to check and it works fine for me. In the Script module at line 689 should be this
B4X:
Sub SetActivityTitle(title As String)
    Activity.title = title
End Sub

and at line 3533 this
B4X:
    ' Activity functions
    Blib.AddSysCalls(Array As String("ActivityFinish", _
                                    "CloseMenu", _
                                    "GetFirstTime", _
                                    "CloseAfterThis", _
                                    "LogCat", _
                                    "OpenMenu", _
                                    "SetActivityBackground", _
                                    "SetActivityTitle", _
                                    "SetActivityTitleColor"))
If they are there and it is not working then you have me baffled. Try starting from scratch again.
 

johndb

Active Member
Licensed User
Longtime User
I downloaded the project from the first post above to check and it works fine for me. In the Script module at line 689 should be this
B4X:
Sub SetActivityTitle(title As String)
    Activity.title = title
End Sub

and at line 3533 this
B4X:
    ' Activity functions
    Blib.AddSysCalls(Array As String("ActivityFinish", _
                                    "CloseMenu", _
                                    "GetFirstTime", _
                                    "CloseAfterThis", _
                                    "LogCat", _
                                    "OpenMenu", _
                                    "SetActivityBackground", _
                                    "SetActivityTitle", _
                                    "SetActivityTitleColor"))
If they are there and it is not working then you have me baffled. Try starting from scratch again.

Yes, both exist. I am using B4A Version 8.80 (latest) and testing it on a Pixel XL with Android version 9. It would appear that all syscalls aren't connected to the script activity. They are all underlined (red) indicating that the subs aren't found. I'll reinstall the libraries and will give it another go. Thanks.
 

johndb

Active Member
Licensed User
Longtime User
Yes, both exist. I am using B4A Version 8.80 (latest) and testing it on a Pixel XL with Android version 9. It would appear that all syscalls aren't connected to the script activity. They are all underlined (red) indicating that the subs aren't found. I'll reinstall the libraries and will give it another go. Thanks.
I downloaded it again and unfortunately I had the same error. I also tried using a Galaxy 5, Android Version 6.01 with the same error.
Has anyone else played with this other than @agraham? It seems to work for him ... he is the author ;)
Thank you,
John
 

agraham

Expert
Licensed User
Longtime User
It would appear that all syscalls aren't connected to the script activity. They are all underlined (red) indicating that the subs aren't found
Thats' not why they are underlined. The editor isn't that clever, there is no code in the main module that does that. The editor is an unadorned EditText which is why I suggest in the help that you use a dedicated code editor like Quoda to edit the code. I've haven't had time to investigate but it looks like EditText may have grown a spellchecker in Android 8.1.0 which is on by default. My Xiamoi Mi Max 3 with 8.1.0 displays them, my Huawei Y7 with 8.0.0 does not. BasicIDE works on both.

Are you trying to run in Release(obfuscated) mode? If so this will cause the problem you are seeing. The Sub names are mangled and can no longer be identified by their original name. This kills Callsub as well.
 
Last edited:
Top