2 Nikolas, 2 Lee

Thank you for your answers. However I think both you and
Lee didn't understand what I want, or I didn't understand you :))

I am totaly positive that i can create wrapper for callbacks in
any embedable languag, be it Lua, Neko or whatever. But the problem is not
to do it for one particular function, but as a general mechanism to be
used for ALL possible/eventual APIs in windows. So, your do_enum will do
enum, but it will not do something else that require callbacks, lets say,
enumerating fonts :)

I seek for the embadable language to be able to do so on its own via some
mechanism. For instance, Lua is capable to call API functions that I didn't
wrapp using dyncall libraray. Or, AutoHotKey automatition language has
DllCall function witch you can use if the language is not enough like:

   DllCall("user32.dll\MessageBox", "uint", 0, "uint", 1", str, "title"
.... )

And this is general mechanism, you can call any API function this way and
handle C structures etc.. everything except callbacks.

I need general mechanism for callbacks. AHK can't do it, Lua can't do it, so
I came upon Neko hopping it can behave better in this situation.

In my DM application I want to encapsulate only some common things but
plugin writters should be able to do it without wrappers for some non-common
behavior that isn't wrapped. After all, windows management is big topic,
wrapping entire API is out of question.

So, if lets say, user is writting handler for OnTitleClick provided by DM,
with desire to lets say show all windows in some pop up menu when title is
clicked, it will have to enumerate. If I provided do_enum, cool, he will use
it, but if I didn't he still must be able to do it using some of the other
mechanisms like DllCall in AHK. The problem with such generalisation comes
with callbacks as functions of embeded language are not C functions but I
basicly want some mechanism to make them behave like that, so I can set Niko
function to be called using Niko language.

About accessing Lua from Neko, well, that is entirely another topic witch I
didn't started :)))
I was researching Lua before Neko as I thought it is the good choice for me.
After finding out it is not capable of doing around callbacks I found Neko.

I hope I cleared some things


Thanks

On 12/15/06, Lee McColl Sylvester <[EMAIL PROTECTED]> wrote:

Thanks Nicolas,

I woulda worked out an example, but that requires more thinking... Not
something I'm willing to provide on a Friday ;-)

Lee





Nicolas Cannasse wrote:

>>Hello
>>
>>
>>This is what I want to do (from Lua archive). In short, if the one can
>>enumerate all windows in Windows, using neko program only (of course, it
>>can use some general purpose dll to allow it for dynamic calls and
>>callbacks, but this shouldn't depend on particular API function):
>>
>>
>
>Most of the C callbacks allow you to pass an extra parameter, so here's
>a quick example :
>
>// your fake Enum API :
>
>typedef void (*enum_function)( int item, void *param );
>void do_enum( enum_function f, void *param ) {
>   f(1,param);
>   f(2,param);
>   f(3,param);
>}
>
>// your program, you want to use do_enum with a neko function
>
>value neko_do_enum( value neko_function ) {
>    val_check_function(neko_function,1); // takes 1 parameter
>    do_enum(neko_wrapper,neko_function);
>    return val_null;
>}
>
>// and your wrapper which callback your neko function :
>
>void neko_wrapper( int item, void *param ) {
>   val_call1((value)param,alloc_int(item));
>}
>
>Nicolas
>
>
>



--
Neko : One VM to run them all
(http://nekovm.org)




--
www.r-moth.com
http://r-moth.deviantart.com
-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to