PDA

View Full Version : thinBasic Beta 1.8.6.0



ErosOlmi
02-08-2010, 15:49
thinBasic Beta 1.8.6.0
Download from: http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.8.6.0.zip

Some bugs fixed from previous beta and few more features.

Main changes:

thinCore: StartsWith function added
thinCore: EndsWith function added
thinCore: temporary fix an internal bug in hash table used to handle UDT elements
thinCore: numeric equates now possible in function default parameters value
thinCore: implicit line continuation when in presence of a delimiter ending the line
thinCore: c-style block comments using /* ... */ pairs
DT: DT_GetTimeStamp fixed. Error in output format
UI: Canvas_GetTextHeight function added
UI: Canvas_GetTextWidth function added
UI: RTF_AppendText improved adding COLOR and BCOLOR blocks and possibility to specify color name taken from predefined color equates
thinAir: improved speed in handling code browser code scanning
thinAir: reduced MDI windows refresh
thinAir: added an option in code browser to sync active MDI window with code browser
thinAir: for better future handling and improvements, code browser scanned elements setup has now its own option dialog in thinAir option
thinAir: fix function name scanning when in presence of = signs in parameters default values
Oxygen module: updated to the latest available on SVN server (examples included)
TBGL module: updated to the latest available on SVN server

... see thinBasic help for complete and detailed list of changes.

More updates in next few weeks

Regards
Eros

Petr Schreiber
02-08-2010, 16:40
Thanks a lot,

the reduced MDI refresh is working well and the other improvements are highly welcomed!

Only one thing - "the sync active MDI window with code browser" works good, but does not react when I use CTRL+TAB to switch to other code.


Petr

ErosOlmi
02-08-2010, 16:44
Only one thing - "the sync active MDI window with code browser" works good, but does not react when I use CTRL+TAB to switch to other code.


Yes, sorry about that but I had some hurry to publish this release.
For the moment I had time to just add it to react to thinAir Tab switching.
I need few more improvements and than I will extend it to whatever MDI switch will be performed.

Ciao
Eros

Petr Schreiber
02-08-2010, 16:58
No problem Eros,

I posted it just to let you know.
The MDI refresh minimalization is great, most visible when launching script from IDE. Before it blinked through all files, now it is more "calm".


Petr

ErosOlmi
02-08-2010, 17:01
I'm getting a lot of advantages transforming thinAir source code from 100% procedural to some Power Basic OOP.
There will be a lot of improvements in thinAir in next versions.

ErosOlmi
02-08-2010, 17:07
Petr,

by this evening I will post an updated beta 1.8.6 with MDI switching codebrowser also when using CTRL+TAB or CTRL+SHIFT+TAB
I think it is better to have it soon at least this one.

Eros

catventure
03-08-2010, 21:34
Thanks for the fixes and another great update. Petr's new string functions "StartsWith" and "EndsWith" very interesting and should prove useful when you have certain text manipulation or searching of strings...

catventure.

ErosOlmi
05-08-2010, 13:32
Forgot to say this version already has some kind of "implicit line continuation".

The general rule is:

if statement (line) ends with a delimiter (a comma, a math operator, ...) parser will ignore $CRLF and will continue parsing next line.
In the bove cases underscore sign (used to indicate line continuation) is not necessary.


Eros

Petr Schreiber
05-08-2010, 17:12
Forgot to say this version already has some kind of "implicit line continuation".

The general rule is:

if statement (line) ends with a delimiter (a comma, a math operator, ...) parser will ignore $CRLF and will continue parsing next line.
In the bove cases underscore sign (used to indicate line continuation) is not necessary.



:shock:
This might be little step for parser, but giant step for mankind ThinBASIC coders.
Thank you very much, just tried it and works great!


Petr

zak
05-08-2010, 17:35
i agree with Petr, this is a giant step for (basic languages), i have not seen this in basic languages at all,
to illustrate visually, the following code resemble a man using this feature, the answer is 90
from now on i am sure the other basics will imitate this.
ps : it should give 81, i have confirmed by using perl, i was using 9+ at the end, now giving the right answer 81

Dim a As Long
a = 1 +
2+3+4+
5+6+7+8+9+
0+0+0+0+0+
1+2+3+4+
5+
1 +1+
1 +1+
1 +1+
1 +1+
1 +1+
1 +1+
9


MsgBox 0, a

ErosOlmi
06-08-2010, 16:00
Sorry, I forgot anothor new feature already available in beta 1.8.6.0:

c-style block comments using /* ... */ pairs

That blocks can be used in single line comments, multi-line comments or inside a code line.
Examples:


/* single line comment */

/***********************
multi
line
comment
***********************/

DIM MyVar AS LONG /* comments into code line */

:oops: :D

Petr Schreiber
06-08-2010, 18:43
:lol:

Just tried it, works good. It might not be typical BASIC feature, but I am used to it from C#, so I welcome it :)

