PDA

View Full Version : why are the callback params not a part of the function prolog ?



D.J.Peters
03-03-2010, 09:21
to hell why isn't the callback defined like this ?

CallBack Function MyDialogCallback(CBHNDL, CBMSG, CBWPARAM, CBLPARAM) As Long

Joshy

Michael Clease
03-03-2010, 09:41
Because the way Eros has written the interpreter it handles all the udt's for you and populates them with the relevant data making life a lot easier for the programmer.

Mike

ErosOlmi
03-03-2010, 10:13
Thanks Michael you said the main reason.

There are other reasons of course and the most important one is that thinBasic is an interpreted language. thinBasic scripts cannot interact with internal window real callbacks because windows does not know anything about source code scripts. Also there is no function pointer callback to a script (piece of text in a file) function so windows cannot call a callback pointer to a script function.

It is true that I would have chosen to ask users to always write callbacks functions with full parameters but why if thinBasic can do it for you with pseudo variables?
Yes, maybe for compatibility with other languages but that's it.

Eros

D.J.Peters
03-03-2010, 11:09
hello Eros
i can't belief that your design interprets line by line
normaly a modern interpreter have a virtual CPU and scripts are compiled as byte code
and the virtual CPU has a stack for calling function/subs/callbacks inside of the script(compiled byte code)

if you don't use a virtual bytecode CPU with a stack
i wonder me your srcipt engine isn't slow. (good job)

where are the source code of thinbasic or is it closed source ?

Joshy

Aurel
03-03-2010, 12:51
i can't belief that your design interprets line by line
I dont see anything wrong with that
If work good on this whay OK for me.
As you see work good and Eros make really good job with thinBasic.

ErosOlmi
03-03-2010, 13:11
if you don't use a virtual bytecode CPU with a stack
i wonder me your srcipt engine isn't slow. (good job)

where are the source code of thinbasic or is it closed source ?

Joshy


yes, Joshy, I'm sorry to say that thinBasic has no any intermediate byte code or virtual machine ;)
thinBasic is a continuous parser interpreter that works on byte level (not line level).

Of course it implements many tricks to speed up things like indexing/hashing token when they are encountered.
In theory it could even possible to change source code while interpreting. In practice I would have to change a bit the core engine but it can be done.

thinBasic is written almost 99% with PowerBasic compiler.
thinBasic is not open source.
But if you are interested in extending thinBasic with new functions/modules you can have a look at \thinBasic\SDK\ directory where we have placed some examples on how to create new modules for thinBasic adding your own compiled functions. TBGL (developed in PowerBasic), Oxygen (developed in FreeBasic), TBDI (developed in PowerBasic), ... and all other thinBasic modules are created with thinBasic SDK.
To make it short, thinBasic Core Engine (thinCore.dll) exposes some function that let other compilers (please remain with PowerBasic and FreeBasic) created interfaces with Core Parser. You can define your own functions and decide what is the syntax and how to parse.

Also you can get additional ideas reading TBJ, thinBasic Journal at http://community.thinbasic.com/index.php?board=160.0
In Issue Number 2 you will find and introductory article on how to create thinBasic modules and what is the logic.

Ciao
Eros