variable type arguments
Juraj Bednar <juraj <at> bednar.sk>
2003-03-01 20:28:08 GMT
Hello,
I would like to use swig to add scripting possibility to my
"intelligent bot" for silc network (silcnet.org). There's one
particular problem. I have a function like this:
samadhi_signal_emit("signal name",5,arg1,arg2,arg3,arg4,arg5);
There can be up to 10 args (this is configurable with define) and the
argument type depends on the emitted signal. Now what with type
conversion.
I can create a list of signal<->argument types mapping, but it will be
availaible only on runtime. The question is, if it is possible to
make some use of argument mappings.
I need to access simple data types (int, char*, ...) and also some
structures (SilcClient*, SilcClientConnection*). I can work with them
using wrapper functions like:
char *samadhi_get_silcclientconnection_servername(SilcClient *client) {
return client->remote_host;
}
So all I need to do is to access them like a pointer. I hope you get
the idea (if I implemented it without swig, I would create a hash table
of SilcClient* <-> unique id mapping and would pass unique ID).
I hope you understand what I want to do :). Any pointers, URLs,
examples, similiar projects appreciated.
(Continue reading)