I posted more suggestions related to this here:
http://community.thinbasic.com/index.php?topic=3577.0


Petr

Petr Schreiber
30-01-2011, 16:39
It seems Eset NOD32 antivirus again gives false positive message for this installation. I just sent message to the support, awaiting reply...


Petr

ErosOlmi
31-01-2011, 08:01
Thanks Petr.

Petr Schreiber
01-02-2011, 19:30
After some email exchange I got this:


Dobrý den,
jde o false positive a některá z nových aktualizací detekci odstraní.
Děkujeme za upozornění.


Which basically translates as:


Good day,
it is false positive and one of the new updates will remove this detection.
Thanks for letting us know.



Petr

ErosOlmi
01-02-2011, 19:49
Great.
Thanks a lot Petr

John Spikowski
25-04-2011, 22:58
I thought I would give thinBasic 1.8.6.0 a try under Ubuntu 10.10 64 bit (Wine 1.3 - XP Royale theme)

http://files.allbasic.info/thinBASIC/thinAir.png

OxygenBasic also runs extremely well.

http://files.allbasic.info/thinBASIC/O2h_OpenGL.png

ErosOlmi
26-04-2011, 22:20
Thanks a lot John for your testing.

John Spikowski
03-05-2011, 20:57
Eros,

When I run most of the examples, it asks me to save the file first. :confused:

The examples run fine but curious why the request to save when I didn't modify anything before running the script. Are you seeing the same under Windows?

John

ErosOlmi
03-05-2011, 21:38
In 1.8.6 beta version thinAir had many problems now mostly fixed. See list at: http://www.thinbasic.com/community/projectmilestone.php?projectid=2

Try preliminary 1.8.7 version (not yet finished) at http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.8.7.0.zip

Let me know.
Eros

John Spikowski
03-05-2011, 22:48
There seems to be a problem with the zip.



Archive: /home/jrs/Downloads/thinBasic_1.8.7.0.zip
[/home/jrs/Downloads/thinBasic_1.8.7.0.zip]
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
zipinfo: cannot find zipfile directory in one of /home/jrs/Downloads/thinBasic_1.8.7.0.zip or
/home/jrs/Downloads/thinBasic_1.8.7.0.zip.zip, and cannot find /home/jrs/Downloads/thinBasic_1.8.7.0.zip.ZIP, period.
Update

