Eugene Chernyshov a écrit :
> Hi again.
> 
> Please show me some examples for such functions as:
> EXTERN neko_module *neko_read_module( reader r, readp p, value loader );
> EXTERN int neko_file_reader( readp p, void *buf, int size ); // FILE *
> EXTERN int neko_string_reader( readp p, void *buf, int size ); //
> string_pos *

You can have a look at neko/libs/std/module.c which use these methods.

> EXTERN value neko_select_file( value path, const char *file, const char
> *ext );

> EXTERN void neko_global_init( void *s );

this is just a way of initializing the core. call it only one time at first.

> EXTERN void neko_set_stack_base( void *s );

this is used for some experimental GC, no need for you right now

> EXTERN void neko_global_free();

global uninitializing method, call before exiting if you wish

> EXTERN int neko_thread_create( thread_main_func init, thread_main_func
> main, void *param, void *handle );

Creates a thread, see neko/libs/std/thread.c for example.

> You could just reffer me to a proper place in sources and explain what
> that means.
> 
> Also, some questions.
> 
> How to get a list of imported modules?

$loader.cache should contain all modules that have been loaded.
Please note that you don't have a direct access to the module global
table, but to the export table. This is because globals are indexes and
not names.

> So as you can see value of "a" is stored in python, and it could be
> accessed from lua as "python.a".
> 
> Do you have such global/general/main module in Neko? If not, then my
> wrapper must have access to any active/imported/loaded module as it
> described in example http://nekovm.org/doc/vm
> How to work with Neko's arrays from C? And how to expose array like
> objects from C to Neko?

Short example :

value v = alloc_array(1);
val_array_ptr(v)[0] = alloc_int(5);

 > Can I make objects with overloaded operation of + - * / and other (like
> in C++, I can overload operator+)? 

Yes, see http://nekovm.org/specs#operators_overloading

> As I can see Neko arrays is something
> like tuple in python. It's a pitty that you don't have dict/map type.

See the "hashtable builtins" in http://nekovm.org/doc/view/builtins

> Do Neko's objects have callable aspect? In python we can call (and use
> with same interface) function, bounded methods and objects of class with
> "__call__" method.

No there's no __call__ equivalent

Best,
Nicolas

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

Reply via email to