PDA

View Full Version : Oxygen within thinBasic - some Feedback



ReneMiner
17-07-2013, 12:18
This is just some feedback to mirror reasons why I never thought about using Oxygen within tB and never had a closer look at it. Maybe other users experienced similar impressions. This is not supposed to be an offense but to clearify why one would not try to use it, because I think it merits to get paid more attention.

All posts in this forum-section are older than a year or so... has there been no change in all this time? I really thought built-in oxygen-module would be some forgotten leftover of old times and became an own language later.

Anyway, thinBasic-help tells only


How to do?


Inside your script, before calling any module specific keyword, add the following:

USES"Oxygen"

How to do?


To have more info about this fantastic module see Oxygen dedicated thinBasic community forum (http://community.thinbasic.com/index.php?board=175.0)



I think there would be better a link to HERE (http://www.oxygenbasic.org/) instead of a dead link and to this current forum-section here or to the oxygen-forums and also some note to check oxygen-help (which I honestly discovered yesterday!) from thinAir-User-Help too.

The Oxygen-helpfile ("About Asmosphere") should document Oxygen-basic too. Also in there is a dead link to some forum which made me think it's outdated already and the with tB shipped oxygen-examples should be checked- there are so many that don't run - so is no good way to learn from them, since someone who's learning it can only guess what the reasons for errors are. For someone who does coding for fun it's daunting to have to browse a few dozen samples over and over again to find out how to.
So it would be nice to have a description how oxygen-jit works in general- so what the first steps are, even that one has to set up the oxygen-code inside some string first or to load it from some file and then to execute it. For you and people who studied informatics, that seems to be the logical way - but how could someone know who did not invent it?

Disturbing to me is also the pick of variable-names in the examples. Of course it's nice to have them examples small - but I would appreciate if demonstrational user-variables are not abbreviations but some readable words, so the code and what it does becomes easier to follow. It's already enough if the keywords are small.

Also documentation/samples on oxygen-site (http://www.oxygenbasic.org/introductory.htm)are somewhat cryptic and hard to understand for a beginner, so I have for example not understood yet what this means:


float v[q]<=(9,8,7,6,5,4,3)

why "<=" ??? - and why is "<=" twice in the keyword-reference but only information is "operators" and not a real description what it does. The layout of the online-oxygen-basic-doc is cumbersome, I would prefer some common help-file-style with some treeview/search/Index, favoured offline with fitting link to or at least mentioning the filename of some sample-script about this topic/method instead of opening a dozen tabs in my browser.

OK, this should be enough of the stuff that scared me away from using oxygen for now.

ReneMiner
17-07-2013, 22:17
I did not blame anyone - I just told what kept me from snooping in. And there are a few things that scare someone like me - who does not get paid for typing functions and stuff - away from trying it. And that's mostly if there's no overview about functionality, possibilities, purpose. If you had not told me that oxygen-compiler could do stuff as adressing variables by their names stored to some string - I would not have had a look at it til now. It appeared to me somehow like COM/COMM-module or Sapi or DirectInput which is only there for some certain use. For example SMTP or Crypto seem to me the same seven sealed books which only serve the needs of professionals who know what they are doing with their computers- but I am just one who's trying out :D

Charles Pegge
17-07-2013, 22:26
Hi Rene,

I need to reintroduce thinBasicOxygen here, and and weed out, if not dump most of the examples, which were made during the early development of Oxygen. There is also a new thinBasic_Oxygen ready to go, with a much smaller set of examples demonstrating ThinBasic interfacing. There are hundreds of native O2 examples included in the Oxygen-in-progress .zip.

If your TB apps require high performance in areas such as image processing, or collision detection, then this is where Oxygen becomes useful, as an alternative to developing specialised modules.

For Manuals and documentation, I seek assistance. If it is left entirely to me, it will take a long time. It requires a different kind of brain, and it takes a while to grow one :)

Charles

ReneMiner
18-07-2013, 10:28
searching for that zip-file I've found another oxygen-documentation hidden in C:\thinBasic\Sample Scripts\Oxygen\Data Processing\ManualHTML
thinBaisc_oxygen_help.chm - with some information about available oxygen-basic keywords. They are only through "Index" to find, but better than nothing - this and the other (regular) one ("about asmosphere") can probably be combined... :)

Petr Schreiber
20-07-2013, 16:10
I use the Oxygen from within ThinBASIC quite frequently, if Charles can hear me, I am still interested :)


Petr

Charles Pegge
20-07-2013, 16:50
Hi Petr, Welcome back :)

Would you like to try this version of thinBasic_Oxygen. It uses the generic Oxygen.ll, which belongs in the lib folder.

Charles

Petr Schreiber
20-07-2013, 19:32
Thank you!,

