PDA

View Full Version : a very short tour in thinbasic Oxygen module



primo
29-01-2018, 12:31
if you have a huge repetitive task such as in the fractals then you need a compiler, fortunately there is an embedded compiler inside thinbasic called Oxygen.
how to use it?
by providing a string contains oxygen code to oxygen engine for processing
there are 3 ways to do this:
1- using a normal string (the last line should have a new line)
2- using a RawText ....

string src = RawText
...code here
End RawText
3- by writing Oxygen code in external file and loading the whole file to a string then provide this string to the oxygen processor

Uses "oxygen", "File"
String src=FILE_Load("oxy.bas")
...

for a working examples look for thinBasic_Oxygen.zip here https://github.com/Charles-Pegge/OxygenBasic
also save the new oxygen.dll and thinBasic_Oxygen.dll to thinbasic\Lib
look at the oxygen_help.chm in the package

to be able to use the examples in the thinbasic distrubution (which is old)
1-remove the word "basic" after the very beginning of the string we want to provide to oxygen processor
2- in the functions inside oxygen replace AT with link , look example O2Functions.tbasic in the package from github above
3-to make a DLL from oxygen you must include RTL32.inc look folder DLL in the package

if you keep these small changes in mind then you will keep enjoying using Oxygen compiler in thinbasic

another small note: we can write strings in oxygen like "this is a string" or `this is a string ` the privilige of using ` ` is that we can use " inside any way we want such as
` thinbasic with "oxygen" `
example:

Uses "oxygen"

String src = RawText
Dim st As String
st = ` Thinbasic With "Oxygen" is a good choice`
mbox st
'print st
End RawText

o2_basic src
If o2_error Then
MsgBox 0,o2_error
Stop
Else
o2_exec
End If

also there is a possibility to use the Console , look example consoleIO.tbasic in C:\thinBasic\SampleScripts\Oxygen\DLLandEXE\CompilingExe

ErosOlmi
29-01-2018, 21:43
Sometimes I forget about this great on the fly in memory (and not only this) compiler.

Charles Pegge
01-02-2018, 16:04
ThinBasic_Oxygen has just been updated. We are approaching the first beta version of oxygen.dll. 141K and shrinking further! We have lost a few redundant keywords like basic and asm.

https://github.com/Charles-Pegge/OxygenBasic/blob/master/thinBasic_Oxygen.zip

ErosOlmi
01-02-2018, 23:20
Thanks Charles!
I will add into next thinBasic distribution