View Full Version : [Beta] thinBASIC 1.9.16.X
ErosOlmi
01-11-2015, 13:51
ThinBASIC 1.9.16.x
Download from: http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.17.zip
2016.08.14 11:15 (CET Time) updated to version 1.9.16.17: added few additional classes, one module from Petr (StringBuilder), fixed and improved few features.
See list of changes at http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_9_16_17.htm
2016.02.04 23:15 (CET Time) updated to version 1.9.16.16: added few more features to Hash Table. Added thinBasic recent paths. Added a new very interesting data structure: AVL Tree. Create a tree, add new nodes key/data pairs, traverse tree in order from top to bottom and bottom to top. See AVL Tree example in \thinBasic\SampleScripts\DataStructure\
2016.01.24 12:15 (CET Time) updated to version 1.9.16.15: fixed a Tokenizer bug. Added more features to Hash Table now able to change Hash Table capacity and to Clone an Hash Table into another with all key/data pairs.
2016.01.23 12:50 (CET Time) updated to version 1.9.16.14: other fixed in Exit Do, more pre-parsing error checking in IF/ELSE/END IF, few fix in zLib module
2016.01.22 11:43 (CET Time) updated to version 1.9.16.13: hopefully fixed Exit Do. Changed HASH Table functions in order to avoid Second WW SS acronym :) See Hash Table example in \thinBasic\SampleScripts\DataStructure\
2016.01.21 12:14 (CET Time) updated to version 1.9.16.12: an important bug fixed: numeric parameters passed BYREF in user defined functions not working properly. Added new native Core data structure: Hash Table and some functions working with it. Those of you in need to store great amount of data in order to quickly retrieve will love it. See Hash Table example in \thinBasic\SampleScripts\DataStructure\
2016.01.20 22:55 (CET Time) updated to version 1.9.16.11: this version had a BUG that GPF Core Engine. Discard!
2016.01.18 21:42 (CET Time) updated to version 1.9.16.10: some fix, changed the way #INCLUDE find files, added left/right bit shift << >>, added C notation for hex numbers, added Scintilla Edit Control in template dialogs (it's a start), numeric and string equates (constants starting with % or $) can now be declared also without = sign, #INCLUDE and #INCLUDEDIR can now have many meta tags for getting special folders, improved profile info
2015.12.21 05:20 (CET Time) updated to version 1.9.16.9: some fix, added APP_IniFile, renamed #TRACE to #PROFILE, added a profile utility (see help), added more profile info: time spent in function stack allocation/de-allocation, number of function parameters, number of function local variables
2015.12.16 23:45 (CET Time) updated to version 1.9.16.8: some fix plus new #TRACE (http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?trace.htm) directive. See help for more info
2015.12.14 21:10 (CET Time) updated to version 1.9.16.7: nothing new compared to 1.9.16.6 but LD function renamed to StrDistance
2015.12.13 20:41 (CET Time) updated to version 1.9.16.6: #BUNDLE File ... added, FOR ... WHEN ... added, LD function added, ZLib_ExtractToString function added. See help for info
2015.12.01 17:30 (CET Time) updated to version 1.9.16.5: dynamic arrays (numeric and dyn strings) inside TYPEs can now extends the power of thinBasic TYPEs. A new tokenizer module class.
2015.11.23 17:23 (CET Time) updated to version 1.9.16.4: some urgent fixes
2015.11.11 20:00 (CET Time) updated to version 1.9.16.3: some fixes
2015.11.04 07:40 (CET Time) updated to version 1.9.16.2: improved ARRAY SORT ... adding Collate Ucase. Thanks to René Miner.
2015.11.02 21.15 (CET Time) updated to version 1.9.16.1: fixed error reported by Petr Schreiber.
Previous 1.9.16.x beta versions (in case of any needs):
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.16.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.15.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.14.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.13.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.12.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.10.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.9.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.8.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.7.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.6.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.5.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.4.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.3.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.2.zip
http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.1.zip
This version will be an ongoing development version for some time.
Among other changes, this version introduced 1 great new change:
possibility to have TYPEs methods inside TYPE declaration.
possibility to define and re-dimension as many times as needed dynamic string and numeric arrays inside TYPEs
Example:
Uses "console"
Type tCircle
Radius As Double
lColor As Long
Function getRadius() As Double
Return Me.Radius
End Function
Function getColor() As Double
Return Me.lColor
End Function
Function getArea() As Double
Return Me.Radius * Me.Radius * 3.1416
End Function
End Type
Dim c1 As tCircle
c1.Radius = 10
c1.lColor = Rgb(255, 0, 0)
PrintL "---Circle data---"
PrintL "Radius:", c1.getRadius
PrintL "Color:", c1.getColor
PrintL "Area:", c1.getArea
Waitkey
See help for details.
More detailed info and examples will come next days.
Have fun.
Eros
ReneMiner
01-11-2015, 16:40
thanks for the new stuff to play with :)
Sadly i could not find anything about the user-utilities of thinAir documented yet.
Is it already possible? Does the utilities-subfolder belong into c:\thinBasic or c:\thinBasic\thinAir?
----------------------------------------------------------
Missing highlighted keywords because not USES "..." in
c:\thinBasic\thinAir\Syntax\thinBasic\thinBasic.CreateSyntaxIni.tBasic:
Uses "ADODB"
Uses "Excel"
completely undocumented but keywords are created of it:
Uses "ASTAR" ' what's this?
---------------------------------------------------------
The menu for user-help (see image) does not show any names, so it's a guess - i know i have to click on "Help 7" for TBGL-help.
Petr Schreiber
02-11-2015, 19:48
Hi Eros,
so far very good, but I think one little creature slipped the testing.
Try to run this script - it will throw false-positive run time error:
' -- Will trigger run time error, but it should not
MarkSeparator("Monsters (werewolves, dwarfs), are awesome", "!")
Function MarkSeparator( textIn As String, separator As String ) As String
Long i, inBracket
For i = 1 To Len(textIn)
Select Case Mid$(textIn, i, 1)
Case "("
inBracket = TRUE
Iterate For
Case ")"
inBracket = FALSE
Iterate For
Case ","
If inBracket = FALSE Then
Mid$(textIn, i, 1) = separator
End If
End Select
Next
Return textIn
End Function
What is strange is that just reordering the CASEs fixes the problem:
' -- Will run ok
MarkSeparator("Monsters (werewolves, dwarfs), are awesome", "!")
Function MarkSeparator( textIn As String, separator As String ) As String
Long i, inBracket
For i = 1 To Len(textIn)
Select Case Mid$(textIn, i, 1)
Case ","
If inBracket = FALSE Then
Mid$(textIn, i, 1) = separator
End If
Case "("
inBracket = TRUE
Iterate For
Case ")"
inBracket = FALSE
Iterate For
End Select
Next
Return textIn
End Function
Petr
ErosOlmi
02-11-2015, 21:52
Sadly i could not find anything about the user-utilities of thinAir documented yet.
Is it already possible? Does the utilities-subfolder belong into c:\thinBasic or c:\thinBasic\thinAir?
Still to be developed, sorry.
Missing highlighted keywords because not USES "..." in
c:\thinBasic\thinAir\Syntax\thinBasic\thinBasic.CreateSyntaxIni.tBasic:
Uses "ADODB"
Uses "Excel"
Sorry, I do not understand.
completely undocumented but keywords are created of it:
Uses "ASTAR" ' what's this?
An old module developed by Randall: http://www.thinbasic.com/community/showthread.php?8403-Maze-Solver-A-Star-Path-Finding
The menu for user-help (see image) does not show any names, so it's a guess - i know i have to click on "Help 7" for TBGL-help.
:( I will fix in next versions, thanks
ErosOlmi
02-11-2015, 21:53
Hi Eros,
so far very good, but I think one little creature slipped the testing.
Try to run this script - it will throw false-positive run time error:
' -- Will trigger run time error, but it should not
MarkSeparator("Monsters (werewolves, dwarfs), are awesome", "!")
Function MarkSeparator( textIn As String, separator As String ) As String
Long i, inBracket
For i = 1 To Len(textIn)
Select Case Mid$(textIn, i, 1)
Case "("
inBracket = TRUE
Iterate For
Case ")"
inBracket = FALSE
Iterate For
Case ","
If inBracket = FALSE Then
Mid$(textIn, i, 1) = separator
End If
End Select
Next
Return textIn
End Function
What is strange is that just reordering the CASEs fixes the problem:
' -- Will run ok
MarkSeparator("Monsters (werewolves, dwarfs), are awesome", "!")
Function MarkSeparator( textIn As String, separator As String ) As String
Long i, inBracket
For i = 1 To Len(textIn)
Select Case Mid$(textIn, i, 1)
Case ","
If inBracket = FALSE Then
Mid$(textIn, i, 1) = separator
End If
Case "("
inBracket = TRUE
Iterate For
Case ")"
inBracket = FALSE
Iterate For
End Select
Next
Return textIn
End Function
Petr
A fix in on the way, a dummy temp variable not defined during checking.
ReneMiner
02-11-2015, 22:02
...
Sorry, I do not understand.
...
I mean we have both modules (ADODB & Excel) but the script to create the keywords-list does not load them, so the keywords of both modules are not in bold & blue within thinAir-code-window...
Result of this: my current auto-complete-scripting-stuff is kind of incomplete
ErosOlmi
02-11-2015, 22:19
A fix in on the way, a dummy temp variable not defined during checking.
Fixed.
Updated first post of this thread to version 1.9.16.1
Updated download link to 1.9.16.1
New version available for download
ErosOlmi
02-11-2015, 22:24
I mean we have both modules (ADODB & Excel) but the script to create the keywords-list does not load them, so the keywords of both modules are not in bold & blue within thinAir-code-window...
Result of this: my current auto-complete-scripting-stuff is kind of incomplete
OK, I've understood now.
Well the problem is that there are no keywords when modules has embedded module classed.
I mean for example "Visible" property in <ObjectInstance>.Visible is not passed to Core engine as a keyword because is valid only when used with the object for which it has been developed.
You can have any variable defined as "Visible" and this will not interfere with <ObjectInstance>.Visible
If it would be a language keyword you would have a runtime error.
Maybe I need to develop few more APP_List... functionalities able to list all module class objects and for each of them all properties and methods/nested methods.
Quite complex at the moment.
ErosOlmi
04-11-2015, 08:44
Updated to version 1.9.16.2
See first post of this thread.
ReneMiner
04-11-2015, 17:25
small discoveries while fooling around with keywords & especially equates:
Help tells there would be some to Core built-in equate M_Zero
but thinAir-syntax-highlighting does not have it. Using it ends up with an Error.
(tB-help, section Thinbasic Modules\Core\Built-In Constants\Math-Equates)
ErosOlmi
04-11-2015, 22:11
Thanks, solved.
Will be present in next update.
In the module equates are defined as the following and usually first byte of the name is used to determine if it is a string ($) or a numeric (%).
I can force the type passing specific type (see M_Pi) but I missed to specify the type for M_Zero.
And it had no % in front of the name so variable was skipped.
Variable_ADD_Equate "M_Pi" , "" , 3.141592653589793##, %ArrayType_Ext
Variable_ADD_Equate "M_e" , "" , 2.718281828459045##, %ArrayType_Ext
Variable_ADD_Equate "M_Zero" , "" , 0##
Variable_ADD_Equate "%Zero" , "" , 0##
Now I've change to:
Variable_ADD_Equate "M_Zero" , "" , 0##, %ArrayType_Ext
Petr Schreiber
05-11-2015, 08:20
Eros,
do you think you would have time to fill in the documentation for Year, Month, Day, Hour, Minute, Second, Now functions?
The first 6 seem to cooperate nicely with Now, but not with Date$ for example (Month returns Day actually).
It is also possible to call Year, Month, Day, Hour, Minute, Second without arguments, but then they return zero.
What about making them return components of Now directly instead.
Use case:
I wake up with question in my mind "Oh my god, what year is this?" and calling Year would give me answer... :)
Petr
ErosOlmi
05-11-2015, 12:57
do you think you would have time to fill in the documentation for Year, Month, Day, Hour, Minute, Second, Now functions?
The first 6 seem to cooperate nicely with Now, but not with Date$ for example (Month returns Day actually).
It is also possible to call Year, Month, Day, Hour, Minute, Second without arguments, but then they return zero.
What about making them return components of Now directly instead.
Sure, next version will have.
Use case:
I wake up with question in my mind "Oh my god, what year is this?" and calling Year would give me answer... :)
To have such a wake up needs, it means you had a nasty night, isn't it?
:onthequiet:
ErosOlmi
05-11-2015, 19:57
Damn! You are much better than me in programming ... grrrr :D
Using this thread for your project does not give merit to your work.
This post will pass but it would be nice your code remain as a project.
If you like, I can create a dedicated forum for this project under http://www.thinbasic.com/community/forumdisplay.php?194-User-projects
If yes, just give me the name and forum will your as moderator.
Petr Schreiber
10-11-2015, 19:52
Little bug found - not a serious one, as it can be workarounded, but it is change from 1.9.15.0 behavior:
Function TBMain()
If TRUE Then
Stop
End If
End Function
...the STOP will cause MSGBOX error. It is also interesting, that it causes no error at all, if used outside function:
If TRUE Then
Stop
End If
Petr
Petr Schreiber
10-11-2015, 20:52
Eros,
to prove we take stability of ThinBASIC seriously, I think it is good idea to keep the regression set public at GitHub.
I have already started this here: https://github.com/ErosOlmi/ThinBASIC_On_GitHub/tree/master/Regression/1.9.16.x
Simple rules:
- one directory with tests per version A.B.C.x (in this case 1.9.16.x)
- one tests_<module>_<feature>.tBasicU file in tests directory per command/feature (in this case tests_Core_ArrayExtract.tBasicU, ...)
- tests can be launched easily from the root of version folder (in this case by running regression_1_9_16_X.tBasicU)
-- it performs automatic test discovery, so just adding files to tests folder following the tests_<module>_<feature>.tBasicU pattern is enough.
Try to run, it will show problems with Array Extract and Contains I recently discovered + 1 more.
This way it will be easier to check we did not break anything in future + allows users who want to join to get creative and broaden the regression set.
Petr
ErosOlmi
10-11-2015, 22:12
Little bug found - not a serious one, as it can be workarounded, but it is change from 1.9.15.0 behavior:
Function TBMain()
If TRUE Then
Stop
End If
End Function
...the STOP will cause MSGBOX error. It is also interesting, that it causes no error at all, if used outside function:
If TRUE Then
Stop
End If
Petr
Fixed will be present in next release.
ErosOlmi
10-11-2015, 22:13
Eros,
to prove we take stability of ThinBASIC seriously, I think it is good idea to keep the regression set public at GitHub.
I have already started this here: https://github.com/ErosOlmi/ThinBASIC_On_GitHub/tree/master/Regression/1.9.16.x
Simple rules:
- one directory with tests per version A.B.C.x (in this case 1.9.16.x)
- one tests_<module>_<feature>.tBasicU file in tests directory per command/feature (in this case tests_Core_ArrayExtract.tBasicU, ...)
- tests can be launched easily from the root of version folder (in this case by running regression_1_9_16_X.tBasicU)
-- it performs automatic test discovery, so just adding files to tests folder following the tests_<module>_<feature>.tBasicU pattern is enough.
Try to run, it will show problems with Array Extract and Contains I recently discovered + 1 more.
This way it will be easier to check we did not break anything in future + allows users who want to join to get creative and broaden the regression set.
Petr
I need to have some rest and put my head a little bit more concentrated on this.
Give me some day to check it, in the meantime please go on.
I will check examples and fix in the meantime.
Eros
ErosOlmi
10-11-2015, 23:23
Eros,
to prove we take stability of ThinBASIC seriously, I think it is good idea to keep the regression set public at GitHub.
I have already started this here: https://github.com/ErosOlmi/ThinBASIC_On_GitHub/tree/master/Regression/1.9.16.x
Simple rules:
- one directory with tests per version A.B.C.x (in this case 1.9.16.x)
- one tests_<module>_<feature>.tBasicU file in tests directory per command/feature (in this case tests_Core_ArrayExtract.tBasicU, ...)
- tests can be launched easily from the root of version folder (in this case by running regression_1_9_16_X.tBasicU)
-- it performs automatic test discovery, so just adding files to tests folder following the tests_<module>_<feature>.tBasicU pattern is enough.
Try to run, it will show problems with Array Extract and Contains I recently discovered + 1 more.
This way it will be easier to check we did not break anything in future + allows users who want to join to get creative and broaden the regression set.
Petr
Petr,
I've put my single neuron into the matter of Unit Testing :)
I got it in the general form and I'm with you in creating such a units.
Not so easy to maintain and to develop all cases but you are right, we need to go on in this way.
In the meantime ...
I've fixed ARRAY EXTRACT ... Contains ... found in Unit testing
I will release 1.9.16.3 by tomorrow I hope.
ErosOlmi
11-11-2015, 21:56
Updated to 1.9.16.3
See first post in this thread
Some bug fixed:
Array Extract
Stop
thinAir User Help menu
Petr Schreiber
12-11-2015, 18:57
Hi Eros,
thank you so much for 1.9.13.0! Because testing is larger topic, I created new thread here:
http://www.thinbasic.com/community/showthread.php?12607-Possible-approaches-for-testing&p=92254#post92254
Petr
ReneMiner
14-11-2015, 13:26
Small thing to report about Array Extract, Help-file documents wrong Syntax for
Syntax
(for array of pointer to heap allocated memory areas: each element of MainArray MUST be a DWORD pointer to some memory allocated with HEAP* functions.)
nRec = ARRAY EXTRACT PTR MainArray, [COLLATE UCASE,] {StartsWith | EndsWith |Contains} ComparisonStringExpression InTo DestinationArray
life proved it has to be:
nRec = ARRAY EXTRACT MainArray PTR, [COLLATE UCASE,] {StartsWith | EndsWith |Contains} ComparisonStringExpression InTo DestinationArray
ErosOlmi
14-11-2015, 14:10
Thanks, will fix for next release.
I'm working on new Tokenizer. As soon as I have something to test I will publish an updated version, hope by tomorrow.
Petr Schreiber
18-11-2015, 17:37
Hi Eros,
does the SAPI example in SampleScripts work for you with latest Beta? It does not produce any sound here, it seems (Windows 8.1 box)
Petr
ErosOlmi
18-11-2015, 19:59
I have Windows 10.
I will check this evening when back to home and will let you know.
A lot of time I do not use that Module.
ErosOlmi
18-11-2015, 21:42
Under:
Windows 10 physical machine
Windows 7 virtual machine
all seems OK.
sapi example works okay for me in v1.9.16.3
i have tested it in winxp32 and win 7/64b
Petr Schreiber
18-11-2015, 23:34
Thank you, guys!
I tried again, even with reboot and... nothing.
But after brief investiagion I can confirm it is not thinBasic issue - something got broken when I update Windows 8 to 8.1.
Petr
Petr Schreiber
20-11-2015, 13:37
Hi Eros,
I added unit tests to cover Now, Hour, Minute, Second, Day, Month and Year here:
https://github.com/ErosOlmi/ThinBASIC_On_GitHub/blob/master/Regression/1.9.16.x/tests/tests_Core_TimeRelated.tBasicU
Please note there are 9 failing tests, because:
- Hour, Minute, Second, Day, Month and Year without parameter still return zero instead of expected value (that is, current value)
- Hour, Minute, Second are unable to work with string in case it is just like "11:50:25" (but Day, Month, Year is able to work with string without time)
The first is easy to do (we talked about it earlier), the second... what about making the functions even more flexible with... regex!
Before you start parsing the values, you can get the appropriate date/time parts this easily:
#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN () AS LONG
MSGBOX GetDatePart("Hello Eros, do you remember what happened on 11/08/2014. I do not :D")
MSGBOX GetTimePart("Ciao, it is 20/11/2015 today, and I am writing this on 12:36:50")
END FUNCTION
FUNCTION GetDatePart(BYVAL inputText AS STRING) AS STRING
LOCAL position, length AS LONG
REGEXPR "([0-9]+)/([0-9]+)/([0-9]+)" IN inputText TO position, length
FUNCTION = MID$(inputText, position, length)
END FUNCTION
FUNCTION GetTimePart(BYVAL inputText AS STRING) AS STRING
LOCAL position, length AS LONG
REGEXPR "([0-9]+):([0-9]+):([0-9]+)" IN inputText TO position, length
FUNCTION = MID$(inputText, position, length)
END FUNCTION
... with this one, we would be able to return date correctly even from normal text. That would bring even more value.
I am not very strong with regular expressions, but these seem to work! :)
I also created documentation for those functions, you should be able to just copy paste:
Now
Description
Returns date time stamp representing current date and time on local computer.
Syntax
timeStamp = Now
Returns
String
Parameters
Remarks
The time stamp contains two parts, separated by space.
First part represents date, second part time.
The overall signature is:
DD/MM/YYYY hh:mm:ss
Restrictions
Will contain invalid date and time, if you have set it wrong on your local computer.
See also
Day, Month, Year, Hour, Minute, Second
Examples
String dateTimeStamp = Now
Day
Description
Extracts day in month from string containing "DD/MM/YYYY" pattern
If used without parameter, returns current day in month directly.
Syntax
dayNumber = Day(dateTimeStamp)
dayNumber = Day
Returns
Number in range 1..31
Parameters
dateTimeStamp String Yes Value conaining DD/MM/YYYY pattern
Remarks
Restrictions
The passed dateTimeStamp must follow the mentioned signature, otherwise incorrect result can be returned.
See also
Now, Month, Year, Hour, Minute, Second
Examples
Long dayToday = Day(Now)
Long dayFromString = Day("Let's meet on 12/06/2015")
Long dayTodayDirect = Day
Month
Description
Extracts month from string containing "DD/MM/YYYY" pattern
If used without parameter, returns current month directly.
Syntax
monthNumber = Month(dateTimeStamp)
monthNumber = Month
Returns
Number in range 1..12
Parameters
dateTimeStamp String Yes Value conaining DD/MM/YYYY pattern
Remarks
Restrictions
The passed dateTimeStamp must follow the mentioned signature, otherwise incorrect result can be returned.
See also
Now, Day, Year, Hour, Minute, Second
Examples
Long currentMonth = Month(Now)
Long monthFromString = Month("I don't remember what is special about 12/06/2015, do you?")
Long currentMonthDirect = Month
Year
Description
Extracts year from string containing "DD/MM/YYYY" pattern
If used without parameter, returns current year directly.
Syntax
yearNumber = Year(dateTimeStamp)
yearNumber = Year
Returns
Number
Parameters
dateTimeStamp String Yes Value conaining DD/MM/YYYY pattern
Remarks
Restrictions
The passed dateTimeStamp must follow the mentioned signature, otherwise incorrect result can be returned.
See also
Now, Day, Month, Hour, Minute, Second
Examples
Long currentYear = Year(Now)
Long yearFromString = Year("Thinking of 12/06/2015...")
Long currentYearDirect = Year
Hour
Description
Extracts hour from string containing "hh:mm:ss" pattern
If used without parameter, returns current hour directly.
Syntax
hourNumber = Hour(dateTimeStamp)
hourNumber = Hour
Returns
Number in range 0..23
Parameters
dateTimeStamp String Yes Value containing pattern hh:mm:ss
Remarks
Restrictions
The passed dateTimeStamp must follow the mentioned signature, otherwise incorrect result can be returned.
See also
Now, Day, Month, Year, Minute, Second
Examples
Long currentHour = Hour(Now)
Long hourFromString = Hour("I woke up today around 11:50:25")
Long currentHourDirect = Hour
Minute
Description
Extracts minute from string containing "hh:mm:ss" pattern
If used without parameter, returns current minute directly.
Syntax
minuteNumber = Minute(dateTimeStamp)
minuteNumber = Minute
Returns
Number in range 0..59
Parameters
dateTimeStamp String Yes Value containing pattern hh:mm:ss
Remarks
Restrictions
The passed dateTimeStamp must follow the mentioned signature, otherwise incorrect result can be returned.
See also
Now, Day, Month, Year, Hour, Second
Examples
Long currentMinute = Minute(Now)
Long minuteFromString = Minute("It was around 11:50:25, or not?")
Long currentMinuteDirect = Minute
Second
Description
Extracts second from string containing "hh:mm:ss" pattern
If used without parameter, returns current second directly.
Syntax
secondNumber = Second(dateTimeStamp)
secondNumber = Second
Returns
Number in range 0..59
Parameters
dateTimeStamp String Yes Value containing pattern hh:mm:ss
Remarks
Restrictions
The passed dateTimeStamp must follow the mentioned signature, otherwise incorrect result can be returned.
See also
Now, Day, Month, Year, Hour, Minute
Examples
Long currentSecond = Second(Now)
Long secondFromString = Second("Current time is like 11:50:25, ... or maybe not")
Long currentSecondDirect = Second
Petr
Petr Schreiber
22-11-2015, 00:14
Eros,
I added further unit tests for APP_*, ARRAY SORT and COMM fixes and enhancements added in 1.9.16.x - passing, no further issues found = :drink:
If you could just have a look at those Date/Time mini-issues mentioned above, we could have "clean table" to continue with further :)
Petr
P.S. I really wanted to be more productive this weekend, but then... Battlefront happened :P
ReneMiner
23-11-2015, 16:39
few of my older scripts and also my current project suffer from messgeboxes as these (see images)
The messages appear in counts of 5 to 6 after each other- the headline tells to report this in thinBasic-forum.
Ok, i did...
Just to add: always if these messages occur during script-execution 1 more message will appear when script-execution ends
I found a way to repeat the appearance of these bugs in my thinICE.
Uses "console"
Type tType
Eros As String
Petr As String
Rene As String
' --------------------------------------------------------
Function thinBasic(ByRef X As Long, _
ByVal Y(Any) As DWord, _
Optional ByVal Z As Quad )
' --------------------------------------------------------
Local a As tType
Static b As Byte
Dim c(123) As Word
Local d As Double At 0
End Function
End Type
' --------------------------------------------------------
Function TBMain()
' --------------------------------------------------------
Local lName As tType
PrintL
PrintL "---Press a key to finish---"
WaitKey
End Function
• save this script to your disk.
• get thinICE_20151123b.zip (http://www.thinbasic.com/community/showthread.php?12611-preview-thinICE&p=92281#post92281)
• unzip and run thinICE.tBasic from thinAir
• click on "Explorer"-Tab there up left...
• navigate through the pathview to the location of the script above that you just saved before.
(use middle-mouse-button to expand or collapse nodes in tree)
• Load by clicking onto the filename in the filelist-box
(left,center on explorer-tab)
• if you see the script (as in large image below), click into line 23 and type
Function tType.Test()
ErosOlmi
23-11-2015, 19:12
René, please try 1.9.16.4 at: http://www.thinbasic.biz/projects/thinbasic/thinBasic_1.9.16.4.zip
If this will fix your error I will publish it.
Petr, all new date/time functions should be fixed.
I do not like them too much even if I developed. I would like to add a Date variable type sooner or later.
This is a tninBasic code equivalent to your PB example mentioned in previous posts:
Function TBMain () As Long
MsgBox 0, GetDatePart("Hello Eros, do you remember what happened on 11/08/2014. I do not :D")
MsgBox 0, GetTimePart("Ciao, it is 20/11/2015 today, and I am writing this on 12:36:50")
End Function
Function GetDatePart(ByVal inputText As String) As String
Local position, length As Long
RegExpr$("([0-9]+)/([0-9]+)/([0-9]+)", inputText, 1, position, length)
Function = Mid$(inputText, position, length)
End Function
Function GetTimePart(ByVal inputText As String) As String
Local position, length As Long
RegExpr$("([0-9]+):([0-9]+):([0-9]+)", inputText, 1, position, length)
Function = Mid$(inputText, position, length)
End Function
This version didn't add any new feature, I was working on Tokenizer but not yet finished.
This version has latest TBGL from Pter Schreiber.
ReneMiner
23-11-2015, 19:27
yes, the bug seems gone :)
Petr Schreiber
23-11-2015, 21:56
Ciao Eros,
perfect! I like how you fine tuned the help file even further, I am soo happy now.
Now all unit tests passing... :dance1:
If you would like to do some pair coding on DateTime datatype, let me know. Will be happy to help!
Petr
P.S. Forgot about RegExp$, I thought we have just that VBScript wrapper, nice!
P.P.S. One little issue: My examples for help file presumed incorporation of my regex proposal, so the following dob't work currently:
Long dayFromString = Day("Let's meet on 12/06/2015")
Long hourFromString = Hour("I woke up today around 11:50:25")
Long minuteFromString = Minute("It was around 11:50:25, or not?")
Long monthFromString = Month("I don't remember what is special about 12/06/2015, do you?")
Long secondFromString = Second("Current time is like 11:50:25, ... or maybe not")
Long yearFromString = Year("Thinking of 12/06/2015...")
and should be changed to this (unless regex is brought into it):
Long dayFromString = Day("12/06/2015")
Long hourFromString = Hour("11:50:25")
Long minuteFromString = Minute("11:50:25")
Long monthFromString = Month("12/06/2015")
Long secondFromString = Second("11:50:25")
Long yearFromString = Year("12/06/2015")
Petr Schreiber
23-11-2015, 21:59
Rene - as promised, the 1.9.16.4 has the TBGL_PushLogicOp / TBGL_PopLogicOp, so you can drop TBGL_DrawInverted from your thinICE and replace it with this one.
Michael Hartlef
26-11-2015, 11:02
Thank you for the ongoing development of thinBasic!!!
Michael Hartlef
26-11-2015, 11:40
I am testing the newest version and getting errors with some sample scripts.
#1: I am getting this error in Excel/Excel_Test_SingleWorkBook.tbasic
Error Code: 5030
Description: Class not intialized using NEw keyword
Line 50
#2: Similar in Excel/Excel_Test.tbasic
#3: General/Keywords/Keywords.tbasic crashes
#4: General/UDT/UDT_VarPtr.tbasic
Error Code: 18
Description: Unknown Keyword
Line 42
#5: Similar with others in the General/UDT folder
#5: Similar with others in the General/Functions folder
Michael Hartlef
26-11-2015, 11:49
In the Api/Dummy/AnimateWindow.tbasic script, the API call is commented out. Any reason for it? It seems to work fine.
Michael Hartlef
26-11-2015, 12:00
1# In the APi/Dummy/Memory.tbasic it shows only half of my memory available.
2# COM/xml.tbasic crashes with an execption.
Ok, that is all for now. More later when I find something.
Petr Schreiber
26-11-2015, 20:37
Hi Michael,
thanks for the list of issues, it is very important for us!
Nice to see you again!
Regarding APi/Dummy/Memory.tbasic and half memory - it is probably because the API used is 32 bit.
You can easily perform much more precise queries via WMI:
Uses "WMI", "OS", "Console"
String sBuffer = WMI_GetData(OS_GetComputerName, "", "", "", "Win32_ComputerSystem", "", "TotalPhysicalMemory" )
Print "Total memory: "
PrintL Grab$(sBuffer, "TotalPhysicalMemory=", $CRLF)+" bytes" In 10
PrintL
PrintL "Press any key to exit..." In 14
WaitKey
Petr
ErosOlmi
27-11-2015, 19:09
Ciaooooo Michael :)
Thanks for reporting, as Petr said, it is important to try to fix thinBasic as much as possible and have a super stable version asap.
I will have a look in the week-end.
Cheers
Eros
ErosOlmi
28-11-2015, 10:13
I am testing the newest version and getting errors with some sample scripts.
#1: I am getting this error in Excel/Excel_Test_SingleWorkBook.tbasic
#2: Similar in Excel/Excel_Test.tbasic
Regarding this problem, it is related to the Operating System Regional settings configuration regarding "List separator".
In the sample code I've used ; as list separator. You need to check if in your operating system list separator is ; or something else like , comma.
Check image of where to find regional settings
'---Working with sheet.range
Dim sRange As String
sRange = "A1:B3;D1:F10" '<---Change to "A1:B3,D1:F10" based on your OS regional settings
out("Working with range: " & sRange)
xRange = xSheet.Range(sRange)
Let me know if this fix the problem.
Michael Hartlef
29-11-2015, 11:13
Hi Eros,
no it didn't change anything.
9410
The error looks either like a parser problem or classes need to be created via the NEW keyword.
ErosOlmi
29-11-2015, 12:42
What version of MS Excel do you have installed?
Michael Hartlef
29-11-2015, 22:11
Actually I am using LibreOffice. I apologize if you have to have Excel installed to make it work. I thought you need only a excel file for it.
ErosOlmi
30-11-2015, 08:29
No problem Michael,
new Excel module is for COM Automation of Excel so, in order to work, Excel is needed.
I will add a few functions in order to test if instantiated components are valid objects.
Ciao
Eros
ErosOlmi
01-12-2015, 08:18
Almost ready for the next beta update :D
Uses "Console"
Type tWithDynamicArrays
lLong1 As Long
lLong2 As Long
aLong() As Long
aExt() As Ext
End Type
Dim MyT As tWithDynamicArrays
ReDim MyT.aLong(15)
ReDim MyT.aExt (10)
MyT.aLong( 1) = 1
MyT.aLong(10) = 10
MyT.aLong(15) = 15
MyT.aExt ( 1) = 1.1
MyT.aExt (10) = 10.1
ReDim Preserve MyT.aExt (15)
MyT.aExt (15) = 15.1
PrintL "---Press a key to finish---"
WaitKey
All numeric types already handled.
I'm working on:
how to automatically released allocated memory on instantiated type de-allocation
making some utility internal functions
handling arrays of dynamic strings
change UBound/LBound/SizeOf/Parse/, ... and all other functions working with data/arrays
checking bounds
handling up to 3 dimensions (actually just one)
Maybe I will release before developing all whet is needed in order to have your feedback.
ReneMiner
01-12-2015, 14:17
That's great news.
I think it could be possible then for fixed-size String & fixed-size Udts (such that don't contain any dynamic udt-elements) to become dynamic udt-subarrays too - when it works with numeric types :)
Dynamic subarrays of dynamic strings - it's quite easy already to store their keys or ptrs in an array of numbers and use dictionary-module or heap for the data. Dynamic String for me were less important and also for multidimensional data there are ways to calculate the Indexes from 1-dimensional arrays to almost unlimited count of dimensions - only have to know the bounds. And in urgent cases one could always place virtual a multidimensional array up to 3 dimensions without any calculations onto a 1-dimensional.
Ubound/SizeOf and release of (local) data seem to me the most important points then.
ErosOlmi
01-12-2015, 15:30
Yes, at the end is just a a matter of pointers to something ;)
The complex part is to keep track constantly at run-time of what is what, its state and where is located.
Petr Schreiber
01-12-2015, 21:09
If I ever get a tatoo, it will be a few words in english:
"at the end is just a a matter of pointers to something"
:eusaclap:
Petr
Michael Clease
02-12-2015, 17:28
If I ever get a tatoo, it will be a few words in english:
:eusaclap:
Petr
"at the end is just a a matter of pointers to something"
or
"In the end it is a matter of pointers to something"
have different means
Did you notice the double "a a"??
@Eros your English still far exceeds my Italian.:wizard:
Mike C.
ErosOlmi
02-12-2015, 17:32
There is always room for learning something new.
(hope the above is correct :) )
ReneMiner
05-12-2015, 18:26
thanks. already downloaded :)
ErosOlmi
05-12-2015, 18:28
ThinBASIC Updated to 1.9.16.5
Download link can be found in the first post in this thread
Dynamic string and numeric arrays inside TYPEs can now be defined and re-dimensioned as needed.
Many changes are still needed in order to consider complete and bug free but I think it is already quite usable.
A dummy example just showing the new feature:
Uses "Console"
#MINVERSION 1.9.16.5
'-------------------------------------------------
'---Performed tests---
'-------------------------------------------------
' [x] define dynanmic array inside UDT level 1
' [X] numeric dynanmic array
' [X] string dynanmic array
' [x] redimension dynamic arrays within UDT functions
' [x] without using PRESERVE
' [x] numeric dynanmic array
' [x] string dynanmic array
' [x] using PRESERVE
' [x] numeric dynanmic array
' [x] string dynanmic array
' [x] redimension dynamic arrays outside UDT functions
' [x] without using PRESERVE
' [x] numeric dynanmic array
' [x] string dynanmic array
' [x] using PRESERVE
' [x] numeric dynanmic array
' [x] string dynanmic array
' [X] assign a value to dynamic array elements
' [X] numeric dynanmic array
' [X] string dynanmic array
' [x] get a value from dynamic array elements
' [X] numeric dynanmic array
' [x] string dynanmic array
' [x] speed tests getting data from dynamic array elements
' [x] numeric dynanmic array
' [x] string dynanmic array
' [x] speed tests changing data into dynamic array elements
' [x] numeric dynanmic array
' [x] string dynanmic array
' [ ] UBOUND from dynamic array elements
' [ ] numeric dynanmic array
' [ ] string dynanmic array
' [ ] LBOUND from dynamic array elements
' [ ] numeric dynanmic array
' [ ] string dynanmic array
' [ ] VARPTR dynamic array elements
' [ ] numeric dynanmic array
' [ ] string dynanmic array
' [ ] STRPTR dynamic array elements
' [ ] numeric dynanmic array
' [ ] string dynanmic array
'-------------------------------------------------
Type tWithDynamicArrays
lCounter As Long
lLong1 As Long
lLong2 As Long
aLong () As Long
aExt () As Ext
aString () As String
aDWord As DWord
'------------------------
Function SetUp(ByVal nItems As Long) As Long
'------------------------
Me.lLong2 = nItems
Me.aDWord = nItems
ReDim Me.aLong (nItems)
ReDim Me.aExt (nItems)
ReDim Me.aString (nItems)
Me.aLong (nItems) = nItems
Me.aExt (nItems) = nItems
Me.aString (nItems) = "Number is " & nItems
ReDim Preserve Me.aLong (nItems * 2)
ReDim Preserve Me.aExt (nItems * 2)
ReDim Preserve Me.aString (nItems * 2)
Me.aLong (nItems * 2) = nItems
Me.aExt (nItems * 2) = nItems
Me.aString (nItems * 2) = "Number is " & nItems
ReDim Me.aLong (nItems)
ReDim Me.aExt (nItems)
ReDim Me.aString (nItems)
Me.aLong (nItems-1) = nItems-1
Me.aExt (nItems-1) = nItems-1
Me.aString (nItems-1) = "Number is " & Str$(nItems-1)
End Function
End Type
'---Create some variables
Dim MyT As tWithDynamicArrays
Dim lCounter As Long
Dim lMaxLoops As Long = 500000
Dim lExt As Ext
Dim lStr As String
'---Call Type method
MyT.Setup(10)
'---Redim outside a method
ReDim MyT.aLong (15)
ReDim MyT.aExt (15)
ReDim MyT.aString (15)
'---Assign values
MyT.aLong( 1) = 1
MyT.aLong(10) = 10
MyT.aLong(15) = 15
ReDim Preserve MyT.aLong(35)
For lCounter = 1 To 35
Print MyT.aLong(lCounter), ""
Next
PrintL
PrintL Timer
'---Here we go outside bound and thinBasic automatically adjust dynamic array new bound
'MyT.aLong(35) = 15
'---Assign values
MyT.aExt ( 1) = 1.1
MyT.aExt (10) = 10.1
'---Assign values
MyT.aString ( 1) = "Hi there"
MyT.aString (10) = "From thinBasic"
For lCounter = 1 To 10
PrintL lCounter, MyT.aString(lCounter)
Next
PrintL
ReDim Preserve MyT.aString(15)
MyT.aString (15) = "After redim preserve 15"
For lCounter = 1 To 15
PrintL lCounter, MyT.aString(lCounter)
Next
'---Redim preserve
ReDim Preserve MyT.aExt (25)
MyT.aExt (15) = 15.1
PrintL "------------------------------------------------------"
PrintL "'---Speed test Numeric change: " & lMaxLoops
ReDim MyT.aLong(lMaxLoops)
PrintL Timer
For lCounter = 1 To lMaxLoops
MyT.aLong(lCounter) = lCounter
Next
PrintL
PrintL Timer
PrintL "'---Speed test String change: " & lMaxLoops
ReDim MyT.aString(lMaxLoops)
PrintL Timer
For lCounter = 1 To lMaxLoops
MyT.aString(lCounter) = "Element: " & lCounter
Next
PrintL
PrintL Timer
PrintL "------------------------------------------------------"
PrintL "'---Speed test Numeric get: " & lMaxLoops
PrintL Timer
For lCounter = 1 To lMaxLoops
lExt = MyT.aLong(lCounter)
Next
PrintL
PrintL Timer
PrintL "'---Speed test String get: " & lMaxLoops
PrintL Timer
For lCounter = 1 To lMaxLoops
lStr = MyT.aString(lCounter)
Next
PrintL
PrintL Timer
PrintL "---Press a key to finish---"
WaitKey
Petr Schreiber
05-12-2015, 18:47
Eros, bravo! :drink:
ErosOlmi
05-12-2015, 22:50
eheh
René was faster to download new version than me to post about it :D
Next version will have:
LBOUND/UBOUND
multiple dimensions
memory release when a TYPE variable is defined inside a function and function unload its local stack
possibly dynamic arrays in any nesting UDT level (UDT inside UDT or TYPEs inside TYPEs)
VARPTR and STRPTR working on dynamic arrays inside UDT
STATIC dynamic arrays inside TYPEs
ARRAY ... functions able to recognize arrays inside TYPEs
Petr Schreiber
06-12-2015, 00:34
Perfect! :)
I just noticed one thing - functions like ARRAY ASSIGN do not like arrays in TYPEs. That means, if your reference array like Me.<arrayName>, it is not recognised.
Petr
ErosOlmi
06-12-2015, 00:42
NO, I'm sorry.
All ARRAY ... functions are STILL to be amended in order to recognize arrays inside TYPEs
Next betas maybe. Added to the list.
ReneMiner
06-12-2015, 11:59
more tests to perform?
' [ ] SIZEOF
' [ ] complete array as "myT.aString()"
' [ ] single array elements as "myT.aString(1)"
' [ ] myT
+++ still completely undocumented new class cDrives in File-module:
http://www.thinbasic.com/community/showthread.php?12581-How-to-get-a-drive-list&p=92073&viewfull=1#post92073
I know this is not major, but the DOWNLOAD thinBasic BETA 1.9.16.X: 2015.11.23 date needs updated. Unless someone reads the last page or goes to the first page, they mess an update. As you are aware the link in the "Latest Posts" on main page take you to the last reply to the topic and might be pass where an update is mentioned.
Bill
Petr Schreiber
07-12-2015, 19:07
I noticed that when I open thinAir, the file names in tabs are reverted now - tbasic.07 instead of 07.tbasic, for example :D
Bilbo, thanks for the report!
Petr
ReneMiner
07-12-2015, 22:03
something about oxygen:
when i made this (see attachement) i noticed that there are 2 *.dll-files for oxygen (thinBasic_Oxygen.dll 19 kB, & oxygen.dll 130 kB)
ThinBasic manual tells, if i write
Uses "oxygen"
then it searches for a "thinBasic_oxygen.dll" in "c:\thinBasic\Lib\" :confused::confused::confused:
So will it use what? Do we use correct version? Why are there 2?
Petr Schreiber
08-12-2015, 01:38
Hi Rene,
I think oxygen.dll is the compiler itself, and thinBasic_oxygen is the embedding layer for integration with thinBASIC.
Petr
ErosOlmi
13-12-2015, 21:47
ThinBASIC Updated to 1.9.16.6
Download link can be found in the first post in this thread
#BUNDLE File ...
FOR ... NEXT ... WHEN
LD function added
ZLib_ExtractToString function added
Se help for detailed info about new features.
Also added many internal changes not jet ready to be released that work on dynamic array inside UDT/TYPEs. Mainly on LBOUND/UBOUND.
ReneMiner
14-12-2015, 09:47
new short keyword "LD" is very annoying, there should not be any new keywords with less than 3 chars and keywords should have some meaning that can be memorized
i very often used local long lW, lH, lD (width, height, depth), sometimes to store a numeric Distance too - i have a variable "lD" in around 30 functions and a few as udt_subelements of only my current project - and many scripts now do not run any more.
Please consider to name it like LevDist or StringDist
or even re-use already existing keyword Dist with string-expression-parameters as
Long lD = Dist( [String,] s1, s2 [, Collate Ucase] )
so one knows from the name what it does
ErosOlmi
14-12-2015, 10:56
You are right, I didn't consider that, sorry.
Will change by next version.
If this is already creating you problems, I will change by this evening when back home.
ReneMiner
14-12-2015, 12:07
i will use 1.9.16.5. in the meantime.
I will change by this evening when back home.
then how you will drive 3 hours while feeling sleep ?? so i suggest the version 1.9.16.7 until the next week.
thanks Eros for all your efforts, and thanks ReneMiner for the notes.
Petr Schreiber
14-12-2015, 21:19
Hi Eros,
great work, I like the FOR/NEXT tunning especially :)
The speed gain in comparison with IF inside loop is around 30%, which is significant improvement!
Petr
ErosOlmi
14-12-2015, 22:31
ThinBASIC Updated to 1.9.16.7
Download link can be found in the first post in this thread
Nothing new compared to 1.9.16.6
LD function renamed to StrDistance
ErosOlmi
15-12-2015, 13:35
Hi Eros,
great work, I like the FOR/NEXT tunning especially :)
The speed gain in comparison with IF inside loop is around 30%, which is significant improvement!
Petr
Nice feature requested by Robert Hodge a lot time ago: http://www.thinbasic.com/community/project.php?issueid=404
I was guilty to forget about that but recently Robert pinged me.
Robert Hodge and George Deluca are using thinBasic Core Engine as scripting engine of their editor (thanks for that).
More info at: http://www.spflite.com/
ReneMiner
16-12-2015, 14:44
1.9.16.7: the letter "Y" became a keyword again.
ErosOlmi
16-12-2015, 19:01
Thanks for reporting.
I'm checking, there is something wrong with the script I use to generate the keywords list.
Also missing module classes
ErosOlmi
17-12-2015, 00:52
ThinBASIC Updated to 1.9.16.8
Download link can be found in the first post in this thread
Few fix.
A little speed improve in function calling
New #TRACE (http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?trace.htm) directive
ErosOlmi
17-12-2015, 08:56
#TRACE directive will be substituted with a more correct #PROFILE directive in next version.
ReneMiner
17-12-2015, 15:44
still/again keyword "Y".
And still undocumented cDrives-class in File-module. see
http://www.thinbasic.com/community/showthread.php?12581-How-to-get-a-drive-list&p=92073&viewfull=1#post92073
ReneMiner
18-12-2015, 11:19
I've a small question while i'm tampering around with thinBasic.createSyntaxIni.tBasic to clear unwanted keywords as "Y" from the list.
Keyword #includedir is not listet but becomes red - not bold - in thinAir.
How comes? Is it a special kind of keyword?
Should it be listed in thinBasic_Keywords.ini?
Also "_CREATE" appears twice and Array Unique is not able to Collate Ucase so it would be removed automatic.
Script below creates a keyword-list, the list has around 50 more keywords than the one shipped with 1.9.16.8
(even after subtracting the incorrect "Y" and making sure each keyword is uniqe)
' #Filename "CreateTBKeywords.tBasic"
' writes a sorted keyword-list,
' save to "C:\thinBasic\thinAir\Syntax\thinBasic"
' then run to overwrite currently incorrect keyword-list
' -- load all modules:
Uses "Console"
Uses "BIFF"
Uses "CGI"
Uses "COM"
Uses "COMM"
Uses "Crypto"
Uses "File"
Uses "eval"
Uses "Exe"
Uses "Dictionary"
Uses "DT"
Uses "FTP"
Uses "INet"
Uses "INI"
Uses "LAN"
Uses "LL"
Uses "MATH"
Uses "WinMM"
Uses "OS"
Uses "PC"
Uses "RAS"
Uses "Registry"
Uses "SAPI"
Uses "SMTP"
Uses "stat"
Uses "TBASS"
Uses "TcpUdp"
Uses "tokenizer"
Uses "VBRegExp"
Uses "UI"
Uses "UIAdv"
Uses "WMI"
Uses "XPrint"
Uses "ZLib"
Uses "ASTAR"
Uses "TBAI"
Uses "TBDI"
Uses "TBEM"
Uses "TBGL"
Uses "FileLine"
Uses "OnLineScores"
Uses "TImage"
Uses "iComplex"
Uses "GDIP"
Uses "OXYGEN"
Uses "ADODB"
Uses "EXCEL"
' when i brought the list of used modules in an alphabetical order
' thinBasic crashes on App_ListKeywords
' --------------------------------------------------------------------------
Dim k, l(), s() As String ' only 1-char-length variables here!
Dim i, n As Long
' -- collect keywords in k:
k = APP_ListKeywords($CRLF) _
& $CRLF & APP_ListFunctions($CRLF) _
& $CRLF & APP_ListEquates($CRLF) _
& $CRLF & APP_ListClasses($CRLF) _
& $CRLF & APP_ListUDTs($CRLF) _
& $CRLF & "Me" _
& $CRLF & "_Create" _
& $CRLF & "_Destroy" _
& $CRLF & "CBHNDL" _
& $CRLF & "CBCTL" _
& $CRLF & "CBCTLMSG" _
& $CRLF & "CBLPARAM" _
& $CRLF & "CBWPARAM" _
& $CRLF & "CBMSG" _
& $CRLF & "CBNMCODE" _
& $CRLF & "CBNMHDR" _
& $CRLF & "CBNMHWND" _
& $CRLF & "CBNMID" _
& $CRLF & "TBMain" _
& $CRLF & "#INCLUDE" _
& $CRLF & "INCLUDE" _
& $CRLF & "Comment" ' _
' & $CRLF & "#INCLUDEDIR" ' not sure about this...
' parse keywords k into list l()
n = Parse(k, l, $CRLF)
PrintL "Keywords parsed " & Str$( n )
For i = 1 To n
' make sure to have at least 2 chars
' else it's not a keyword
If StrPtrLen(StrPtr(l(i))) < 2 Then
l(i) = ""
Else
Select Case l(i)
Case "_CREATE"
PrintL "we have added _Create already..."
l(i) = ""
End Select
EndIf
Next
' -- bring empty elements to the end
Array Sort l, Collate Ucase, Descend
For i = n To 0 Step - 1
' -- remove empty elements:
If StrPtrLen(StrPtr(l(i))) > 0 Then
ReDim Preserve l(i)
n = i
Exit For
EndIf
Next
' -- sort the list ascending
Array Sort l, Collate Ucase, Ascend
' -- make sure each element is listed only once
Array Unique l, s ', Collate Ucase sadly not possible here...
PrintL "Keywords left " & Str$( UBound(s) )
k = Join$(s, $CRLF) & $CRLF
Save_File(APP_ScriptPath & "thinBasic_keywords.ini", k )
' -- path does not exist !!!
' Save_File(APP_Path & "Lib\thinBasic_Trace\Resources\thinBasic_Keywords.ini", k)
PrintL "Keywords saved"
PrintL "----------------------------- key to end"
WaitKey
ErosOlmi
21-12-2015, 06:32
The way keywords list is constructed is surely to me improved.
I will think how.
ErosOlmi
21-12-2015, 06:35
ThinBASIC Updated to 1.9.16.9
Download link can be found in the first post in this thread
Few fix.
APP_IniFile added
improved tokenizer module class (full help will follow in next version) adding possibility to have keyword made by just one byte of chars that usually are delimiters. Also added a reset method.
#TRACE has been renamed to #PROFILE
Added a profile utility: http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?profile.htm
Profile now able to measure: number of function parameters, number of function local variable, time spent in function stack allocation / de-allocation
ReneMiner
21-12-2015, 14:27
#Profile (r) helps a lot :) - maybe on shift+esc on profiler it could exit and delete the file?
Minor: there's a UCase-char-typo as well in help-doc as in keyword APP_IniFIle
ErosOlmi
21-12-2015, 15:56
I'm trying to integrate Profile Grid directly in thinAir. Maybe.
Regarding file, yes I thought about leaving so many files on disk.
I think I will solve using something like: #PROFILE ON [SAVE]
With SAVE option, file will remain on disk.
Without SAVE, file will be read and deleted immediately.
ReneMiner
21-12-2015, 16:24
please do not make "Save" a new keyword... maybe you could re-use UI-keyword "Kill"...
ErosOlmi
08-01-2016, 00:24
Just to let you know I'm not sleeping :)
I'm working on the following items:
exadecimal can now indicated in C notation using 0x...
PrintL 0x0008
PrintL 0x000C
PrintL 0x0010
%MAXIMUM_D = 0XFFFFFFFF As DWord
%MAXIMUM_L = 0X7FFFFFFF As Long
%MINIMUM_L = 0X80000000 As Long
Equates can now be indicated with or without = sign. The following are now identically handled:
%MAXIMUM_D = 0XFFFFFFFF As DWord
%MAXIMUM_D 0XFFFFFFFF As DWord
Left and Right byte shifting like in C using << and >>:
%MC_MTHT_NOWHERE = (1 << 0)
%MC_MTHT_ONITEMICON = (1 << 1)
%MC_MTHT_ONITEMLABEL = (1 << 2)
%MC_MTHT_ONITEMCLOSEBUTTON = (1 << 3)
thinAir ... I'm moving from CodeMax current source editor (very good but also very old and never maintained since ... many years) to more feature rich and well maintained Scintilla Code editor.
I'm experimenting it inside thinAir New File template window. I've already reached a good set of features (see attached image) like full folding at any level and real time checking (while typing) of nested levels.
I'm working now on creating a Lexer for thinBasic language. Scintilla has already some internal Lexers similar to thinBasic (VB, FreeBasic, Blitz Basic, PowerBasic) but none it satisfyingly me and I need to have some compromises. With our own Lexer we will be able to add any feature we will need.
If all will went fine, next thinAir will have this feature in Template window and when stabilized in all MDI windows.
Ciao
Eros
ReneMiner
08-01-2016, 11:23
Very good.
Especially i like the idea to re-new thinAir to fit "thinBasic 2.0"-standards :D
(guess my thinICE-project gave some kick into that direction).
I hope for an auto-complete feature, project-oriented clearly structured code-browser & global variable-view which saves a lot of browsing through different script-units and for an editor that helps us coding faster and reduces avoideable errors as much as possible.
ErosOlmi
08-01-2016, 11:33
Yeeees: thinICE gave me a kick in ... the right place (my ass)
:D
Anyway, very excited to add those new feature. Scintilla is very powerful but also a little bit complex to understand at first.
I think I've mastered the basis and I'm quite ready to add in editor window.
The rest will come and auto-completion will be the next.
Now I'm concentrating on syntax coloring without the need to create a specific Lexer DLL in C.
I think I'm on the right track.
ReneMiner
08-01-2016, 12:04
EDIT:
post moved to
http://www.thinbasic.com/community/showthread.php?12596-User-Utilities-in-thinAir&p=92552#post92552
ErosOlmi
11-01-2016, 13:14
Scintilla edit control is rally giving me an headache.
I'm trying to find a way to apply folding and syntax highlight without the need to create a C++ lexer specific for thinBasic.
I did it and is working quite well but as soon as the document is more than 20k/30k lines of code it starts to slow down quite dramatically.
I will set some options to switch folding and coloring on/off but that's not the way to solve the situation.
Anyway, quite ready to release it in a couple of day at least in script template preview (File/New ...)
Will see.
ReneMiner
11-01-2016, 13:30
for the folding: there are countless possibilities of it, like Type/End Type, Select Case/End Select, For/Next, TBGL_ClearFrame/TBGL_Drawframe,... etc. etc. etc.
I don't need to fold anything if codebrowser-tree (which is some kind of "folding" too) would give me enough overview ;)
The only really useful way to fold by default were Subs & (Callback-) Functions
- but if it's a multiline-function-header, it were too cumbersome for me to unfold every time when i need to check for parameters on the second line and i would not use the ability to fold...
Also folding hides a part of the code mostly...
So I vote for "no wild default-folding of anything that can be folded" -
but just smart, user-placed "fold-mark-comments" like this example:
Function myFun(Byval A As Number, _
Optional Byval B As String _
) As Number
'{ some comment here...
' some code here...
End Function
'}
'... or
Type tType
Private
'{ Statics
Static X As Long
Static Y As Long
'}
'{ Variables
A As String
B As String
'}
Public
'{ Methods
Function fun() As Long
'{ returns fun-factor...
End Function
'}
'}
End Type
'...
where '{ and '} mark the start and end of the code-part to fold.
On the line that starts with '{ or '} there might more comment follow on the same line...
some times when i need to check the corresponding parenthesis i copy the numerical sentence from thinbasic ide to notepad++ which can highlight which parenthesis corresponds to what. such as this (((5/((7*3+2)*4))^2)+(23-5)*(27*2))*3 .
9496
so if scintella provides such features will be great.
ErosOlmi
12-01-2016, 09:05
Yes, there is the possibility.
There is also in current editor but not implemented.
I will add for next release in few days. Right click on a ( or ) and using command "Match brace" will select corresponding brace.
Also using CTRL+1 when cursor is close to a ( or )
ReneMiner
14-01-2016, 12:01
To #Profile/ thinBasic_Profiler:
how about one more column:
"Average Running Time" = Iif("Calls" = 0, 0, "Run(ms)"/"Calls")
?
ErosOlmi
14-01-2016, 12:43
Sure, accepted :)
Will be present in next update.
ReneMiner
14-01-2016, 23:25
sucking download like a greedy vampire :dance1:
ErosOlmi
14-01-2016, 23:37
ThinBASIC Updated to 1.9.16.10
Download link can be found in the first post in this thread
Few fixes
#INCLUDEDIR has now a set of new meta tags
#INCLUDE has now a set of new meta tags
#INCLUDE has now a new logic for searching files: relative paths are always relative to the parent script file. Before it was always relative to the main script file.
Improved SMTP message size
hexadecimal numbers can be indicated using c notation 0x...
left/right bit shifting like in C using <<< and >>>
numeric and string equates can now be indicated without = sign
thinAir: added experimental code indentation
thinAir: added Scintilla Code editor inside Template window
thinAir: added CTRL+1 for brace matching
#PROFILE has now a second optional parameter that allows to save a profile session file
#PROFILE has now function total execution time and function mean time
See What's New in help for additional info.
ReneMiner
15-01-2016, 09:08
#PROFILE has now function total execution time and function mean time
something seems wrong with them column headers here,
see image
"No. Parameters" equals "Function Run(ms)" and "No. local Vars" seems to hold the mean-time...
ErosOlmi
15-01-2016, 11:30
Data is OK (last 2 columns are the new 2 columns added in this version Total time and Mean) but viewer is the old one.
Maybe I did an error in Setup script creator so new Profile viewer was not updated.
I will check
Thanks for the Update.
but what it means : numeric and string equates can now be indicated without = sign
a=4 , i though first that we can now write a 4 , or is it about the comparison operators ??
ReneMiner
15-01-2016, 16:01
only to assign equates (constant values), that means
$a "hello" ' equals $a = "hello"
%a 123 'equals %a = 123
ReneMiner
15-01-2016, 17:04
ERROR,
something's wrong with the nesting of IF-SELECT CASE-DO LOOP-WHILE WEND-stuff.
I get Error-messages for stuff that does not apply
ErosOlmi
15-01-2016, 17:14
Regarding #PROFILE ... I've uploaded a new thinBasic Setup.
I didn't find any error but for security I've created it again, tested in a virtual machine and seems fine.
Please download again thinBasic a.9.16.10
ERROR,
something's wrong with the nesting of IF-SELECT CASE-DO LOOP-WHILE WEND-stuff.
I get Error-messages for stuff that does not apply
Can you give me more info.
Where is this happening ?
ReneMiner
15-01-2016, 17:59
Can you give me more info.
Where is this happening ?
Had ERROR mutliple times in different situations already, always within type-functions
calling other type-functions
I'll try to create an example later.
Sorry i have no smaller option currently
You can try current thinICE-version where i can repeat it.
Function tControl_Codefield.AutoComplete() ' Line 2811
'...
While ...
Select Case bChar
Case 32
Case 35, 36, 37
Case 44
Case 46 '.
If Not bVariable Then
If ... Then
If ... Then
Do
Select Case
Case 40
Case 41
Case Else
If ... Then
Exit Do
EndIf
End Select
Loop
' Insert this "Else" before Line 2886
Else
' jumps in here without meeting conditions and an existing call to a type-function
' that is placed here results in Error-message as unknown variable
' Insert this "UI.StatusText("test",1)" which does for sure exist
UI.StatusText("test",1)
EndIf
EndIf
EndIf
Case ...
Case Else
End Select
Wend
then run, load any project into thinICE and type into a codefield a little bit-
even if you type no dot (CHR$(46)) you'll get an Error, Variable not defined or misspelled keyword.
ErosOlmi
15-01-2016, 19:34
Regarding #PROFILE ... I've uploaded a new thinBasic Setup.
I didn't find any error but for security I've created it again, tested in a virtual machine and seems fine.
Please download again thinBasic a.9.16.10
Again on Profile.
I just found a problem in Setup script: if \thinBasic\thinAir\thinBasic_Profiler\thinBasic_Profiler.exe already exists, it is not replaced with the new version.
Damn! I'm going home right now, I will fix this evening when back home.
Petr Schreiber
16-01-2016, 02:10
Hi Eros,
the bracket matching is very handy, thanks! And the profiler is the best thing ever!!! :)
How does the "added experimental code indentation" work?
I did a minor typo pass on the documentation of 1.9.16.10:
- documentation for SHIFTN contains SHIFT (without N) in syntax and body
- #include contains "resolver" but should be "resolved"
Petr
Petr Schreiber
16-01-2016, 02:24
Eros,
I think I found a bug in >>, it actually behaves like <<:
Uses "Console"
Byte myByte_ApproachA = 8
Byte myByte_ApproachB = 8
PrintL "SHIFT RIGHT function"
PrintL "--------------------"
PrintBinary("Original value: ", myByte_ApproachA)
SHIFT RIGHT myByte_ApproachA, 1
PrintBinary("Altered value: ", myByte_ApproachA, 4)
PrintL
PrintL ">> operator"
PrintL "------------"
PrintBinary("Original value: ", myByte_ApproachB)
myByte_ApproachB = myByte_ApproachB >> 1
PrintBinary("Altered value: ", myByte_ApproachB, 4)
WaitKey
Function PrintBinary(prefix As String, nValue As Byte, Optional expectedValue As Byte)
String binaryPattern = Bin$(nValue, 8)
Print prefix
If Function_CParams = 3 Then
PrintL binaryPattern In IIf(nValue = expectedValue, 10, 12)
Else
PrintL binaryPattern In 15
End If
End Function
I added unit tests for the new functionality here:
https://github.com/ErosOlmi/ThinBASIC_On_GitHub/blob/master/Regression/1.9.16.x/tests/tests_Core_BitShiftOperators.tBasicU (one passing, one failing)
https://github.com/ErosOlmi/ThinBASIC_On_GitHub/blob/master/Regression/1.9.16.x/tests/tests_Core_ShiftN.tBasicU (both passing)
Petr
ErosOlmi
16-01-2016, 13:19
Thanks a lot, I will fix asap.
Yesterday evening I installed latest Windows 10 preview build 11099 and almost destroyed everything in my PC that was inside user configuration paths: desktop, personal data, mail setup, browser setup, ...
My data was backuped so no problem but almost every program as no configuration and I need to redo configs.
Petr Schreiber
16-01-2016, 17:52
Hi Eros,
thanks for the warning. I guess I will get Windows 10 no sooner than with new PC, the horror stories I hear from all the sides are scaring me a lot :)
Petr
ErosOlmi
16-01-2016, 18:30
How does the "added experimental code indentation" work?
Select some text and then right click on it and on then on the popup menu menu "With selection\Indent"
Otherwise to indent the full source code file, right click on the MDI Tab and on the popup menu "Indent Code"
Petr Schreiber
16-01-2016, 19:18
Aha!,
so it is syntax aware indenting, to fix wrongly formatted sources - very handy!
Petr
ErosOlmi
16-01-2016, 22:26
Thanks a lot, I will fix asap.
Yesterday evening I installed latest Windows 10 preview build 11099 and almost destroyed everything in my PC that was inside user configuration paths: desktop, personal data, mail setup, browser setup, ...
My data was backuped so no problem but almost every program as no configuration and I need to redo configs.
Situation seems recovered.
When Windows 10 gets a new build, it makes some restart with a user called TEMP. At the end it should return in standard user mode.
For some reason it remained into TEMP that had no configurations at all.
Now I've my user back again.
ErosOlmi
16-01-2016, 23:13
Updated thinBasic 1.9.16.10.
Fixed typo
Fixed bit shifting
Petr Schreiber
18-01-2016, 00:10
Thank you very much Eros,
I can now shift bits with style :cool:. Perfect!
Petr
ReneMiner
18-01-2016, 12:00
i have still the ERROR that probably has to do with Select Case-Loop-If-nesting.
Therefor i still left an old thinICE-download online but I'll move the attachement here.
As described above, use thinICE of 2016 01 15,
goto \data_thinICE, unit tControl_Codefield.tBasicU, -function autocomplete()-
and insert 2 new lines 2886 + 2887 previous current line 2886:
Else
UI.StatusText("test",1)
then run thinICE and type something into codefield like "Type xxx".
Its impossible that it will meet that line since there is no dot (".", chr$(46)) in typed text.
And UI.Statustext is a known function of a global type...
EDIT: Bug gone- so attachement removed
ErosOlmi
18-01-2016, 12:44
Renč,
I've replicated the situation you are mentioning. I will investigate, it's a quite complex situation.
Strange is that if I put something like:
Else
Msgbox 0, "test"
instead of
Else
UI.StatusText("test",1)
it works fine.
Anyway, interesting and must be cleared.
I will let you know.
Eros
ReneMiner
18-01-2016, 12:52
i tried more,
if i insert this: (Win.hWnd also is a global known udt-variable)
Else
MsgBox win.hWnd, "test"
it does Error too. (with and without parenthesis)
More:
In the beginning of thinICE-script there is
Alias Rem As debug
within the function exist:
Local ac as tControl_Autocomplete.
Local bChar as Byte
if i write this
Else
debug ac.X1
MsgBox win.hWnd, "test"
it claims .X1 unknown even if Alias Rem As Debug.
if i write this
Else
debug bChar
MsgBox win.hWnd, "test"
it claims .hWnd again...
ReneMiner
18-01-2016, 14:59
for the >> & << -thing:
how about
X =<< 1
Alias
X = X << 1
and allow this within Const/End Const:
Begin Const
%Flag_Bold 1
%Flag_Italics << 1
%Flag_Underline << [1] ' * see below
%Flag_AlignLeft <<
%Flag_AlignRight <<
%Flag_AlignCenter = %Flag_AlignLeft + %Flag_AlignRight
%Flag_BorderShow = %Flag_AlignRight << 1
%Flag_BorderThick <<
'...
End Const
* [1] : optional/default 1,
so
%Flag_Italics <<
would mean the same as
%Flag_Italics << 1
Petr Schreiber
18-01-2016, 21:07
I agree, I would just propose:
<<=
>>=
...to match the order in already existing operators like +=, *= ...
Petr
ErosOlmi
18-01-2016, 21:29
Hi Renč,
maybe I've surrounded the problem: it seems definitely generated by an Exit While in case of space.
While GetAt(bChar) >= StrPtr(sText) And bSpace = %FALSE
i += 1
Select Case bChar
Case 32 ' $SPC
If i > 1 Or bSpace Or StrPtrLen(StrPtr(sRight)) Then
'[breakpoint] <Any note here. Breakpoint will be set to line following this statement>
>>>>> Exit While
End If
bSpace = TRUE
Now I have to understand why.
Eros
ErosOlmi
18-01-2016, 22:02
FOUND !!!!!
As usual ... a stupid error.
When I need to find a specific execution point I execute special functions that found the next WEND or the next END IF or whatever.
Inside those functions I put a status "DoNotResolveAnyToken" to TRUE in such a way parser just found the next token without investigating what the token is.
I had a point where "DoNotResolveAnyToken" was set to FALSE in the middle of the searching.
I will make final checking and releasing a new thinBasic update.
ErosOlmi
18-01-2016, 22:44
Sorry for the many updates but I've just uploaded again 1.9.16.10 version with fixed Exit While problem.
Petr Schreiber
19-01-2016, 00:58
How dare you to fix bugs... :p
Just one proposal - even for these fixes, it would be better to increase last version number. This way we always know which code runs through users version 100%. Also better for... potential centralised update systems ;)
Petr
ErosOlmi
19-01-2016, 07:32
Ok Petr, right you are.
There will be soon a .11 version :)
ReneMiner
19-01-2016, 13:41
I agree, I would just propose:
<<=
>>=
...to match the order in already existing operators like +=, *= ...
Petr
Of course, thats what i meant
ErosOlmi
21-01-2016, 00:05
ThinBASIC Updated to 1.9.16.11
Forget this version: had a bug that GPF Core Engine
Removed from download
ReneMiner
21-01-2016, 12:33
Sadly have to report that something is very wrong with 1.9.16.11,
my project keeps on crashing - there are some UDT-properties that are not recognized
I had this crash also occur in other functions - always if referring to some UDT-property that seems not available.
I left all my debug-lines inside since i was not able to reconstruct this on purpose so console will help you follow and tells where it is.
Currently I'm stuck at this:
'-------------------------------------------------------------------
Function ShowTab(ByVal Index As Long) As DWord
'-------------------------------------------------------------------
debug "tControl_Tabstrip.ShowTab" & Str$(Index)
' accessing property makes thinBasic crash without any report:
If Me.pText Then
debug Str$(Me.pText)
' ...
edit attachement removed
ErosOlmi
21-01-2016, 12:51
Yes Renč, sorry about that.
Just found an internal constant that is wrong.
That constant is the maximum number of internal keywords and generate a GPF.
I will recompile all and release new version in few minutes.
ErosOlmi
21-01-2016, 13:16
ThinBASIC Updated to 1.9.16.12
Download link can be found in the first post in this thread
Few fixes
an important bug found by dcromley fixed: numeric parameters passed BYREF in user defined functions not working properly
Added new native Core data structure: Hash Table Container and some functions working with it.
A Hash Table Container is handled by a DWORD/LONG handler so it can be easily stored wherever a 4 bytes can be stored.
You can create arrays of hash tables or insert hash tables inside an UDT (Type) and handle it in an easy way.
Those of you in need to store great amount of data and be able to quickly (very quickly) retrieve it at run-time will love it.
See Hash Table example in \thinBasic\SampleScripts\DataStructure\
There will be more surprises in next versions regarding native Core data structures!!!
See What's New in help for additional info.
ReneMiner
21-01-2016, 17:23
Error on Exit Do?
I extracted some of a function to some small example.
At line 89 it meets an Exit Do and the code-execution should continue at line 100 (after Loop)
but its stuck then.
' #Filename "testbug_ExitDO.tBasic"
Uses "console"
Alias PrintL As debug
'-------------------------------------------------------------------
Function TBMain()
'-------------------------------------------------------------------
Local sText As String = "test(1)." ' this would be the codelines left part until cursor
Local sRight As String = "" ' this would be the right part that follows cursor
autocomplete(sText, sRight)
PrintL "done. Key to end"
WaitKey
End Function
'-------------------------------------------------------------------
Function Autocomplete(ByRef sText As String, _
ByRef sRight As String )
'-------------------------------------------------------------------
'debug "tControl_Codefield.Autocomplete " & sText
Local sToComplete, sVariable As String
Local bVariable, bSpace, bParens As Boolean
Local lKW, lAll, lParens, i, lStart As Long
Local bChar As Byte At 0
SetAt(bChar, StrPtr(sText) + StrPtrLen(StrPtr(sText)) - 1)
While GetAt(bChar) >= StrPtr(sText)
i += 1
debug "bChar " & Chr$(bChar)
Select Case bChar
Case 32 ' $SPC
If i > 1 Or bSpace Or StrPtrLen(StrPtr(sRight)) Then Exit While
bSpace = TRUE
Case 35, 36, 37 ' #, $, %
If bVariable Then
' invalid
bVariable = FALSE
sVariable = ""
sToComplete = ""
Exit While
Else
sToComplete = Chr$(bChar) & sToComplete
EndIf
Case 44 ' ,
bSpace = TRUE
sToComplete = sFirst
Exit While
Case 40 ' (
If i = 1 Then
bParens = TRUE
Else
Exit While
EndIf
Case 46 ' .
If All( Not bVariable, Not bParens) Then
If GetAt(bChar) > StrPtr(sText) Then
Select Case Peek(Byte, GetAt(bChar) - 1 )
Case 32, 38, 42, 43, 44, 45, 47, 60, 61, 62, 92
'bVariable = Me.TokenFindWith(sVariable)
Exit While
Case 41
Do
SetAt(bChar, GetAt(bChar) - 1)
debug "Now " & Chr$(bChar)
Select Case bChar
Case 40 '(
lParens -= 1 ' going backward!
Case 41 ' )
lParens += 1
Case Else
If lParens = 0 Then
SetAt(bChar, GetAt(bChar) + 1)
debug "exit do " & Chr$(bChar)
Exit Do
Else
debug "bChar " & Chr$(bChar) & " lParens" & Str$(lParens)
EndIf
End Select
If GetAt(bChar) <= StrPtr(sText) Then
debug "exit at first char"
Exit Do
EndIf
Loop
debug ">>> this line does not get printed"
debug "out of do-loop"
End Select
bVariable = TRUE
debug "is a variable"
EndIf
Else
debug "go to exit"
sVariable = ""
sToComplete = ""
Exit While
EndIf
Case 48 To 57
If Not bVariable Then
sToComplete = Chr$(bChar) & sToComplete
Else
sVariable = Chr$(bChar) & sVariable
EndIf
Case 65 To 90
If Not bVariable Then
sToComplete = Chr$(bChar) & sToComplete
Else
sVariable = Chr$(bChar) & sVariable
EndIf
Case 95 ' _
If Not bVariable Then
sToComplete = Chr$(bChar) & sToComplete
Else
sVariable = Chr$(bChar) & sVariable
EndIf
Case 97 To 122
If Not bVariable Then
sToComplete = Chr$(bChar) & sToComplete
Else
sVariable = Chr$(bChar) & sVariable
EndIf
Case Else
debug "go to exit else, bChar (" & Chr$(bChar) & ")" & Str$(bChar)
Exit While
End Select
debug "while-wend"
SetAt(bChar, GetAt(bChar) - 1)
Wend
End Function
ErosOlmi
21-01-2016, 21:25
Can you please check if attached thinCore.dll fix the problem and ... does not introduce any other :oops:
Just substitute your current in \thinBasic\thinCore.dll
Thanks a lot
Eros
PS: attached file removed. Working on a better solution
Petr Schreiber
21-01-2016, 22:07
Hi Eros,
tried the example with the core you posted and it still makes the code hanged.
I think we should cover the basic structure flow with some tests as well, so we know when something breaks. I added Rene's example to regression at GitHub.
Just try to run regression_1_9_16_X.tBasic, and if it finishes, problem is fixed.
Petr
Petr Schreiber
21-01-2016, 22:13
Eros,
those Hash functions are great, it's fantastic to have such a low level power at disposal.
The SS... sounds a bit like World War II to me :P
Petr
ErosOlmi
22-01-2016, 00:04
The SS... sounds a bit like World War II to me :P
Yes, :) also to me.
The idea is to have hash table able to work with String/String (SsSs), String/Long (SsLo), String/DWord (SsDw), ...
If you have a better idea ...
ErosOlmi
22-01-2016, 00:23
Can you please check if attached thinCore.dll fix the problem
Just substitute your current in \thinBasic\thinCore.dll
Thanks a lot
Eros
Attached file removed.
Petr Schreiber
22-01-2016, 01:17
The new thinCore fixes the problem nicely :)
Regarding SS - what about having equates like:
%Hash_String2String
%Hash_String2Long
...
which would be passed as parameter to Hash_New?
All the functions would be just Hash_..., and the pointer itself would internally point to data structure, which would contain this type, so internal implementation can decide which backend to use without problem?
Just thinking out loud :)
Petr
ErosOlmi
22-01-2016, 12:49
ThinBASIC Updated to 1.9.16.13
Download link can be found in the first post in this thread
Hopefully fixed Exit Do
Removed Second WW SS style acronym from Hash Table. Future implementation of Hash Table able to work on something different from String/String will be indicated using Hash Table Type in Hash_New function
See Hash Table example in \thinBasic\SampleScripts\DataStructure\
See What's New in help for additional info.
ReneMiner
22-01-2016, 16:25
bad news.
another Do-Loop-Bug now with 1.9.16.13:
extracted+ reduced buggy part of my script:
' #Filename "testbug_Missing_DO.tBasic"
Uses "console"
'Alias PrintL As debug
'-------------------------------------------------------------------
Function TBMain()
'-------------------------------------------------------------------
CodeTree_Click(123)
PrintL "done. Key to end"
WaitKey
End Function
' ---------------------------------------------------------------------
Sub CodeTree_Click(ByVal pControl As DWord)
' ---------------------------------------------------------------------
Long i = 123
Do
i -= 1
If i < 100 Then
PrintL "exit on" & Str$(i)
Exit Do
EndIf
Loop Until i = 0
End Sub
it should use the Exit Do at line 27 but then laments Missing Do-Loop at line 30
ReneMiner
22-01-2016, 18:27
just to enclose it, if i use this sub as below, it works correct!
(replace in example above)
' ---------------------------------------------------------------------
Sub CodeTree_Click(ByVal pControl As DWord)
' ---------------------------------------------------------------------
Long myReputation = 123 ' i need to make this joke....
Do
myReputation -= 1
If myReputation < 100 Then
PrintL "exit on" & Str$(myReputation)
Exit Do
EndIf
Loop While myReputation > 0
End Sub
so something wrong with that "Until" ?
_______________________________________________________________
EDIT: I tested more, now gets crazy...
try this:
' #Filename "testbug_crazyExit.tBasic"
Uses "console"
'( that UDT just for some suspicion i wanted to follow in my script)
Type tWin
hWnd As DWord
Function NewInfo() As Boolean
Printl "tWin.NewInfo"
End Function
End Type
'-------------------------------------------------------------------
Function TBMain()
'-------------------------------------------------------------------
Local i As Long = 123
Local Win As tWin
win.hWnd = 123
While All( Win.hWnd, i >= 99)
Printl "While"
Win.NewInfo()
If TRUE Then
i -= 1
If i = 100 Then
codetree_click(123)
EndIf
EndIf
PrintL "Wend"
Wend
PrintL "done. Key to end"
WaitKey
End Function
' ---------------------------------------------------------------------
Sub CodeTree_Click(ByVal pControl As DWord)
' ---------------------------------------------------------------------
Local i As Long = 123
PrintL "Sub Codetree_Click"
'For i = 1 To 123
'Next
If FALSE Then
If FALSE Then
PrintL "it's all wrong"
Else
PrintL "impossible"
EndIf
Else
If FALSE Then
If i Then
Exit Sub
EndIf
EndIf
Do
If TRUE Then
i -= 1
If i < 100 Then
PrintL "Exit on i = " & Str$(i)
'Exit Do
Exit Sub
EndIf
EndIf
Loop While i
'EDIT try:
' Loop Until i = 0
' and it works with Exit Sub.
' but in my project thinBasic crashes thereafter.
' i can not reproduce it with an example here (too complex...)
' i solved it to get past the crash using this syntax:
' Do Until i = 0
' If TRUE Then
' i -= 1
' If i < 100 Then
' PrintL "Exit Do on i = " & Str$(i)
' Exit Do
' 'Exit Sub
' EndIf
' EndIf
'
' Loop
EndIf
PrintL "exit sub codetree_click"
End Sub
run this, thereafter in second run uncomment Exit Do (line 76) and comment Exit Sub (line 77)
Crazy messages I get.
ErosOlmi
23-01-2016, 13:52
ThinBASIC Updated to 1.9.16.14
Download link can be found in the first post in this thread
more fixed Exit Do
more pre-parsing control over IF/ELSE/END IF
fix in zLib module
StatusBar_SetIcon fix
See What's New in help for additional info.
Petr Schreiber
24-01-2016, 11:23
Good job! :drink:
ErosOlmi
24-01-2016, 13:25
ThinBASIC Updated to 1.9.16.15
A new version a day keeps the bug away :)
Download link can be found in the first post in this thread
fixed a Tokenizer bug
Added more features to Hash Table now able to change Hash Table capacity and to Clone an Hash Table into another with all key/data pairs.
See updated example in \thinBasic\SampleScripts\DataStructures
See What's New in help for additional info.
PS 1: I will have a stop in development for few days because I will have 3 or 4 crazy/heavy working days at work.
I will read the forum at night but if no big/important issues will come out, I will restart replying on Thursday or so.
PS 2: The idea now is to work only on bugs (not sure I will resist not to add new features :) ) and manual missed items for 2 or 3 weeks in order to have a definitive 1.10 version to release for February.
most of the time i am running examples saved to the the desktop, but many times i want to consult examples from C:\thinbasic\SampleScripts , so from the menu :File-> open-> then my computer then C:\ then thinbasic then sampleScripts.
is there a way i don't see to go directly to the Home thinbasic directory without all these clicking ?
ErosOlmi
29-01-2016, 20:38
If file/Open is used with a script already opened, it open using current script path.
Another way is to use "Explorer" Window (near Code browser)
Anyway, I can think to something else.
For example keep track of the last 10 used paths. Then add a dynamic menu near File/Open/ to be able to choose from last used paths.
Hi Eros
i have found that your idea are also implemented in wolfram mathematica v8. at first there is Empty item:
http://s12.postimg.org/9krh49bbh/math1.png
after opening some files , the place of Empty looks like this:
http://s10.postimg.org/ylkcf34a1/math2.png
also i remember a software which have (Home or something like that) in Files menu, but can't remember its name
ReneMiner
30-01-2016, 11:14
Yes, primo is right.
My thought were, to add some more points to the thinAir-explorer context-menu | popup
(where you currently find some menuitems as "Open Explorer In ...", "Reload folders structure" etc.)
if you right-click into thinAir-explorer-tree.
So i would like to fast-navigate here to some special folders as
thinBasic-install-path (where samples and includes are, usually "C:\thinBasic")
%User%\Documents\thinBasic (where own scripts are saved)
%User%\Downloads (where we save scripts that we download from forum)
ErosOlmi
30-01-2016, 13:17
Implemented: list of recent 30 files will also be used to populate list of recent paths.
Will be present in next release ... I think mid of next week.
In the meantime I will add more point where the list will be visible and some special specific thinBasic folders like René has suggested.
ErosOlmi
05-02-2016, 00:24
ThinBASIC Updated to 1.9.16.16
Download link can be found in the first post in this thread
added thinAir recent paths from which to open files. Also recent paths in file browser using right click
added few more features to Hash Table.
Added a new very interesting data structure: AVL Tree.
Create a tree, add new nodes key/data pairs, traverse tree in order from top to bottom and bottom to top.
See AVL Tree example in \thinBasic\SampleScripts\DataStructure\
See What's New in help for additional info: http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_9_16_x.htm
ReneMiner
05-02-2016, 00:37
I was nosy about the tree-stuff, but i have two folders in c:\thinBasic\Samplescripts as \DataStructure which is empty and \DataStructures, but there i only find example for Hash-table
ErosOlmi
05-02-2016, 00:40
I attach here the example, maybe I made an error in Setup script
ErosOlmi
05-02-2016, 00:46
I'm uploading again 1.9.16.16 setup (10 minutes to have the new one).
I made a mistake in Script Setup
Thanks René
ReneMiner
05-02-2016, 00:47
Don't know if that chat is working since i get no reply... but c:thinBasic\Samplescripts\Other is empty too. Don't know if there belong any samples.
The Tree-stuff is quite interesting - but what about the nodes is there any structure/type?
Do i understand correct: I node more trees onto the tree to get new branches?
ErosOlmi
05-02-2016, 00:53
Yes I saw your message.
\SampleScripts\Other\ is empty. Is there since I do not know how long.
Anyway, an AVL tree is a balanced tree.
With just a pointer you have an AVL tree with you.
You can Set/Get data using the key like in a hash table.
Keys are always stored in order and tree is always automatically balanced when new leaf are inserted/deleted.
Than you can also use First/Last/Prev/Next to get a pointer to a node and use that pointer to traverse the tree.
ReneMiner
05-02-2016, 01:13
I have an Error- but i have no time to locate the cause. My girlfriend is annoying me to play something...
I loaded the above posted AVL-Tree-example into thinICE- then let it run (f5)
after ending your sample and thereafter try ending thinICE by pressing esc-key i get message of undeclared variable in tControl_Codefield.InputKeyboard line 2471
(bResult) which is a static and declared for sure few lines above (2467)
Thank You Eros for adding open recent files/open from recent paths. this makes life easier
ReneMiner
06-02-2016, 12:46
I've found a solution for the above described "bug", it's caused by order.
Will need a few hours to check all my scriptunits and apply the rule i've found.
Local Static variables inside functions must be very first within the function.
This is valid syntax:
' CORRECT :)
Function f()
Static bStatic As Boolean ' static first!
If <condition> Then Exit Function
End Function
this is not valid - illegal - bad - do not do this:
' WRONG ! WRONG ! WRONG ! :(
Function f()
If <condition> Then Exit Function
' never exit a function before local statics are declared!
Static bStatic As Boolean
End Function
' WRONG ! WRONG ! WRONG ! :(
+++
to thinBasic-Helpfile,
concerning AVL-tree.
the below listed functions have a wrong parameter-name (pHash instead of pTree) in parameters table:
Tree_Clone
Tree_Exists
Tree_Get
Tree_Validate
ErosOlmi
06-02-2016, 13:28
Thanks René for founding that.
In thinBasic local variables are allocated when they are encountered.
If function exits before encountering a variable declaration, that variable is not declared.
There are some internal optimizations that can be influenced by the above behave like:
when a script function is executed the very first time, thinBasic keep track of the allocated variable and function parameters.
From the second execution it optimize local function stack using the counter variable, counted during first execution.
If not all variables were encountered during first execution, something weird can happen (usually a GPF)
static variables are allocated not in function execution stack (that is local to the execution and destroyed when function execution ends) but inside internal function data structure (one for each script function) and never destroyed. This because static variables must retain their value across function executions. If a static variable is not visible the very first time a function is executed, a GPF can occurs.
I will see if I can optimize something on this aspect.
Ciao
Eros
ReneMiner
06-02-2016, 13:42
I know it's very nice to have the ability to declare variables on-the-fly.
From the other view it would be easier to handle for thinCore if all variables are listed on top of the function.
Many programming-languages have this condition mandatory and i would not mind if i had to if it helps to stabilize execution.
In fact i will try to follow that rule in future.
What do these:
Function_GetBodyCode
Function_GetSourceCode
???
PS. see my post above again for some minor "help-file-repairs"
ErosOlmi
06-02-2016, 14:02
What do these:
Function_GetBodyCode
Function_GetSourceCode
Experiments for future ideas.
Both require a function name as string parameter.
One return full function code, the other just the inner part.
PS. see my post above again for some minor "help-file-repairs"
Thanks, fixed for the next release.
ReneMiner
06-02-2016, 14:54
Very nice.
I tried a simple as:
'#FILENAME "Function_GetCode.tBasic"
' --------------------------------------------------------------------
Function TBMain()
' --------------------------------------------------------------------
MsgBox 0, Function_GetBodyCode( "TBMain" ),
%MB_OK, "Function_GetBodyCode(""TBMain""):"
MsgBox 0, Function_GetSourceCode( "TBMain" ),
%MB_OK, "Function_GetSourceCode(""TBMain""):"
End Function
and i made an executeable bundle of it.
Still works and has the same output even if not a thinBasic-file any more...
:)
ReneMiner
08-02-2016, 15:28
2 * Hash-tables:
1.
If i want to use a hash-table to store data its likely the case that my data-elements (mostly udts or arrays) may have more data noded to it.
Lets say, i store my control-udts of every window in a seperate hash table and want to destroy some data and i need a list of all keys to call _Destroy() on the stored udt-data (for example to free noded multiline-text)
I wish for a function that does this:
String myList()
Long numKeys = Hash_ListKeys pHash Into myList
2.
My keys shall hold some information about the data so i already know from the key what it is and if to proceed it
alike:
' create hash-table:
Dword pControls = Hash_New(500, %Hash_String2String)
'...
' create a control:
Dim lButton As tControl_Button
' assume i use some enumerating-functions here to store Type and Name ;)
lButton.pType = Heap_AllocByStr("tControl_Button")
lButton.pName = Heap_AllocByStr("myButton")
lButton.Index = 1
'... some more settings here but this serves...
' this be the header of my basetype
' its 2 Dwords, 1 Long = 12 Bytes
' and i want that information to be my key:
String myKey = Memory_Get(Varptr(lButton), 12)
Hash_Set( pControls, myKey, lButton )
but what about the nulls that a hash-String-key must not contain?
Were it possible to have a "Byte"-key, probably with a fixed same lenght for all keys of this hash-table?
Dword pControls = Hash_New(500, %Hash_Byte2String, 12)
- or would i have to convert my key into a size-formatted Hex$?
ErosOlmi
08-02-2016, 21:48
Regarding point number 1:
yes, I already thought about something similar
thinCore already use something like that
should not be that complex to develop
Regarding point number 2:
quite complex at the moment to have nulls inside keys
HEX conversion is something you can do but would slow down operations because done at script level
maybe I can get HEX idea and use inside compiled code
let me think a bit about that
ReneMiner
09-02-2016, 11:07
As PeekHex$ | Memory_HexGet & PokeHex | Memory_HexSet ?
(Peek could be optimized by creating sResult in correct size once instead of to compose it
' #Filename "ConvertHex.tBasic"
Uses "console"
' --------------------------------------------------------------------
Function TBMain()
' --------------------------------------------------------------------
String data = MKDWD$(123, 456) & MKL$(789)
Local dw1 As DWord At StrPtr(data)
Local dw2 As DWord At StrPtr(data) + 4
Local l As Long At StrPtr(data) + 8
PrintL dw1, dw2, l
Long nBytes = StrPtrLen(StrPtr(data))
String sKey = PeekHex$(StrPtr(data), nBytes)
PrintL "key: " & sKey
' overwrite data with 0:
Memory_Set(StrPtr(data), Repeat$(nBytes, MKBYT$(0)))
PrintL "data empty now:", data
PrintL dw1, dw2, l
' poke the key into data-space
PokeHex$(StrPtr(data), sKey)
PrintL dw1, dw2, l
Printl $Crlf & "key to end"
WaitKey
End Function
' ---------------------------------------------------------------------
Function PeekHex$(ByVal pData As DWord, _
ByVal numBytes As Long _
) As String
' ---------------------------------------------------------------------
' convert a sequence of bytes into Hex$
' returns hex-expression
Local b As Byte At pData
Local sResult As String
Do
sResult &= Hex$(b, 2)
SetAt(b, GetAt(b)+1)
numBytes -= 1
Loop While numBytes
Function = sResult
End Function
' ---------------------------------------------------------------------
Function PokeHex$(ByVal pData As DWord, _
ByVal sData As String _
) As String
' ---------------------------------------------------------------------
' convert a Hex$ into bytes and poke it to given pointer
' sData must not contain Hex-prefix as "&H" nor "0x"
' returns converted memory
Local B(2) As Byte At StrPtr(sData)
Local num As Byte At pData
While GetAt(b) < StrPtr(sData) + StrPtrLen(StrPtr(sData))
num = Val("&H" & Chr$(b(1), b(2)))
SetAt(b, GetAt(b) + 2)
SetAt(num, GetAt(num) + 1)
Wend
Function = Memory_Get(pData, StrPtrLen(StrPtr(sData))/2)
End Function
ErosOlmi
09-02-2016, 23:33
I sometimes forget your capacity to solve problems :)
Great!
Hash_GetKeys is on the right way
PeekHex$ already developed
PokeHex$ will follow
Ciao
Eros
ReneMiner
15-02-2016, 10:40
It's minor and only happens in case there are type-definitions above other functions in a script.
TBMain() becomes a function of the Type above, so its "tTest.TBMain()" in codebrowser.
A type-function outside Type ~ End Type becomes prefixed twice.
Perhaps possible to check for an "End Type" and kill the memorized prefix to avoid this ?
Or is there a general makeover for codebrowser to await?
Then it won't make sense to fix this...
:yes:
ReneMiner
16-02-2016, 15:54
nesting(?) Error Do-Loop While
I can not create smaller example somehow.
Situation is as follows:
I have some global udt-variable that get's _Create()d and _Destroy()ed.
The function _Destroy calls another Function FreeAt() to free noded data.
If i have a loop as this:
Version 1
Do
'...
Loop Until X = 0
then it works fine.
But if i have the loop as this:
Version 2
Do
'...
Loop While X
then thinBasic shows an error-30 message
variable not defined or misspelled keyword
pointing onto first codeline (Uses "console" ), Token = S
I attach some code here.
Run "test_tClassifiedHeap.tBasic" as is: everything should be fine.
Then go into tClassifiedHeap.tBasicU, Function tClassifiedHeap.FreeAt, Line 437/438
change the code from
Loop Until lPos = 0
'Loop While lPos
to
'Loop Until lPos = 0
Loop While lPos
and run "test_tClassifiedHeap.tBasic" again.
after script ends you'll get the message.
tClassifiedHeap is some heap-manager-type that allows you to store different udts in some kind of "array".
All members should be extensions of the same basetype.
All members are able to detect own type.
Each member has a unique combination of name and index to indicate it.
So member-names may be "myButton" or "myRectangle" or even "", index in range of Long
If you read attentive you'll discover do-loop inside function FreeAt() is currently some nonsense, but it shows the error and it works.
ReneMiner
21-02-2016, 16:41
I sometimes forget your capacity to solve problems :)
Great!
Hash_GetKeys is on the right way
PeekHex$ already developed
PokeHex$ will follow
Ciao
Eros
thoughts to Hash_GetKeys / indexing key-ability
i think i've an idea that makes us have multiple keys with same name but different index in a very simple way:
Dim myData As someType ' data to store
Dword pHash = Hash_New() ' create hash-table
String sName = "myDataName"
Long Index = 123
' compose keys from Name & Index:
String sKey = sName & "_" & Hex$(Index, 8)
' now set data:
Hash_Set(pHash, sKey, Memory_Get(Varptr(myData), SizeOf(myData)))
Dword pData = Hash_GetPtr(pHash, sKey)
' and we know the key contains a name & formatted index...
...we could Array Extract the result of Hash_GetKeys() to find keys with matching names...
keep in mind, indexes are in range of long = Val("&H" & Right$(sKey,8 ))
(i would not use right$ but it explains shorter)
maybe you got an idea how to pass the name & optional index seperate to access data...
?
Hash_New(500, %Hash_StringIndexed2String)
?
I think it needs a function that works reverse to Hash_GetPtr(),
so we could retrieve the key of data from its pointer too:
sKey = Hash_GetKey(pHash, pData)
also Hash_Set() should return pData
ReneMiner
05-03-2016, 01:29
very serious bug:
http://www.thinbasic.com/community/project.php?issueid=506
ErosOlmi
05-03-2016, 08:45
Rene,
your example has a never ending loop.
I think it is programming responsibility to solve never ending loops in something that, at some point will exit.
Also in compiled application you would have a still running process in the computer if you create an uncontrolled loop.
What would happen if thinBasic would completely exit when the window is closed if the other loop is finishing an important task like:
updating a DB?
waiting of a stop signal from a production machine in order to perform clean machine shut-down?
finishing an FTP transfer?
Why do I have to force process to exit if there is a piece of code still running?
Other users would complain of the complete other way round situation: why do thinBasic exit process if the loop is not finished?
thinAir is not blocked, it is simply waiting for the executed process to finish in order to intercept possible run-time errors.
thinAir is using WaitForSingleObject function in order to determine when the process will finish https://msdn.microsoft.com/en-us/library/windows/desktop/ms687032(v=vs.85).aspx
Ciao
Eros
ErosOlmi
05-03-2016, 09:16
Maybe this can help.
You can add a STOP command at the end of the main loop will forcibly stop process execution.
STOP will internally simulate a runtime error.
All loops internally checks if script is in a runtime error state and if yes, they will exit one after the other.
don't know if this is possible but i saw a commercial basic programming ide which have 'X' button (other than the close button) :here is a screen capture: 9575
and when the program is running we can click on it and kill the program ie forcing the the running exe to end
i should add that sometimes clicking on 'X' in that ide does not work and we should press Ctrl+Alt+Del to invoke the task manager and then select the process to end it.
i suspect that forcing the exe to stop may damage the hard disk if we have used it too much. only in emergency.
porcelain_tree
26-06-2016, 18:57
Functions in the code browser of 1.9.16.16 are prepended with the name of the last defined UDT. I include a screenshot. If I remove FakeType UDT and save, thinAir uses the UDT above it. It's always the last UDT I define.
9613
Petr Schreiber
26-06-2016, 21:41
Good catch!
Here is example to replicate this issue (for Eros):
Function FirstNormalFunction()
End Function
Type MyType
Function TypeFunction()
End Function
End Type
Function SecondNormalFunction()
End Function
Petr
ReneMiner
26-06-2016, 21:47
It's minor and only happens in case there are type-definitions above other functions in a script.TBMain() becomes a function of the Type above, so its "tTest.TBMain()" in codebrowser.A type-function outside Type ~ End Type becomes prefixed twice.Perhaps possible to check for an "End Type" and kill the memorized prefix to avoid this ?Or is there a general makeover for codebrowser to await? Then it won't make sense to fix this... :yes:I posted this already a while ago.Sorry for quoting but linking is too cumbersome via phone ;) See previous page for original post with screenshots
porcelain_tree
27-06-2016, 03:00
Ah, I see. I thought I had scanned the entire thread for this issue.
ErosOlmi
27-06-2016, 07:42
Thanks a lot for remembering that issue.
I will completely re-code code browser scanning by the next version.
porcelain_tree
30-06-2016, 00:21
Cool. I appreciate the time you've put into thinBasic.
At the risk of repeating a known issue, I find that the code that closes my program doesn't work in 1.9.16.16. I've tried all of the following:
global dlg_main as long
dialog end dlg_main
and:
dialog end CBHNDL
Both of these work in earlier versions.
Edit: version number
ErosOlmi
30-06-2016, 11:08
porcelain_tree,
sorry to ask you but it would help me a lot in checking this issue if you can create a small script (the smallest you can) that show the problem you are describing.
In my tests it seems working as expected, so it is hard to find something I'm not able to replicate.
Thanks in advance.
Eros
Michael Hartlef
07-08-2016, 15:50
Hi Eros,
I tried to install 1.9.16.16 on my Windows 7 Home edition. Again Avira Antivir Free has problems with it and denied to let the installer run because it detected the trojan Crypt.XPACK.Gen2 (cloud) inside of it.
Michael Hartlef
07-08-2016, 15:52
If I let it install with a deactivated virus scanner, and then check, it complained about the ChainShot4D.exe of the Oxygen sample scripts.
Petr Schreiber
07-08-2016, 18:52
The heuristics are both blessing and the curse of today's antiviruses.
We had an issue recently with thinBasic.com being reported by Google as "probably hacked" in the search results.
It took like 3 weeks to persuade them everything is allright...
Petr
ErosOlmi
08-08-2016, 10:04
Hi Eros,
I tried to install 1.9.16.16 on my Windows 7 Home edition. Again Avira Antivir Free has problems with it and denied to let the installer run because it detected the trojan Crypt.XPACK.Gen2 (cloud) inside of it.
Thanks Michael, I will try to see what I can do but that kind of reporting is very general and related to executable compression not really a virus.
ErosOlmi
08-08-2016, 10:05
If I let it install with a deactivated virus scanner, and then check, it complained about the ChainShot4D.exe of the Oxygen sample scripts.
Thanks, I will remove all executable from oxygen examples.
They are not needed.
Michael Hartlef
09-08-2016, 08:28
How about deleting that exe file i had mentioned from the distribution? The user can create it themself, or?
ErosOlmi
09-08-2016, 09:24
Yes, yes, I'm preparing a new release with additional changes.
ErosOlmi
14-08-2016, 11:35
thinBASIC updated to 1.9.16.17
Complete list of changes at http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_9_16_17.htm
Download link in first post of this thread or in Main web site page.
I'm going to 2 weeks holidays, do not know if I will have connection :(
Ciao
Eros.
ReneMiner
14-08-2016, 17:54
Yeah, got the download. :DIf I check "what's new" offline as well as online there is 3 lines above PeekHex (sorry no string-char on the phone) a line that says PokeHex but no description neither does thinAir recognize it as a Keyword.
ReneMiner
14-08-2016, 18:10
Yeah, got the download. :D
If I check "what's new" offline as well as online there is 3 lines above PeekHex (sorry no string-char on the phone) a line that says PokeHex but no description neither does thinAir recognize it as a Keyword.
Have to add some Bug-report:
I tried to run my Sudoku-game but then only opens a msgbox that says Powerbasic and Shows a line-number probably. If close the msgbox a new one appears.
It does not happen with all Scripts but definitely when I try to run the Sudoku-version that I lately uploaded and that was running fine with Version 1.9.16.16
Petr Schreiber
14-08-2016, 19:06
You are correct,
this is minimal example to replicate the issue:
type MySubType
x as long
end type
type MyType
arr(10) as MySubType
end type
dim v as MyType
v.arr(1).x = 1
Petr
ErosOlmi
14-08-2016, 20:43
Sorry, I'm recompiling and re-publishing withing 30 minutes
ErosOlmi
14-08-2016, 21:31
Uploaded a new 1.9.16.17 version without debug message box.
Sorry about that.
Ciao
Eros
Petr Schreiber
14-08-2016, 22:05
This release is packed with some new features and fixes, so highly recommended for everyone.
Let's have a look at few of them...
StringBuilder
For some time developed as 3rd party module, now moved to default installation.
If you wish to learn more about it, please read in dedicated post (http://www.thinbasic.com/community/showthread.php?12447-StringBuilder-for-ThinBASIC-GitHub&highlight=stringbuilder).
Ini module enhancements
Ini is one of the most straightforward modules, yet it got even simpler now.
Tired of repeating file name all over again? Your wishes came true:
uses "ini", "console"
dim config as new cIniFile(app_sourcepath + "config.ini") ' -- Notice new cool direct initialization
config.setKey("Path", "Root", app_sourcepath)
printl config.getKey("Path", "Root")
waitkey
#include from internet
Yes, a bit wild, but why not. Do you maintain your unit at github? Reference it directly from the script!
...and much more, of course. Check the help file for more information :)
Petr
catventure
16-08-2016, 09:40
thinBASIC updated to 1.9.16.17
Complete list of changes at http://www.thinbasic.com/public/products/thinBasic/help/html/index.html?version_1_9_16_17.htm
Download link in first post of this thread or in Main web site page.
I'm going to 2 weeks holidays, do not know if I will have connection :(
Ciao
Eros.
Thanks for latest update and all the new stuff! Enjoy your holiday.
Catventure.
i have installed the new version, with its huge number of functions it is suitable for educational and scientific research. so now i have 2 versions on my hard disk : 1.9.16.17 and older one 1.8.9.0 . i have noticed there is a Pow function which is a C function in addition to the original '^' pow operator. it seems added after version 1.8.9.0
i don't like Pow since the '^' is easier to use but Pow can be useful also when copying math code from other sources using C syntax.
there is just one Basic there, which have Pow but not '^' and this is contradicting the Basic spirit. even the oldest basics have '^' : possibly they don't know how to implement the Pow as '^'
thanks Eros for the Update , and happy holiday
Michael Hartlef
17-08-2016, 08:33
Thanks for the update. As soon i have access to my PC, i will test the installation against my virus check.
Have a great vacation.
Michael Hartlef
19-08-2016, 18:31
Hi Eros,
Avira AntiVir Free didn't complain now with the new version of thinBasic. Thank you!!
Petr Schreiber
21-08-2016, 10:46
Thanks Michael,
this has been bothering us for a while, good to know the situation is getting better!
Petr
ReneMiner
28-08-2016, 11:11
there's still some debug-msg-box that appears if we have some invalid code.
Simple example:
' i just omit the window-handle-parameter
MsgBox "hello", %MB_OK, "we error on purpose"
ErosOlmi
28-08-2016, 12:58
Thanks.
It is not a debug message box but thinBasic think first parameter is the handle of the parent window and try to transform message text into a number.
Anyway, next thinBasic version will have parent window handle as optional. New syntax will be:
Result = MSGBOX([hParent,] Message [, Style [, Title [, Timeout [, UpdateCountDown, [, CountDownFormat ] ]] ] ] )
So:
'---No parent window
Msgbox 0, "Test"
and
'---hwndParent is the handle of the parent window
Msgbox hwndParent, "Test"
and
'---No parent window, just message box
Msgbox "Test"
Will be the parsed correctly.
ReneMiner
13-09-2016, 19:43
Since when can static udt-subelements be dynamic string?
I just tried out and i'm surprised. I never read an announcement about it and my opinion was, static udt-subelements in thinBasic can not be strings but i just tested it and found proof that i was wrong,
Type tTest
Static sName As String
Function _Create(ByVal sName As String)
Me.sName = sName
End Function
Function TellYourName() As String
Function = Me.sName
End Function
End Type
Function TBMain()
Local dummy As tTest("Frank")
MsgBox 0, dummy.TellYourName, %MB_OK, "My name is"
End Function
btw. TBMain in this example still appears to be a function of tTest in codebrowser ;)
I tested the atan2 function against online calculators and their answer does not match that of thinBasic's.
Check the image to see clearly this problem. Thanks.
Uses "Console"
Uses "Math"
Single angle = ATAN2(1, 3)
PrintL Str$(angle,6)
PrintL "Press a key to end program"
WaitKey
9687
Also arccos is not working correctly.
Uses "Console"
Uses "Math"
Single angle = ArcCos ( .983869910099907 )
PrintL Str$(angle,6)
PrintL "Press a key to end program"
WaitKey
The image shows it better.9688
kryton9, i check the atan2 only, will check the other later, thinbasic result in degrees while in online calc in radians. if we change to
angle = DegToRad(ATAN2(3, 1))
the answer wll be like online calc: 1.24904
https://www.easycalculation.com/trigonometry/atan2-calculator.php
edit: i depends on the picture: it is written: angle = ATAN2(3, 1)
Thanks Primo, I have functions to do those already in my archives, will dig them up. I never thought of the different degree types.
Found them here they are:
function Rad2Deg(rad as double)
function = ( ( rad * 180 ) / 3.14159265 )
end function
function Deg2Rad(deg as double)
function = ( ( deg * 3.14159265 ) / 180 )
end function
Thanks again, all tests green now.
Petr Schreiber
11-05-2017, 18:28
Hi Kent,
DegToRad and RadToDeg are part of thinBasic Math module, so you don't have to declare them yourself :)
Petr
Petr, you know what it is? Its been 11 years of thinBasic and it just seems like 4 at the most. And of course, in all of that time much has been added to thinBasic, and I am still thinking like it was 11 years ago. I need to check the help first from now on :D