I usually use the basic (or BASIC) link functionality for non parallel speed kicks, it works great for me even in the updated version.
Can I find somewhere current list of changes?


Petr

Charles Pegge
20-07-2013, 21:22
Petr, The main critical change following the 'link' word, is the removal of operator overloading. Most of the other changes are bug fixes and syntax-yoga , of which there are many (about 1000 since 2010). Anyway, I am relieved that your O2 code still works.

This new thinBasic_Oxygen module is itself written in Oxygen, and interfaces generic Oxygen.

Here is the Alpha040 log, relating to the Oxygen-in-progress version:

Charles Pegge
20-07-2013, 21:28
John, this is a simple example, posted earlier. There are more complex examples included in /ProjectsB/ThinBasic/Examples.
I am trying to get everything under the same roof :)



uses "oxygen"


dim as string src
dim as long pHypot3d
dim as long pFinish


src="
function hypot3d(double a,double b, double c) as double link #pHypot3d
return sqr( a*a+b*b+c*c)
end function


sub finish() link #pFinish
terminate
end sub
"
o2_basic src
if o2_error then
msgbox 0,o2_error
stop
else
o2_exec
end if


declare function Hypot3d(byval double, byval double, byval double ) as double at pHypot3d
declare sub Finish() at pFinish


msgbox 0,Hypot3d(2,3,4)
Finish()

zlatkoAB
21-07-2013, 01:43
@Rene
what is not clear here:

float v[q]<=(9,8,7,6,5,4,3)
it is only a array of numbers
q=7
v[1] = 9
and this operator just say to you what content belong to this array.
I do my programs lately only in Oxygen i am quite happy how Oxygen Basic work:)

ReneMiner
21-07-2013, 07:10
I'm trying to understand and learn - but my brains are old, rusty and stuffed with loads of useless knowledge, that's why I still did not get it.

I know this "<=" as some comparison-operator. If it's used to assign values it would be enough to use just "=".
So does this assign the values to the array ordered from smallest to largest or what?
Or does it assign only values if the original value of the variable is smaller than the new one?
or is it just supposed to symbolize an arrow as "->" in some older c-dialect?

Edit: hours later :) ...does it mean to assign the count of elements to the variable enclosed in brackets?

zlatkoAB
21-07-2013, 08:52
rene
It is just a content of array ...
try this one:

INT arr[5]
arr[q] <= (1,2,3,4,5)
print str arr[2] ' show 2

so ,as you see is very clear what it is,right?

ReneMiner
21-07-2013, 09:01
I tried this:



Uses "oxygen"


String src = RawText
'
#basic
'
Int arr[5]
Int q
arr[q] <= (1,2,3,4,5)
Print str arr[2] ' show 2
Print str q
'
terminate
'
End RawText

O2_BASIC src
If Len(O2_ERROR) Then
MsgBox 0, O2_ERROR : Stop
End If

O2_EXEC

Output:
3
0

???
Now I'm speechless

Charles Pegge
21-07-2013, 09:07
'<=' is use a multi-assign operator. Oxygen also accepts '=>' as used by Freebasic. Curly braces are also accepted:

long a[5]={1,2,3,4,5}

The reason for this flexi-syntax is to support clean layouts of data, including tabulations:



dim as long a[16]
...

'no need for brackets here
a=>
1, 2, 3, 4,
2, 4, 6, 8,
3, 6, 9,12,
4, 8,12,16

Charles Pegge
21-07-2013, 09:17
Aurel, Rene,

Correction here: Oxygen static arrays are dimensioned at compile-time. So the number of elements must be a constant. The new version will report the error.

%q=5
arr[q] <= (1,2,3,4,5)

ReneMiner
21-07-2013, 09:27
strange: twice nearly the same content



Uses "oxygen"


String src = RawText
'
#basic
'
%q = 5
Int arr[q]
arr[q] <= (1,2,3,4,5)
Print str arr[2] ' show 2
Print str q

terminate
'
End RawText

O2_BASIC src
If Len(O2_ERROR) Then
MsgBox 0, O2_ERROR : Stop
End If

O2_EXEC

the above results wrong


Uses "oxygen"


String src = RawText
'
#basic
'
%q = 5
Int arr[q] <= (1,2,3,4,5)
Print str arr[2] ' show 2
Print str q

terminate
'
End RawText

O2_BASIC src
If Len(O2_ERROR) Then
MsgBox 0, O2_ERROR : Stop
End If

O2_EXEC

this one seems correct.
So the <= just means "populate the array"

Edit: I also had a few basic questions - already posted here (http://www.thinbasic.com/community/showthread.php?t=12173&p=89342#post89342)

zlatkoAB
21-07-2013, 17:22
Charles ...
i know the quirks..:D

Rene
I use Oxygen directly ,not trough thinBasic