It is currently Tue May 23, 2017 3:43 pm



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 90 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9  Next
Author Message
 Post subject: Re: Hot summer of code
Unread postPosted: Wed Mar 08, 2017 9:58 am 
Offline

Joined: Wed Feb 20, 2013 3:25 pm
Posts: 423
Location: Italy
Hi all,

Just a question: What happens if one calls LOCALS.OFF inside a function and that function is not invoked inside an interrupt?
Does one get access to the global context?

/ Luca


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Wed Mar 08, 2017 11:29 am 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 325
luca_italy wrote:
Hi all,

Just a question: What happens if one calls LOCALS.OFF inside a function and that function is not invoked inside an interrupt?
Does one get access to the global context?

/ Luca


Hi Luca,

You know BASIC! is an interpreter.
If BASIC identifies some characters as a variable name, it searches for a variable by name.
Normally inside functions BASIC! searches in a local (function) symbol table.
But in this test version in BASIC! notation:

IF mGlobalsAll=1 & mLocals=0
! Search in all symbol tables
ELSE
! Search in local (function) symbol table
ENDIF

In the test version it is interrupt independent.
It is your choice to insert GLOBALS.ALL at program start, after ON***: in a function or where you want.
But there must be a LOCALS.OFF, too!

To be compatible with interrupts you have to take a decision, because BASIC! does not know the needs of access to variables in the main loop.

Happy coding
Gregor


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Wed Mar 08, 2017 12:33 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 325
Hi Janusz,

januszchmiel wrote:
Dear specialists. I have constructive suggestion. Why Rfo-Basic can not contain console based commands which are capable to create all available Android object types for GUI controls creation such as buttons, combo boxes, radio buttons, check boxes and others. Which problem prevent you from making that,

It is not a problem more a complex task. Maybe a case of an external Activity like Custom Controls. Android's GUI is template layout driven. Some controls are SDK dependent. Normally not an issue but Google removed some controls later.
Quote:
so for now, only HTML5 and Webwiev can enable developers to use those kind of GUI controls.

Sorry, but in this case you are wrong. See "Tools for BASIC!", especially Emil's (RSA) tool.
Quote:
I Am wondering why is it so complex to incorporate this. So GUI of console based apps would also use other object types than list items or OK and Cancel buttons. For now button radio button and check boxes would be incorporated as beginning. What do you think about it?

Suggestion: Take a look in some layout.xml files.

And Janusz, what is with the bug fix at the SELECT command. Does it work properly now?
What was before and after update?

Gregor


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Fri Mar 10, 2017 1:01 pm 
Offline
User avatar

Joined: Mon Aug 18, 2014 1:16 pm
Posts: 1336
Hi Gregor

Do you think a New group command would be possible:
Gr.group.array <object_number_nvar>, <array_ptr_nexp>

At the moment it is very long winded to add an array to a group
Code:
gr.group allHelp, helpBox[1], helpBox[2], helpBox[3], helpBox[4], helpBox[5], helpBox[6], helpBox[7], helpBox[8], helpBox[9]

I have asked this question before
add-an-array-to-a-group-t4569.html

Regards Roy


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Fri Mar 10, 2017 3:48 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 325
Hi Roy,

roy wrote:
Hi Gregor

Do you think a New group command would be possible:
Gr.group.array <object_number_nvar>, <array_ptr_nexp>

At the moment it is very long winded to add an array to a group
Code:
gr.group allHelp, helpBox[1], helpBox[2], helpBox[3], helpBox[4], helpBox[5], helpBox[6], helpBox[7], helpBox[8], helpBox[9]

I have asked this question before
add-an-array-to-a-group-t4569.html

Regards Roy


I would write it like this:
Code:
List.add.array elementListPointer, helpBox[]
Gr.group.list allHelp, elementListPointer


Gregor


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Sat Mar 11, 2017 12:39 am 
Offline
User avatar

Joined: Mon Aug 18, 2014 1:16 pm
Posts: 1336
OK Thanks Gregor

Regards Roy


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Fri Mar 17, 2017 6:30 pm 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 325
Hi ALL,

I updated to base release 1.91, made some enhancements and corretions.
Please read the description carefully especially the article about Android internal and external file folders.

An short example:

Code:
REM FilesB.bas
ARRAY.LOAD paths$[], "_Source", "_SourceSamples", "_Data"~
, "_Database", "_App", "_AppPath", "_Alarms", "_Dcim", "_Documents"~
, "_Downloads", "_Movies", "_Music", "_Notifications"~
, "_Pictures", "_Podcasts","_ProgramPath", "_Ringtones", "_External"~
, "_System", "_Storage", "_Mnt", "_SdRemovable", "_InternalOnSdRemovable"~
, "_InternalOnExternal", "_Internal"
ARRAY.LENGTH al, paths$[]
FOR i = 1 TO al
FILE.ROOT dataPath$, paths$[i]
PRINT paths$[i]; ": "; dataPath$
fn$ = "file://" + dataPath$
IF dataPath$ = ""
  PRINT "Path not found!"
