PDA

View Full Version : thinCore as embeddable 3rd party DLL



ErosOlmi
24-08-2009, 12:39
Next thinBasic beta preview will have the first necessary SDK functions in order to use thinCore.dll as 3rd party embeddable scripting engine other than just thinBasic programming language.

It will be possible to use thinCore.dll to add scripting functionalities to any application able to handle external dll function calling and manage OLE32 dynamic strings (BSTR strings).

I will go by step:

first step will be allow application to run scripts (from file or from a string buffer) in a INIT/SETUP/RUN/RELEASE way. It means application will have to INIT thinCore engine, SETUP any local function interface (if any) adding new dedicated keywords to the engine, RUN the thinBasic script, RELEASE thinCore engine

if feedback/usage of first step will be successful and no big bugs, I will develop more functionalities (mainly already in place) in order to be able to execute more script without the need to RELEASE and INIT again. It will be also possible to keep data from RUN to RUN of different script and/or reset/delete global variables


Will see.
Eros

Michael Hartlef
24-08-2009, 13:00
Damn, now that i have no time to test this you come up with it :) but for sure, it is a great feature.

Thank you!

Petr Schreiber
24-08-2009, 13:57
That is cool Eros, I did not expected it so soon!

ErosOlmi
24-08-2009, 14:37
For the next beta version update, I will prepare a PowerBasic example showing how to use it on a very basic level.
Than we will see how it seems. I have a direction in mind but maybe some feedback can help me adjust it.

Ciao
Eros

ErosOlmi
25-08-2009, 00:43
Beta 1.7.9.0 present here http://community.thinbasic.com/index.php?topic=2875.0
has already the basic functionalities to be used and embeddable dll but unfortunately I didn't have enough time to prepare a clever example and document interfaces, sorry.

I will do during the next days.

Eros

MouseTrap
25-08-2009, 00:48
Do you plan on adding support for other string types: C style strings ?

ErosOlmi
25-08-2009, 00:53
I suppose definitely yes.

Engine Initialization and Release are already OK.
Only the RUN function that receive the script file name or the script string buffer must be changed but I can easily wrap it making relevant string conversion before passing buffer as BSTR string.

Maybe I will be able to do it quite quickly before stating to test it.

Thanks for alerting me.
Ciao
Eros

John Spikowski
25-08-2009, 03:54
That's good news Eros !

When your ready, I'll retrieve the "Embedded Scripting Code Challenge" from the archive and try it again. It didn't seem like there would be enough interest with only ScriptBasic and VBA as options. This opens up new possibilities. I'm working on a ScriptBasic embedded example in BCX.


John

ErosOlmi
25-08-2009, 09:18
John,

where can I find ScrptBasic used as embedded DLL documentation?
I would like to compare methods.

Thanks
Eros

ErosOlmi
25-08-2009, 09:20
Do you plan on adding support for other string types: C style strings ?


I've already changed new interface functions to accept ASCIIZ strings as file or script buffer input.
Interface with programming languages other than PowerBasic will be quite straight.

This will be present in next beta refresh.

John Spikowski
25-08-2009, 10:28
where can I find ScrptBasic used as embedded DLL documentation?
I would like to compare methods.

Embedding the interpreter:

http://www.scriptbasic.org/docs/dg/devguide_3.html

The source to ScriptBasic can be found here.

http://www.scriptbasic.org/download/scriba_v2.1-scr.zip

Let me know if I can be of any help.

John

ErosOlmi
25-08-2009, 11:32
Thanks a lot

John Spikowski
25-08-2009, 11:53
Glad to be of service.

Be careful, you might get hooked on ScriptBasic. :read:

It might take sending you a fully functional Linux VM with ScriptBasic installed but that will only be used as a last resort. :)

ErosOlmi
25-08-2009, 12:21
I'm already in love with thinBasic and I'm usually very faithful.
But who knows? Life sometimes is so strange :D

John Spikowski
26-08-2009, 02:49
Eros,

I'm going to make an attempt to fix the problem with libscriba.dll missing exported functions. (header issue I assume) If I get it working, I'll pass it along.

Just curious, is thinBASIC code converted to a tokenized format first before execution or translated on the fly?

John

ErosOlmi
26-08-2009, 08:12
Just curious, is thinBASIC code converted to a tokenized format first before execution or translated on the fly?


No intermediate format. Script is translated on the fly.
thinBasic is a "continuous parser", it would be even possible (with some modification of the current engine) to change source code in memory on the fly while the script is under execution.

I didn't follow any of the classical interpreters theory algos but all was invented.
In fact there are also many points I would recode completely because I did the wrong choice :oops: and maybe one day I will do.

John Spikowski
26-08-2009, 10:12
No intermediate format. Script is translated on the fly.

That pretty amazing for how fast thinBASIC is. ScriptBasic builds a binary format of 'nodes' in a continuous memory space and from what I have seen, works really well. I'm spoiled not having to define variables and having the Basic figure out it's type based on how the data is used. The goal of ScriptBasic is take it to the highest level and make it easy to use. Being cross platform and extensible is icing on the cake.

John Spikowski
27-08-2009, 07:08
Armando (BCX developer) created a Linux share object exporting the ScriptBasic API functions to allow embedding the interpreter and running a script.

http://basic-compiler.com/forum/index.php?topic=106.0

As soon as I create a Windows DLL of this, I'll post it here.

The All Basic embedded scripting engine code challenge has been restarted and a example of ScriptBasic embedded with BCX Linux Universal is available.

http://www.allbasic.info/forum/index.php?topic=730.0


John

John Spikowski
30-08-2009, 00:41
I was able to get the Windows version of ScriptBasic embedded in a BCX-32 container application to create a 19KB BCX Basic interpreter. :)

Check it out here (http://www.allbasic.info/forum/index.php?topic=730.msg2552#msg2552).


John

Michael Hartlef
30-08-2009, 09:32
Hey John, with all respect, but isn't this topic about thinBasic?

John Spikowski
30-08-2009, 10:06
John,

where can I find ScrptBasic used as embedded DLL documentation?
I would like to compare methods.

Thanks
Eros



Seems to me that Eros was looking for a working model to base thinBASIC on. (or at least pickup a few pointers)

I said I would let him know when I had a DLL for him to play with.

John Spikowski
04-09-2009, 01:11
Eros,

Can you or someone else here create a libscriba.dll include file for PowerBASIC? I think this would be a good first step with your thinBASIC embedding project. It would also give PowerBASIC programmers a working general purpose scripting solution to embed in their projects today.

I'm also looking for the same effort from the FreeBASIC advocates.


John