I was able to extract the archive with the command line unzip utility. (the GUI archive manager didn't work this time)

The save issue seems to have been fixed in 1.8.7.0 and ran the script as soon as I clicked on the green right arrow button.

http://files.allbasic.info/thinBASIC/tB_dict.png

http://files.allbasic.info/thinBASIC/sys.png

ErosOlmi
04-05-2011, 09:58
Thanks again for your testing John.
It is great to see thinBasic also works under Wine.

I have to say I'm not an expert of *nix systems other than installed some VM with Ubuntu for testing. But for those willing to test thinBasic and have a look also under *nix systems, your tests are precious.

Thanks again
Eros

John Spikowski
04-05-2011, 10:45
Happy to help out where I can.

As an added bonus of running under Wine, ODBC uses the native Linux (32/64) unixODBC library which allows you to use native MySQL, PostgreSQL, ... databases in conjunction with other native Linux applications.

I'm overjoyed how well OxygenBasic / OpenGL runs under Wine. They have to be doing some the same native magic to run as well as it does. I haven't tried to use the O2h extension module for thinBasic yet but I will try to find time to give it a try.

John Spikowski
06-05-2011, 00:36
As promised, here is your OxygenBasic extension module example running under Wine. Under Ubuntu, thinBasic programs/scripts are displayed in the file browser/explorer using the thinBasic icon and if clicked, it runs as if I clicked on any other native executable.

PerformSinCos.tbasic


' Test of loop optimization with Oxygen
uses "Console", "Oxygen"

dim T1 as quad
dim T2 as quad

dim p0,p1,p2 as dword
dim src as string

' -- Prepare Oxygen script

src = "

function Calculate_basic(c as long) as long at #p1
local ic, jc as double
local i
'
'
'BASIC VERSION
'
for i=1 to c
ic = sin(i)
jc = cos(i)
next
end function


'


function Calculate_asm(c as long) as long at #p2
local ic, jc as double, i as long
'
'ASSEMBLER VERSION
'
'
dim a=&c
mov eax,a
mov edx,[eax]
fld1
fld1
(
fsincos
fstp qword jc
fstp qword ic
fld1
faddp st(1),st(0)
fld st(0),st(0)
dec edx
jg repeat
)
fcomp st(0),st(0)
'
end function

sub finish() at #p0
terminate
end sub
"

o2_basic src
if len(o2_error) then
msgbox 0, o2_error : stop
end if
o2_exec


dim c as long=1000000

declare function Calculate_o2bas(c as long) as long at p1
declare function Calculate_o2asm(c as long) as long at p2
declare sub finish () at p0

printl "SPEED BENCHMARKS:"
printl ""
printl "Double precision Sin & Cos Test: loops=" & c
printl ""

doevents(off)

hirestimer_init

T1 = hirestimer_get
Counter c
T2 = hirestimer_get

printl "Script: microSecs:" & $tab & FORMAT$(T2 - T1, "#,")

T1 = hirestimer_get
Calculate_o2bas c
T2 = hirestimer_get

printl "Compiled: microSecs:" & $tab & FORMAT$(T2 - T1, "#,")

T1 = hirestimer_get
Calculate_o2asm c
T2 = hirestimer_get

printl "Assembler: microSecs:" & $tab & FORMAT$(T2 - T1, "#,")

finish
waitkey

function Counter( MaxCount as long ) as long
local ic, jc as double,i as long
For i = 1 To MaxCount
jc = sin(i)
jc = cos(i)
Next
end function
http://files.allbasic.info/thinBASIC/tB_O2h.png

John Spikowski
06-05-2011, 06:12
In an attempt to touch all bases, here is a COM example in thinBasic under Wine.



uses "COM"

%MAX_NUMBER_OF_PARAMETERS = 3

dim hXMLHTTP as dword
dim vParam(%MAX_NUMBER_OF_PARAMETERS) as variant
dim vResult as variant

hXMLHTTP = COM_CreateObject("MSXML2.XMLHTTP.3.0")

IF COM_Succeeded(hXMLHTTP) THEN
vParam(1) = "GET"
vParam(2) = "http://www.w3.org/Math/XSL/pmathml2.xml"
vParam(3) = 0 as boolean
if COM_Succeeded(COM_CallMethod(hXMLHTTP, "open", %MAX_NUMBER_OF_PARAMETERS, vParam(1), 0)) then
if COM_Succeeded(COM_CallMethod(hXMLHTTP, "send", 0, 0, 0)) then
if COM_Succeeded(COM_GetProperty(hXMLHTTP, "responseText", vResult)) then
msgbox 0, vResult
end if
end if
COM_Release(hXMLHTTP)
end if
end if
http://files.allbasic.info/thinBASIC/tB_COM.png

Charles Pegge
06-05-2011, 06:14
Hi John,

Did you install thinBasic under Ubuntu/Wine?

I had problems trying to run thimBasic scripts from Ubuntu but I think this is because I am trying to use the thinBasic I installed under Vista.

Charles

John Spikowski
06-05-2011, 06:35
All I did was download the zip, extracted it and right click on the installer .exe saying run it as a Wine job. It went through the normal install dialogs. In my Applications -> Wine menu, thinAir is presented as an option and it would have put an shortcut icon on my desktop if I wanted. If I'm in the Nautilus file browser, thinBasic scripts show with their native Windows program icon and run with just a click.

Sorry, I never used Vista before so I feel lucky.

ErosOlmi
06-05-2011, 06:56
I was thinking about creating a dedicated place where to talk about thinBasic test running under different environment. Placing those interesting posts under this thread ... they will soon fall into forget area.

I will do it this evening (CET time) and that move some posts there.

Charles Pegge
06-05-2011, 07:34
Sharing an executable installed on another operating system, I know is asking a bit much. When thinBasic is installed in Windows, it makes various registry entries which will be invisible when accessing from Linux.

I am optimistic however that there will not be many issues running thinBasic independently installed under Linux/Wine.

Charles

John Spikowski
06-05-2011, 18:33
Wine emulates having a registry (text file) so as far as your application is concerned, it's happy. Without a registry, very few Windows applications would run under Wine.

Take a peek at the system.reg, user.reg and userdef.reg text files in the ~/.wine directory.

ErosOlmi
07-05-2011, 10:37
In general, thinBasic interpreter does not need any registry settings in order to execute scripts.

Instead registry settings are used to

integrate thinAir with the operating system shell
show thinBasic files with dedicated icons in explorer
been able to execute scripts just double clicking on them in explorer
right click on scripts and have dedicated menu


Eros

John Spikowski
07-05-2011, 11:06
http://files.allbasic.info/thinBASIC/tbreg.png

Registry access is working fine in thinBasic under Wine.



uses "Registry"

dim lRet as long
dim sKeyPath as string value "Software\thinBasic"
dim sKeyName as string value "InstallPath"

DIM MyValue AS STRING

lRet = Registry_KeyExists("HKEYLM", sKeyPath, sKeyName)

if lRet = %TRUE then
MyValue = Registry_GetValue("HKEYLM", sKeyPath, sKeyName)
msgbox 0, "Key " & sKeyPath & sKeyName & " exists: " & MyValue
else

if lRet = -1 then
msgbox 0, "Path [" & sKeyPath & "] not found in registry"
elseif lRet = -2 then
msgbox 0, "Path [" & sKeyPath & "] exists but key [" & sKeyName & "] not found in registry"
end if

end if