Author Topic: Android revisited  (Read 6082 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3511
    • ScriptBasic Open Source Project
Android revisited
« on: May 10, 2014, 02:17:38 PM »
Quote
Folks,

Recently I bought a Nexus7 tablet, because I don't want to be sitting with my laptop on the couch all the time :)

It contains Android 4.4.2 and works pretty well. Of course I installed Terminal IDE, which contains a rather complete set of Unix commands and a GCC port, and I tried to compile BaCon also.

Good news is that the shell version of BaCon could convert BaCon completely to C source code.

Bad news is however, the C compiler runs into an issue mentioned somewhere else in this forum: two missing C header files, namely <ftw.h> and <search.h>. After all recent developments I more or less forgot what these are used for.


    <ftw.h> - this header file only is used for the DELETE RECURSIVE statement, and contains convenience functions for a "File Tree Walk". In recent man pages I found a remark that though it is part of POSIX2001, in the more recent POSIX2008 it is considered to be obsolete. Instead, the header file <fts.h> should be used ("File Tree Search"). This last header file also is available in Android. However, it cannot be found in Unix distributions like Tru64 and some older Solaris versions.

    <search.h> - this header file is used solely for the C function 'lfind', which actually looks up the value of an associative array member. It can be replaced by 'bsearch' which is contained in the generic <stdlib.h> (also available in Android), however, it will have a severe negative impact on BaCon's performance.


For <ftw.h>, it will not be difficult to implement the file tree lookup from scratch, so there will be no dependency to <ftw.h> nor <fts.h>.

For <search.h>, it would be a waste to downgrade performance by using 'bsearch'. But probably it also can be worked around by implementing 'lfind' from scratch, provided there's no performance loss.

So I will start looking into this and will keep you posted.

Rgrds
Peter

Thanks for the substitutions for the ftw.h and search.h. I will give that a try and update my Android port of BaCon.

Offline John

  • Forum Support / SB Dev
  • Posts: 3511
    • ScriptBasic Open Source Project
Re: Android revisited
« Reply #1 on: May 26, 2014, 10:29:29 PM »
Quote
It turns out that compiling other programs is not so straight forward, so I will come up with some instructions later. As a final proof, a screenshot of a working Gopher client.

I was able to get the gopher.bac example to compile after changing the PAGESIZE define. (previously defined error) I also got an error on exit due to the hard coded path with line 369.

OPEN GETENVIRON$("HOME") & "/.gopher.txt" FOR WRITING AS bm

I'm not using the latest 3.0.1 beta and using a version I hacked to get BaCon to compile native. I'm using C4droid's version of gcc in my own custom development environment that runs on non-rooted devices. This includes SDL, Qt, OpenGL with Android gesturing, orientation and other native app / Android VM interface goodies. You should find traces of this in posts I've made over the last couple years.

 




« Last Edit: May 27, 2014, 12:11:38 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3511
    • ScriptBasic Open Source Project
Re: Android revisited
« Reply #2 on: May 27, 2014, 10:10:45 PM »
I gave Peter's latest 3.0.1 a try and was finally able to get things to compile with some manual steps. The screen shot also shows cURL with OpenSSL and SQLite 3. This is running on a stock (non-rooted) Samsung Galaxy Tab 2 10.1 tablet.





« Last Edit: May 27, 2014, 11:44:28 PM by John »

Offline John

  • Forum Support / SB Dev
  • Posts: 3511
    • ScriptBasic Open Source Project
Re: Android revisited
« Reply #3 on: May 28, 2014, 09:31:15 PM »
I copied the libbacon.a to my gcc lib directory and bacon to my xbin. I would recommend using the C4droid set of gcc, SDL, Qt, ... rather than the console only TerminalIDE application. C4droid is a much better C / C++ gcc enviornment than the hack job TerminalIDE has done. IMO It's using 4.4.0 gcc and I'm using 4.8.x with C4droid. The major issue I have with Terminal IDE is that I can't use with my blue tooth external keyboard. Terminal IDE displays two characters for every one typed. I see no options in the program to fix this.  :-\


« Last Edit: May 29, 2014, 10:15:24 AM by John »