View Full Version : thinBasic scripts and CodeSense control
ErosOlmi
27-02-2008, 15:19
I did some test on a well known (now discontinued) control called CodeSense.
CodeSense is a text editor control used by some text code editor. CodeSense is now discontinued but it is in any case a valid alternative for fast source code editing needs. It support source code language definition on the fly, syntax coloring, multi pane window, vertical block selection (press CTRL and use mouse to select), and many other features.
See attached thinBasic script example how easy is to use it.
I've not implemented control notification but I will work more on this in case there is some interest.
Ciao
Eros
ErosOlmi
27-02-2008, 15:57
Attached file in first post of this thread updated.
I forgot to add latest version of thinCore.dll needed to use a new improvement added to STRINSERT$ function that will be release in next preview.
In STRINSERT$ function, if position is negative it is interpreted as the Toke Size. Mainly it will be possible to split MainString into single tokens of the same size inserting the new string.
Example: imagine you have a string and want to insert a comma every 3 bytes. Now you can do it in this way:
Dim MyOldString As String VALUE "123ABC456XYZ"
Dim MyNewString As String VALUE STRINSERT$(MyOldString, ",", -3)
'---MyNewString will be: '123,ABC,456,XYZ'
Michael Hartlef
27-02-2008, 16:28
Arrrrgggh ;D Man I was just playing the last days in FreePascal and there the SynEdit implementation and then
you come up with this. Damn :D Now I HAVE to check this out. To bad I don't have time for it tonight. >:(
Thanks man ;)
ErosOlmi
27-02-2008, 16:31
;D Sorry
To handle the basic it seems very simple.
I will play next days with notifications (messages sent by the control to the main window when events occur) in order to make more advanced things.
Ciao
Eros
Petr Schreiber
27-02-2008, 17:08
Hi Eros,
very nice.
And pretty fast, I created 1 000 000 lines text and it was still as smooth as on the beginning.
Do you know the reason why this project was discontinued ?
Thanks,
Petr
ErosOlmi
27-02-2008, 17:38
Do you know the reason why this project was discontinued ?
I do not followed the project very closely. I remember it was a free ocx and dll control.
If I remember well (but I can be wrong) the author said he didn't had anymore time to follow it. He asked for someone willing to continue to maintain the project and gave the sources to another guy. That new guy after some time of work decided to go into a commercial product ( www.winmain.com (http://www.winmain.com) ) and from that point general interest went down. After some time also the commercial product disappeared.
You can Google around using keywords "CodeMax" or "CodeMax CodeSense"
Downloads can be found using Google Code Search:
http://www.google.com/codesearch?q=cmax20.dll&hl=en&lr=
http://www.google.com/codesearch?hl=en&lr=&q=cmcs21.dll
Going back to history using web archive:
http://web.archive.org/web/*/http://www.winmain.com/
and, for example:
http://web.archive.org/web/20040828195413/http://www.winmain.com/
Ciao
Eros
ErosOlmi
27-02-2008, 18:33
Petr,
if you use Power Basic and JelliFish editor you should know this control.
It is the edit control used by JellyFish. In JellyFish directory you can find it under the name "jproedit.dll" but in reality it is CodeSense (if you have it, see file properties). It is an interesting control.
Ciao
Eros
Petr Schreiber
27-02-2008, 19:05
Ha!,
nice find. I did not know it.
JellyFish is very nice IDE, I use it often before release of TBGL especially to check for duplicate variables :)
Thanks,
Petr
Michael Hartlef
01-02-2010, 16:44
Sorry for bringing up this old topic. It gives me an error about a missing parent at line 137 with the beta 2010.01.31.
Anyone else experiencing this?
ErosOlmi
01-02-2010, 17:38
Change that line from
CMRegisterLanguage("thinBasic", VarPtr(lCM_LANGUAGE))
to
CMRegisterLanguage("thinBasic", lCM_LANGUAGE)
At that time thinBasic was not able to recognise UDT passing BYREF to external functions.
Now thinBasic is able to recognize external procedure expect an UDT and so it expect an UDT to be passed. thinBasic will take care automatically of BYREF.
I've updated original file attached in first post.
Ciao
Eros
Michael Hartlef
01-02-2010, 18:08
Thanks, I'm glad it was that easy. But shouldn't this first version be possible too?
Petr Schreiber
01-02-2010, 18:24
Hi Mike,
I didn't tried it for this case, but if param is defined ByRef, you can:
Pass directly the variable
Pass it like BYVAL VarPtr(variable)
I think external declares have ByRef as default. I think the current behavior is ok.
Petr
ErosOlmi
01-02-2010, 18:47
Well, in 2008 thinBasic passing parameters to external functions phase was quite primitive especially in BYREF, ASCIIZ and UDT
Current version takes care of many aspects.
Petr is right. With current version you can either:
CMRegisterLanguage("thinBasic", BYVAL VarPtr(lCM_LANGUAGE))
or
CMRegisterLanguage("thinBasic", lCM_LANGUAGE)
With
CMRegisterLanguage("thinBasic", BYVAL VarPtr(lCM_LANGUAGE))
thinBasic is instructed that what follows BYVAL is an expression that will return a pointer and will pass that calculated pointer
With
CMRegisterLanguage("thinBasic", lCM_LANGUAGE)
thinBasic is instructed you are not passing a pointer but you are passing an UDT structure exactly like the one expected by the declaration of CMRegisterLanguage function. thinBasic will parse the UDt and will pass UDT ptr to external function.
Michael Hartlef
01-02-2010, 21:29
Thanks guys for the info! :)