ELSE
  FILE.EXISTS ok, fn$
  IF ok = 4
   PRINT "*** read- and writeable ***"
  ENDIF
  IF ok = 0
   PRINT "File / Directory does not exists!"
   dl = 0
  ELSE
   FILE.DIR "file://" + dataPath$, dirFiles$[]
   ARRAY.LENGTH dl, dirFiles$[]
  ENDIF
  FOR k = 1 TO dl
   PRINT  ": "; dirFiles$[k]
  NEXT k
ENDIF
NEXT I

fn$ = "file://" + dataPath$
FILE.EXISTS ok, fn$
IF  ok = 3
BUNDLE.PUT bp, "Test", "Contens"
BUNDLE.SAVE bp, "file://" + dataPath$ + "/" + "Bundle.bn"
FILE.MKDIR "file://" + dataPath$ + "/MyDocs"
ELSE
PRINT "file://" + dataPath$ + " is not writeable"
ENDIF


Download under:
https://github.com/RFO-BASIC/Basic/files/852057/OliBasicXV.zip

Happy coding
Gregor

EDIT 2017-03-18
IF ok = 4
PRINT "*** read- and writeable ***"


Last edited by aFox on Sat Mar 18, 2017 3:28 am, edited 1 time in total.

Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Fri Mar 17, 2017 9:39 pm 
Offline
User avatar

Joined: Mon Aug 18, 2014 1:16 pm
Posts: 1336
Hi Gregor

I'v install the update and run the example. Result below

Regards Roy
Attachment:
snap.PNG
snap.PNG [ 83.95 KiB | Viewed 292 times ]


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Sat Mar 18, 2017 3:39 am 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 325
Ok

You did not save the code before running.
I will fix this.

Thanks a lot!

/ Gregor


Report this post
Top
 Profile  
 
 Post subject: Re: Hot summer of code
Unread postPosted: Mon Mar 20, 2017 8:54 am 
Offline
User avatar

Joined: Wed Jul 10, 2013 8:11 am
Posts: 325
Hi All,

I fixed the bug and added a new FILE.LASTMODIFIED.

Download under
https://github.com/RFO-BASIC/Basic/files/855992/OliBasicXVI.zip

Code:
REM Example Restart.bas

BUNDLE.IN action$, data$, bp
PRINT action$
PRINT data$
DIALOG.MESSAGE "Restart", "Restart?", selection, "ok",  "bas from data", "next"
IF selection = 1
RUN
ENDIF
IF selection = 2
RUN "file://" + data$
ENDIF
DIALOG.MESSAGE "CreateProgramFile", "And Restart?", selection, "ok",  "only bas", "escape"
IF selection = 1 |  selection = 2
!Create a new BASIC! program
FILE.ROOT dataPath$, "_Internal" % Internal privat protected program path, no write permissions needed!!!
fn$ = "file://" + dataPath$ + "/" + "myProg.bas"
TEXT.OPEN w, ft, fn$
TEXT.WRITELN ft, "PRINT " + CHR$(34) + "Hello World!" + CHR$(34)
TEXT.WRITELN ft, "FILE.LASTMODIFIED t," + CHR$(34) + fn$ + CHR$(34)
TEXT.WRITELN ft, "PRINT " + CHR$(34) + "myProg.bas last modified at " + CHR$(34) + "%;t"
TEXT.WRITELN ft, "PRINT USING$( , " + CHR$(34) + "%tY-%<tm-%<td %<tH:%<tM:%<tS" + CHR$(34) + ", int(t))"
TEXT.CLOSE ft
ENDIF
IF selection = 1
! Restart with new program
RUN fn$
ENDIF
END


The APK you can get here
https://github.com/RFO-BASIC/Basic/files/855456/Restart.zip

First start the Restart app.
Second the following bas file manually.

Code:
REM CallRestartB.bas

FN.DEF CallRestart(mProg$)
FILE.ROOT filePath$,"_Source"
filePath$ = "file://"+filePath$
LIST.CREATE S, commandListPointer
LIST.ADD commandListPointer~
"getLaunchIntentForPackage(" + CHR$(34) + "com.rfo.RestartTest" + CHR$(34) +");" ~
"setData("+ CHR$(34) + filePath$ + "/" + mProg$ + CHR$(34) +");" ~
"addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);" ~
"EOCL"
BUNDLE.PL appVarPointer,"_CommandList",commandListPointer
APP.SAR appVarPointer
FN.RTN appVarPointer
FN.END
aP = CallRestart("Background.bas") % Your example BASIC! program


You see, calling the last code two times you get with the Restart app every time the same result, because the RUN command saves the last incomming data by calling.

What we now need, is an activated compiler checkbox for ExternalWritePermissions.
If you use the _Internal directory you need no ExternalWritePermissions.
If the App is deleted all the data are also automatically deleted.

Happy coding
Gregor

EDIT 1. Link changed


Report this post
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 90 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9  Next


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred