|
From: Chris F. <cd...@fo...> - 2011-06-06 19:36:49
|
On Wed, Jun 01, 2011 at 02:09:25AM -0300, Luiz Angelo Daros de Luca wrote:
> Maybe we are talking about different things. :-) The objformat is already
> avaiable to who askes for it.
> My suggestion is to do something like these:
>
> char *osync_objformat_print(OSyncObjFormat *format, const char *data,
> unsigned int size, OSyncError **error) {
> (...)
> + return format->print_func(data, size, format->user_data, error);
> - return format->print_func(format, data, size, format->user_data,
> error);
> }
>
> And so on for all callbacks. plugin and sink does just like this. My ruby
> wrapper can implement multiple objformats (and plugins) and I have, for each
> callback type, only one C callback for all ruby objects. If I have
> the format inside the callback, I can look for the ruby callback defined for
> this format.
Sorry for the delay. I'm sure this is frustrating for you. I hope you
don't give up! :-)
I have to be honest, that adding this argument, as a special case for
wrapper code, just feels like the wrong move. :-)
From a C perspective, this kind of data belongs in the user_data block.
By including the format pointer in the user_data (which you need in order
to register print_func), you have everything you need.
- Chris
|